<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 "<b>There was an error opening this document, the file is damaged and could not be repaired</b>". 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 'WID' 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 'OP_LEN' 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 'IT_SOLIX_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)">
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'</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 = 'B'.</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 = 'Attachment.pdf'.</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 = 'PDF'.</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 = 'EN'.</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 'SAP_WAPI_ATTACHMENT_ADD'</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 'SOFM' 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 'SOFM' lo_sofm.</span><br style="font-family:courier new,monospace"></div>