代码语言:javascript复制
REPORT y4_b4_test8.
DATA:lt_ekko TYPE zheaders,
lt_ekko2 TYPE zheaders,
gt_ekko TYPE zheaders,
gs_ekko TYPE zheader,
gt_ekpo TYPE zitems,
gs_ekpo TYPE zitem,
xml_xstring TYPE xstring,
xml_string TYPE string,
lo_oref TYPE REF TO cx_st_error,
lv_message TYPE char200. "输出参数
"行结构
gs_ekpo-buzei = '001'.
gs_ekpo-bschl = '22'.
gs_ekpo-kostl = '55555' .
gs_ekpo-hkont = '99999' .
gs_ekpo-matnr = 'MM01' .
gs_ekpo-werks = '1710' .
APPEND gs_ekpo TO gt_ekpo.
APPEND gs_ekpo TO gt_ekpo.
"头结构
gs_ekko-bukrs = '1310'.
gs_ekko-gjahr = '2022'.
gs_ekko-belnr = '2022042610'.
gs_ekko-item = gt_ekpo.
APPEND gs_ekko TO gt_ekko.
APPEND gs_ekko TO gt_ekko.
DATA: lv_em TYPE string,
lv_em1 TYPE string,
p_gv_xml TYPE string.
"数据
lv_em = 'test' .
CALL TRANSFORMATION id
OPTIONS value_handling = 'MOVE' "防止内表中有N类型dump
SOURCE connet = lv_em
data = gt_ekko
RESULT XML p_gv_xml.
CALL TRANSFORMATION id
SOURCE XML p_gv_xml
RESULT connet = lv_em1
data = lt_ekko2.