Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8594

Problem Converting xml to ABAP

$
0
0

Dear all,

 

We are uploading a PDF file and converting to XML (into string variable).

 

 

This XML has three elements:

 

     - Structure        (OK)

     - Internal Table (OK)

     - Variable          (Not OK)

 

When calling transformation to pass these data from XLM into respective elements, we have the structure and internal table filling very well, but i REALLY don't know why the variable I caught  the exception CX_ST_MATCH_ELEMENT.

 

I tried to find something, but nothing useful.

 

 

 

Below my code:

 

CALL TRANSFORMATION ztransf

       SOURCE XML lv_xml_data_string

       RESULT root    = s1

                       root1  = t1

                       root2  = v1.

 

lv_xml_data_string contains (I pasted only the final):

<NETWR_WAERS/></DATA></LISTA_ITENS></DADOS_COTACAO><V1>ggggggggggggg</V1>

 

The <V1>ggggggggggggg</V1> is important here, I just need to pass "ggggggggggggg" to a simple variable.

 

 

 

Now, my transformation code:

 

<?sap.transform simple?>

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

   <tt:root name="ROOT" type="?"/>

   <tt:root name="ROOT1" type="?"/>

   <tt:root name="ROOT2" type="?"/>

 

   <tt:template>

     <DADOS_COTACAO tt:ref="ROOT">

       <BUKRS>

         <tt:value ref="BUKRS"/>

       </BUKRS>

       <LIFNR>

         <tt:value ref="LIFNR"/>

       </LIFNR>

       <NAME1>

         <tt:value ref="NAME1"/>

       </NAME1>

       <STRAS>

         <tt:value ref="STRAS"/>

       </STRAS>

       <LISTA_ITENS>

         <tt:loop name="data" ref=".ROOT1">

           <DATA xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">

             <EBELP>

               <tt:value ref="$data.ebelp"/>

             </EBELP>

             <EBELN>

               <tt:value ref="$data.ebeln"/>

             </EBELN>

             <MATNR>

               <tt:value ref="$data.matnr"/>

             </MATNR>

             <MAKTX>

               <tt:value ref="$data.maktx"/>

             </MAKTX>

             <LABST>

               <tt:value ref="$data.labst"/>

             </LABST>

             <LABST_MEINS>

               <tt:value ref="$data.labst_meins"/>

             </LABST_MEINS>

             <NETWR>

               <tt:value ref="$data.netwr"/>

             </NETWR>

             <NETWR_WAERS>

               <tt:value ref="$data.netwr_waers"/>

             </NETWR_WAERS>

           </DATA>

         </tt:loop>

       </LISTA_ITENS>

     </DADOS_COTACAO>

    

     <V1>                                             """""Here is the part that isn't working

       <tt:value ref="ROOT2"/>

     </V1>

   </tt:template>

 

</tt:transform>

 

Please, i really appreciate any help!

 

 

 

Best Regrads

Thanks In advanced

Vinicius Ostan


Viewing all articles
Browse latest Browse all 8594

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>