I consistently run into trouble when using XSLT Transformation to import XML data into (deep) ABAP Structures. Partly because I do not use it often I guess. So to make sure that next time I will quickly find a how-to that works for me I created this blog 😉
Other options are; to use Simple Transformation or the standard Identity Transformation (XSLT via existing transformation 'ID').
The goal now is to import the following XML into a deep ABAP structure using XSLT
The RESULT variable of the CALL TRANSFORMATION must have the same name as the root target element in the XSLT (in this example; 'file' == <FILE>
The target elements in the XSLT (ie the elemenst that correspond with your target ABAP structure) must be in CAPITALS; Like <HEAD>, <NAME>, ...
The Source element references must be in same case as in the XML. Like "/Items/ITM"
The output of the CALL TRANSFORMATION must be a table type (structure is not allowed, other outputs like XML and ref to data is also possible, for that see SAP Help). Like in our example; lt_out is a table type.
Each substructure or table line in the output needs to be explicitly defined with a dummy structure name. These dummy structure names do not exist in the ABAP target, but need to be defined. The name used is irrelevant. See <DUMMY1> and <DUMMY2> in XSLT