...
Type | Name | Description |
---|---|---|
Importing | ID_TASK_ID | OneList Task ID being actioned (SAP workflow work item ID) |
Importing | ID_ACTION_BY | User Name that triggered the action |
Importing | ID_ACTION_ID | OneList Action ID |
Importing | ID_ACTION_COMMENT | Action comment entered by the user in OneList |
Importing | ID_OBJECT_ID | The object ID of the workflow task (generally, the SAP document number being actioned) |
Exception | FAILED_TO_ACTION | Raised exception when the action could not be executed |
...
As an example, the Release and Reject actions for a Purchase Order approval can be implemented as followfollows:
Code Block |
---|
METHOD execute_action. DATA: lo_api TYPE REF TO cl_gbapp_apv_po_api. DATA: lt_approval_decision TYPE gbappt_po_approval_decision, ls_approval_decision TYPE LINE OF gbappt_po_approval_decision, ls_parameter TYPE LINE OF /iwbep/t_mgw_name_value_pair, lt_parameter TYPE /iwbep/t_mgw_name_value_pair, ls_action_result TYPE gbapps_action_result. DATA: ld_po_number TYPE bapimmpara-po_number, ld_rel_code TYPE bapimmpara-po_rel_cod. ld_po_number = id_object_id. ld_rel_code = me->get_po_rel_code( id_po_number = ld_po_number ). lo_api = cl_gbapp_apv_po_api=>get_instance( ). CHECK ld_rel_code IS NOT INITIAL. CLEAR ls_approval_decision. CLEAR lt_approval_decision. ls_approval_decision-workitem_id = id_task_id. CASE id_action_id. WHEN 'RELEASE'. ls_approval_decision-decision = '0001'. ls_approval_decision-approval_text = id_action_comment. WHEN 'REJECT'. ls_approval_decision-decision = '0002'. ls_approval_decision-rejection_text = id_action_comment. ENDCASE. APPEND ls_approval_decision TO lt_approval_decision. TRY. lo_api->set_decision( EXPORTING it_approval_decision = lt_approval_decision IMPORTING es_action_result = ls_action_result ). CATCH /iwbep/cx_mgw_busi_exception . RAISE failed_to_action. ENDTRY. ENDMETHOD. |
...