Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata
in case you manually create ABAP proxy via transaction code SPROXY or generate it via webservice generation utility, you can use utility class cl_proxy_xml_transform to convert the data of the ABAP proxy to XML format, and vice versa.
For example, the following ABAP proxy is a structure with one field ITEM, which is an internal table contains four table columns.
we can use the following sample code to test its usage:
DATAls_abap TYPE zzcrmost__pro001dotproduct1.

DATAls_line LIKE LINE OF ls_abap-item.

ls_line-logsys 'AG3'.
ls_line-object_family '0401'.
ls_line-product_id 'MCF-0001'.
ls_line-product_type '01'.
APPEND ls_line TO ls_abap-item.


ls_line-logsys 'QDD'.
ls_line-object_family '0402'.
ls_line-product_id 'MCF-0002'.
ls_line-product_type '02'.
APPEND ls_line TO ls_abap-item.

DATA(xmlcl_proxy_xml_transform=>abap_to_xml_xstringEXPORTING abap_data ls_abap ddic_type 'ZZCRMOST__PRO001DOTPRODUCT1' ).

DATAls_abap2 LIKE ls_abap.
cl_proxy_xml_transform=>xml_xstring_to_abapEXPORTING ddic_type 'ZZCRMOST__PRO001DOTPRODUCT1' xml xml IMPORTING abap_data ls_abap2 ).

ASSERT ls_abap2 ls_abap.
This class is still using simple transformation to do conversion between ABAP and xml.
The necessary transformation will be generated when the method is called for the first time, if not available yet:
Once transformation is generated, it is saved for reuse later.
You can open the generated transformation stylesheet via transaction code STRANS and type the name you get from debugger:

  • No labels

2 Comments

  1. Hi Jerry, could you explain what's the use case? Is it for making sure what xml data is sent to the webservice, for troubleshooting?
    Thx. 

  2. Awesome Jerry. This was exactly what I am looking for. Thanks a lot.

    VJ