cancel
Showing results for 
Search instead for 
Did you mean: 

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

PraveenChitturi
Participant
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

sandeep_reddy24
Participant
0 Kudos

Hi Praveen,

Maybe this can help:

https://archive.sap.com/kmuuid2/60ff6ad3-729b-2b10-6582-fedc82680a29/Creating%20Attachments%20to%20W...

Please check with this FM:

SAP_WAPI_ATTACHMENT_ADD_REF

SAP_WAPI_GET_ATTACHMENTS

Regards,

Sandeep

PraveenChitturi
Participant
0 Kudos

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.

Answers (2)

Answers (2)

pokrakam
Active Contributor
0 Kudos

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

PraveenChitturi
Participant
0 Kudos

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

former_member184495
Active Contributor
0 Kudos

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

PraveenChitturi
Participant
0 Kudos

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.

former_member184495
Active Contributor
0 Kudos

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