<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<div><br></div>Hello,<div><br></div><div>Yeah i forgot to mention the saving part. It should work that way.<br><br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">From: ikhansap@gmail.com<br>Date: Thu, 5 Jan 2012 10:15:12 +0400<br>Subject: Re: Issue with attaching pdf in work item<br>To: sap-wug@mit.edu<br>CC: mr_mago40@hotmail.com<br><br><div dir="ltr">Hi Ali,<br>&nbsp; Thanks for your reply. I have a doubt on your approach. Before calling CL_FITV_GOS=&gt;GET_LINKS&nbsp; i think we should use CL_FITV_GOS=&gt;SAVE to save the pdf document(attachment) to GOS and then used GET_LINKS method to get the key of the attachment. Correct me if I am wrong.<br>

<br>Regards<br>Ibrahim<br><br><div class="ecxgmail_quote">On Wed, Jan 4, 2012 at 1:49 PM, Ali Husain <span dir="ltr">&lt;<a href="mailto:mr_mago40@hotmail.com">mr_mago40@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex">




<div><div dir="ltr">
<div><br></div>Hello Ibrahim,<div><br></div><div>I've done that in a different way and it was working fine with me. After you convert to pdf, you can call the method&nbsp;CL_FITV_GOS=&gt;GET_LINKS and pass it your BOR object along with the keys. The sofm table&nbsp;reference&nbsp;you get back you can then&nbsp;perform&nbsp;the&nbsp;following:&nbsp;</div>

<div><br></div><div><div>LOOP AT ex_sofm INTO ls_sofm.</div><div>&nbsp; CONCATENATE ls_sofm-foltp ls_sofm-folyr ls_sofm-folno</div><div>&nbsp; ls_sofm-doctp ls_sofm-docyr ls_sofm-docno ls_sofm-fortp</div><div>&nbsp;ls_sofm-foryr ls_sofm-forno INTO lv_key RESPECTING BLANKS.</div>

<div><br></div><div>&nbsp; swc_create_object lr_sofm 'SOFM' lv_key.</div><div>&nbsp; APPEND lr_sofm TO lt_sofm.</div><div>&nbsp; CLEAR: ls_sofm, lv_key,lr_sofm.</div><div>ENDLOOP.</div><div><br></div><div>swc_set_table container 'EX_SOFM' lt_sofm.</div>

</div><div><br></div><div>You can then bind lt_sofm with the attach_objects container element and the attachment should open when displaying the work item.</div><div><br></div><div>Hope this helps,</div><div>Ali</div><div>

<br></div><br><div><div></div>&gt; From: <a href="mailto:sap-wug-request@mit.edu">sap-wug-request@mit.edu</a><br>&gt; Subject: SAP-WUG Digest, Vol 86, Issue 3<br>&gt; To: <a href="mailto:sap-wug@mit.edu">sap-wug@mit.edu</a><br>

&gt; Date: Tue, 3 Jan 2012 12:13:09 -0500<br>&gt; <br>&gt; Send SAP-WUG mailing list submissions to<br>&gt;         <a href="mailto:sap-wug@mit.edu">sap-wug@mit.edu</a><br>&gt; <br>&gt; To subscribe or unsubscribe via the World Wide Web, visit<br>

&gt;         <a href="http://mailman.mit.edu/mailman/listinfo/sap-wug" target="_blank">http://mailman.mit.edu/mailman/listinfo/sap-wug</a><br>&gt; or, via email, send a message with subject or body 'help' to<br>&gt;         <a href="mailto:sap-wug-request@mit.edu">sap-wug-request@mit.edu</a><br>

&gt; <br>&gt; You can reach the person managing the list at<br>&gt;         <a href="mailto:sap-wug-owner@mit.edu">sap-wug-owner@mit.edu</a><br>&gt; <br>&gt; When replying, please edit your Subject line so it is more specific<br>

&gt; than "Re: Contents of SAP-WUG digest..."<br>&gt; <br>&gt; <br>&gt; Today's Topics:<br>&gt; <br>&gt;    1. Issue with attaching pdf in work item (Ibrahim)<br>&gt; <br>&gt; <br>&gt; ----------------------------------------------------------------------<br>

&gt; <br>&gt; Message: 1<br>&gt; Date: Tue, 3 Jan 2012 16:06:34 +0400<br>&gt; From: Ibrahim &lt;<a href="mailto:ikhansap@gmail.com">ikhansap@gmail.com</a>&gt;<br>&gt; Subject: Issue with attaching pdf in work item<br>

&gt; To: "SAP Workflow Users' Group" &lt;<a href="mailto:SAP-WUG@mit.edu">SAP-WUG@mit.edu</a>&gt;<br>&gt; Message-ID:<br>&gt;         &lt;<a href="mailto:CADb5asq-DCxY0HidihMp9BYmzuCb3BAF6CYJad33W25%2B2yeN-Q@mail.gmail.com">CADb5asq-DCxY0HidihMp9BYmzuCb3BAF6CYJad33W25+2yeN-Q@mail.gmail.com</a>&gt;<br>

&gt; Content-Type: text/plain; charset="iso-8859-1"<div class="ecxim"><br>&gt; <br>&gt; Dear Friends,<br>&gt;   I am trying to attach Adobe form output to a work item and send it in for<br>&gt; approval. I have converted the Adobe form output to binary format inside<br>

&gt; the program and passed it to the workflow container while starting the<br>&gt; workflow and then inside the workflow i used the below method code to<br>&gt; convert the binary to xstring format and then attach it to the workitem.<br>

&gt; But when I open the attachment from business workplace I am getting an<br></div>&gt; error that "*There was an error opening this document, the file is damaged<br>&gt; and could not be repaired*". I tried to debug the method and everything<div>

<div></div><div class="h5"><br>&gt; seems to be fine, even I check the Adobe output by sending it as an email<br>&gt; attachment and I am able to open the same Adobe form attachment in the<br>&gt; email. So I suspect that I am doing something wrong while converting the<br>

&gt; same in the workflow. Please advise what would be wrong with the below code.<br>&gt; <br>&gt; <br>&gt;  DATA:  wid TYPE swwwihead-wi_id,<br>&gt;             op_len TYPE wsuser-wsuserinstanceno,<br>&gt;            it_solix_tab TYPE solix-line OCCURS 0.<br>

&gt; <br>&gt;  DATA : zswr_att_header TYPE swr_att_header,<br>&gt;            zswr_att_id     TYPE swr_att_id,<br>&gt;            lo_sofm TYPE swc_object,<br>&gt;            zxstring TYPE xstring.<br>&gt; <br>&gt;  swc_get_element container 'WID' wid.<br>

&gt;  swc_get_element container 'OP_LEN' op_len.<br>&gt;  swc_get_table container 'IT_SOLIX_TAB' it_solix_tab.<br>&gt; <br>&gt;  CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'<br>&gt;    EXPORTING<br>&gt;      input_length = op_len<br>

&gt;    IMPORTING<br>&gt;      buffer       = zxstring<br>&gt;    TABLES<br>&gt;      binary_tab   = it_solix_tab.<br>&gt; <br>&gt;  zswr_att_header-file_type = 'B'.<br>&gt;  zswr_att_header-file_name = 'Attachment.pdf'.<br>

&gt;  zswr_att_header-file_extension = 'PDF'.<br>&gt;  zswr_att_header-language = 'EN'.<br>&gt;  BREAK-POINT.<br>&gt;  CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'<br>&gt;    EXPORTING<br>&gt;      workitem_id = wid<br>

&gt;      att_header  = zswr_att_header<br>&gt;      att_bin     = zxstring<br>&gt;   IMPORTING<br>&gt;     att_id      = zswr_att_id.<br>&gt; <br>&gt; swc_create_object lo_sofm 'SOFM' zswr_att_id-doc_id.<br>&gt; swc_set_element container 'SOFM' lo_sofm.<br>

</div></div>&gt; -------------- next part --------------<br>&gt; An HTML attachment was scrubbed...<br>&gt; URL: <a href="http://mailman.mit.edu/pipermail/sap-wug/attachments/20120103/40efd24a/attachment-0001.htm" target="_blank">http://mailman.mit.edu/pipermail/sap-wug/attachments/20120103/40efd24a/attachment-0001.htm</a><br>

&gt; <br>&gt; ------------------------------<br>&gt; <br>&gt; _______________________________________________<br>&gt; SAP-WUG mailing list<br>&gt; <a href="mailto:SAP-WUG@mit.edu">SAP-WUG@mit.edu</a><br>&gt; <a href="http://mailman.mit.edu/mailman/listinfo/sap-wug" target="_blank">http://mailman.mit.edu/mailman/listinfo/sap-wug</a><br>

&gt; <br>&gt; <br>&gt; End of SAP-WUG Digest, Vol 86, Issue 3<br>&gt; **************************************<br></div>                                               </div></div>
<br>_______________________________________________<br>
SAP-WUG mailing list<br>
<a href="mailto:SAP-WUG@mit.edu">SAP-WUG@mit.edu</a><br>
<a href="http://mailman.mit.edu/mailman/listinfo/sap-wug" target="_blank">http://mailman.mit.edu/mailman/listinfo/sap-wug</a><br>
<br></blockquote></div><br></div></div></div>                                               </div></body>
</html>