Skip to Content
0

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

May 09, 2017 at 04:42 AM

127

avatar image

Hi,

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,

Praveen.

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
0

Hi Praveen,

Maybe this can help:

https://archive.sap.com/kmuuid2/60ff6ad3-729b-2b10-6582-fedc82680a29/Creating%20Attachments%20to%20Work%20Items%20or%20to%20User%20Decisions%20in%20Workflows.pdf

Please check with this FM:

SAP_WAPI_ATTACHMENT_ADD_REF

SAP_WAPI_GET_ATTACHMENTS

Regards,

Sandeep

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

Hi,

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.
          endloop.


* 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'
            exporting
              workitem_id    = wa_item-top_wi_id
              att_header     = lv_atthdr
              att_txt        = l_text
              document_owner = sy-uname
              language       = sy-langu
              do_commit      = ' '
            importing
              return_code    = lv_return_code
              att_id         = lv_att_id
*       TABLES
*             MESSAGE_LINES  =
*             MESSAGE_STRUCT =
            .


        endif.

Thank you.

0
Aditya Varrier May 09, 2017 at 05:33 AM
0

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,

Praveen.

0

Hi,

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

0
Mike Pokraka May 09, 2017 at 01:41 PM
0

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 .

0