当前位置: 首页 > 工具软件 > CL-XML > 使用案例 >

SAP asXML-内表映射为xml

尹乐邦
2023-12-01

1.代码

  • 将内表序列化为XML

    TYPES: BEGIN OF ty_marc,
             matnr TYPE marc-matnr,
             werks TYPE marc-werks,
           END OF ty_marc.
    
    DATA: lt_marc TYPE TABLE OF ty_marc.
    DATA: xmlstr TYPE xstring.
    
    SELECT *
      FROM marc
      INTO CORRESPONDING FIELDS OF TABLE lt_marc
      UP TO 3 ROWS.
    
    CALL TRANSFORMATION id
    SOURCE table = lt_marc
    RESULT XML xmlstr.
    
    cl_abap_browser=>show_xml( xml_xstring = xmlstr ).
    

2.转换后的XML展示

  • 结果
 类似资料: