SAP MDG · UTILITIES

How do I read inactive entity data from an SAP MDG change request using the standard API?

Use CL_USMD_MODEL_EXT=>GET_INSTANCE to get IF_USMD_MODEL_EXT, then call READ_ENTITY_DATA_ALL with IF_ACTIVE = space and I_CREQUEST filled to read inactive change-request data. Do not read MDG staging tables directly for this use case.

Use CL_USMD_MODEL_EXT=>GET_INSTANCE to get IF_USMD_MODEL_EXT, then call READ_ENTITY_DATA_ALL with IF_ACTIVE = space and I_CREQUEST filled to read inactive change-request data. Do not read MDG staging tables directly for this use case.

The standard MDG way to read inactive change-request data is to use `CL_USMD_MODEL_EXT=>GET_INSTANCE` and then `READ_ENTITY_DATA_ALL`. Pass the MDG model and entity name explicitly, keep `IF_ACTIVE = space`, and supply the change request number in `I_CREQUEST` so the API returns the inactive version of the entity data.

Process flow

  1. Identify the MDG model and the leading entity.
  2. Declare the change request number and message table.
  3. Call `CL_USMD_MODEL_EXT=>GET_INSTANCE` for the model.
  4. Check that the returned model instance is bound.
  5. Call `READ_ENTITY_DATA_ALL` with `IF_ACTIVE = space` and `I_CREQUEST` set.
  6. Inspect `ET_MESSAGE` and consume the returned data safely.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP example

Exact relevant implementation excerpt from the knowledge document.

1" Inputs: model, leading entity, change request. 2DATA lv_model TYPE usmd_model VALUE '0G'. 3DATA lv_entity TYPE usmd_fieldname VALUE 'CCTR'. 4DATA lv_crequest TYPE usmd_crequest. " Supply 5DATA lo_model_ext TYPE REF TO if_usmd_model_ext. 6DATA lt_data_entity TYPE usmd_ts_data_entity. 7DATA lt_message TYPE usmd_t_message. 8 9cl_usmd_model_ext=>get_instance( 10 EXPORTING i_usmd_model = lv_model 11 IMPORTING eo_instance = lo_model_ext et_message = lt_message ). 12 13IF lo_model_ext IS BOUND. 14 lo_model_ext->read_entity_data_all( 15 EXPORTING i_fieldname = lv_entity if_active = space i_crequest = lv_crequest 16 IMPORTING et_message = lt_message et_data_entity = lt_data_entity ). 17ENDIF.

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

Related questions and keywords

Alternative questions

  • How can I read CR-specific MDG entity data without selecting staging tables?
  • What is the standard way to read inactive MDG data for a change request?
  • How do I use CL_USMD_MODEL_EXT=>GET_INSTANCE and READ_ENTITY_DATA_ALL for CR data?

Possible questions

  • Which API should I use for MDG entity reads?
  • How do I read inactive data for a specific change request?
  • What is the difference between active and inactive MDG reads?
  • Can I read MDG staging data directly?
  • How do I get the change-request entity data in ABAP?

Keywords

CL_USMD_MODEL_EXTIF_USMD_MODEL_EXTREAD_ENTITY_DATA_ALLGET_INSTANCEUSMD_TS_DATA_ENTITYUSMD_T_MESSAGEI_CREQUESTIF_ACTIVEinactive MDG datachange request