SAP MDG · CONSOLIDATION

Why does CL_MDC_MODEL_BP=>PREFETCH_OWN_OBJECT_IDS dump DATREF_NOT_ASSIGNED after a custom READ_ALL_DATA?

DATREF_NOT_ASSIGNED in CL_MDC_MODEL_BP PREFETCH_OWN_OBJECT_IDS

Runtime error DATREF_NOT_ASSIGNED in CL_MDC_MODEL_BP=>PREFETCH_OWN_OBJECT_IDS. This typically appears during the validation step, which runs in a bgRFC or background workflow context.

Error

Runtime error DATREF_NOT_ASSIGNED in CL_MDC_MODEL_BP=>PREFETCH_OWN_OBJECT_IDS. This typically appears during the validation step, which runs in a bgRFC or background workflow context.

Symptoms

  • Short dump DATREF_NOT_ASSIGNED. The dump stack shows only standard MDC objects, which can mislead analysis toward a SAP standard defect.
  • The dump happens after a custom subclass of CL_MDC_MODEL_BP redefines READ_ALL_DATA.
  • Member data references such as MR_BUT000_PRC are not bound when PREFETCH_OWN_OBJECT_IDS runs.

What is the issue

After READ_ALL_DATA, CL_MDC_MODEL_BP=>PREFETCH_OWN_OBJECT_IDS dereferences the member data references `MR_

<table>_PRC (for example ME->MR_BUT000_PRC) to prefetch object IDs. The standard superclass normally binds these references during READ_ALL_DATA. A custom redefinition can leave them unbound: the super call may not bind them in this process step, or a refactor may have dropped a fallback that previously bound them from the access object's records. When PREFETCH_OWN_OBJECT_IDS` then reads an unbound reference, the dump occurs in standard code even though the cause is in the redefinition.

Where to debug

  • Set an external breakpoint in the custom READ_ALL_DATA, immediately after SUPER->READ_ALL_DATA, and in CL_MDC_MODEL_BP=>PREFETCH_OWN_OBJECT_IDS, for the background workflow or bgRFC user in the same client where the process runs.
  • Watch ME->MR_BUT000_PRC (and other MR_*_PRC references) right after the super call. If they are not bound, that is the cause of the later dump.
  • Do not stop at the dump stack alone; it will point at the standard method, not the custom read.

How to solve

After the super call, if MR_BUT000_PRC is not bound, loop over the data objects or tables and bind each MR_<table>_PRC from the access object's records:

ABAP
1 super->read_all_data( iv_from_current_step = iv_from_current_step ). 2  3 IF me->mr_but000_prc IS NOT BOUND. 4 LOOP AT lt_tables INTO DATA(lv_table). " process table names, e.g. BUT000 5 DATA(lv_attr) = 'MR_' && lv_table && '_PRC'. 6 ASSIGN me->(lv_attr) TO FIELD-SYMBOL(<lr_prc>). 7 IF sy-subrc = 0 AND <lr_prc> IS NOT BOUND. 8 " <lt_records> comes from the access object (access->records) 9 GET REFERENCE OF <lt_records> INTO <lr_prc>. 10 ENDIF. 11 ENDLOOP. 12 ENDIF.

Adjust the access-object lookup to however RECORDS is exposed in your model. Keep this fallback even if a later refactor of READ_ALL_DATA seems to make it unnecessary.

Alternate option

If you can fix the super-call parameters (see the entry on passing IV_FROM_CURRENT_STEP through) so the standard read binds the references itself, do that first. Still keep the IS NOT BOUND fallback so a future change does not reintroduce the dump.

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

Related questions and keywords

Alternative questions

  • Why is MR_BUT000_PRC not bound after SUPER->READ_ALL_DATA?
  • MDC validation dumps DATREF_NOT_ASSIGNED in a bgRFC or workflow context — what should I check?
  • The dump stack shows only standard MDC objects; could a custom READ_ALL_DATA still be the cause?

Possible questions

  • Why is MR_BUT000_PRC not bound after SUPER->READ_ALL_DATA?
  • MDC validation dumps DATREF_NOT_ASSIGNED in a bgRFC or workflow context — what should I check?
  • The dump stack shows only standard MDC objects; could a custom READ_ALL_DATA still be the cause?
  • What configuration is required for DATREF_NOT_ASSIGNED in CL_MDC_MODEL_BP PREFETCH_OWN_OBJECT_IDS?
  • How can this SAP MDG scenario be tested?

Keywords

DATREF_NOT_ASSIGNEDCL_MDC_MODEL_BPPREFETCH_OWN_OBJECT_IDSMR_BUT000_PRCREAD_ALL_DATAaccess->recordsbgRFCvalidationunbound data reference