cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP-XML conversion via call transformation

Former Member
0 Kudos

Hi folks!

I'm using a deep structure for returning the reply from a function module. To save my test data I wanted to generate an XML from this ABAP structure.

I had in mind that I could use CALL TRANSFORMATION to get the asXML representation of the ABAP structure but I could not figure out how this works.

Can somebody give me a hint how I could convert my deep ABAP structure into XML without much coding?

Thanks!

Birgit

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi stonefish,

1. internal table -


> Xml

xml -


> internal table

2. this program will show both.

3. It will do this for

T001 table.

4. Just copy paste in new program.

REPORT abc.

*----


DATA

DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.

DATA : BEGIN OF itab OCCURS 0,

a(100) TYPE c,

END OF itab.

DATA: xml_out TYPE string .

DATA : BEGIN OF upl OCCURS 0,

f(255) TYPE c,

END OF upl.

DATA: xmlupl TYPE string .

                                                              • FIRST PHASE

                                                              • FIRST PHASE

                                                              • FIRST PHASE

*----


Fetch Data

SELECT * FROM t001 INTO TABLE t001.

*----


XML

CALL TRANSFORMATION ('ID')

SOURCE tab = t001[]

RESULT XML xml_out.

*----


Convert to TABLE

CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'

EXPORTING

i_string = xml_out

i_tabline_length = 100

TABLES

et_table = itab.

*----


Download

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filetype = 'BIN'

filename = 'd:\xx.xml'

TABLES

data_tab = itab.

                                                              • SECOND PHASE

                                                              • SECOND PHASE

                                                              • SECOND PHASE

BREAK-POINT.

REFRESH t001.

CLEAR t001.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'D:\XX.XML'

filetype = 'BIN'

TABLES

data_tab = upl.

LOOP AT upl.

CONCATENATE xmlupl upl-f INTO xmlupl.

ENDLOOP.

*----


XML

CALL TRANSFORMATION ('ID')

SOURCE XML xmlupl

RESULT tab = t001[]

.

BREAK-POINT.

regards,

amit m.

athavanraja
Active Contributor
0 Kudos

you can use the following stt for this case

 CALL TRANSFORMATION (`ID`)                                      
           SOURCE output = <itab iwth deepdatstructure>         
           RESULT XML xml_out.                                   

Regards

Raja

mandar_shete
Active Participant
0 Kudos