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

XML output Function module

Former Member
0 Likes
3,718

Hi All,

Is there any function module in ABAP to generate an xml structure?

I want to generate an xml output in a string for the input structure (internal table)

Thanks

Ricky

3 REPLIES 3
Read only

amit_khare
Active Contributor
0 Likes
1,333

Hi,

Check these link -

Check Amit's Reply.

Regards,

Amit

Read only

Former Member
0 Likes
1,333

hi ricky!!

See the below function modules:-

SDIXML_DATA_TO_DOM -> Convert SAP data(elementary/structured/table types) into DOM (XML) ExampleO

SDIXML_DOM_TO_XML -> Convert DOM (XML) into string of bytes that can be downloaded to PC or application server

SDIXML_DOM_TO_SCREEN -> Display DOM (XML)

SDIXML_DOM_TO_DATA

and also see the below thred, it is having example program also

/people/gregor.wolf3/blog/2005/12/30/sdn-points-blow-out-chart-sdn-forum-users-online

hope these links wud clarify ur question.

all the best.

Read only

Former Member
0 Likes
1,333

Hi ricky,

1. itab --- > xml

xml ---> itab.

2. This program will do both.

(just copy paste in new program)

3.

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.

CALL FUNCTION 'SCMS_STRING_TO_FTEXT'

EXPORTING

TEXT = xml_out

  • IMPORTING

  • LENGTH =

TABLES

FTEXT_TAB = 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.