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

Similar Messages

  • PARSE_APPLICATION_DATA Error during XML = ABAP conversion: Response Message; CX_ST_DESERIALIZATION_ERROR in /1SAI/SAS0446CC11CC6EC1AD4789 Line 24 An error occurred when deserializing in the simple transformation program /1SAI/SAS0446CC11CC6EC1AD4789

    Hi Experts ,
    i have a scenario proxy to soap  where i am getting error while getting the response .
    we are sending the request successfully and getting response .some times we are getting in proxy level error below
    PARSE_APPLICATION_DATA Error during XML => ABAP conversion: Response Message; CX_ST_DESERIALIZATION_ERROR in /1SAI/SAS0446CC11CC6EC1AD4789 Line 24 An error occurred when deserializing in the simple transformation program /1SAI/SAS0446CC11CC6EC1AD4789 (Cha
    Please help us to fix this bug in proxy response.
    Regards
    Ravi

    Hello Ravinder,
    Can you please post the complete stack trace, it seems to be some fields are getting truncated i,e data sent from the program to the proxy object might be violating some length restrictions.
    Please check your message interface field lengths and what is being passed to the proxy.
    Regards,
    Ravi.

  • Debugging Simple transformation program

    can i know how to debugg a simple transformation program

    Number of ways
    When in SE80, and executing by a Tran Code, one of the options is to run in Debug mode.
    Another is to set a break point in the program and then run it.  It will stop at the break point IF it gets there
    Yet another is once a program is running and is stopped at a screen, use /H in the transaction field in the Top Left area of
    every screen (unless you have it shut off).

  • 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

  • ABAP Simple Transformation - How to save XML to file with CL_FX_WRITER?

    Hello!
    When calling a Simple Transformation program for transformation from ABAP to XML, it is possible to specify RESULT XML rxml as a class reference variable of type CL_FX_WRITER, which points to an XML writer.
    How to handle CL_FX_WRITER in order to save XML to a file?
    Thanks and regards,
    Andrey

    Hallo Rainer!
    Many thanks. I have checked the profile parameter ztta/max_memreq_MB and it is set to 2048 MB in the development system. I hope, that won't be less on the client's machine. The only thing I did not clearly explained, is that I need to write XML data to the server. I am so sorry. Downloading to the local PC is very helpful for me also, but only for the test purposes.
    Regards,
    Andrey

  • Simple transformation DOCTYPE

    hello,
    anybody knows how to get the get the DOCTYPE statement in my XML file which is generated via simple transformation. my simple transformation program looks like:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates" template="tmpl1">
      <tt:root name="ROOT1"/>
      <tt:root name="ROOT2"/>
      <tt:template name="tmpl1">
         <BatchSet Format="xxxxxxx" FormatSet="676 xxxx" Name="xxxx" TotalBatches="1">
          <tt:loop name="line1" ref=".ROOT1">
            <X1>
              <tt:value ref="$line1.KSTAR"/>
            </X1>
          </tt:loop>
          <X2>
            <tt:loop name="line2" ref=".ROOT2">
              <tt:value ref="$line2.KSTAR"/>
            </tt:loop>
          </X2>
        </BatchSet>
      </tt:template>
    </tt:transform>
    The result should look like:
    <?xml version="1.0" encoding="utf-16" ?>
      <!DOCTYPE BatchSet SYSTEM "xxxx.dtd" >
    <BatchSet Format="xxxxxxx" FormatSet="xxxxx" Name="xxxxxx" TotalBatches="1">
      <X1>1</X1>
      <X1>1</X1>
      <X1>1</X1>
      <X1>1</X1>
      <X1>1</X1>
      <X1>1</X1>
      <X1>1</X1>
      <X1>1</X1>
      <X1>1</X1>
      <X1>1</X1>
      <X2>2222222222</X2>
      </BatchSet>
    IF I enter the <!DOCTYPE BatchSet SYSTEM "xxxx..dtd" > in my ST programm I get a syntax error.
    Anybody of you has an idea?
    Ths in advance
    Andy

    Hi,
    Just go thru the link given below.....
    http://help.sap.com/saphelp_nw2004s/helpdata/en/e3/7d4719ca581441b6841f1054ff1326/frameset.htm
    the main link is given below...
    http://help.sap.com/saphelp_nw2004s/helpdata/en/e3/7d4719ca581441b6841f1054ff1326/frameset.htm
    <b>reward if helpful</b>
    Regards,
    Prajith

  • Debugging a  XML Transformation Program

    Hi,
    We are converting incoming XML into ABAP structure and checking if the data has any future effective changes. If there is a future effective update, then it is converted back to XML string and stored in a custom table as a XML string. A job which runs picks up the record on the given date and process the changes that are to be applied. We are facing issues during the transformation which happens on this day(effective date. Though the XML string has data when the transformation is called, there is no ABAP output after transformation. Interesting things to note are:
    .  No Transformation error is thrown
        When the same scenario with same XMLs is repeated in other regions(Dev & Quality), there are no issues at all
       What I would like to know is
          >> Is there any file encoding & xml string conversions issues?
          >> is it possible to debug within the transfomation(ie transformation program) We tried STRANS, but were not able?
    Any help is this regard is appreciated.
    Thanks
    Ganesh

    Rich,
    I tried to do what you suggested but it didn't allow me to stop at the break-point.
    Here is why I need to debug the program.  Our sales orders just crossed over the number range for ITOs (inter company transfer orders).  Where we are including the header text of the sales order it is pulling the header info of the ITO that has the same order number (from the numbers crossing).  I need to figure out where/how to pull the header information based on the order type.  The Order Confirmation is pulling the correct header text but I am unsure how it is doing that.  I need to determine what the text name is from the Order Confirmation.  On the Picklist the text name is the sales order number.
    I hope that made sense. 
    Davis

  • 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 ).

  • 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.

  • 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.

  • 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 tt: utf-16 to utf-8 encoding

    Hi,
    (reposting here as no response in the ABAP General forum)
    I have a simple transformation the results of which are written to a file using open dataset. The XML in the file is appearing with encoding utf-16 but I need utf-8. I tried placing the following line in the transformation but it did not work:
    <xsl:output encoding="utf-8"/>
    The only way it works is if I use type xstring for the result of the transformation and not string. I then have to convert the xml from xstring to string before writing to the file. This works but I was wondering if there was an easier way to change the encoding of a simple transformation (tt:) ?????????
    Che

    Hi All,
    Reopening this old post, as I found that the same transformation and same program call results in an XML with utf-8 in a NW 7.30 system, while utf-16 in a NW 7.01 system!
    Any ideas why would it happen like this? And if there's anything that can be done to make sure the encoding remains same in both the systems?

  • 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 : deserialize

    Hi,
    I have a simple transformation that works if I serialize table data, but it doesn't work when I wan't to deserialize.
    Here is my ABAP program that calls the transformation:
    TYPES: BEGIN OF flight,
            f_id TYPE p LENGTH 5,
            data TYPE c LENGTH 40,
          END OF flight,
          tt_flight TYPE STANDARD TABLE OF flight
                          WITH DEFAULT KEY.
    DATA: data1 TYPE flight.
    DATA: data2 TYPE flight.
    DATA: xml_string TYPE string.
    DATA: tab_data TYPE tt_flight.
    data1-f_id = '00001'.
    data1-data = 'before'.
    APPEND data1 to tab_data.
    data2-f_id = '00002'.
    data2-data = 'before'.
    APPEND data2 to tab_data.
    concatenate '<?xml version="1.0" encoding="iso-8859-2"?><XY><flights>'
                                       '<flight><id>11111</id><data>data1</data></flight>'
                                       '<flight><id>22222</id><data>data2</data></flight>'
                                       '</flights></XY>'
                into xml_string.
    CALL TRANSFORMATION ...
      SOURCE XML xml_string
      RESULT root = tab_data.
    And the transformation:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates" template="temp_main">
      <tt:root name="ROOT"/>
      <tt:template name="temp_main">
        <XY>
          <flights>
            <tt:loop name="line" ref="ROOT">
              <flight>
                <id>
                  <tt:value ref="f_id"/>
                </id>
                <data>
                  <tt:value ref="data">
                </data>
              </flight>
            </tt:loop>
          </flights>
        </XY>
      </tt:template>
    </tt:transform>
    It won't update or append the content of the xml to my table.
    I would like to read many "<flight><id>.....</id><data>......</data></flight>" lines and write them into the table "tab_data".
    Could somebody please help me?
    Thanks in advance,
    Greg

    Hi Greg,
    try to address the root node with a period. Instead of
    <tt:loop name="line" ref="ROOT">
    use
    <tt:loop name="line" ref=".ROOT">
    Regards
    Stephan

  • Simple transformation with reference to ddic structures

    Hi, experts,
    we decide to use xml as the format when exchanging massive data with other applications. and we want to use simple transformation because according to the document it's more fast.
    actually our file structure is determined by certain ddic structures, one xml file main contain several ddic structures , and they are all flat one, not deep structure.
    the xml file may look like this:
    <data>
    <ddic1>[components of ddic structure 1 ]</ddic1>
    <ddic2>[components of ddic structure 2 ]</ddic2>
    </data>
    i am new to ST,i am wondering that is it possible to make the ST more easy with the help of ddic structure? do i still need to declare the components one by one in the ST program?
    BR.
    jun

    It only runs ok with 2 internal tables because of the way you set up the XML string.  It will run ok with 3 internal tables too.  If you strip out the '<C>' nodes or move the '<C>' nodes around, you'll see what I mean (move the C nodes to the last B node).  Each time you start a loop in a simple transformation, the internal table is initialized.  So, you need to form your sample XML string differently, declare your internal tables differently (nested), or use XSLT for a little more power.

Maybe you are looking for

  • SQL error "-601" occurred when accessing table "SMEN_BUFFC

    Hi Guys I am getting the above error at tiem when i am logging on. The actual error message in the st22 dump is Database error text........: "SMEN_BUFH5 in R3EPT32000 type *SQLPKG already     exists. Job=018343/EPT01/WP00"  The termination occurred i

  • Best approach -Tabs based ADF Tree left side navigation with Dynamic Regions with out UI Shell

    Hi, Somebody can help for the best approach to implement the following requirement. Req: When the user select the ADF Tree left side navigation menu, each menu will open as multiple tabs(Dynamic Tabs) in right side content area with out UI Shell Temp

  • Install lightroom 4 in Windows XP

    In technical specification Windoes XP are supported but I cant install Lightroom 4?

  • Jdev Plugin for BPEL question

    Hi, I am trying to do the tutorial that came with the download soa_windows_x86_101310_disk1.zip off of OTN called "Send Email with Attachments"... I am using JDev version 10.1.3.2 on XP. I installed the SOA suite into c:\Oracle. When I create a new B

  • Call JavaScript-Method from Command in NW04s WebApplication

    Hi, I would like to use a command to call a JavaScipt-method. Is that possible? I want to use a JavaScript generated from the following command as an ACTION_BEFORE_RENDERING-event. <bi:TEMPLATE_PARAMETERS name="TEMPLATE_PARAMETERS" >   <bi:WEB_TEMPLA