Skip to Content
Former Member
Jan 08, 2012 at 06:51 AM

Issue with attaching pdf in work item


Dear Friends,

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 using function module 'SCMS_XSTRING_TO_BINARY and passed it to the workflow container while starting the workflow and then inside the workflow i used the below code inside a method 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 There was an error opening this document, the file is damaged and could not be repaired.

I tried to debug the method and found that everything seems to be fine, even I checked 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(binary to xstring) in the workflow. Please advise what would be wrong with the below code.

DATA: wid TYPE swwwihead-wi_id,

op_len TYPE wsuser-wsuserinstanceno,

it_solix_tab TYPE solix-line OCCURS 0.

DATA : zswr_att_header TYPE swr_att_header,

zswr_att_id TYPE swr_att_id,

lo_sofm TYPE swc_object,

zxstring TYPE xstring.

swc_get_element container 'WID' wid.

swc_get_element container 'OP_LEN' op_len.

swc_get_table container 'IT_SOLIX_TAB' it_solix_tab.



input_length = op_len


buffer = zxstring


binary_tab = it_solix_tab.

zswr_att_header-file_type = 'B'.

zswr_att_header-file_name = 'Attachment.pdf'.

zswr_att_header-file_extension = 'PDF'.

zswr_att_header-language = 'EN'.




workitem_id = wid

att_header = zswr_att_header

att_bin = zxstring


att_id = zswr_att_id.

swc_create_object lo_sofm 'SOFM' zswr_att_id-doc_id.

swc_set_element container 'SOFM' lo_sofm.