‎2008 Apr 21 2:57 PM
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.
‎2008 Apr 21 8:43 PM
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.
‎2008 Apr 21 8:52 PM
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.