The reason can be found in method /usi/cl_bal_dc_structure->build_alv_output
LOOP AT structure_description->get_components( )
REFERENCE INTO DATA(component)
WHERE type->kind EQ cl_abap_typedescr=>kind_elem.
ASSIGN COMPONENT component->name OF STRUCTURE <structure> TO <field>.
IF sy-subrc NE 0.
CONTINUE.
ENDIF.
INSERT VALUE #( fieldname = component->name
value = <field> )
INTO TABLE alv_output->*.
ENDLOOP.
ENDMETHOD.
The problem is, that structure P0001 contains only includes and that method CL_ABAP_STRUCTDESCR->GET_COMPONENTS will return an internal table, that contains structure descriptions for the included structures, but not their respective fields.
Since all fields without an elementary type are excluded from the processing, the method will return an empty table, that will then be logged.
=> The results of method CL_ABAP_STRUCTDESCR->GET_COMPONENTS need to be processed by a recursive logic, that will resolve structured types into their respective fields. This should work for included types and for structured fields.
The changes were implemented using TDD. Six new test methods in test class lcl_unit_tests_serialization will prevent a regression in subsequent releases.
The following code would produce an empty structure container in the log.
The reason can be found in method
/usi/cl_bal_dc_structure
->build_alv_output
The problem is, that structure P0001 contains only includes and that method
CL_ABAP_STRUCTDESCR
->GET_COMPONENTS
will return an internal table, that contains structure descriptions for the included structures, but not their respective fields.Since all fields without an elementary type are excluded from the processing, the method will return an empty table, that will then be logged.
=> The results of method
CL_ABAP_STRUCTDESCR
->GET_COMPONENTS
need to be processed by a recursive logic, that will resolve structured types into their respective fields. This should work for included types and for structured fields.