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

IDOC to XML Conversion

Former Member
0 Likes
1,663

Hi ABAPers,

Is there any standard procedure to convert IDOC's to XML format ? If

yes can anyone please help me the procedure or steps how to achieve

this conversion.

Regards

VEnk@

Hi ABAPers,

Is there any standard procedure to convert IDOC's to XML format ? If

yes can anyone please help me the procedure or steps how to achieve

this conversion.

Regards

VEnk@

10 REPLIES 10
Read only

Former Member
0 Likes
1,355

Hi Venkat,

I think the below thread can give you some inputs for this.

Rgds

Sripal

Read only

0 Likes
1,355

Hi Sripal,

I have already searched in SDN and i have came across the inputs

that are there in the link that was provided by you and it is XML to IDOC

and my requirement in IDOC to XML.

Regards,

VEnk@

Read only

0 Likes
1,355

Check if this FM helps:

IDX_IDOC_TO_XML

Read only

0 Likes
1,355

Ok,

You can use the below FM for this and can pass Idoc data to the tbale IDOC_DATA_40 in the FM

IDX_IDOC_TO_XML

Rgds,

Sripal

Read only

0 Likes
1,355

Did you check these FM ?

IDOC_XML_TRANSFORM.

IDOC_XML_DISPLAY

Read only

0 Likes
1,355

HI Gautham,

Your answer was helpful.

I am trying to use IDOC_XML_Translate.

Here if you can see the source code of the function module

at the end data is holding by STR and transformed and passed into screen number 100.

But i am trying to download the file so i have created a ZFunModule and in source code

i have used GUI_DOWNLOAD here the problem in STR is string not a table, so how to pass the STR data to Internal table.

  • Transformation

CALL METHOD idoc->get_xmldata_as_string

IMPORTING

data_string = str.

.

.

CALL SCREEN 100.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\Venkat\venkat.xml'

tables

data_tab = ?

Are you having any solution for this ? If yes please share.

Regards

VEnk@

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,355

Hello Venkat,

You cannot use this FM to display the idoc as XML.

If you see the source code of the FM, there is a select from the table IDOCSTYLE. From this the corresponding XSL transformation details are retrieved.

And i think you did not define the XSLT for the idoc type (or rather message type).

So this FM is of no use in your case.

BR,

Suhas

Read only

0 Likes
1,355

Hi Suhas,

Thanks for your information and the problem is solved.

Solved by myself.

Cheers!!

VEnk@

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,355

Hello Venkat,

Can you please share how you solved the problem?

I am curious to know 'coz this will be a very handy tool to display an Idoc as an XML.

Do revert back.

BR,

Suhas

Read only

0 Likes
1,355

Hi Suhas,

Basically i have created my custom Function Module.

If you can see the source code of the function module IDOC_XML_TRANSLATE at the end lines after

ENDTRY i have inserted GUi_DOWNLOAD which i have shown in BOLD

you can see. Basically i have used SPLIT keyword to capture my string

values into my inetrnal table.

CATCH cx_xslt_exception INTO gen_ex.

MESSAGE e110(idoc_xml1) WITH local_xslid wa_obj_location-url

RAISING error_loading_object.

EXIT.

ENDTRY.

SPLIT str AT SPACE INTO TABLE t_table.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\venkat.xml'

tables

data_tab = t_table

when you run the XML file will be stored in the file path as given.

I hope this ends the discussion.

Cheers!!

VEnk@