Simple Transformation Exception

Hello,
I am tying to map XML to ABAP(deserialize) but receive a CX_ST_MATCH_ELEMENT Exception.
Below is my Simple Transformation, the calling method, and the XML snippet I am tying to deserialize.
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
  <tt:root name="ROOT"/>
  <tt:template>
       <SndgInst>
         <tt:value ref="ROOT"/>
       </SndgInst>
  </tt:template>
</tt:transform>
method PARSE_XML.
  DATA:
    sndginst(10)                  type c value '          ',
    l_exception_error               TYPE REF TO cx_st_error.
parse the xml content
    TRY.
        CLEAR: l_exception_error.
        CALL TRANSFORMATION (i_st_name)
                     SOURCE XML i_xml_string
                     RESULT root = sndginst.
catch exception
      CATCH: cx_st_error INTO l_exception_error.
    ENDTRY.
endmethod.
<S2SCTScf:SndgInst ymlns:S2SCTScf="urn:S2SCTScf:xsd:$SCTScfBlkCredTrf">ZYDOFRP0</S2SCTScf:SndgInst>
I have tried adding a reference for the namespace 'S2SCTScf' but receive the same exception.
I think it must have something to do with the namespace prefix and I have tried several different versions of the Simple transformation, such as <S2SCTSCF:SndgInst> as my tag reference, to no avail.
The exception class does not provide a lot of useful information and since you cannot debug a Simple Transformation it is a guessing game.
Thanks in advance for your help.
Best Regards,
Mark Lengel
Edited by: Mark Lengel on Mar 31, 2009 11:32 AM

I've exactly the same problem.
My XML Input Stream contains Namespaces in the root element for e.g.
<Measurement xmlns="es.xxx.com" xmlns:ns2="http://www.w3.org/1999/xlink" xmlns:ns3="http://www.w3.org/1998/Math/MathML">
The Simple Transformation always raise an CX_ST_MATCH_ELEMENT Exception.
If i delete the xmlns declarations, the Element will be found and everything is o.k.
I've also tried to avoid this by adding the tt:extensible="deep-dynamic" attribute but it doesn't matter.
<tt:template>
    <Measurement tt:extensible="deep-dynamic">
I use WebAS 6.40, ERP 2004.
I hope the Community could help us. Maybe it's bug in the XML Libraries.. etc..
Kind Regards
Chris

Similar Messages

  • Simple Transformation XML to ABAP   - error CX_ST_MATCH_ELEMENT

    Hi all,
    I have a problem with a transformation from xml to abap. My XML file (taken from a pdf file) is
    <?xml version="1.0" encoding="iso-8859-1" ?>
    - <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    - <asx:values>
      <NETWORK>E60000000000</NETWORK>
      <OPERAZIONE>0010</OPERAZIONE>
    - <TABELLA>
    - <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">
      <MANDT>300</MANDT>
      <NETWORK>E60000000000</NETWORK>
      <OPERAZIONE>0010</OPERAZIONE>
      <ID_ACT>1</ID_ACT>
      <DESC_ACT>ATTIVITÀ1</DESC_ACT>
      <LONG_TXT></LONG_TXT>
      <MAKE_BUY></MAKE_BUY>
      <WP></WP>
      <EVENTO_TECH></EVENTO_TECH>
      <TIPO_LEGAME></TIPO_LEGAME>
      <CONSEGNA></CONSEGNA>
      </ROW>
    - <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">
      <MANDT>300</MANDT>
      <NETWORK>E60000000000</NETWORK>
      <OPERAZIONE>0010</OPERAZIONE>
      <ID_ACT>2</ID_ACT>
      <DESC_ACT>ATTIVITÀ2</DESC_ACT>
      <LONG_TXT>ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2</LONG_TXT>
      <MAKE_BUY>M</MAKE_BUY>
      <WP></WP>
      <EVENTO_TECH></EVENTO_TECH>
      <TIPO_LEGAME></TIPO_LEGAME>
      <CONSEGNA></CONSEGNA>
      </ROW>
      </TABELLA>
      </asx:values>
      </asx:abap>
    my transformation is
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="ROOT"></tt:root>
      <tt:root name="NETWORK"></tt:root>
      <tt:root name="OPERAZIONE"></tt:root>
      <tt:template>
      <abap>
        <values>
           <network>
               <tt:value ref="NETWORK"></tt:value>
           </network>
           <operazione>
               <tt:value ref="OPERAZIONE"></tt:value>
           </operazione>
           <tabella>
              <tt:loop ref=".ROOT" name="line">
                <mandt>
                  <tt:value ref="$line.mandt"></tt:value>
                </mandt>
                <network>
                  <tt:value ref="$line.network"></tt:value>
                </network>
                <OPERAZIONE>
                  <tt:value ref="$line.OPERAZIONE"></tt:value>
                </OPERAZIONE>
                <ID_ACT>
                  <tt:value ref="$line.ID_ACT"></tt:value>
                </ID_ACT>
                <DESC_ACT>
                  <tt:value ref="$line.DESC_ACT"></tt:value>
                </DESC_ACT>
                <LONG_TXT>
                  <tt:value ref="$line.LONG_TXT"></tt:value>
                </LONG_TXT>
                <MAKE_BUY>
                  <tt:value ref="$line.MAKE_BUY"></tt:value>
                </MAKE_BUY>
                <WP>
                  <tt:value ref="$line.WP"></tt:value>
                </WP>
                <EVENTO_TECH>
                  <tt:value ref="$line.EVENTO_TECH"></tt:value>
                </EVENTO_TECH>
                <TIPO_LEGAME>
                  <tt:value ref="$line.TIPO_LEGAME"></tt:value>
                </TIPO_LEGAME>
                <CONSEGNA>
                  <tt:value ref="$line.CONSEGNA"></tt:value>
                </CONSEGNA>
             </tt:loop>
            </tabella>
          </values>
        </abap>
      </tt:template>
    </tt:transform>
    when I execute my code
    the system dump with this error
    ST_MATCH_FAIL
    excep.  CX_ST_MATCH_ELEMENT
      TRY.
                CALL TRANSFORMATION ('ZT_NETWORK')
                SOURCE XML lv_xml_data_string
                RESULT  network = l_network
                        operazione = l_operazione
                        root = it_data_tmp.
              CATCH cx_sy_conversion_data_loss .
              CATCH cx_xslt_exception INTO xslt_error.
                xslt_message = xslt_error->get_text( ).
                WRITE:/ xslt_message .
            ENDTRY.
    Any help?
    thanks
    enzo

    Enzo Porcasi wrote:
    > I have a problem with a transformation from xml to abap. My XML file (taken from a pdf file) is
    >
    <?xml version="1.0" encoding="iso-8859-1" ?>
    >  <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    >  <asx:values>
    Your XML is strange, it looks like a mix of pdf form content (xfa) and identity transformation (asx).
    Could you explain more ?
    Anyway, I tried to find out the errors (not only cx_st_match_element, that was just a catch missing), it works with the following program. Here are the main issues I have found :
    - always catch exception class cx_st_error when you use simple transformations (it contains cx_st_match_element and all other simple transformation exceptions)
    - xml "asx:abap" and "asx:values" in your input XML are useless, they are only used by identity transformation ("ID"); you may keep them if you want, but I advise you to see why they are in the xml !
    - Use same case in your tags (if xml contains  in the transformation so that it corresponds to the input XML
    - I renamed all abap names with prefix ABAP_ so that to clearly differentiate xml tags and abap field names (so that it is more easy to understand, for every sdn reader; I hope it will help as I didn't find many threads in the forum).
    Simple transformation :
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="ABAP_NETWORK"></tt:root>
      <tt:root name="ABAP_OPERAZIONE"></tt:root>
      <tt:root name="ABAP_TABELLA"></tt:root>
      <tt:template>
        <ROOT>
          <NETWORK>
            <tt:value ref=".ABAP_NETWORK"></tt:value>
          </NETWORK>
          <OPERAZIONE>
            <tt:value ref=".ABAP_OPERAZIONE"></tt:value>
          </OPERAZIONE>
          <TABELLA>
            <tt:loop ref=".ABAP_TABELLA" name="line">
              <ROW>
                <MANDT>
                  <tt:value ref="$line.ABAP_MANDT"></tt:value>
                </MANDT>
                <NETWORK>
                  <tt:value ref="$line.ABAP_NETWORK"></tt:value>
                </NETWORK>
                <OPERAZIONE>
                  <tt:value ref="$line.ABAP_OPERAZIONE"></tt:value>
                </OPERAZIONE>
                <ID_ACT>
                  <tt:value ref="$line.ABAP_ID_ACT"></tt:value>
                </ID_ACT>
                <DESC_ACT>
                  <tt:value ref="$line.ABAP_DESC_ACT"></tt:value>
                </DESC_ACT>
                <LONG_TXT>
                  <tt:value ref="$line.ABAP_LONG_TXT"></tt:value>
                </LONG_TXT>
                <MAKE_BUY>
                  <tt:value ref="$line.ABAP_MAKE_BUY"></tt:value>
                </MAKE_BUY>
                <WP>
                  <tt:value ref="$line.ABAP_WP"></tt:value>
                </WP>
                <EVENTO_TECH>
                  <tt:value ref="$line.ABAP_EVENTO_TECH"></tt:value>
                </EVENTO_TECH>
                <TIPO_LEGAME>
                  <tt:value ref="$line.ABAP_TIPO_LEGAME"></tt:value>
                </TIPO_LEGAME>
                <CONSEGNA>
                  <tt:value ref="$line.ABAP_CONSEGNA"></tt:value>
                </CONSEGNA>
              </ROW>
            </tt:loop>
          </TABELLA>
        </ROOT>
      </tt:template>
    </tt:transform>
    Program and XML included :
    REPORT  zsro2.
    DATA l_network TYPE string.
    DATA l_operazione TYPE string.
    DATA : BEGIN OF lt_data_tmp OCCURS 0,
             abap_mandt      TYPE string,
             abap_network    TYPE string,
             abap_operazione TYPE string,
             abap_id_act     TYPE string,
             abap_desc_act   TYPE string,
             abap_long_txt   TYPE string,
             abap_make_buy   TYPE string,
             abap_wp         TYPE string,
             abap_evento_tech TYPE string,
             abap_tipo_legame TYPE string,
             abap_consegna   TYPE string,
           END OF lt_data_tmp.
    DATA xslt_error TYPE REF TO cx_xslt_exception.
    DATA lo_st_error TYPE REF TO cx_st_error.
    DATA lv_xml_data_string TYPE string.
    DATA xslt_message TYPE string.
    DEFINE conc.
      concatenate lv_xml_data_string &1 into lv_xml_data_string.
    END-OF-DEFINITION.
    *conc '<?xml version="1.0" encoding="iso-8859-1" ?>'.
    *conc '<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">'.
    *conc '  <asx:values>'.
    conc ' <ROOT>'.
    conc '    <NETWORK>E60000000000</NETWORK> '.
    conc '    <OPERAZIONE>0010</OPERAZIONE> '.
    conc '    <TABELLA>'.
    conc '      <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">'.
    conc '        <MANDT>300</MANDT> '.
    conc '        <NETWORK>E60000000000</NETWORK> '.
    conc '        <OPERAZIONE>0010</OPERAZIONE> '.
    conc '        <ID_ACT>1</ID_ACT> '.
    conc '        <DESC_ACT>ATTIVITÀ1</DESC_ACT> '.
    conc '        <LONG_TXT></LONG_TXT> '.
    conc '        <MAKE_BUY></MAKE_BUY> '.
    conc '        <WP></WP> '.
    conc '        <EVENTO_TECH></EVENTO_TECH> '.
    conc '        <TIPO_LEGAME></TIPO_LEGAME> '.
    conc '        <CONSEGNA></CONSEGNA> '.
    conc '      </ROW>'.
    conc '      <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">'.
    conc '        <MANDT>300</MANDT> '.
    conc '        <NETWORK>E60000000000</NETWORK> '.
    conc '        <OPERAZIONE>0010</OPERAZIONE> '.
    conc '        <ID_ACT>2</ID_ACT> '.
    conc '        <DESC_ACT>ATTIVITÀ2</DESC_ACT> '.
    conc '        <LONG_TXT>ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2</LONG_TXT> '.
    conc '        <MAKE_BUY>M</MAKE_BUY> '.
    conc '        <WP></WP> '.
    conc '        <EVENTO_TECH></EVENTO_TECH> '.
    conc '        <TIPO_LEGAME></TIPO_LEGAME> '.
    conc '        <CONSEGNA></CONSEGNA> '.
    conc '      </ROW>'.
    conc '    </TABELLA>'.
    conc ' </ROOT>'.
    *conc '  </asx:values>'.
    *conc '</asx:abap>'.
    DATA lv_xml_data_string_2 TYPE string.
    TRY.
        CALL TRANSFORMATION zsro
              SOURCE
                XML lv_xml_data_string
              RESULT
                abap_network    = l_network
                abap_operazione = l_operazione
                abap_tabella    = lt_data_tmp[].
      CATCH cx_sy_conversion_data_loss .
      CATCH cx_st_error INTO lo_st_error.
        xslt_message = lo_st_error->get_text( ).
        WRITE:/ xslt_message .
      CATCH cx_xslt_exception INTO xslt_error.
        xslt_message = xslt_error->get_text( ).
        WRITE:/ xslt_message .
    ENDTRY.
    BREAK-POINT.

  • Using Simple Transformations with Objects tt:copy .. results in Exception

    Question:
    How can I serialize an ABAP-Object-Instanz with my own simple transformation?
    In the sap-documentation I found the following solution for the serialisation of any data-objects.
    "z_steffens_simple_transf":
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="ROOT"/>
      <tt:template>
        <root>
          <tt:copy ref="ROOT"/>
        </root>
      </tt:template>
    </tt:transform>
    Following the example I wrote this report:
    report  zspahr_test_simple_transf.
    class serializable definition.
      public section.
        interfaces if_serializable_object.
        data attr type string value 'Attribute'.
    endclass.         
    method main_serializable.
        data: oref type ref to serializable,
              xmlstr type xstring.
        create object oref.
        call transformation id
          source root = oref
          result xml xmlstr.
        call function 'DISPLAY_XML_STRING'
          exporting
            xml_string = xmlstr.
        call transformation z_steffens_simple_object
          source root = oref
          result xml xmlstr.
        call function 'DISPLAY_XML_STRING'
          exporting
            xml_string = xmlstr.
      endmethod.                    "main_
    start-of-selection.
      demo=>main_serializable( ).
    Executing this report leads to an exception "CX_SY_REF_NOT_SUPPORTED".
    The "standard" transformation "ID" ist working an translates my object-instance into an asXML representation:
      <?xml version="1.0" encoding="utf-8" ?>
    - <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    - <asx:values>
      <ROOT href="#o3" />
      </asx:values>
    - <asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary">
    - <prg:SERIALIZABLE xmlns:prg="http://www.sap.com/abapxml/classes/program/ZSPAHR_TEST_SIMPLE_TRANSF" id="o3">
    - <local.SERIALIZABLE>
      <ATTR>Attribute</ATTR>
      </local.SERIALIZABLE>
      </prg:SERIALIZABLE>
      </asx:heap>
      </asx:abap>
    How can I do this with my own Simple Transformation "ZSPAHR_TEST_SIMPLE_TRANSF" ?
    I want to serialize my object using my own xml-structure, not the asXML-structure !
    Regards
    Steffen

    Hi,
    try like this,i think it may help you.
    ABAP:
    CALL TRANSFORMATION ztrans_test
          SOURCE
               root = partab
         RESULT XML lv_xstring.
    Trnsformation:
    <tt:root name="ROOT" type="?"/>
    <tt:template>
    <VALUES>
    <VALUE_SOURCE>
            <tt:value ref=".ROOT"/>
    </VALUE_SOURCE>
    <VALUE_PARAM>
    <tt:value ref="NAME"/>
    <tt:value ref="VALUE"/>
    </VALUE_PARAM>
    </VALUES>
    Thanks,
    Rajesh.

  • Simple Transformation to deserialize an XML file into ABAP data structures?

    I'm attempting to write my first simple transformation to deserialize
    an XML file into ABAP data structures and I have a few questions.
    My simple transformation contains code like the following
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates"
                  xmlns:pp="http://www.sap.com/abapxml/types/defined" >
    <tt:type name="REPORT" line-type="?">
      <tt:node name="COMPANY_ID" type="C" length="10" />
      <tt:node name="JOB_ID" type="C" length="20" />
      <tt:node name="TYPE_CSV" type="C" length="1" />
      <tt:node name="TYPE_XLS" type="C" length="1" />
      <tt:node name="TYPE_PDF" type="C" length="1" />
      <tt:node name="IS_NEW" type="C" length="1" />
    </tt:type>
    <tt:root name="ROOT2" type="pp:REPORT" />
        <QueryResponse>
        <tt:loop ref="ROOT2" name="line">
          <QueryResponseRow>
            <CompanyID>
              <tt:value ref="$line.COMPANY_ID" />
            </CompanyID>
            <JobID>
              <tt:value ref="$line.JOB_ID" />
            </JobID>
            <ExportTypes>
              <tt:loop>
                <ExportType>
                   I don't know what to do here (see item 3, below)
                </ExportType>
              </tt:loop>
            </ExportTypes>
            <IsNew>
              <tt:value ref="$line.IS_NEW"
              map="val(' ') = xml('false'), val('X') = xml('true')" />
            </IsNew>
          </QueryResponseRow>
          </tt:loop>
        </QueryResponse>
        </tt:loop>
    1. In a DTD, an element can be designated as occurring zero or one
    time, zero or more times, or one or more times. How do I write the
    simple transformation to accommodate these possibilities?
    2. In trying to accommodate the "zero or more times" case, I am trying
    to use the <tt:loop> instruction. It occurs several layers deep in the
    XML hierarchy, but at the top level of the ABAP table. The internal
    table has a structure defined in the ABAP program, not in the data
    dictionary. In the simple transformation, I used <tt:type> and
    <tt:node> to define the structure of the internal table and then
    tried to use <tt:loop ref="ROOT2" name="line"> around the subtree that
    can occur zero or more times. But every variation I try seems to get
    different errors. Can anyone supply a working example of this?
    3. Among the fields in the internal table, I've defined three
    one-character fields named TYPE_CSV, TYPE_XLS, and TYPE_PDF. In the
    XML file, I expect zero to three elements of the form
    <ExportType exporttype='csv' />
    <ExportType exporttype='xls' />
    <ExportType exporttype='pdf' />
    I want to set field TYPE_CSV = 'X' if I find an ExportType element
    with its exporttype attribute set to 'csv'. I want to set field
    TYPE_XLS = 'X' if I find an ExportType element with its exporttype
    attribute set to 'xls'. I want to set field TYPE_PDF = 'X' if I find
    an ExportType element with its exporttype attribute set to 'pdf'. How
    can I do that?
    4. For an element that has a value like
    <ErrorCode>123</ErrorCode>
    in the simple transformation, the sequence
    <ErrorCode>  <tt:value ref="ROOT1.CODE" />  </ErrorCode>
    seems to work just fine.
    I have other situations where the XML reads
    <IsNew value='true' />
    I wanted to write
    <IsNew>
            <tt:value ref="$line.IS_NEW"
            map="val(' ') = xml('false'), val('X') = xml('true')" />
           </IsNew>
    but I'm afraid that the <tt:value> fails to deal with the fact that in
    the XML file the value is being passed as the value of an attribute
    (named "value"), rather than the value of the element itself. How do
    you handle this?

    Try this code below:
    data  l_xml_table2  type table of xml_line with header line.
    W_filename - This is a Path.
      if w_filename(02) = '
        open dataset w_filename for output in binary mode.
        if sy-subrc = 0.
          l_xml_table2[] = l_xml_table[].
          loop at l_xml_table2.
            transfer l_xml_table2 to w_filename.
          endloop.
        endif.
        close dataset w_filename.
      else.
        call method cl_gui_frontend_services=>gui_download
          exporting
            bin_filesize = l_xml_size
            filename     = w_filename
            filetype     = 'BIN'
          changing
            data_tab     = l_xml_table
          exceptions
            others       = 24.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
                     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        endif.

  • Upload xml file to internal table only using simple transformation

    Hi Friends
    How to write transformation code for the following xml data.. Please let me know immedately if any one know..
    I have written as following but i encountered an eror staating -
    Iam facing the following error
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_ST_REF_ACCESS', was not caught in
    procedure "UPLOAD_XML" "(FORM)", nor was it propagated by a RAISING clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    The goal was to access variable "ROOT1". However, this access was not
    possible.
    Go through my xml file , the code and code in simple transformation.. Please reply(transformation code) me as soon as possible
    - <Negara>
    - <item>
    - <COUNTRY>
    <MANDT>600</MANDT>
    <ZCODE>500</ZCODE>
    <ZDESC>Pening Lalat</ZDESC>
    <ZSAPCD>T1</ZSAPCD>
    </COUNTRY>
    </item>
    - <item>
    - <COUNTRY>
    <MANDT>600</MANDT>
    <ZCODE>600</ZCODE>
    <ZDESC>Pening Lalat2</ZDESC>
    <ZSAPCD>T2</ZSAPCD>
    </COUNTRY>
    </item>
    </Negara>
    DATA : BEGIN OF XDATA OCCURS 0,
    STR(255) TYPE C,
    END OF XDATA.
    DATA: XMLUPL TYPE string .
    DATA : BEGIN OF ITAB OCCURS 0,
    MANDT(3) TYPE C,
    ZCODE(3) TYPE C,
    ZDESC(15) TYPE C,
    ZSAPCD(2) TYPE C,
    END OF ITAB.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    FILENAME = 'C:\country.xml'
    FILETYPE = 'BIN'
    TABLES
    DATA_TAB = XDATA.
    LOOP AT XDATA.
    CONCATENATE XMLUPL XDATA-STR INTO XMLUPL.
    ENDLOOP.
    CALL TRANSFORMATION ('Y_XMLCTRY')
    SOURCE XML XMLUPL
    result xml = ITAB[].
    BREAK-POINT.
    <?sap.transform simple?>
    <tt:transform template="temp1"
    xmlns:tt="http://www.sap.com/transformation-templates">
    <tt:root name="ROOT1"/>
    <tt:root name="ROOT2"/>
    <tt:template name="temp1">
    <Negara>
    <tt:loop ref=".ROOT1" name="i">
    <item>
    <tt:loop ref=".ROOT2" name="c">
    <COUNTRY>
    <MANDT>
    <tt:value ref="$c.nummer" />
    </MANDT>
    <ZCODE>
    <tt:value ref="$c.nummer" />
    </ZCODE>
    <ZDESC>
    <tt:value ref="$c.name" />
    </ZDESC>
    <ZSAPCD>
    <tt:value ref="$c.name" />
    </ZSAPCD>
    </COUNTRY>
    </tt:loop>
    </item>
    </tt:loop>
    </Negara>
    </tt:template>
    </tt:transform>
    Thanking You
    Devi

    Hi Friends
    How to write transformation code for the following xml data.. Please let me know immedately if any one know..
    I have written as following but i encountered an eror staating -
    Iam facing the following error
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_ST_REF_ACCESS', was not caught in
    procedure "UPLOAD_XML" "(FORM)", nor was it propagated by a RAISING clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    The goal was to access variable "ROOT1". However, this access was not
    possible.
    Go through my xml file , the code and code in simple transformation.. Please reply(transformation code) me as soon as possible
    - <Negara>
    - <item>
    - <COUNTRY>
    <MANDT>600</MANDT>
    <ZCODE>500</ZCODE>
    <ZDESC>Pening Lalat</ZDESC>
    <ZSAPCD>T1</ZSAPCD>
    </COUNTRY>
    </item>
    - <item>
    - <COUNTRY>
    <MANDT>600</MANDT>
    <ZCODE>600</ZCODE>
    <ZDESC>Pening Lalat2</ZDESC>
    <ZSAPCD>T2</ZSAPCD>
    </COUNTRY>
    </item>
    </Negara>
    DATA : BEGIN OF XDATA OCCURS 0,
    STR(255) TYPE C,
    END OF XDATA.
    DATA: XMLUPL TYPE string .
    DATA : BEGIN OF ITAB OCCURS 0,
    MANDT(3) TYPE C,
    ZCODE(3) TYPE C,
    ZDESC(15) TYPE C,
    ZSAPCD(2) TYPE C,
    END OF ITAB.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    FILENAME = 'C:\country.xml'
    FILETYPE = 'BIN'
    TABLES
    DATA_TAB = XDATA.
    LOOP AT XDATA.
    CONCATENATE XMLUPL XDATA-STR INTO XMLUPL.
    ENDLOOP.
    CALL TRANSFORMATION ('Y_XMLCTRY')
    SOURCE XML XMLUPL
    result xml = ITAB[].
    BREAK-POINT.
    <?sap.transform simple?>
    <tt:transform template="temp1"
    xmlns:tt="http://www.sap.com/transformation-templates">
    <tt:root name="ROOT1"/>
    <tt:root name="ROOT2"/>
    <tt:template name="temp1">
    <Negara>
    <tt:loop ref=".ROOT1" name="i">
    <item>
    <tt:loop ref=".ROOT2" name="c">
    <COUNTRY>
    <MANDT>
    <tt:value ref="$c.nummer" />
    </MANDT>
    <ZCODE>
    <tt:value ref="$c.nummer" />
    </ZCODE>
    <ZDESC>
    <tt:value ref="$c.name" />
    </ZDESC>
    <ZSAPCD>
    <tt:value ref="$c.name" />
    </ZSAPCD>
    </COUNTRY>
    </tt:loop>
    </item>
    </tt:loop>
    </Negara>
    </tt:template>
    </tt:transform>
    Thanking You
    Devi

  • Simple Transformation - XML to Internal Table Error

    I have a webservice call that returns XML.  I need to transform a portion of the response to an internal table, but my simple transformation is not working with loop processing.  I have read through most posts regarding the topic but they're either too old or related to serialization.  There aren't any exceptions thrown, but I don't get any data in the internal table (PAPERWORK root).  Below are some code snippets.  Any ideas on the problem with the XSLT template?  Thanks.
    Sample XML:
    <?xml version="1.0" encoding="utf-8" ?>
    <PrintVersionDataSet>
    <Result>
    <ReturnCode>W</ReturnCode>
    <ReturnMessage>There are reports with later version(s)</ReturnMessage>
    </Result>
    <Paperwork>
    <ReportCode>CVR</ReportCode>
    <ReportName>Cover Sheet</ReportName>
    <Version>2</Version>
    <PrintedDateTime>2009-05-01T09:54:04.1-05:00</PrintedDateTime>
    </Paperwork>
    <Paperwork>
    <ReportCode>SPS</ReportCode>
    <ReportName>Sponsor Summary</ReportName>
    <Version>2</Version>
    <PrintedDateTime>2009-05-01T09:54:04.99-05:00</PrintedDateTime>
    </Paperwork>
    </PrintVersionDataSet>
    XSLT Code:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="RESULT"/>
      <tt:root name="PAPERWORK"/>
      <tt:template>
        <PrintVersionDataSet>
          <Result tt:ref="RESULT">
            <ReturnCode>
              <tt:value ref="RETURNCODE"/>
            </ReturnCode>
            <ReturnMessage>
              <tt:value ref="RETURNMESSAGE"/>
            </ReturnMessage>
          </Result>
          <tt:deserialize>
            <tt:loop ref=".PAPERWORK">
              <Paperwork>
                <ReportCode>
                  <tt:value ref="REPORTCODE"/>
                </ReportCode>
                <ReportName>
                  <tt:value ref="REPORTNAME"/>
                </ReportName>
                <Version>
                  <tt:value ref="VERSION"/>
                </Version>
                <PrintedDateTime>
                  <tt:value ref="PRINTEDDATETIME"/>
                </PrintedDateTime>
              </Paperwork>
            </tt:loop>
          </tt:deserialize>
        </PrintVersionDataSet>
      </tt:template>
    </tt:transform>
    ABAP Call to Transform Data:
    TRY.
    CALL TRANSFORMATION Z_GA_PAPERWORK_VERS_WEBSVC
          SOURCE XML LS_RESPONSE-VERIFY_PRINT_VERSION_RESULT
          RESULT RESULT     = LS_RESULT
                 PAPERWORK  = LT_PAPERWORK.
        CATCH CX_ROOT INTO ROOT_EXCEPTION.
          CALL METHOD ROOT_EXCEPTION->IF_MESSAGE~GET_TEXT
            RECEIVING
              RESULT = LV_MESSAGE.
      ENDTRY.

    Upon further inspection and testing with a simple file and program, I can see that the XML structure isn't quite correct for the loop process.  There needs to be a single <PAPERWORK> node, instead of one for each table line in the file.  This should allow the loop to execute properly after a slight adjustment to the XSLT template.

  • Simple transformation XML to ABAP, runtime error: CX_ST_REF_ACCESS

    Hi, all experts,
    I got a runtime error CX_ST_REF_ACCESS, while I tried to use Simple Transformation to transfer XML-String to ABAP internal table.
    Can anybody help me to fix the problem? Thanks very much. It's urgent.
    The code of transformation like this:
    <tt:root name="DATA"/>
      <tt:template>
        <node>
          <tt:deserialize>
            <tt:loop ref=".DATA" name="mdr_data">
              <tt:attribute name="type">
                <tt:value ref="$mdr_data.lf_type"/>
              </tt:attribute>
              <tt:attribute name="objid">
                <tt:value ref="$mdr_data.lf_objid"/>
              </tt:attribute>
              <tt:attribute name="name" value-ref="$mdr_data.lf_name"/>
              <tt:attribute name="short" value-ref="$mdr_data.lf_short"/>
            </tt:loop>
          </tt:deserialize>
        </node>
      </tt:template>
    The Data-structure in my Report:
    DATA: BEGIN OF ls_mdr_data,
            lf_type TYPE /ehr/ct_dt_bo_type,
            lf_objid TYPE realo,
            lf_name TYPE stext,
            lf_short TYPE short_d,
          END OF ls_mdr_data,
         lt_result_data like TABLE OF ls_mdr_data.
    If I call the transformation use the XML-String like:
    <node type="MDRFOLDER" objid="50016122" name="MDR Root Folder" short="MDR Root"/>
    I got the  error  CX_ST_REF_ACCESS:
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_ST_REF_ACCESS', was not  caught and
        therefore caused a runtime error.
        The reason for the exception is:
        The goal was to access variable "LF_TYPE". However, this access was not
        possible.

    Hi, all experts,
    I got a runtime error CX_ST_REF_ACCESS, while I tried to use Simple Transformation to transfer XML-String to ABAP internal table.
    Can anybody help me to fix the problem? Thanks very much. It's urgent.
    The code of transformation like this:
    <tt:root name="DATA"/>
      <tt:template>
        <node>
          <tt:deserialize>
            <tt:loop ref=".DATA" name="mdr_data">
              <tt:attribute name="type">
                <tt:value ref="$mdr_data.lf_type"/>
              </tt:attribute>
              <tt:attribute name="objid">
                <tt:value ref="$mdr_data.lf_objid"/>
              </tt:attribute>
              <tt:attribute name="name" value-ref="$mdr_data.lf_name"/>
              <tt:attribute name="short" value-ref="$mdr_data.lf_short"/>
            </tt:loop>
          </tt:deserialize>
        </node>
      </tt:template>
    The Data-structure in my Report:
    DATA: BEGIN OF ls_mdr_data,
            lf_type TYPE /ehr/ct_dt_bo_type,
            lf_objid TYPE realo,
            lf_name TYPE stext,
            lf_short TYPE short_d,
          END OF ls_mdr_data,
         lt_result_data like TABLE OF ls_mdr_data.
    If I call the transformation use the XML-String like:
    <node type="MDRFOLDER" objid="50016122" name="MDR Root Folder" short="MDR Root"/>
    I got the  error  CX_ST_REF_ACCESS:
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_ST_REF_ACCESS', was not  caught and
        therefore caused a runtime error.
        The reason for the exception is:
        The goal was to access variable "LF_TYPE". However, this access was not
        possible.

  • XML to Nested Itab using Simple Transformation

    Hi there is there any experts there who can show me an example of Transforming a XML to a Nested Internal Table using Simple Transformation?
    I have tried this the program from the blog by
    Tobias Trapp
    <a href="/people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1:///people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1
    but I have encountered this error
    Runtime Errors         ST_REF_ACCESS   
    Exception              CX_ST_REF_ACCESS
       1 <?sap.transform simple?>                                    
       2 <tt:transform template="temp1"                              
       3     xmlns:tt="http://www.sap.com/transformation-templates"> 
       4     <tt:root name="ROOT"/>                                  
       5     <tt:template name="temp1">                              
    >>>>       <tt:loop ref=".ROOT" name="a">                        
       7         <A>                                                 
       8            <name>                                           
       9              <tt:value ref="$a.name" />                     
      10            </name>                                          
      11            <ZLS>                                            
      12              <tt:loop ref="$a.zls" name="z">                
      13                <Z>                                          
      14                  <tt:value ref="$z.nummer" />               
      15                </Z>                                         
      16             </tt:loop>                                      
      17           </ZLS>                                            
      18         </A>                                                
      19       </tt:loop>                                            
      20     </tt:template>                                          
      21 </tt:transform>                                             
    Anyone knows whats wrong?

    I had to pass an XSLT program in the transformation statement.

  • Error occured while deserializing simple transformation program

    Hi,
    In the SOA Manager( In the CRM PRD system ), when I check the payload trace, the Request is blank and in the Response I find that there are few exceptions
    1) CX_SY_CONVERSION_DATA_LOSS: XSLT exception - An error occured while deserializing the simple transformation
    Data loss occured when converting ...
    How do I know what was the input provided by the user and how to I use the transformation generated and identify the cause of the problem. in the PRD system What is the use of XSLT transformation?
    Thanks,
    Chakram Govindarajan

    Hello Chakram,
    We are facing the same issue , but in GRC & Remedy Integration.
    Will you please let me know what did you do to resolve this issue if it has got resolved ??
    Thanks in advance.
    Regards,
    Victor

  • Creating Simple transformation for an XML data having deep structure

    Hi
    I have the following XML structure..
    <REQUESTS>
      <REQUESTNAME>REQ123</REQUESTNAME>
      <REQUESTID>1234</REQUESTID>
      <CITY>NEWYORK</CITY>
      <ZIPCODE>123456</ZIPCODE>
    <COMPETENCIES>
       <LANGUAGES>
         <COMPETENCY>
            <SKILL>SAP</SKILL>
            <PROFICIENCY>TEST</PROFICIENCY>
            <SKILL>JAVA</SKILL>
            <PROFICIENCY>TEST123</PROFICIENCY>
    (here we may have any number of records for SKILL&PROFICIENCY...)*
    </COMPETENCIES>
       </LANGUAGES>
         </COMPETENCY>
    </REQUESTS>
    My requirement is to read the above data from an URL and push it into an internal table.
    For this I'm trying to use Simple transformations but I'm facing difficulty in doing this.
    Can you pl. guide me how to create the transformation and the corresponding code for this.
    Best Regards
    Anil

    Hi
    Here is the actual XML structure..
    - <REQUEST>
      <COUNTRY />
      <ADDRESS />
      <CITY />
      <ASSIGNTYPE>IP</ASSIGNTYPE>
      <CHARGETYPE>CH</CHARGETYPE>
      <REMOTEALLOWED>Y</REMOTEALLOWED>
      <SALESRATE>EUR</SALESRATE>
      <SECURITY>NO</SECURITY>
      <TRAVELEXP>Y</TRAVELEXP>
      <MAXDAILYRATE />
      <CREDENTIALS />
      <EXPENDDATE />
      <NEWENDDATE />
      <NEWEXPENDDATE />
      <REPLYBEFORE>2010-11-30</REPLYBEFORE>
      <STARTDATE>2010-01-01</STARTDATE>
      <ENDDATE>2010-12-31</ENDDATE>
      <GCMTYPE>PM</GCMTYPE>
      <GCMLEVELFROM>02</GCMLEVELFROM>
      <GCMLEVELTO>08</GCMLEVELTO>
      <LOCATION>FR43</LOCATION>
      <MOBILITY>04</MOBILITY>
      <ZIPCODE />
    - <COMPETENCIES>
    - <LANGUAGES>
    - <COMPETENCY>
      <SKILL>01106034</SKILL>
      <PROFICIENCY>005103</PROFICIENCY>
      </COMPETENCY>
      </LANGUAGES>
    - <ACTIVITIES>
    - <COMPETENCY>
      <SKILL>01105500</SKILL>                            
      <PROFICIENCY>004507</PROFICIENCY>
      </COMPETENCY>
      </ACTIVITIES>
    - <BUSINESS>
    - <COMPETENCY>
      <SKILL>01105729</SKILL>
      <PROFICIENCY>004605</PROFICIENCY>
      </COMPETENCY>
      </BUSINESS>
    - <INDUSTRIES>
    - <COMPETENCY>
      <SKILL>01105491</SKILL>
      <PROFICIENCY>004901</PROFICIENCY>
      </COMPETENCY>
      </INDUSTRIES>
    - <METHODS>
    - <COMPETENCY>
      <SKILL>01105591</SKILL>
      <PROFICIENCY>004805</PROFICIENCY>
      </COMPETENCY>
      </METHODS>
    - <OFFERINGS>
    - <COMPETENCY>
      <SKILL>01105840</SKILL>
      <PROFICIENCY>005002</PROFICIENCY>
      </COMPETENCY>
      </OFFERINGS>
    - <PRODUCTS>
    - <COMPETENCY>
      <SKILL>01107304</SKILL>
      <PROFICIENCY>004703</PROFICIENCY>
      </COMPETENCY>
      </PRODUCTS>
      </COMPETENCIES>
      <CANDIDATES />
      </REQUEST>
    Here..... <SKILL></SKILL>   <PROFICIENCY></PROFICIENCY>  can be more than 1 entry...
    For this I have created a simple transformation like below..
    I have used the tcode 'XSLT_TOOL '..
    In SE11 I have created a Table type 'ZCOMPETENCIES' which is having  a line type 'ZLANGS'.
    ZLANGS is a structure which has another structure called 'ZCOMPETENCY' and this 'ZCOMPETENCY' is having fields
    SKILL & PROFICIENCY.
    I have used the wizard button which u can find  'XSLT_TOOL '.. and provided the table type ZCOMPETENCIES'  and it has automatically created the following transformation...
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates" xmlns:ddic="http://www.sap.com/abapxml/types/dictionary" xmlns:def="http://www.sap.com/abapxml/types/defined">
      <tt:root name="ROOT" type="?"/>
      <tt:root name="COMPETENCIES" type="ddic:ZCOMPETENCIES"/>
      <tt:template>
        <COMPETENCIES>
          <tt:loop ref=".COMPETENCIES">
            <ZLANGS>
              <COMPETENCY>
                <SKILL tt:value-ref="COMPETENCY.SKILL"/>
                <PROF tt:value-ref="COMPETENCY.PROF"/>
              </COMPETENCY>
            </ZLANGS>
          </tt:loop>
        </COMPETENCIES>
      </tt:template>
    </tt:transform>
    I have written following code to get the data
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename                = gs_file
      CHANGING
        data_tab                = gt_itab
      EXCEPTIONS
        file_open_error         = 1
        file_read_error         = 2
        no_batch                = 3
        gui_refuse_filetransfer = 4
        invalid_type            = 5
        no_authority            = 6
        unknown_error           = 7
        bad_data_format         = 8
        header_not_allowed      = 9
        separator_not_allowed   = 10
        header_too_long         = 11
        unknown_dp_error        = 12
        access_denied           = 13
        dp_out_of_memory        = 14
        disk_full               = 15
        dp_timeout              = 16
        not_supported_by_gui    = 17
        error_no_gui            = 18
        OTHERS                  = 19.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    GET REFERENCE OF gt_person INTO gs_result_xml-value.
    gs_result_xml-name = 'COMPETENCIES'.
    APPEND gs_result_xml TO gt_result_xml.
    TRY.
        CALL TRANSFORMATION ZTEST_TRAN
        SOURCE XML gt_itab
        RESULT (gt_result_xml).
      CATCH cx_root INTO gs_rif_ex.
        gs_var_text = gs_rif_ex->get_text( ).
        MESSAGE gs_var_text TYPE 'E'.
    ENDTRY.
    Please let me know if you need any further details..
    Best Regards
    Anil

  • Simple transformation program debugging

    hi ,
       can any boby guide me how can we debug a simple transformation program which is used for xml to abap conversion .

    Hi,
    have a look on this.
    REPORT  YMS_XMLTOSAP.
    TYPE-POOLS: IXML.
    TYPES: BEGIN OF T_XML_LINE,
            DATA(256) TYPE X,
          END OF T_XML_LINE.
    DATA: L_IXML            TYPE REF TO IF_IXML,
          L_STREAMFACTORY   TYPE REF TO IF_IXML_STREAM_FACTORY,
          L_PARSER          TYPE REF TO IF_IXML_PARSER,
          L_ISTREAM         TYPE REF TO IF_IXML_ISTREAM,
          L_DOCUMENT        TYPE REF TO IF_IXML_DOCUMENT,
          L_NODE            TYPE REF TO IF_IXML_NODE,
          L_XMLDATA         TYPE STRING.
    DATA: L_ELEM            TYPE REF TO IF_IXML_ELEMENT,
          L_ROOT_NODE       TYPE REF TO IF_IXML_NODE,
          L_NEXT_NODE       TYPE REF TO IF_IXML_NODE,
          L_NAME            TYPE STRING,
          L_ITERATOR        TYPE REF TO IF_IXML_NODE_ITERATOR.
    DATA: L_XML_TABLE       TYPE TABLE OF T_XML_LINE,
          L_XML_LINE        TYPE T_XML_LINE,
          L_XML_TABLE_SIZE  TYPE I.
    DATA: L_FILENAME        TYPE STRING.
    PARAMETERS: PA_FILE TYPE CHAR1024 DEFAULT 'c:\temp\orders_dtd.xml'.
    * Validation of XML file: Only DTD included in xml document is supported
    PARAMETERS: PA_VAL  TYPE CHAR1 AS CHECKBOX.
    START-OF-SELECTION.
    *   Creating the main iXML factory
      L_IXML = CL_IXML=>CREATE( ).
    *   Creating a stream factory
      L_STREAMFACTORY = L_IXML->CREATE_STREAM_FACTORY( ).
      PERFORM GET_XML_TABLE CHANGING L_XML_TABLE_SIZE L_XML_TABLE.
    *   wrap the table containing the file into a stream
      L_ISTREAM = L_STREAMFACTORY->CREATE_ISTREAM_ITABLE( TABLE = L_XML_TABLE
                                                      SIZE  = L_XML_TABLE_SIZE ).
    *   Creating a document
      L_DOCUMENT = L_IXML->CREATE_DOCUMENT( ).
    *   Create a Parser
      L_PARSER = L_IXML->CREATE_PARSER( STREAM_FACTORY = L_STREAMFACTORY
                                        ISTREAM        = L_ISTREAM
                                        DOCUMENT       = L_DOCUMENT ).
    *   Validate a document
      IF PA_VAL EQ 'X'.
        L_PARSER->SET_VALIDATING( MODE = IF_IXML_PARSER=>CO_VALIDATE ).
      ENDIF.
    *   Parse the stream
      IF L_PARSER->PARSE( ) NE 0.
        IF L_PARSER->NUM_ERRORS( ) NE 0.
          DATA: PARSEERROR TYPE REF TO IF_IXML_PARSE_ERROR,
                STR        TYPE STRING,
                I          TYPE I,
                COUNT      TYPE I,
                INDEX      TYPE I.
          COUNT = L_PARSER->NUM_ERRORS( ).
          WRITE: COUNT, ' parse errors have occured:'.
          INDEX = 0.
          WHILE INDEX < COUNT.
            PARSEERROR = L_PARSER->GET_ERROR( INDEX = INDEX ).
            I = PARSEERROR->GET_LINE( ).
            WRITE: 'line: ', I.
            I = PARSEERROR->GET_COLUMN( ).
            WRITE: 'column: ', I.
            STR = PARSEERROR->GET_REASON( ).
            WRITE: STR.
            INDEX = INDEX + 1.
          ENDWHILE.
        ENDIF.
      ENDIF.
    *   Process the document
      IF L_PARSER->IS_DOM_GENERATING( ) EQ 'X'.
        PERFORM PROCESS_DOM USING L_DOCUMENT.
      ENDIF.
    *&      Form  get_xml_table
    FORM GET_XML_TABLE CHANGING L_XML_TABLE_SIZE TYPE I
                                L_XML_TABLE      TYPE STANDARD TABLE.
    *   Local variable declaration
      DATA: L_LEN      TYPE I,
            L_LEN2     TYPE I,
            L_TAB      TYPE TSFIXML,
            L_CONTENT  TYPE STRING,
            L_STR1     TYPE STRING,
            C_CONV     TYPE REF TO CL_ABAP_CONV_IN_CE,
            L_ITAB     TYPE TABLE OF STRING.
      L_FILENAME = PA_FILE.
    *   upload a file from the client's workstation
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
        EXPORTING
          FILENAME   = L_FILENAME
          FILETYPE   = 'BIN'
        IMPORTING
          FILELENGTH = L_XML_TABLE_SIZE
        CHANGING
          DATA_TAB   = L_XML_TABLE
        EXCEPTIONS
          OTHERS     = 19.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *   Writing the XML document to the screen
      CLEAR L_STR1.
      LOOP AT L_XML_TABLE INTO L_XML_LINE.
        C_CONV = CL_ABAP_CONV_IN_CE=>CREATE( INPUT = L_XML_LINE-DATA REPLACEMENT = SPACE  ).
        C_CONV->READ( IMPORTING DATA = L_CONTENT LEN = L_LEN ).
        CONCATENATE L_STR1 L_CONTENT INTO L_STR1.
      ENDLOOP.
      L_STR1 = L_STR1+0(L_XML_TABLE_SIZE).
      SPLIT L_STR1 AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO TABLE L_ITAB.
      WRITE: /.
      WRITE: /' XML File'.
      WRITE: /.
      LOOP AT L_ITAB INTO L_STR1.
        REPLACE ALL OCCURRENCES OF CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB IN
          L_STR1 WITH SPACE.
        WRITE: / L_STR1.
      ENDLOOP.
      WRITE: /.
    ENDFORM.                    "get_xml_table
    *&      Form  process_dom
    FORM PROCESS_DOM USING DOCUMENT TYPE REF TO IF_IXML_DOCUMENT.
      DATA: NODE      TYPE REF TO IF_IXML_NODE,
            ITERATOR  TYPE REF TO IF_IXML_NODE_ITERATOR,
            NODEMAP   TYPE REF TO IF_IXML_NAMED_NODE_MAP,
            ATTR      TYPE REF TO IF_IXML_NODE,
            NAME      TYPE STRING,
            PREFIX    TYPE STRING,
            VALUE     TYPE STRING,
            INDENT    TYPE I,
            COUNT     TYPE I,
            INDEX     TYPE I.
      NODE ?= DOCUMENT.
      CHECK NOT NODE IS INITIAL.
      ULINE.
      WRITE: /.
      WRITE: /' DOM-TREE'.
      WRITE: /.
      IF NODE IS INITIAL. EXIT. ENDIF.
    *   create a node iterator
      ITERATOR  = NODE->CREATE_ITERATOR( ).
    *   get current node
      NODE = ITERATOR->GET_NEXT( ).
    *   loop over all nodes
      WHILE NOT NODE IS INITIAL.
        INDENT = NODE->GET_HEIGHT( ) * 2.
        INDENT = INDENT + 20.
        CASE NODE->GET_TYPE( ).
          WHEN IF_IXML_NODE=>CO_NODE_ELEMENT.
    *         element node
            NAME    = NODE->GET_NAME( ).
            NODEMAP = NODE->GET_ATTRIBUTES( ).
            WRITE: / 'ELEMENT  :'.
            WRITE: AT INDENT NAME COLOR COL_POSITIVE INVERSE.
            IF NOT NODEMAP IS INITIAL.
    *           attributes
              COUNT = NODEMAP->GET_LENGTH( ).
              DO COUNT TIMES.
                INDEX  = SY-INDEX - 1.
                ATTR   = NODEMAP->GET_ITEM( INDEX ).
                NAME   = ATTR->GET_NAME( ).
                PREFIX = ATTR->GET_NAMESPACE_PREFIX( ).
                VALUE  = ATTR->GET_VALUE( ).
                WRITE: / 'ATTRIBUTE:'.
                WRITE: AT INDENT NAME  COLOR COL_HEADING INVERSE, '=',
                                 VALUE COLOR COL_TOTAL   INVERSE.
              ENDDO.
            ENDIF.
          WHEN IF_IXML_NODE=>CO_NODE_TEXT OR
               IF_IXML_NODE=>CO_NODE_CDATA_SECTION.
    *         text node
            VALUE  = NODE->GET_VALUE( ).
            WRITE: / 'VALUE     :'.
            WRITE: AT INDENT VALUE COLOR COL_GROUP INVERSE.
        ENDCASE.
    *     advance to next node
        NODE = ITERATOR->GET_NEXT( ).
      ENDWHILE.
    ENDFORM.                    "process_dom
    Thanks,
    Sankar M

  • Simple Transformation and RSS feed

    OK, I decided to clean up an old program and try it with a Simple Transformation. I created the Simple Transformation and when I "execute" and give it the location of a local copy of the RSS file it returns.
    XSLT Tester                                                                               
    Runtime Errors                                                                               
    Reason          : No valid XSLT program supplied
    So is this a problem with the ST or is the preview system perhaps missing something? If it's the ST I'll post it otherwise where should I be looking?

    I'm going to take a guess, but I'm thinking that the test/debug tool doesn't actually support Simple Transformations, just XSLTs.  I couldn't find documentation to support this, but when I looked at the coding of the test/debug application I find that it doesn't use the CALL TRANSFORMATION command - instead it uses the class CL_XSLT_PROCESSOR so that it can trap extra information.  In the notes of the program it even states that this is not the correct usage in normal programs and the class is only used here for extra debug information.  This class appears to be structured to only support full XSLT and not Simple Transformations.
    Although it is pretty easy just to code up your own little test.  The key is to include the extra exception handling to get the source position in the ST where the error occurred (very helpful when debugging).
    catch cx_st_error into st_err.
       s = st_err->get_text( ).
       st_err->get_st_source_position(
          importing
            prog_name = prog_name
            line = line ).

  • Dynamic TAG - Simple Transformation

    Hi All,
    I need work with dynamic TAGS (Elements) on Simple Transformation?
    The tag should be <Invoice> or <DebitNote> depending on a Variable.
    How can I achieve this?
    Thanks and Regards,

    We work with Microsoft Outlook, but I'm sure this could work with any email system.
    This error only came from external emails - what we did in the end is to get the third party to email a particular email (email1) in our company.  This is set up as a regular email account.  On this email put a forward rule to email2 for a particular sender/subject.  email2 is set up as POP3 so that XD1 can poll it - we also block any emails except from email1.
    Doing this accomplishes a couple of things:
    1)  We get around the error because XI polls email2 (which has adapter settings of IMAP4 so we can see MAIL adapter attributes ie. sender, subject etc...When we originally had as POP3 we were not able to see these - but setting as IMAP4 causes the error for external emailers)
    2) We have a SPAM filter - the XI email is clean from SPAM and the adapter will not have errors, as it only receives valid emails to process
    3) We have a central email (email1) which is used to archive all XI emails - we use this for all email scenarios (as we also save to folder and forward in the rule)
    Hope this helps your situation.

  • A question about simple transformation

    Hello Experts,
    I wrote a simple transformation according to certain XML structure. But when I ran the transformation with an XML file, an exception will pop up as following
    "Attribute 'requestListId' expected"
    So I executed my program once again in debug mode and go inot the transformation. The exception comes from the following line
    <tt:attribute name="requestListId" value-ref="REQUEST_LIST_ID"/>
    I can open the XML file with IE. I checked the XML carefully and can't find anything wrong.
    I really don't why the exception poped up. 
    Can any expert provide support and help in Transformation programming and Transfromation debug?
    Thanks a lot.
    Best Regards, Johnney.

    Have other solution. So close it.

  • Help with ABAP Structure to XML - Simple Transformation

    Hi guys,
    I need help with a Simple Transformation. I am trying to convert a structure in ABAP to XML String but i ma getting short dumps...
    Can any of you help.
    Thanks in advance.
    *& Report  ZTESTXML
    REPORT  ZTESTXML.
    class demo DEFINITION.
       PUBLIC SECTION.
       CLASS-METHODS main.
       ENDCLASS.
       CLASS demo IMPLEMENTATION.
         method main.
           data : begin of account,
                    partner type bu_partner,
                    primary(1),
                    update(3),
                    email(50),
                    memberid(4),
                    telephone(12),
                    fax(10),
                    dept(20),
                    end of account.
            data : xmlstr type xstring.
                    account-partner = '12345'.
                    account-primary = 'N'.
                    account-update = 'Yes'.
                    account-email = 'zz at hotmail.com'.
                    account-memberid = '555'.
                    account-telephone = '123-448-6710'.
                    account-fax = '345-123-7899'.
                    account-dept = 'Info Systems'.
                    call TRANSFORMATION ztest_inttable
                                        SOURCE account = 'account'
                                        result XML xmlstr.
           call FUNCTION 'DISPLAY_XML_STRING'
               EXPORTING xml_string = xmlstr.
           ENDMETHOD.
           ENDCLASS.
           start-of-SELECTION.
             demo=>main( ).
    Transformation
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="account"/>
      <tt:template>
        <IGT_CRM_AccountInfo>
          <Account>
            <tt:ref name=".account">
              <tt:attribute name="Id" value-ref="PARTNER"/>
              <tt:attribute name="Primary" value-ref="primary"/>
              <tt:attribute name="Update" value-ref="update"/>
              <Contact>
                <tt:attribute name="EMail" value-ref="email"/>
                <tt:attribute name="Member Id" value-ref="memberid"/>
              </Contact>
              <Communications>
                <tt:attribute name="Telephone" value-ref="telephone"/>
                <tt:attribute name="Fax" value-ref="fax"/>
              </Communications>
              <IGT>
                <tt:attribute name="Department" value-ref="dept"/>
              </IGT>
            </tt:ref>
          </Account>
        </IGT_CRM_AccountInfo>
      </tt:template>
    </tt:transform>
    Dump message
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_ST_REF_ACCESS', was not caught in
    procedure "MAIN" "(METHOD)", nor was it propagated by a RAISING clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    The goal was to access variable "PARTNER". However, this access was not
    possible.

    to convert abap itab or variable into xml string use ABAP key word call transformation.
    call transformation (`ID`)
                source output = itab[]
                result xml xml_out.
    where itab is your internal table or any abap variable.
    xml_out is type string which will hold the resulting xml.
    ID is the transformation program. if you wanto use your own transformation, use your XSLT or ST program there.
    Raja

Maybe you are looking for

  • IPod Classic syncs but no songs on iPod

    Hi I just connected to iTunes so I could add some new songs to my iPod - it wiped my collection from the iPod.  I did a reset, then a restore and finally a factory reset.  The factory reset seemed to work, as my iTunes advised it was syncing (about a

  • IPhone 5 battery is terrible - been through two now --- anyone else? Help

    I have gone through 2 iPhone 5's now.  Genius Bar swapped my first one out.  Second one is worse than first.  I lose 1 percent every minute or two, just doing email and phone.  Have tried all fixes I can find over the past week now with no success an

  • Vendor number in FBL3N report

    Hello Freinds, There is a filed in line item report FLB3N "VENDOR". In one of the requirement we need to populate the vendor number in a GL account.  In vendor recon account the vendor number is populated but for the other GLs involved in the transac

  • Connecting Two WRV200s Wirelessly?

    Due to layout of the house and lack of wire access, need to connect two WRV200's wirelessly. One will be connected to my cable modem and the other will need to provide additional coverage but act as an access point to the net. Can someone tell me how

  • ITunes could not connect to iphone ..... 0xE8000022

    please i need ur help .. when i try to connect my  iphone to computer whith iTunes (last version ) an error message say that iTunes could not connect to this iphone coz an unknown problem occured (0xE78000022) .. id onot know what to do .. aany one h