‎2006 Dec 08 9:50 AM
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
‎2006 Dec 08 9:52 AM
‎2006 Dec 08 9:53 AM
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.
‎2006 Dec 08 10:15 AM
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.