SAP MDG · UTILITIES
How do I add an MDG Change Request note in ABAP using the Change Request API?
Use `CL_USMD_CREQUEST_API` to get the change-request instance for model `BP`, read the request if needed, then insert a note record into `USMD1210` with the CR number, timestamp, creator, and note text. The documented pattern writes the note as `SAP_WFRT` and catches `CX_USMD_GOV_API`.
Use `CL_USMD_CREQUEST_API` to get the change-request instance for model `BP`, read the request if needed, then insert a note record into `USMD1210` with the CR number, timestamp, creator, and note text. The documented pattern writes the note as `SAP_WFRT` and catches `CX_USMD_GOV_API`.
Use `CL_USMD_CREQUEST_API` to resolve the Change Request instance, optionally read the request header, then create a `USMD1210` row with the current timestamp and your note text. The exported method from `ZCL_MDG_BP_UTIL` writes the note directly and uses `SAP_WFRT` as the creator value, which is suitable for workflow-generated audit notes.
Process flow
- Call `CL_USMD_CREQUEST_API=>get_instance` with the CR ID and model `BP`.
- Check that the returned CR API object is bound.
- Optionally call `read_crequest` to validate or inspect the request.
- Build a `USMD1210` row with CR number, timestamp, creator, and note text.
- Insert the row into `USMD1210`.
- Catch `CX_USMD_GOV_API` and handle the failure in your message framework.
Referenced tables
| Object | Purpose |
|---|---|
USMD1210 | Stores MDG Change Request note entries. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example: ADD_CREQUEST_NOTE.abap
Exact relevant implementation excerpt from the knowledge document set.
1METHOD add_crequest_note.
2
3 DATA:
4 lv_ts TYPE timestamp,
5 ls_creq_note TYPE usmd1210,
6 ls_crequest TYPE usmd_s_crequest.
7
8 TRY.
9 CALL METHOD cl_usmd_crequest_api=>get_instance
10 EXPORTING
11 iv_crequest = iv_crequest_id
12 iv_model_name = 'BP'
13 IMPORTING
14 re_inst_crequest_api = DATA(lo_crequest).
15
16 IF lo_crequest IS BOUND.
17 CALL METHOD lo_crequest->read_crequest
18 IMPORTING
19 es_crequest = ls_crequest. " Change Request
20* lo_crequest->add_note(
21* EXPORTING
22* iv_note = iv_note
23* ).
24
25 GET TIME STAMP FIELD lv_ts.
26
27 ls_creq_note-mandt = sy-mandt.
28 ls_creq_note-usmd_crequest = iv_crequest_id.
29 ls_creq_note-usmd_ncreated_at = lv_ts.
30 ls_creq_note-usmd_ncreated_by = 'SAP_WFRT'.
31 ls_creq_note-usmd_note = iv_note.
32
33 WAIT UP TO 1 SECONDS.
34 INSERT INTO usmd1210 VALUES ls_creq_note. "#EC CI_SUBRC
35
36 ENDIF.
37 CATCH cx_usmd_gov_api.
38
39 ENDTRY.
40
41ENDMETHOD.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How can I write a note into USMD1210 for an MDG Change Request?
- What is the ABAP pattern for adding a Change Request note in model BP?
- How do I use CL_USMD_CREQUEST_API to append a note to an MDG request?
Possible questions
- How do I add an MDG Change Request note in ABAP using the Change Request API?
- How can I write a note into USMD1210 for an MDG Change Request?
- What is the ABAP pattern for adding a Change Request note in model BP?
- How do I use CL_USMD_CREQUEST_API to append a note to an MDG request?
- How do I create a reusable helper for CR notes and workflow audit text?