SAP MDG · DATA MODEL UI

How do I automatically derive and populate the Cost Element / Controlling Data UIBB during SAP MDG G/L Account creation for a Profit and Loss account?

Enhance CL_MDGF_GUIBB_FI_ACCT_CTRAREAS~IF_FPM_GUIBB_LIST~GET_DATA with an implicit enhancement that calls the standard Generate Controlling Data event only when the account is a P&L account, the short text exists, no controlling-data row is already present, the standard action is enabled, and the current change request has not yet been processed in this session.

Enhance CL_MDGF_GUIBB_FI_ACCT_CTRAREAS~IF_FPM_GUIBB_LIST~GET_DATA with an implicit enhancement that calls the standard Generate Controlling Data event only when the account is a P&L account, the short text exists, no controlling-data row is already present, the standard action is enabled, and the current change request has not yet been processed in this session.

Enhance the standard feeder `CL_MDGF_GUIBB_FI_ACCT_CTRAREAS` in `IF_FPM_GUIBB_LIST~GET_DATA` with an implicit enhancement at the end of the method. Reuse the standard action-usage decision for `IF_USMDZ10_CONSTANTS=>GC_ACT_CTRAREAS_GENERATE`, check that the G/L account is a Profit and Loss account (`S4ACCTYP = 'P'`), ensure the short text exists, skip if `CT_DATA` already contains a controlling-data row, and prevent duplicate execution for the same change request in the current internal session.

Process flow

  1. Enhance `CL_MDGF_GUIBB_FI_ACCT_CTRAREAS->IF_FPM_GUIBB_LIST~GET_DATA` at the end of the standard method.
  2. Read the MDG runtime context using `CL_USMD_APP_CONTEXT=>GET_CONTEXT` and extract the change request ID.
  3. Reuse the feeder-populated values for `MV_S4ACCOUNT_TYPE` and `MV_ACCOUNT_NAME`.
  4. Exit unless `S4ACCTYP = 'P'`, the short text exists, and `CT_DATA` is initial.
  5. Check `CT_ACTION_USAGE` for `IF_USMDZ10_CONSTANTS=>GC_ACT_CTRAREAS_GENERATE` and confirm it is enabled.
  6. Use a local `STATICS` guard to avoid duplicate generation for the same change request in one internal session.
  7. Create the standard FPM event with `CL_FPM_EVENT=>CREATE_BY_ID` and call `ME->ON_GENERATE_CTRAREAS`.
  8. Set `EV_DATA_CHANGED = ABAP_TRUE` after generation.

Referenced tables

ObjectPurpose
CT_DATARuntime list table in the feeder; the enhancement checks that no controlling-data row already exists before generating.
CT_ACTION_USAGERuntime action-usage table; the enhancement checks the enabled status of `IF_USMDZ10_CONSTANTS=>GC_ACT_CTRAREAS_GENERATE`.

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

Related questions and keywords

Alternative questions

  • How can I trigger the standard Generate Controlling Data action automatically in MDG G/L Account maintenance?
  • Which feeder class and method should I enhance to auto-populate controlling data in SAP MDG?
  • How do I run the same logic as the Generate Controlling Data button in G/L Account creation?

Possible questions

  • Which class and method are used for automatic controlling-data generation in SAP MDG?
  • What guard conditions should I check before auto-generating controlling data?
  • Can I use an implicit enhancement in GET_DATA for CL_MDGF_GUIBB_FI_ACCT_CTRAREAS?
  • How do I avoid duplicate generation in the same change request session?
  • What standard event is used for generating controlling data?

Keywords

SAP MDGG/L AccountCost ElementControlling DataUIBBCL_MDGF_GUIBB_FI_ACCT_CTRAREASIF_FPM_GUIBB_LISTGET_DATAMDGF_CTRAREAS_GENERATEIF_USMDZ10_CONSTANTS=>GC_ACT_CTRAREAS_GENERATEimplicit enhancementchange requestP&L account