Skip to Content

How to add note / some text as attachment into the workflow container from program?

May 09, 2017 at 04:42 AM


avatar image


I am looking to add the some text as attachment to the workflow container from Z program. And later steps I want to use that text in the email attachment. Could you please advice me on how to do this one?

Thank you,


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Sandeep Reddy Jillella May 09, 2017 at 05:16 AM

Hi Praveen,

Maybe this can help:

Please check with this FM:





Show 1 Share
10 |10000 characters needed characters left characters exceeded


Thankyou. Yes now able to add the attachment successfully.

        if wa_item-rb_reject eq icon_wd_radio_button.
          loop at wa_item-decision_text into data(ls_decsion_text).
            concatenate l_text ls_decsion_text lc_linefeed into l_text separated by space.

* construct attachment header
          lv_atthdr-file_type      = 'T'.
          lv_atthdr-file_name      = zcl_sd_sample_order_wf_exit=>c_att_name_reason_for_rej.
          lv_atthdr-file_extension = 'TXT'.
          lv_atthdr-language       = sy-langu.

          call function 'SAP_WAPI_ATTACHMENT_ADD'
              workitem_id    = wa_item-top_wi_id
              att_header     = lv_atthdr
              att_txt        = l_text
              document_owner = sy-uname
              language       = sy-langu
              do_commit      = ' '
              return_code    = lv_return_code
              att_id         = lv_att_id
*       TABLES
*             MESSAGE_LINES  =
*             MESSAGE_STRUCT =


Thank you.

Aditya Varrier May 09, 2017 at 05:33 AM

Hi PC,

am not clear on your requirement, how can you add a text as an attachment?

Either you can add text to your email or add an file. Please elaborate the requirement.

Or do you mean that you want to keep a text in a WF container which you will use later in your steps?

Aditya V

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Background of the requirement:-

I have a workflow which will have asynchronous dialog steps(not the decision step) for approval. And I will use terminating events to approve / reject the dialog step. So in the dialog step I will call another Z program to take the decision text and approval / rejection from approver. If 'approve' selected then will trigger terminating event to end the current work item and similarly for rejection also.

We need to insert these decision text in the email body at later steps in the workflow.

* We have some reason to create asynchronous dialog step for approval and also do the approve / reject from Z program.

Thank you,




try to fetch workitem-id for your step in the program. Use the workitem-id in FM SAP_WAPI_WRITE_CONTAINER and fill the container.

However check if you get expert comments.

Aditya V

Mike Pokraka May 09, 2017 at 01:41 PM

If you're approving/rejecting via event, add comments and attachments as event parameters. Then just bind it into your WF.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Mike, Thanks for your valued input and felt worth .