cancel
Showing results for 
Search instead for 
Did you mean: 

convert internal table to XML

Former Member
0 Kudos

Hi ALL,

Can any one guide me on how to convert internal table to XML format??? Actually i want to pass data from webdynpro ABAP to flex application.

Thanks in Advance

Regards

Shilpa

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi Shilpa ,

refer this thread for similar requirement :

regds,

amit

Former Member
0 Kudos

I need to convert the internal table to XML . I things the link is for converting the internal table to Excel.

thanks,

Shilpa

jan_krohn
Active Participant
0 Kudos

Please check out my tutorial here, and feel free to ask further questions:

http://www.heidoc.net/joomla/development-mainmenu-31/22-sap--xslt/15-sapxslt

Best regards,

Jan

Former Member
0 Kudos

I want to convert the internal table into XML and not excel

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

The process is actually quite simple as you can use the built in CALL TRANSFORMATION command and an SAP delivered XSLT (either ID or ID_INDENT). Here is an example:

data xml_out type xstring.
data itab type standard table of sflight.
select * from sflight into table itab.

 call transformation id
        source itab
        result xml xml_out.

Former Member
0 Kudos

Hi Jan,

Thanks for the reply.

I have tried the tutorial sent by you and have tried the same example(ABAP to XML). It creates the Customers.xml but the XML displays the following content:

The XML page cannot be displayed

Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.

-


Switch from current encoding to specified encoding not supported. Error processing resource 'file:///C:/customers.xml'. Li...

<?xml version="1.0" encoding="utf-16"?>

Can you guide me why I am not able to see the correct XML content?

Thanks,

Shilpa

Former Member
0 Kudos

Hi Jan,

Can you please look into the error i am getting (mentioned in the above post).

Looking foward for your reply.

Thanks,

Shilpa.

Former Member
0 Kudos

Hi Jan,

Thanks for the reply.

I have tried the tutorial sent by you and have tried the same example(ABAP to XML). It creates the Customers.xml but the XML displays the following content:

The XML page cannot be displayed

Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.

-


Switch from current encoding to specified encoding not supported. Error processing resource 'file:///C:/customers.xml'. Li...

<?xml version="1.0" encoding="utf-16"?>

Can you guide me why I am not able to see the correct XML content?

Thanks,

Shilpa

jan_krohn
Active Participant
0 Kudos

Seems to be some problem with unicode. Try to specify the code page in gui_download. It should be one of the UTF-16 subtypes.

Regards,

Jan

Former Member
0 Kudos

HI Jan,

Thanks for your reply.

I have tried the CODEPAGE = '4102' in gui_download and I an getting the below ouput.

<?xml version="1.0" encoding="utf-16" ?>

- <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">

- <asx:values>

<IPERSON />

</asx:values>

</asx:abap>

The about content of XML file doesnot contain the data of I person.

Can you help further on this.

Thank ,

Shilpa

jan_krohn
Active Participant
0 Kudos

Hi Shilpa,

You're using the incorrect XSLT style sheet. You should use the sencond one instead of the first one

Regards,

Jan

Former Member
0 Kudos

Hi Jan,

Thanks for the reply!!! It is working now. I have a another question : If I want the output to be in the form of xstring and not file. Then how can I do that?

REgards,

Shilpa

jan_krohn
Active Participant
0 Kudos

Yes, that's possible. You'll just have to define the parameter of type xstring, or table of xstring, and it'll work.

Jan