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

Approve or Reject using Function Module

Hvshal4u
Active Participant
0 Likes
6,851

Hi ,

I want to approve or reject the workitem using UI5. The backend process is already set it has workflow for the same.

The workflow looks exactly like this : https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=68644

The Worlflow consultant have used the Form for approve or reject. Now I want achieve this using the FM : SAP_WAPI_DECISION_COMPLETE

But the issue is when I pass the workitem ID to this FM it say that it don't have decision key.

Kindly suggest a way where I can Approve or Reject using Function Module.

Thanks

Vishal

View Entire Topic
bpawanchand
Active Contributor

Hi,

To use the function module SAP_WAPI_DECISION_COMPLETE two things are very important to understand

  1. The work item which you are trying to complete is a standard decision step, or is it is a copy of TS00008267 , or it is the same task.
  2. You must be aware of the action option sequence define in the decision step of the workflow. For instance 001 is for Approve, 002 is for Reject.
   CALL FUNCTION 'SAP_WAPI_DECISION_COMPLETE'
 EXPORTING
 workitem_id = i_wiid
 language = l_langu
 user = l_uname
 decision_key = <PASS the ID  it can be either 001 or 002> 
 do_commit = 'X'
 IMPORTING
 return_code = l_subrc
 TABLES
 message_lines = lt_message_lines
 message_struct = lt_message_struct.

Form step of the workflow does not use the decision step task it is generated dynamically each time you create a new form step. So this function module does not work.

Thanks, Pavan