Skip to Content
avatar image
Former Member

Conversion from ABAP into XML

Hi,

I am trying to convert data of internal table into XML, using below code

TYPES : BEGIN OF tp_vbap,

vbeln TYPE vbap-vbeln,

posnr TYPE vbap-posnr,

matnt TYPE vbap-matnr,

END OF tp_vbap.

DATA : tl_vbap TYPE STANDARD TABLE OF tp_vbap.

DATA : l_object TYPE REF TO cl_xml_document.

SELECT vbeln posnr matnr FROM vbap INTO TABLE tl_vbap UP TO 100 ROWS.

CREATE OBJECT l_object.

l_object->create_with_data( dataobject = tl_vbap ).

l_object->export_to_file( filename = l_pathtext ).


But in XML file all fields i get are in CAPITAL, like VBELN andd POSNR.I want it to be case sensitive.

How to do that?


Thanks.

XML.PNG (16.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 29, 2016 at 01:11 PM

    Hi Bhavika,

    You can use XSLT Transformation.

    Pl follow this document.

    By this procedure you have to

    1. Create structure in SE11 same as your required structure.

    2. Create XSLT Transformation.

    3. Pass data from Internal Table to Transformation.

    4. Capture output in String.

    5. Download data using GUI_DOWNLOAD FM.

    It will give you case sensitive XML tags in output.


    Regards,

    Saurabh


    temp11223.PNG (10.9 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Mar 29, 2016 at 01:22 PM

    I think the fieldnames are upper case in SAP thats why you get them like that in your xml.

    If you need them lower case you will have to build up your xml with the classes/interfaces: if_ixml , if_ixml_document and if_ixml_element.

    ,

    Add comment
    10|10000 characters needed characters exceeded