Application Development 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: 

XML File Generation

Former Member
0 Kudos

Hi Abap Experts:

I need to create a XML file from the structure ls_bil_invoice (type lbbil_invoice).

This structure is used in the stadard program RLB_INVOICE, the one used for invoice printing.

Anyway, with the data provided in this structure I need to create a XML file.

Does anyone know how to do it?

Thanks in advance.

Best Regards.

Eduardo.

2 REPLIES 2

former_member583013
Active Contributor
0 Kudos

You should create an Internal Table referring to that structure and do the following...


DATA: XML_OUT TYPE STRING.

  CALL TRANSFORMATION ('ID')
  SOURCE TAB = T_INVOICE[]
  RESULT XML XML_OUT.

Haven't test it with deep structures...But it should work...

Greetings,

Blag.

Former Member
0 Kudos

Try like this.

DATA: BEGIN OF struc1,

col1 TYPE c LENGTH 10 VALUE 'ABCDEFGHIJ',

col2 TYPE i VALUE 111,

BEGIN OF struc2,

col1 TYPE d VALUE '20040126',

col2 TYPE t VALUE '084000',

END OF struc2,

END OF struc1.

DATA: xml_string TYPE string,

result LIKE struc1.

TRY.

CALL TRANSFORMATION st_trafo

SOURCE para = struc1

RESULT XML xml_string.

...

CALL TRANSFORMATION st_trafo

SOURCE XML xml_string

RESULT para = result.

CATCH cx_st_error.

...

ENDTRY.

deep structures will work.