Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Convert XML file to Internal DAta

Former Member
0 Likes
585

Hi gurus,

I have following XML file.

<?xml version="1.0" encoding="UTF-8"?>

-<msvauth:Servicegate-Authorization DocVersion="1.0" xsi:schemaLocation="http://servicegate.infolock.com/ns/sv/v1.0/auth http://servicegate.beta.infolock.com/public/auth/sv/v1.0/request.xsd"; Id="A1" xmlns:trx="http://servicegate.infolock.com/ns/sv/v1.0/transaction" xmlns:auth="http://servicegate.infolock.com/ns/sv/v1.0/auth" xmlns:msvtrx="http://servicegate.infolock.com/ns/sv/v1.0/transaction" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:msvauth="http://servicegate.infolock.com/ns/sv/v1.0/auth">

-<msvtrx:SoftwareInfo>

<msvtrx:Name>Legend</msvtrx:Name>

<msvtrx:Version>6.1</msvtrx:Version> </msvtrx:SoftwareInfo>

-<msvtrx:Transaction Id="T000001">

<msvtrx:Number>000001</msvtrx:Number>

<trx:PurchaseType>Part</trx:PurchaseType>

<msvtrx:AuthorizationType>Auth</msvtrx:AuthorizationType>

<msvtrx:Description>Counter Ticket</msvtrx:Description>

<msvtrx:MerchantNumber>112233</msvtrx:MerchantNumber>

<trx:Currency>USD</trx:Currency>

<msvtrx:Time TimeZone="US-CHICAGO">2010-11-11T00:00:00</msvtrx:Time>

-<msvtrx:CardInfo Expiry="2049-12" Type="PACCAR">

<msvtrx:CardNumber>1234560000003675</msvtrx:CardNumber>

</msvtrx:CardInfo>

<msvtrx:Amount>16.52</msvtrx:Amount>

<msvtrx:PurchaseOrderNumber>052610PN3521</msvtrx:PurchaseOrderNumber>

</msvtrx:Transaction>

</msvauth:Servicegate-Authorization>

want to convert this into internal table , I tried FM 'TEXT_CONVERT_XML_TO_SAP' but not got the output...

if have any sample code, plz provide ....

thanks....

2 REPLIES 2
Read only

Former Member
0 Likes
466

  GET REFERENCE OF gt_offpos INTO ls_offpos_xml-value.
  ls_offpos_xml-name = c_xml_tagname.
  APPEND ls_offpos_xml TO lt_offpos_xml.

  TRY .
      CALL TRANSFORMATION ztrlm_offpos_dtl
      SOURCE XML gt_offpos_xml
      RESULT (lt_offpos_xml).
    CATCH cx_root INTO l_ref_rif_ex.
      l_var_text = l_ref_rif_ex->get_text( ).
      CONCATENATE l_var_text ' Please check xml file.' INTO l_var_text.
      MESSAGE l_var_text TYPE 'E'.
  ENDTRY.
Read only

Former Member
0 Likes
466

Below link might help..