SAP MDG · UTILITIES

How do I cancel, recall, or complete workflow items in SAP MDG Change Request processing for model BP?

Use a stateless utility class in model BP to rollback or recall the change request, complete READY work items, and write an audit note into USMD1210. The documented pattern combines workflow control, note building from ZMDG_RECALL_REAS, and message return to the caller.

Use a stateless utility class in model BP to rollback or recall the change request, complete READY work items, and write an audit note into USMD1210. The documented pattern combines workflow control, note building from ZMDG_RECALL_REAS, and message return to the caller.

Use the reusable static utility pattern in model `BP`: `CANCEL_CR` rolls back the change request, completes pending work items, and writes a cancellation note; `RECALL_CR` moves the step back to the requestor after validating the user and allowed action; `COMPLETE_WORKITEM` resolves READY workflow items tied to the CR; `ADD_CREQUEST_NOTE` writes the audit trail entry to `USMD1210` with `SAP_WFRT` as creator.

Process flow

  1. Trigger the CR action from UI/service/BAdI.
  2. Read the CR context and determine the workflow action.
  3. For cancel: call `CL_USMD_WF_BO_SERVICE->ROLLBACK_CREQUEST`.
  4. For recall: validate the creator user and derive the allowed action from `USMD2301`.
  5. Complete related READY work items with `SAP_WAPI_WORKITEM_COMPLETE`.
  6. Build the audit note text from action, reason, and additional comments.
  7. Write the note to `USMD1210` with `SAP_WFRT` as creator.
  8. Return `USMD_T_MESSAGE` to the caller.

MDG model `BP` reuse pattern in UIBB, BAdI, and service layers

Call the static utility methods from the UI or process layer without keeping state in the class.

Custom reason-code mapping in `ZMDG_RECALL_REAS`

Provide the reason text used by `BUILD_NOTE` for standardized audit comments.

Workflow step customizing in `USMD2301`

Determine the allowed recall action for the current workflow step.

Referenced tables

ObjectPurpose
USMD120CChange request header / type context used during cancel follow-up checks.
USMD1210Change request note timeline table where audit notes are inserted.
USMD2301Workflow step customizing used to determine allowed recall action.
SWW_WI2OBJMaps workflow items to the CR BOR object.
SWWWIHEADUsed to identify top and child READY workflow items.
ZMDG_RECALL_REASCustom reason text lookup for standardized note building.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP example: ADD_CREQUEST_NOTE.abap

Exact relevant implementation excerpt from the knowledge document set.

1METHOD add_crequest_note. 2 DATA: 3 lv_timestamp TYPE timestamp, 4 ls_creq_note TYPE usmd1210, 5 ls_crequest TYPE usmd_s_crequest. 6 7 TRY. 8 cl_usmd_crequest_api=>get_instance( 9 EXPORTING 10 iv_crequest = iv_crequest_id 11 iv_model_name = 'BP' 12 IMPORTING 13 re_inst_crequest_api = DATA(lo_crequest_api) ). 14 15 IF lo_crequest_api IS BOUND. 16 lo_crequest_api->read_crequest( 17 IMPORTING 18 es_crequest = ls_crequest ). 19 20 IF ls_crequest IS NOT INITIAL. 21 GET TIME STAMP FIELD lv_timestamp. 22 23 ls_creq_note-mandt = sy-mandt. 24 ls_creq_note-usmd_crequest = iv_crequest_id. 25 ls_creq_note-usmd_ncreated_at = lv_timestamp. 26 ls_creq_note-usmd_ncreated_by = 'SAP_WFRT'. 27 ls_creq_note-usmd_note = iv_note. 28 29 WAIT UP TO 1 SECONDS. 30 INSERT usmd1210 FROM ls_creq_note. "#EC CI_SUBRC 31 ENDIF. 32 ENDIF. 33 34 CATCH cx_usmd_gov_api INTO DATA(lx_usmd_gov_api). 35 MESSAGE lx_usmd_gov_api->get_text( ) TYPE 'E'. 36 ENDTRY. 37ENDMETHOD.

The remaining configuration, implementation details, and testing guidance continue from this answer more…

Related questions and keywords

Alternative questions

  • How do I implement reusable MDG CR process utilities for cancel, recall, and note handling?
  • Which SAP MDG objects are used to cancel a change request and write an audit note?
  • How can I complete pending MDG workflow work items programmatically for a change request?

Possible questions

  • How do I cancel a change request and write a cancellation note?
  • How do I send a change request step back to the requestor?
  • How do I complete READY workflow work items for a change request?
  • How do I insert a note into USMD1210 for an MDG change request?
  • How do I build standardized audit notes from reason codes?

Keywords

SAP MDGChange RequestBP modelworkflowCANCEL_CRRECALL_CRCOMPLETE_WORKITEMADD_CREQUEST_NOTEBUILD_NOTEUSMD1210USMD2301SWW_WI2OBJSWWWIHEADSAP_WFRT