SAP MDG · UTILITIES

How do I add an audit note to an SAP MDG Change Request in table USMD1210 using ABAP?

Use CL_USMD_CREQUEST_API to verify the Change Request, read it with model BP, and then insert a timestamped row into USMD1210 with USMD_CREQUEST, USMD_NCREATED_AT, USMD_NCREATED_BY = 'SAP_WFRT', and the note text.

Use CL_USMD_CREQUEST_API to verify the Change Request, read it with model BP, and then insert a timestamped row into USMD1210 with USMD_CREQUEST, USMD_NCREATED_AT, USMD_NCREATED_BY = 'SAP_WFRT', and the note text.

To add a Change Request note in SAP MDG, first get the CR API instance for model `BP`, verify the CR exists, then build a `USMD1210` row with the current timestamp and technical user `SAP_WFRT`. The note text is written directly into `USMD1210`, so this is the core pattern for creating an audit entry from ABAP.

Process flow

  1. Get the Change Request API instance with `CL_USMD_CREQUEST_API=>get_instance`.
  2. Use model `BP` and the given Change Request ID.
  3. Call `READ_CREQUEST` to confirm the Change Request exists.
  4. Fill a `USMD1210` structure with timestamp, creator, and note text.
  5. Insert the structure into `USMD1210`.
  6. Catch `CX_USMD_GOV_API` and raise the message text if needed.

Referenced tables

ObjectPurpose
USMD1210Stores SAP MDG Change Request notes / audit comments.

ILLUSTRATIVE ABAP SAMPLE

ABAP method to add an MDG Change Request note

Based on the retrieved utility method for model BP; writes the note directly to USMD1210 after validating the Change Request.

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 can I programmatically write a Change Request note in SAP MDG?
  • What is the ABAP method to add a note to an MDG Change Request?
  • How do I insert a CR note for model BP in SAP MDG?

Possible questions

  • What table stores MDG Change Request notes?
  • Which API should I use to verify a Change Request before writing a note?
  • How do I create a timestamped audit note for SAP_WFRT?
  • What is the ABAP sample to insert a note into USMD1210?
  • How do I handle CX_USMD_GOV_API while adding a CR note?

Keywords

SAP MDGChange RequestUSMD1210CL_USMD_CREQUEST_APIUSMD_S_CREQUESTUSMD_NOTESAP_WFRTaudit noteABAP