SAP MDG · MDG FINANCE

How do I reuse MDG change-request APIs and Excel file-upload building blocks in SAP MDG?

SAP MDG reusable building blocks for change-request lifecycle, CR-type customizing, and Excel file handling can be extracted into a public utility class. The main patterns are: build a CR URL from a CR number, submit a CR safely with check/save/dequeue/start-workflow and rollback on failure, read CR types with authorization and BAdI filtering, and load or generate XLSX files with standard SAP classes.

SAP MDG reusable building blocks for change-request lifecycle, CR-type customizing, and Excel file handling can be extracted into a public utility class. The main patterns are: build a CR URL from a CR number, submit a CR safely with check/save/dequeue/start-workflow and rollback on failure, read CR types with authorization and BAdI filtering, and load or generate XLSX files with standard SAP classes.

The reusable MDG building blocks in the source fall into three areas: change-request lifecycle, CR-type customizing, and file handling. You can lift them into a public utility class and reuse the standard APIs for URL creation, safe CR submission with rollback, CR-type value help, and XLSX import/export.

Process flow

  1. Create a public utility class instead of reusing the original FINAL class directly.
  2. Use `cl_usmd_wf_navigation_handler=>get_instance( iv_crequest_id )` and `get_navigation_parameters( )` to build a CR URL.
  3. Implement the submit flow as check -> save -> dequeue entities -> dequeue CR -> COMMIT WORK AND WAIT -> start workflow -> rollback delete on failure.
  4. Use `cl_usmd_crequest_delete` for rollback deletion of supplied CRs.
  5. Use `cl_usmd2_cust_access_service=>get_crequest_type_by_entity( )` plus `AUTHORITY-CHECK` and BAdI `USMD_CREQUEST_INTEGRATION` to build CR-type help.
  6. Use `cl_usmd2_cust_access_service=>is_parallel_cr_type( )` for parallel CR detection.
  7. Use `cl_fdt_xl_spreadsheet` to read worksheet data into a dynamic internal table.
  8. Use `cl_mime_repository_api` and `cl_wd_runtime_services=>attach_file_to_response( )` to serve or generate XLSX templates.

BAdI `USMD_CREQUEST_INTEGRATION`

Filter CR types per model and entity through `filter_crequest_type( iv_model, iv_entity, CHANGING ct_crequest_type )`.

Authorization object `USMD_CREQ`

Allow only permitted CR types in value help with `ACTVT = '01'` and `CREQ_TYPE = <type>`.

Referenced tables

ObjectPurpose
tihttpnvpParameter table used to build the CR navigation URL.
usmd_t_messageMessage table returned by governance API and exception handling.

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

Related questions and keywords

Alternative questions

  • How do I build a reusable MDG utility for CR submission and Excel upload?
  • How can I programmatically create, submit, and roll back an MDG change request?
  • How do I build CR type help and file upload helpers for MDG?

Possible questions

  • What is the standard API to create and submit an MDG change request?
  • How do I build a CR URL for a change request?
  • How do I implement rollback if CR workflow start fails?
  • How do I filter CR types by entity and model?
  • How do I read or generate XLSX files in MDG ABAP?

Keywords

MDGchange requestIF_USMD_GOV_APICL_USMD_WF_NAVIGATION_HANDLERCL_USMD_CREQUEST_DELETECL_USMD2_CUST_ACCESS_SERVICEUSMD_CREQUEST_INTEGRATIONCL_FDT_XL_SPREADSHEETCL_MIME_REPOSITORY_APICL_WD_RUNTIME_SERVICESXLSXfile upload