SAP MDG · MDG FINANCE
How do I derive the Controlling Area in a G/L Account change request in SAP MDG?
Use the MDG application context to get the change request, read COMPCODE, CELEM, and S4ACCTYP from the CR, and when Company Code is present, account type is `P`, and `CELEM` is still initial, raise the FPM event `MDGF_CTRAREAS_GENERATE` and call `on_generate_ctrareas`.
Use the MDG application context to get the change request, read COMPCODE, CELEM, and S4ACCTYP from the CR, and when Company Code is present, account type is `P`, and `CELEM` is still initial, raise the FPM event `MDGF_CTRAREAS_GENERATE` and call `on_generate_ctrareas`.
Use the MDG application context to get the current change request, read the CR attributes `COMPCODE`, `CELEM`, and `S4ACCTYP`, and then trigger Controlling Area generation only for the qualifying G/L Account request. In the supplied pattern, the generation is fired through FPM event `MDGF_CTRAREAS_GENERATE` and processed by `on_generate_ctrareas` when Company Code is present, account type is `P`, and `CELEM` has not yet been derived.
Process flow
- Get the MDG application context with `cl_usmd_app_context=>get_context( )`.
- Read the change request number and type with `get_attributes`.
- Read CR attributes `COMPCODE`, `CELEM`, and `S4ACCTYP` using `zcl_mdg_workflow_util=>get_single_attribute`.
- Check that Company Code is present, account type is `P`, and `CELEM` is initial.
- Create FPM event `MDGF_CTRAREAS_GENERATE` with `cl_fpm_event=>create_by_id`.
- Call `on_generate_ctrareas` to perform generation.
- Verify that the Controlling Data / Controlling Area values are generated and saved in the CR.
Referenced tables
| Object | Purpose |
|---|---|
T077S | Account-group customizing table referenced in the MDG-F financial conversion context. |
T030 | Account determination table referenced in the MDG-F financial conversion context. |
The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How can I trigger Controlling Area generation for a G/L Account CR?
- How do I populate Controlling Area when Company Code is maintained in a G/L Account change request?
- What logic can I use to call Controlling Area generation in MDG G/L Account?
Possible questions
- How do I derive the Controlling Area in a G/L Account change request?
- How do I trigger Controlling Area generation when Company Code is entered in MDG?
- What ABAP logic checks account type P and calls MDGF_CTRAREAS_GENERATE?
- How do I get the change request number from the MDG app context?
- How do I read CR attributes such as COMPCODE, CELEM, and S4ACCTYP?