Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

TypeNameDescription
ImportingID_TASK_IDOneList Task ID being actioned (SAP workflow work item ID)
ImportingID_ACTION_BYUser Name that triggered the action
ImportingID_ACTION_IDOneList Action ID
ImportingID_ACTION_COMMENTAction comment entered by the user in OneList
ImportingID_OBJECT_IDThe object ID of the workflow task (generally, the SAP document number being actioned)
ExceptionFAILED_TO_ACTIONRaised 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.

...