Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

xml conversion of data refs with dynamic type

Former Member
0 Likes
1,227

Hi Colleagues,

I have to create an XML from a TYPE REF TO DATA, where this data is created using a dynamic internal table. By dynamic internal table i mean that the internal table is created dynamically using the class method cl_alv_table_create=>create_dynamic_table.

Now the problem that i face is when i use the statement:

CALL TRANSFORMATION id

SOURCE jsag_data = im_context_b64

RESULT XML lv_xml

OPTIONS data_refs = 'embedded'

value_handling = 'move'.

to generate the XML i get a dump of type CX_XSLT_SERIALIZATION_ERROR saying "The ABAP data cannot be serialized."

I found a solution to avoid the dump by adding the additional option " TECHNICAL_TYPES = 'ignore' " to the CALL TRANSFORMATION statement, like

CALL TRANSFORMATION id

SOURCE jsag_data = im_context_b64

RESULT XML lv_xml

OPTIONS data_refs = 'embedded'

value_handling = 'move'

TECHNICAL_TYPES = 'ignore'.

But, using this addition the dynamic type ref to data part is totally ignored from the XML generation.

If I use a specific DDIC table type to create the data, we do not face this issue and the XML is generated as desired

Does anyone have a solution to this problem as it has become a sort of blockade for our development?

Thanks and Cheers,

Gaurav.

2 REPLIES 2
Read only

Former Member
0 Likes
698

Hello,

I reached same problem with dynamic data references, the only solution I got is to used global DDIC types (also for table types !!) when creating data which needs to be serialized.

The options technical_types = 'ignore' doesn't solve the problem - it just instructs the parser to skip data references without global ddic type. The options value_handling = 'move' is very helpful as XML serialization is very picky about values beeing serialized.

Here is summary of my observations:

- Global DDIC type has to be associated with data reference, otherwise only technical type is there and this is not supported (you can use OPTIONS TECHNICAL_TYPES = u2018IGNOREu2019 but this will just skip the data to be serialized to XML) u2026

- The above means that if you are serializing data reference to table then you have to have also global DDIC type for the table-type !! Unfortunatelly there is no default table type available for transparent tables u2026. They are treated as structures not as table-types u2026 thus:

- CREATE DATA lr_data TYPE <global_ddic_structure> - can be serialized

- CREATE DATA lr_data TYPE STANDARD TABLE OF <global_ddic_structure> - cannot be serialized

- CREATE DATA lr_data TYPE <global_ddic_table_type> - can be serialized

- !! Unfortunatelly !! CREATE DATA lr_data TYPE <type_pool_ddic_structure/ type_pool_table_type> - also cannot be serialized u2013 this is pitty u2026 this should be supported u2026.

Read only

0 Likes
698

Thanks! This solved my Problem. And with DATA_REFS = 'embedded' the Transformation now also provides json with correct hierarchy structure.