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

Dynamic XML to Dynamic Internal Table

MKM
Active Participant
0 Likes
1,908

Hi,

I am able to read XML file stored in application server into internal table using cl_xml_document class.

but I am stuck with the requirement that the fields of XML files will be dynamic. There is no fix no. of fields as files will be coming from different types of interfaces. for those have to create a single dynamic internal table whose structure is unknown and data will be in tabular format.

I have never used transformation before. I am wondering whether a ABAP logic will work for the requirement or a transformation will be required ?

Quick help will be appreciated.

Regards,

Manoj

3 REPLIES 3
Read only

hiriyappa_myageri
Participant
0 Likes
1,064

Hi Manoj,

I have worked for single structure fileds to generate an xml using transformation and reading it using cl_xml_document.

here you are telling about the data is coming from different interfaces and  which are not fixed structures.

Here i can suggest you that you can make use field symbols as well.

Reagards,

Hiriyappa.

Read only

rb
Contributor
0 Likes
1,064

Good question. I tried several things but i do not think a dynamic XML -> ABAP table is possible.

My idea was to read the XML and use a parser to find the attributes which are relevant.

Read only

ceedee666
SAP Champion
SAP Champion
0 Likes
1,064

Hi Manjo,

do you have at least some control over the structure of the XML document or are these document completely different without any prior knowledge of the structure?

If you have at least some control of the structure I'd suspect that it should be possible to write a simple transformational to convert the different XML formats into ABAP data (http://help.sap.com/abapdocu_70/en/ABENABAP_ST.htm).

If you don't have any control I guess you will need to manually parse the XML file using the ABAP XML classes (ABAP Class Library for XML) and build the result structure depending on the tags you find.

Christian