Issue with attaching pdf in work item

Ibrahim ikhansap at gmail.com
Thu Jan 5 01:15:12 EST 2012


Hi Ali,
  Thanks for your reply. I have a doubt on your approach. Before calling
CL_FITV_GOS=>GET_LINKS  i think we should use CL_FITV_GOS=>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.

Regards
Ibrahim

On Wed, Jan 4, 2012 at 1:49 PM, Ali Husain <mr_mago40 at hotmail.com> wrote:

>
> Hello Ibrahim,
>
> 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 CL_FITV_GOS=>GET_LINKS and pass
> it your BOR object along with the keys. The sofm table reference you get
> back you can then perform the following:
>
> LOOP AT ex_sofm INTO ls_sofm.
>   CONCATENATE ls_sofm-foltp ls_sofm-folyr ls_sofm-folno
>   ls_sofm-doctp ls_sofm-docyr ls_sofm-docno ls_sofm-fortp
>  ls_sofm-foryr ls_sofm-forno INTO lv_key RESPECTING BLANKS.
>
>   swc_create_object lr_sofm 'SOFM' lv_key.
>   APPEND lr_sofm TO lt_sofm.
>   CLEAR: ls_sofm, lv_key,lr_sofm.
> ENDLOOP.
>
> swc_set_table container 'EX_SOFM' lt_sofm.
>
> You can then bind lt_sofm with the attach_objects container element and
> the attachment should open when displaying the work item.
>
> Hope this helps,
> Ali
>
>
> > From: sap-wug-request at mit.edu
> > Subject: SAP-WUG Digest, Vol 86, Issue 3
> > To: sap-wug at mit.edu
> > Date: Tue, 3 Jan 2012 12:13:09 -0500
> >
> > Send SAP-WUG mailing list submissions to
> > sap-wug at mit.edu
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> > http://mailman.mit.edu/mailman/listinfo/sap-wug
> > or, via email, send a message with subject or body 'help' to
> > sap-wug-request at mit.edu
> >
> > You can reach the person managing the list at
> > sap-wug-owner at mit.edu
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of SAP-WUG digest..."
> >
> >
> > Today's Topics:
> >
> > 1. Issue with attaching pdf in work item (Ibrahim)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Tue, 3 Jan 2012 16:06:34 +0400
> > From: Ibrahim <ikhansap at gmail.com>
> > Subject: Issue with attaching pdf in work item
> > To: "SAP Workflow Users' Group" <SAP-WUG at mit.edu>
> > Message-ID:
> > <CADb5asq-DCxY0HidihMp9BYmzuCb3BAF6CYJad33W25+2yeN-Q at mail.gmail.com>
> > Content-Type: text/plain; charset="iso-8859-1"
>
> >
> > 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 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 "*There was an error opening this document, the file is
> damaged
> > and could not be repaired*". 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.
> >
> >
> > 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.
> >
> > CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
> > EXPORTING
> > input_length = op_len
> > IMPORTING
> > buffer = zxstring
> > TABLES
> > 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'.
> > BREAK-POINT.
> > CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
> > EXPORTING
> > workitem_id = wid
> > att_header = zswr_att_header
> > att_bin = zxstring
> > IMPORTING
> > att_id = zswr_att_id.
> >
> > swc_create_object lo_sofm 'SOFM' zswr_att_id-doc_id.
> > swc_set_element container 'SOFM' lo_sofm.
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL:
> http://mailman.mit.edu/pipermail/sap-wug/attachments/20120103/40efd24a/attachment-0001.htm
> >
> > ------------------------------
> >
> > _______________________________________________
> > SAP-WUG mailing list
> > SAP-WUG at mit.edu
> > http://mailman.mit.edu/mailman/listinfo/sap-wug
> >
> >
> > End of SAP-WUG Digest, Vol 86, Issue 3
> > **************************************
>
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20120105/632b5bc5/attachment.htm


More information about the SAP-WUG mailing list