XML

REPORT ZTEST_XML .
TABLES:MARA,MAKT.

TYPES:BEGIN OF S,
MATNR TYPE MATNR,
MAKTX TYPE MAKTX,
END OF S.

DATA:ITAB TYPE S OCCURS 0.

DATA: G_XML TYPE REF TO CL_XML_DOCUMENT,
RC TYPE SY-SUBRC.

SELECT A~MATNR B~MAKTX INTO TABLE ITAB FROM MARA AS A JOIN MAKT AS B ON
A~MATNR = B~MATNR UP TO 10 ROWS
WHERE B~SPRAS = 1.

CREATE OBJECT G_XML.
CALL METHOD G_XML->CREATE_WITH_DATA
EXPORTING
NAME = 'DATA'
DATAOBJECT = ITAB[]
RECEIVING
RETCODE = RC.

CALL METHOD G_XML->EXPORT_TO_FILE
EXPORTING
FILENAME = 'c:\test.xml'
RECEIVING
RETCODE = RC.

你可能感兴趣的:(C++,c,xml,C#,UP)