cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Workflow User Decision Description and Attachment

muzizimele
Explorer
0 Kudos
1,185

Hi all,

I have a workflow with a USER DECISION STEP where i am passing Firm Informartion (firm name, Address etc) and i want this information to be reflected on the 'DECRIPTION" side and then also have attachments which i have on a table that i want to be passed on the "OBJECTS ATTACHMENTS" Side. The agent should be able to Accept or Reject this information after reviewing it.

I am having problems Attaching the documents on the  "OBJECTS ATTACHMENTS" side was using function module: SAP_WAPI_ATTACHMENT_ADD within a method which i call inside the task, but when i do that it messes up with the generic user decision method as i can't call them both.....only one method can be call within "Basic Data" Tab of the Task
any thoughts how i can do this ??

Accepted Solutions (0)

Answers (1)

Answers (1)

SBach
Product and Topic Expert
Product and Topic Expert
0 Kudos

HI, you could add the attachments using an exit class (example CL_SWH_T_DECISION_EXIT)  in the step / activity. Use event C_EVTTYP_AFTER_CREATE (example see below). There is also a BADI for attachments in enhancement spot WF_OBJECT_ATTACHMENT, provided with S/4HANA Cloud 1805 and S/4HANA On Premise 1809. An example implementation can be found in the class is: "CL_SWF_RUN_ATTACH_BADI_SAMPLE".

*How do the program exits work?
*To change alternatives of the user decision at runtime dynamically (for each *work item), you can define an ABAP class here that supports interface *IF_SWF_IFS_WORKITEM_EXIT.

*At runtime, method IF_SWF_IFS_WORKITEM_EXIT~EVENT_RAISED is called multiple *times. Here you can define source code that is run for different time points *of the work item processing.

*To delete or change the alternatives, your code must be run at the time *point SWFCO_EVENT_BEFORE_DECISION.

*Example: Class CL_SWH_T_DECISION_EXIT from workflow definition WS77400143 "WF_Verify141"

Method IF_SWF_IFS_WORKITEM_EXIT~EVENT_RAISED.
  data lt_decialts type IF_WAPI_WORKITEM_CONTEXT=>swrtdecialts.
  if im_event_name = IF_SWF_IFS_DECISION_EXIT~C_EVTTYP_BEFORE_DECISION.
    call method IM_WORKITEM_CONTEXT->get_decision_alts
       importing et_decialts = lt_decialts.
*   --- hide alternative 0001 and 0002 ---
    delete lt_decialts where altkey <> '0003'.
    call method IM_WORKITEM_CONTEXT->set_decision_alts
       exporting it_decialts = lt_decialts.
  endif.
endmethod.