tcode strans 进入建立stranstransformation 文件
"">
"ROOT"/>
"line" ref=".ROOT">
"$line.key"/>
"$line.values">
se38新建程序
REPORT ZTHOMAS_STRANS_SIMPLE.
DATA:xml_string TYPE string.
DATA:BEGIN OF line,
key TYPE i,
values TYPE TABLE OF i,
END OF line.
DATA num TYPE i.
DATA itab LIKE TABLE OF line.
DATA result LIKE itab.
DATA:BEGIN OF it_xml OCCURS 0,
line(100) TYPE c,
END OF it_xml.
DATA:w_len TYPE i.
DO 3 TIMES.
CLEAR line.
line-key = sy-index + 1.
num = line-key ** 2.
APPEND num TO line-values.
num = line-key ** 3.
APPEND num TO line-values.
num = line-key ** 4.
APPEND num TO line-values.
append line to itab.
ENDDO.
CALL TRANSFORMATION ZTHOMAS_STRANS
SOURCE root = itab
RESULT XML xml_string.
WRITE: / '转换完毕'.
CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
EXPORTING
TEXT = xml_string
IMPORTING
LENGTH = w_len
TABLES
FTEXT_TAB = it_xml
.
WRITE: / 'xml格式转换完毕'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'c:\xmlcall.xml'
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = w_len
TABLES
DATA_TAB = it_xml
.
最后生成的xml文件
2
4
8
16
3
9
27
81
4
16
64
256
阅读(1954) | 评论(0) | 转发(1) |