SAP MDG · CONSOLIDATION
Why does MDG consolidation dump later instead of showing the real READ_ALL_DATA error?
Swallowing CX_MDC_MODEL in READ_ALL_DATA hides the real error
A dump or generic failure occurs later in the process (often in a standard MDC method). The original exception from READ_ALL_DATA does not appear in the process log.
Error
A dump or generic failure occurs later in the process (often in a standard MDC method). The original exception from READ_ALL_DATA does not appear in the process log.
Symptoms
- The process log does not show the original
CX_MDC_MODELmessage. - A later dump is hard to relate to the read step.
- The redefined
READ_ALL_DATAcatchesCX_MDC_MODEL, sets a flag, and continues.
What is the issue
CL_MDC_MODEL_BP=>READ_ALL_DATA, and the framework that calls it, expect a failure during the read to be raised as CX_MDC_MODEL so the process can log it and stop cleanly. A custom redefinition that catches the exception and continues leaves the model in a partial or inconsistent state. A later standard method then dumps or fails with a misleading symptom, because the real cause was already swallowed.
Where to debug
- Set an external breakpoint in the custom
READ_ALL_DATA, around theTRY/CATCHofSUPER->READ_ALL_DATA, for the background workflow or bgRFC user in the same client where the process runs. - In the
CATCH, inspect the exception object: callGET_TEXT( )and checkPREVIOUS. - Compare what was visible at the time of the catch with the later dump stack and the process log.
How to solve
Capture the exception text for the process log, then raise the exception again (or wrap it with PREVIOUS so the original is preserved):
1METHOD read_all_data.
2 TRY.
3 super->read_all_data( iv_from_current_step = iv_from_current_step ).
4 CATCH cx_mdc_model INTO DATA(lx_mdc).
5 " write lx_mdc->get_text( ) to the process log, then re-raise
6 RAISE EXCEPTION lx_mdc.
7 ENDTRY.
8ENDMETHOD.You can also raise a new CX_MDC_MODEL (or your exception class) with PREVIOUS = lx_mdc after logging.
Alternate option
If a specific, known error should not abort the whole read (for example a missing optional custom entity), catch only that case in a dedicated custom-entity read, not the entire SUPER->READ_ALL_DATA call. See the related entry on isolating custom entity read failures.
The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- Should a custom READ_ALL_DATA catch CX_MDC_MODEL and continue?
- How do I keep the original CX_MDC_MODEL text in the MDC process log?
- Why is a later MDC dump misleading after a redefined READ_ALL_DATA?
Possible questions
- Should a custom READ_ALL_DATA catch CX_MDC_MODEL and continue?
- How do I keep the original CX_MDC_MODEL text in the MDC process log?
- Why is a later MDC dump misleading after a redefined READ_ALL_DATA?
- What configuration is required for Swallowing CX_MDC_MODEL in READ_ALL_DATA hides the real error?
- How can this SAP MDG scenario be tested?