‎2005 Apr 15 11:30 AM
Hi Everyone,
I am working on some Interface where I need to convert the data avilable in internal table to XML format, can anyone please tell me how this can be achieved.
Rgds,
‎2005 Apr 15 11:40 AM
Hi,
That largely depends on the app server version you're working with.
As of version 6.10 there is a built-in xml engine which you can make use of e. g. with the new ABAP command CALL TRANSFORMATION (just see the online help if applicable).
Before that you would have to build up the XML data "by hand", using the objects in package SIXML. If the latter is the case for you, have a look at the sample programs in package SIXML_TEST.
Hope that helps (plz reward me if it does ,
Joerg
‎2005 Apr 15 11:40 AM
Hi,
That largely depends on the app server version you're working with.
As of version 6.10 there is a built-in xml engine which you can make use of e. g. with the new ABAP command CALL TRANSFORMATION (just see the online help if applicable).
Before that you would have to build up the XML data "by hand", using the objects in package SIXML. If the latter is the case for you, have a look at the sample programs in package SIXML_TEST.
Hope that helps (plz reward me if it does ,
Joerg
‎2005 Apr 15 12:25 PM
Hi Joerg,
Thaks for the useful suggestions, they were really useful. I found some function modules which can convert the data in XML format, but I am really not sure whether they are the right ones to use. Can you please let me know if there are any ready made reports available to do the conversion.
Thanks in Advance.
‎2005 Apr 15 1:10 PM
Hi Lalitha,
Just look at this piece of code, I think it should help you.
DATA : ITAB TYPE TABLE OF SPFLI,
L_XML TYPE REF TO CL_XML_DOCUMENT.
SELECT * FROM SPFLI INTO TABLE ITAB.
* CREATE THE XML OBJECT
CREATE OBJECT L_XML.
* CONVERT THE DATA TO XML
CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB[] ).
* DATA IS CONVERTED TO XML; DISPLAY THE XML-DOCUMENT
CALL METHOD L_XML->DISPLAY.Regards,
Anand Mandalika.
‎2005 Apr 15 9:21 PM
Hi,
You can also use the folloing two function modules to convert the data in an internal table to XML format.
Step 1: Convert to Data Object Model using
'SDIXML_DATA_TO_DOM'
Step 2: Conver to XML using
'SDIXML_DOM_TO_XML'
Good luck,
Suresh Datti
‎2005 Apr 18 10:39 AM
Hi Anand,
Thank you very much for the timely help, the code sent by you was very useful and I incorporated the same in my program.
Rgds,
‎2005 Apr 18 10:52 AM
Hello Lalitha,
If your problem is resolved, then could you please close this thread ? You do that either by
1. rewarding 10 points to the answer that has solved your problem.
or by
2. choosing the option "Solved it on my own".
That would help the guys out there trying to answer the queries. they would know that this question has been resolved.
Regards,
Anand Mandalika.
‎2007 Nov 07 11:49 AM
Hi ,
I am using the function modules :
Step 1: Convert to Data Object Model using
'SDIXML_DATA_TO_DOM'
Step 2: Conver to XML using
'SDIXML_DOM_TO_XML'
They work fine in a normal report. But when I use them in a method in a business object, they behave strangely.
The XML structure generated ignoring the fields with blank values. I want the entire structure to be aded in the XML file including the blank fields.
This happens for a report program , but does not happen for a method of a bisuness object.
May I doing something wrong?
Rgds,
Namita.
‎2007 Dec 16 12:22 AM
Hi Anand,
Your code is very useful to my program, but I have a question,
CALL METHOD L_XML->DISPLAY. >>>> instead of display can I write it to a file on app.server.
Thanks
‎2005 Apr 15 3:04 PM
Hello. I have a question relating to this topic. I am on R/3 v46B. Is there any FM that can convert an ABAP internal table to XML ?
‎2005 Apr 15 3:24 PM
Hello Joyce,
I am able to find the class CL_XML_DOCUMENT in 4.6C also. Unfortunately, I don't have any 4.6B system. Could you check out the aboove code in 4.6B if the class exists?
But if you're particular about using a Function Module, then you should have a look at the FM SAP_CONVERT_TO_XML_FORMAT, if it is available in your system.
Regards,
Anand Mandalika.
‎2005 Aug 04 2:48 PM
be careful, in 4.6C the fm SAP_CONVERT_TO_XML_FORMAT has problems with big amounts of data (had 73000 records of 220 byte length). the program consumed tons of memory during the fm SAP_CONVERT... (>500 MB seen in SM50) and never came back...
the solution mentioned by Poornanand Mandalika performed far better!
kind regards
christian punz
‎2015 Oct 19 8:20 AM
Hello poornandh,
Can u tel me how to download the converted xml file data according to CALL METHOD L_XML->DISPLAY.
I have different format of XML File which i am unable to generate by these methods suggested by u.
Please help me as early as possible.