Simple Transformations : Table parameters

Hi experts,
I'm working on a Simple Transformations and I can't figure out how to access a table parameter from it.
The Help section on the PARAMETERS addition for the instruction CALL TRANSFORMATION says :
You can use this addition to bind ABAP data objects e1 e2 ...
to the parameters p1 p2 ... of an XSL transformation or a
Simple Transformation. All elementary data objects and object
references are permitted.
And then :
Instead of using a static parameter list, you can specify the parameters
dynamically as value pairs in the columns of the internal table ptab that has
one of the following types from the type group ABAP
That is what I am trying to use.
Here is an example I'm trying to make work :
ABAP :
  DATA : partab TYPE abap_trans_parmbind_tab,
              s_par TYPE abap_trans_parmbind,
              lv_xstring TYPE xstring
  CLEAR s_par.
  MOVE 'PAR1' TO s_par-name.
  MOVE 'HELLO' TO s_par-value.
  APPEND s_par TO partab.
  CLEAR s_par.
  MOVE 'PAR2' TO s_par-name.
  MOVE 'WORLD' TO s_par-value.
  APPEND s_par TO partab.
  CALL TRANSFORMATION ztrans_test
      SOURCE
           root = 'IT WORKS !!'
      PARAMETERS
        partab = partab
  RESULT XML lv_xstring.
Transformation :
<tt:root name="ROOT" type="?"/>
<tt:parameter name="PARTAB"/>
<tt:template>
<VALUES>
<VALUE_SOURCE>
        <tt:value ref="ROOT"/>
</VALUE_SOURCE>
<VALUE_PARAM>
<tt:value ref="PAR1"/><tt:value ref="PAR2"/>
</VALUE_PARAM>
</VALUES>
I tried several instructions in the transformations but I never access the values in the table.
I want to use this fonctionality instead of an exhaustive list of parameters.
Can somebody please tell me how to do that ?
Thanks in advance !
Regards,
--Yohann.
Edited by: Yohann Camp on Feb 10, 2012 8:21 AM

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.

Similar Messages

  • Transform Table

    Hello all,
    I'm looking to import sales order via DTW and I'm using a transform table to convert the item code from one code to my SAP code.
    I have done a test with a "simple" transform table and it work perfectly:
    A,000667
    B,000760
    C,000558
    D,000876
    E,000695
    When I want to use my real data DTW does not recognise the data and can not do the mapping:
    6600601   00448BE ,000667
    6600604   J0448BE ,000760
    1130401   00448BE ,000558
    660060F   10451BE ,000876
    6600601   U0450BE ,000695
    Does anyone nows why I have the problem?. Is there a limitation about the size of the source data or is it because I have blank in the original Item Code?
    Do you have an other idea to transform the item code before integration?

    Hello Tsuda and Gordon
    Templates works perfectly as I have done a test with simple codes like A, B, C
    The problem is coming from the mapping table.
    I already tried to remove the space as it was suggested by Tsuda but I was not sucessful in the integration.
    Do you now if there's a limitation in the size of the code?
    Regards,

  • 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 error in converting XML to internal table

    Hi Team,
    I have an issue, its working in Dev, QA, and Prod in PI 7.0, once we upgrade it to PI 7.1 I'm getting the  below mention error,   
    Unknown Simple transformation error in converting XML to internal table
    Application error in mapping program ZF_INT006_FILE_TO_SAP_FILE, error code: , error text: Unknown Simple transformation error in converting XML to internal table An exception has occurred.
    Can any one suggest related notes are suggestion.
    appericate in advance for the solutions which you all provide me
    Thank you
    Venkat Anil

    Check the flag "use SAP XML toolkit" for the operation mapping and try, if that works then.
    Check the flag for all XSLT and Java mappings which is migrated from PI 7.0

  • Fieldcatalog to Excel using Simple transformation

    Hi guys.
    I have tried to sort out how to write own simple transormations but i've got problems along before i had expected.
    The task is to make an XML file, that can be opened with Excel and it must contain row with column names of some dictionary table. The code is pretty simple:
    REPORT  ZJDTEST33.
    parameters: p_tabnam type tabname matchcode object DD_DBTB,
                p_file   type string default 'C:\data\test.xls'.
    data: gt_fcat type lvc_t_fcat,
          gd_xml  type string,
          gt_xml  type table of string.
    start-of-selection.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
         I_STRUCTURE_NAME             = p_tabnam
        CHANGING
          ct_fieldcat                  = gt_fcat.
    end-of-selection.
      call transformation ztest_simple
          SOURCE fieldcat = gt_fcat
          RESULT XML gd_xml.
      refresh gt_xml.
      APPEND gd_xml TO gt_xml.
      CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
             filename                  = p_file
             filetype                  = 'ASC'
          changing
            data_tab                  = gt_xml.
    This is transformation itself:
    <?sap.transform simple?>
    <?mso-application progid="Excel.Sheet"?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates"
                  xmlns:ddic="http://www.sap.com/abapxml/types/dictionary">
      <tt:root name="fieldcat" line-type="ddic:LVC_S_FCAT"/>
      <tt:template>
        <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
                  xmlns:o="urn:schemas-microsoft-com:office:office"
                  xmlns:x="urn:schemas-microsoft-com:office:excel"
                  xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
                  xmlns:html="http://www.w3.org/TR/REC-html40">
          <Worksheet ss:Name="Sheet1">
            <Table>
              <Row>
                <tt:loop ref=".fieldcat">
                  <Cell>
                    <Data ss:Type="String">
                      <tt:value ref="SCRTEXT_M"/>
                    </Data>
                  </Cell>
                </tt:loop>
              </Row>
            </Table>
            <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
              <Selected/>
              <ProtectObjects>False</ProtectObjects>
              <ProtectScenarios>False</ProtectScenarios>
            </WorksheetOptions>
          </Worksheet>
        </Workbook>
      </tt:template>
    </tt:transform>
    Edited by: Petr.Plenkov on Nov 3, 2009 9:07 AM

    Finally, i've got the reason. If somebody has the same problem, just change the encoding manually into a string.
    replace first occurrence of 'utf-16' in ld_xmlstr with 'windows-1251'.
    Edited by: Petr.Plenkov on Nov 3, 2009 12:37 PM

  • 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 Transformations: How deserialize xmlns attributes?

    Hello all,
    during deserializing Simple Transformations ignore surplus attributes in the xml input stream. With one exception: u201Exmlnsu201C (namespace) attributes apparently are not ignored.
    Take for example the xml file:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <CITIES someattribute="XYZ">
      <CITY>Hamburg</CITY>
      <CITY>Berlin</CITY>
    </CITIES>
    This file can be processed successfully by the simple transformation:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="CITIES"></tt:root>
      <tt:template>
        <CITIES>
          <tt:loop ref="CITIES">
            <CITY tt:value-ref="CITY"></CITY>
          </tt:loop>
        </CITIES>
      </tt:template>
    </tt:transform>
    When trying to process the following xml file by the same transformation, however, a CX_ST_MATCH_ELEMENT error is thrown.
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <CITIES xmlns="XYZ">
      <CITY>Hamburg</CITY>
      <CITY>Berlin</CITY>
    </CITIES>
    How can xmlns attributes be deserialized (ignored) with simple transformations?
    Thanks for any hint!
    Simon
    PS:
    To reproduce the error the following ABAP can be used in combination with the quoted simple transformation:
    REPORT  ztestsd13.
    TYPES: BEGIN OF lty_cities,
            city(20) TYPE c,
           END OF lty_cities.
    DATA: ls_cities TYPE lty_cities,
          lt_cities TYPE TABLE OF lty_cities,
          lv_xml TYPE string,
          lv_cities_element TYPE string,
          lv_error TYPE string,
          lo_error TYPE REF TO cx_transformation_error.
    PARAMETERS: lp_incns TYPE boolean DEFAULT ''.
    CASE lp_incns.
      WHEN 'X'.
        lv_cities_element = '<CITIES xmlns="XYZ">'.
      WHEN OTHERS.
        lv_cities_element = '<CITIES someattribute="XYZ">'.
    ENDCASE.
    CONCATENATE:
    '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
    lv_cities_element
    '<CITY>Hamburg</CITY>'
    '<CITY>Berlin</CITY>'
    '</CITIES>' INTO lv_xml.
    TRY.
        CALL TRANSFORMATION ('Z_CITIES')
          SOURCE XML lv_xml
          RESULT cities = lt_cities.
      CATCH cx_transformation_error INTO lo_error.
        lv_error = lo_error->get_text( ).
        WRITE: 'Transformation not successful'.
        SKIP.
        WRITE: lv_error.
        EXIT.
    ENDTRY.
    WRITE: 'Transformation successful'.
    SKIP.
    LOOP AT lt_cities INTO ls_cities.
      WRITE: / ls_cities-city.
    ENDLOOP.
    Edited by: Simon Dähnhardt on Oct 20, 2009 6:04 PM

    first of all your xml isn't well formatted
    root element must be only one like
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <result xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_2.xsd">
    <DB_User>DBSNMP</DB_User>
    <Userhost>localhost.localdomain</Userhost>
    </result>
    <result xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_2.xsd">
    <DB_User>DBSNMP</DB_User>
    <Userhost>localhost.localdomain</Userhost>
    </result>
    </root>or may be in your case
    <?xml version="1.0" encoding="UTF-8"?>
    <result xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_2.xsd">
    <DB_User>DBSNMP</DB_User>
    <Userhost>localhost.localdomain</Userhost>
    </result>for remove you can use xslt as example for xmltransform
    SQL> select * from v$version where rownum=1;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    SQL>
    SQL> with t as
      2  (select xmltype(
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <result xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_2.xsd">
      5  <DB_User xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">DBSNMP</DB_User>
      6  <Userhost xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">localhost.localdomain</Userhost>
      7  </result>') xml from dual)
      8  --
      9  select xmltransform(t.xml, xmltype('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    10  <xsl:output method="xml" indent="no"/>
    11  <xsl:template match="*">
    12      <xsl:element name="{local-name()}">
    13        <xsl:apply-templates select="node()"/>
    14      </xsl:element>
    15  </xsl:template>
    16  </xsl:stylesheet>'))
    17  from t
    18  /
    XMLTRANSFORM(T.XML,XMLTYPE('<X
    <?xml version="1.0" encoding="utf-8"?>
    <result><DB_User>DBSNMP</DB_User><Userhost>localhost.localdomain</Userhost></res
    SQL> --add
    or try add local-name() to your main xquery
    Edited by: AlexAnd on Dec 12, 2012 12:05 AM

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

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

  • Simple Transformation from ABAP to XML and back

    Hi experts,
    Can anyone provide me a simple example of a 'simple transformation' that will convert and internal table with more than one column into XML via a simple transformation.
    I've spend days now reading SAP help and e-learning examples, but this just won't work and I am getting short dumps saying 'The goal was to access variable "ROOT". However, this access was notv possible.'
    Here is my ABAP:
    data: begin of struc,
               counter type i,
               aname type string,
               aname2 type string,
          end of struc.
    data: cnt_c type c.
    data: itab like table of struc with HEADER LINE,
          xml_string type xstring.
    do 3 times.
         move sy-index to: itab-counter, cnt_c.
         concatenate 'nameA' cnt_c into itab-aname.
         concatenate 'nameB' cnt_c into itab-aname2.
         append itab.
    enddo.
    CALL TRANSFORMATION Z_ST_TEST5
           SOURCE  ROOT = itab
           RESULT XML xml_string.
    CALL FUNCTION 'DISPLAY_XML_STRING'
      EXPORTING
        XML_STRING            = xml_string.
    skip 1.
    and here is my ST:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="ROOT"/>
        <tt:template>
         <TABLE>
          <tt:loop ref=".ROOT" name="line">
            <ITEM>
              <counter>
                <tt:value ref="$line.aname" />
              </counter>
              <name>
                <tt:value ref="$line.aname" />
              </name>
              <name2>
                <tt:value ref="$line.aname2" />
              </name2>
            </ITEM>
          </tt:loop>
         </TABLE>
        </tt:template>
    </tt:transform>

    Figured it out. The interla tables used in teh call transformation statement can never have a header line.

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

  • ABAP to XML File (Simple Transformation)

    Hi guys,
    this is my first question here and if I do something wrong please tell me about it.
    I created my own simple transformation which I use in my program:
    CALL TRANSFORMATION ZST_MAGAZYN_BB
         SOURCE lt_magazyn_rh = lt_magazyn_rh[]
                lt_mag_hdr = lt_mag_hdr[]
                lt_mag_hdr2 = lt_mag_hdr2[]
         RESULT XML xml_string.
    Then I tried to use GUI_DOWNLOAD on "xml_string" but there is no content in output xml file (but file's size is not 0kb):
    DATA:  xml_table TYPE STANDARD TABLE OF string.
    APPEND xml_string TO xml_table.
    CALL FUNCTION 'GUI_DOWNLOAD'
       EXPORTING
         filename = 'C:\rh.xml'
       TABLES
         data_tab = xml_table.
    I would really appreciate your help.

    Try to change the path where you're saving the file.
    I had the same problem once, it was authorization. I couldn't save in C:\ root.
    Change filename = 'C:\rh.xml'   to    filename = 'C:\TEMP\rh.xml'.
    Or try any other path, but C:\

  • Simple Transformation from Adobe Form XML document to Dictionary structures

    I have an XML document that I am receiving via email (the XML document is generated from an Adobe Interactive form). I would like to write a simple transformation that will map that XML document to a structure and internal table in my ABAP program. I am new to Simple Transformations and I am having trouble working out how to write a simple transformation for this type of XML document. I would prefer to write a custom transformation rather than using the identity transformation (ID). I would appreciate any help you can provide.
    Please refer to the below for an example of the XML file.
    This maps directly to 2 dictionary structures that exist within our system containing all of the same components. PIM_REQUEST_HDR has a corresponding SAP dictionary structure Y_REQUEST_HDR and PIM_REQUEST_ITEMS has a corresponding SAP dictionary structure Y_REQUEST_ITEMS.
    Can anyone help with some instructions or examples of how to create the simple transformation?
    Thanks for your help! We are using ECC 6.0
    Sample XML to be transformed:
    <?xml version="1.0" encoding="UTF-8" ?>
    <data>
    <SFPSY>
      <DATE>2007-07-03</DATE>
      <TIME>07:25:21</TIME>
      <USERNAME>TLCITY</USERNAME>
      <SUBRC>0</SUBRC>
      </SFPSY>
    <PIM_REQUEST_HDR>
      <MANDT />
      <REQ_NUM />
      <REQ_DESC>blah blah blah</REQ_DESC>
      <PROC_AREA>CTC</PROC_AREA>
      <REQUESTED>2007-07-03</REQUESTED>
      <REQUIRED>2007-07-03</REQUIRED>
      <REQUESTOR>TLCITY</REQUESTOR>
      <MOD_TYPE>SAP Note manual changes</MOD_TYPE>
      <SAPNOTE_NUM>59549656</SAPNOTE_NUM>
      <SAPMSG_NUM>0000000000</SAPMSG_NUM>
      <TECH_SCRIPT />
      <REASON />
      <DEV_ENV>ECC6</DEV_ENV>
      <INSTALL_NO>2861655161</INSTALL_NO>
      <BASIS_REL>700</BASIS_REL>
      <REG_STATUS />
      <REJ_REASON />
      <APP_DATE />
      <REJ_DATE />
      <APPROVER />
      <REGISTRATOR />
      <REG_DATE />
      </PIM_REQUEST_HDR>
    <PIM_REQUEST_ITEMS>
    <DATA>
      <MANDT />
      <REQ_NUM />
      <PGMID>R3TR</PGMID>
      <OBJECT>PROG</OBJECT>
      <OBJ_NAME>RSDIJOIJSDOIF</OBJ_NAME>
      <ACCESSKEY />
      </DATA>
    <DATA>
      <MANDT />
      <REQ_NUM />
      <PGMID>R3TR</PGMID>
      <OBJECT>PROG</OBJECT>
      <OBJ_NAME>RRRSDIJOIJS03</OBJ_NAME>
      <ACCESSKEY />
      </DATA>
      </PIM_REQUEST_ITEMS>
      </data>

    I have solved this one with the help of another collegue.
    To simplify, we changed the XML to be as follows:
    [code]
    <?xml version="1.0" encoding="UTF-8" ?>
    <data>
    <PIM_REQUEST>
    <REQ_HDR>
      <MANDT />
      <REQ_NUM />
      <REQ_DESC>Key required for pricing routines</REQ_DESC>
      <PROC_AREA>SD</PROC_AREA>
      <REQUESTED>2007-07-30</REQUESTED>
      <REQUIRED>2007-08-02</REQUIRED>
      <REQUESTOR>TLCITY</REQUESTOR>
      <MOD_TYPE>SAP Note: Manual Changes</MOD_TYPE>
      <SAPNOTE_NUM>0000000000</SAPNOTE_NUM>
      <SAPMSG_NUM>0000000000</SAPMSG_NUM>
      <TECH_SCRIPT>TS-2498 Pricing Routines</TECH_SCRIPT>
      <REASON>New pricing routines required</REASON>
      <DEV_ENV>ECC6</DEV_ENV>
      <INSTALL_NO>029</INSTALL_NO>
      <BASIS_REL>700</BASIS_REL>
      <REG_STATUS />
      <REJ_REASON />
      <APP_DATE />
      <REJ_DATE />
      <APPROVER />
      <REGISTRATOR />
      <REG_DATE />
      </REQ_HDR>
    <KEY_DETAILS>
    <DATA>
      <MANDT />
      <REQ_NUM />
      <PGMID>R3TR</PGMID>
      <OBJECT>PROG</OBJECT>
      <OBJ_NAME>RVGHT902</OBJ_NAME>
      <ACCESSKEY />
      </DATA>
    <DATA>
      <MANDT />
      <REQ_NUM />
      <PGMID>R3TR</PGMID>
      <OBJECT>PROG</OBJECT>
      <OBJ_NAME>RVGHT901</OBJ_NAME>
      <ACCESSKEY />
      </DATA>
      </KEY_DETAILS>
      </PIM_REQUEST>
      </data>
    [/code]
    This maps directly to 1 dictionary structure that exists within our system containing all of the same components. PIM_REQUEST has a corresponding SAP dictionary structure Y_REQUEST_HDR which is a deep structure and has within it a structure REQ_HDR and a table KEY_DETAILS.
    The corresponding simple transformation we have then used is as follws:
    [code]
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="root"/>
      <tt:template>
        <data>
          <PIM_REQUEST>
            <tt:copy ref="root"/>
          </PIM_REQUEST>
        </data>
      </tt:template>
    </tt:transform>
    [/code]
    Alternatively the following 2 options also work:
    Option 2:
    [code]
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="root"/>
      <tt:template>
        <data>
          <PIM_REQUEST>
            <REQ_HDR>
              <tt:copy ref="root.REQ_HDR"/>
            </REQ_HDR>
            <KEY_DETAILS>
              <tt:loop name="KEY_DETAILS" ref="root.KEY_DETAILS">
                <DATA>
                  <tt:copy ref="$KEY_DETAILS"/>
                </DATA>
              </tt:loop>
            </KEY_DETAILS>
          </PIM_REQUEST>
        </data>
      </tt:template>
    </tt:transform>
    [/code]
    Option 3:
    [code]
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="root"/>
      <tt:template>
        <data>
          <PIM_REQUEST>
            <REQ_HDR>
              <MANDT tt:value-ref="root.REQ_HDR.MANDT"/>
              <REQ_NUM tt:value-ref="root.REQ_HDR.REQ_NUM"/>
              <REQ_DESC tt:value-ref="root.REQ_HDR.REQ_DESC"/>
              <PROC_AREA tt:value-ref="root.REQ_HDR.PROC_AREA"/>
              <REQUESTED tt:value-ref="root.REQ_HDR.REQUESTED"/>
              <REQUIRED tt:value-ref="root.REQ_HDR.REQUIRED"/>
              <REQUESTOR tt:value-ref="root.REQ_HDR.REQUESTOR"/>
              <MOD_TYPE tt:value-ref="root.REQ_HDR.MOD_TYPE"/>
              <SAPNOTE_NUM tt:value-ref="root.REQ_HDR.SAPNOTE_NUM"/>
              <SAPMSG_NUM tt:value-ref="root.REQ_HDR.SAPMSG_NUM"/>
              <TECH_SCRIPT tt:value-ref="root.REQ_HDR.TECH_SCRIPT"/>
              <REASON tt:value-ref="root.REQ_HDR.REASON"/>
              <DEV_ENV tt:value-ref="root.REQ_HDR.DEV_ENV"/>
              <INSTALL_NO tt:value-ref="root.REQ_HDR.INSTALL_NO"/>
              <BASIS_REL tt:value-ref="root.REQ_HDR.BASIS_REL"/>
              <REG_STATUS tt:value-ref="root.REQ_HDR.REG_STATUS"/>
              <REJ_REASON tt:value-ref="root.REQ_HDR.REJ_REASON"/>
              <APP_DATE tt:value-ref="root.REQ_HDR.APP_DATE"/>
              <REJ_DATE tt:value-ref="root.REQ_HDR.REJ_DATE"/>
              <APPROVER tt:value-ref="root.REQ_HDR.APPROVER"/>
              <REGISTRATOR tt:value-ref="root.REQ_HDR.REGISTRATOR"/>
              <REG_DATE tt:value-ref="root.REQ_HDR.REG_DATE"/>
            </REQ_HDR>
            <KEY_DETAILS>
              <tt:loop ref="root.KEY_DETAILS" name="KEY_DETAILS">
                <DATA>
                  <MANDT tt:value-ref="$KEY_DETAILS.MANDT"/>
                  <REQ_NUM tt:value-ref="$KEY_DETAILS.REQ_NUM"/>
                  <PGMID tt:value-ref="$KEY_DETAILS.PGMID"/>
                  <OBJECT tt:value-ref="$KEY_DETAILS.OBJECT"/>
                  <OBJ_NAME tt:value-ref="$KEY_DETAILS.OBJ_NAME"/>
                  <ACCESSKEY tt:value-ref="$KEY_DETAILS.ACCESSKEY"/>
                </DATA>
              </tt:loop>
            </KEY_DETAILS>
          </PIM_REQUEST>
        </data>
      </tt:template>
    </tt:transform>
    [/code]

Maybe you are looking for

  • Help Upgrade to Maverick fails - now unable to restore from time machine as well

    Hello, I have an iMac (2008) which was running snow leopard. The App store reminders to upgrade for free to Mavericks got me today and I decided to go with the upgrade. After the down load of the s/w and while rebooting, it prompts for user id and pa

  • Static Events in ABAP.

    What would be the ideal real-world scenario in which static events would be used?

  • How do I successfully remove photos from iPhoto?

    Just bought a new MacBookPro.. very happy with it, everything except the iphoto application. When I insert my iphone, SD card it uploads my photos to iphoto.. which was great, till I discovered that there is NO obvious file location for my images, an

  • Lenovo x230: Problems with Login and Startup of programs

    Hello,  Lenovo or Lenovo Users  I have a few problems with my Lenovo X230 Laptop 1. Every time when i'm pressing Win + L to lock my account for windows. It will go smoothly to the lock screen and when I return to my laptop. And I press ctrl + alt + d

  • Image based of all the colors currently in the swatch

    Are there anyone who know a method or script that enables generation of an image based of all the colors currently in the swatch? I would want it to fill a grid, with a patch of the color with the colors name underneath it, and with the name of the s