<div dir="ltr"><font style="font-family:verdana,sans-serif" size="2">Dear Friends,<br>
  I am trying to attach Adobe form output to a work item and send it in for approval. I have converted the Adobe form output to binary format inside the program and passed it to the workflow container while starting the workflow and then inside the workflow i used the below method code to convert the binary to xstring format and then attach it to the workitem. But when I open the attachment from business workplace I am getting an error that &quot;<b>There was an error opening this document, the file is damaged and could not be repaired</b>&quot;. I tried to debug the method and everything seems to be fine, even I check the Adobe output by sending it as an email attachment and I am able to open the same Adobe form attachment in the email. So I suspect that I am doing something wrong while converting the same in the workflow. Please advise what would be wrong with the below code.</font><br style="font-family:courier new,monospace">


<br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
 DATA:  wid TYPE swwwihead-wi_id,</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
            op_len TYPE wsuser-wsuserinstanceno,</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
           it_solix_tab TYPE solix-line OCCURS 0.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
 DATA : zswr_att_header TYPE swr_att_header,</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
           zswr_att_id     TYPE swr_att_id,</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
           lo_sofm TYPE swc_object,</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
           zxstring TYPE xstring.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)">
<br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
 swc_get_element container &#39;WID&#39; wid.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
 swc_get_element container &#39;OP_LEN&#39; op_len.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
 swc_get_table container &#39;IT_SOLIX_TAB&#39; it_solix_tab.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)">
<br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
 CALL FUNCTION &#39;SCMS_BINARY_TO_XSTRING&#39;</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
   EXPORTING</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
     input_length = op_len</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
   IMPORTING</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
     buffer       = zxstring</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
   TABLES</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
     binary_tab   = it_solix_tab.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)">
<br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
 zswr_att_header-file_type = &#39;B&#39;.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
 zswr_att_header-file_name = &#39;Attachment.pdf&#39;.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
 zswr_att_header-file_extension = &#39;PDF&#39;.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
 zswr_att_header-language = &#39;EN&#39;.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
 BREAK-POINT.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
 CALL FUNCTION &#39;SAP_WAPI_ATTACHMENT_ADD&#39;</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
   EXPORTING</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
     workitem_id = wid</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
     att_header  = zswr_att_header</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
     att_bin     = zxstring</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
  IMPORTING</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
    att_id      = zswr_att_id.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)">
<br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
swc_create_object lo_sofm &#39;SOFM&#39; zswr_att_id-doc_id.</span><br style="font-family:courier new,monospace;color:rgb(0,0,153)"><span style="font-family:courier new,monospace;color:rgb(0,0,153)">
swc_set_element container &#39;SOFM&#39; lo_sofm.</span><br style="font-family:courier new,monospace"></div>