2013 Aug 22 12:42 PM
Hi experts ,
My requirement is to read a xml file and convert data into internal table(itab).
I already have the code but the result in itab is not in proper format .
Itab is having data like :
emp_id 112233
emp_name xyz
emp_id 223344
emp_name abc
emp_id 334455
emp_name pqr
emp_id 445566
emp_name mno
I want the emp_ id and emp_name to be header of internal table , and data to be stored row wise. like :
emp_id emp_name
112233 xyz
223344 abc
334455 pqr
445566 mno
I WANT A GENERIC PROGRAM for this that can read any xml file and return data in internal table in required format.
Regards,
Meenu
2013 Aug 23 4:17 AM
Hu Meenu Agrawal,
Try like this
http://wiki.sdn.sap.com/wiki/display/ABAP/Upload+XML+file+to+internal+table
2013 Aug 22 6:26 PM
Hi meenu,
Plz refer the following document properly
https://scn.sap.com/docs/DOC-24791
can you plz paste your xml code.
Regards,
Narayan
2013 Aug 23 4:50 AM
Hi Narayan,
I have pasted my XML code.
And my xml file is not on apllication server. I need to pick it from my presentation server ( desktop) only.
Regards,
Meenu
2013 Aug 23 4:17 AM
Hu Meenu Agrawal,
Try like this
http://wiki.sdn.sap.com/wiki/display/ABAP/Upload+XML+file+to+internal+table
2013 Aug 23 4:48 AM
Hi Ramesh ,
I have used this code which is there in this link provided by you , this is good but data fetched in itab is not in proper format as i mentioned in my original post.
please suggest me what code i should use after this code in order to convert the itab in required format.
Regards,
Meenu
2013 Aug 23 4:43 AM
My XML code is :
<?xml version="1.0" ?>
</book>
</book>
</book>
</book>
</book>
</book>
</book>
</book>
</book>
</book>
</book>
</book>
</catalog>
2013 Aug 23 7:40 AM
your output and the xml code u have pasted has no match... if you still not getting output let me know i will fill the internal table based on the xml code u have pasted.......and send u
Regards,
Narayan
2013 Aug 23 7:45 AM
Hi Narayan ,
The output i mention in my post is just a example for explaining the difference between formats of internal table which i am getting and which i want..
Regards,
Meenu
2013 Aug 23 8:22 AM
2013 Aug 23 8:40 AM
Hi Narayan,
my issue is not resolved yet.. i need the correct format of internal table.
Regards,
Meenu
2013 Sep 18 6:01 AM
one you have the internal table filled up as you had shown in your original post, simple solution is to loop at it and append the values to an internal table as per your design. Second option is to use an xslt transformation but it also depends on the way ur XML has been generated.
I believe the easiest fix for you is to loop and move rather than getting into the the complications of XSLT.
2013 Sep 18 6:18 AM