XSLT-ABAP using Call Transformation

Hello Friends,
I am new to this XSLT-ABAP transformation. I went through the blogs and forums and got a fair bit of idea on this. Now, i am trying to create a simple program/ xslt transformation to test the scenario. Once this is successfull i need to implement this in our project.
I am not sure, where and what i am doing wrong. Kindly check the below given XSLT/ XML/ ABAP Program and correct me.
My XML File looks as given below:
  <?xml version="1.0" encoding="utf-8" ?>
- <List>
- <ITEM>
  <ITEMQUALF>ITEM1</ITEMQUALF>
  <MATERIAL>MAT1</MATERIAL>
  </ITEM>
- <ITEM>
  <ITEMQUALF>ITEM2</ITEMQUALF>
  <MATERIAL>MAT2</MATERIAL>
  </ITEM>
- <ITEM>
  <ITEMQUALF>ITEM3</ITEMQUALF>
  <MATERIAL>MAT3</MATERIAL>
  </ITEM>
  </List>
My XSLT Transformation looks as given below:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
  <xsl:strip-space elements="*"/>
  <xsl:template match="*">
    <List>
      <xsl:for-each select="ITEM">
        <xsl:element name="ITEM">
          <xsl:element name="ITEMQUALF">
            <xsl:value-of select="ITEMQUALF"/>
          </xsl:element>
          <xsl:element name="MATERIAL">
            <xsl:value-of select="MATERIAL"/>
          </xsl:element>
        </xsl:element>
      </xsl:for-each>
    </List>
  </xsl:template>
</xsl:transform>
My ABAP program looks as below:
REPORT  ztest_ram.
TYPES:
  BEGIN OF ty_test,
    itemqualf TYPE char10,
    material  TYPE char10,
  END OF ty_test,
  ty_t_test TYPE STANDARD TABLE OF ty_test.
DATA:
  l_xml       TYPE REF TO cl_xml_document,
  t_test      TYPE ty_t_test,
  wa_person   TYPE LINE OF ty_t_test,
  t_xml_out   TYPE string,
  v_retcode   TYPE sy-subrc,
  v_totalsize TYPE i.
DATA: gs_rif_ex     TYPE REF TO cx_root,
      gs_var_text   TYPE string.
* Create object
CREATE OBJECT l_xml.
* Call method to import data from file
CALL METHOD l_xml->import_from_file
  EXPORTING
    filename = 'C:\xml\xml_test.xml'
  RECEIVING
    retcode  = v_retcode.
* Call method to Render into string
CALL METHOD l_xml->render_2_string
  IMPORTING
    retcode = v_retcode
    stream  = t_xml_out
    size    = v_totalsize.
* Call Transformation
TRY.
    CALL TRANSFORMATION (`ZXSLT_RAM`)
            SOURCE XML t_xml_out
            RESULT     outtab = t_test.
  CATCH cx_root INTO gs_rif_ex.
    gs_var_text = gs_rif_ex->get_text( ).
    MESSAGE gs_var_text TYPE 'E'.
ENDTRY.
When i run this ABAP program to fetch the data from XML in to Internal table, i get the error message:
Incorrect element List for XML-ABAP transformation
I am really not sure how to proceed further. Could any one help me on this?
Note: Please do not paste the same links, as i have gone through most of them.
Thank you.
Best Regards,
Ram.

UPDATE, works now.
ABAP:
method IF_HTTP_EXTENSION~HANDLE_REQUEST.
*THIS METHOD IS AN HTTP INTERFACE FOR A
*SICF WEB SERVICE HANDLER. IT RECEIVES AN XML PAYLOAD,
*READS IT INTO AN XSTRING, THEN TRANSFORMS THE
*XSTRING INTO ABAP DATA USING AN ABAP XSLT
*TRANSFORMATION PROGRAM
*Process incoming xml Request
     data: lxs_request TYPE xstring.
     lxs_request = server->request->get_data( ).
*BUILD DATA TYPES
TYPES: BEGIN OF ccw_line,
   field11 TYPE STRING,
   field22 TYPE STRING,
   END OF ccw_line.
TYPES: BEGIN OF ccw_head,
   field1 TYPE STRING,
   field2 TYPE STRING,
   lines TYPE STANDARD TABLE OF ccw_line WITH DEFAULT KEY,
   END OF ccw_head.
DATA: ccw_heads type STANDARD TABLE OF ccw_head,
       xccw_heads TYPE ccw_head.
DATA: ccw_lines TYPE STANDARD TABLE OF ccw_line,
       zccw_lines TYPE ccw_line.
DATA: lr_transformation_error TYPE REF TO cx_transformation_error.
DATA: err_text TYPE string.
*CALL TRANSFORMATION
TRY.
   CALL TRANSFORMATION zccwpayload_prg
   SOURCE XML lxs_request
   RESULT OUTPUT = ccw_heads.   "RESULT PARAMETER ("OUTPUT") NAME MUST EQUAL TRANSFORMED XML ROOT eg <OUTPUT>XML DATA...</OUTPUT>
* RESULT XML my_xml_result.    "THIS CAN BE USED IF YOU WANT TO RETURN XML INSTEAD OF ABAP DATA
   CATCH cx_xslt_exception INTO lr_transformation_error.
   err_text = lr_transformation_error->get_text( ).
   server->response->set_cdata( err_text ).
ENDTRY.
*SAVE TO DATABASE
*BUILD RESPONSE
call METHOD server->response->set_cdata
     EXPORTING
         DATA = err_text.
endmethod.
XML SOURCE:
<?xml version="1.0" encoding="ISO-8859-1"?>
<HEADS> <!--MATCH ON THIS IN XSLT!!!-->
      <HEAD><!-- FOR-EACH ON THIS-->
            <headval1>myHeader</headval1>
            <LINES>
                  <Line>
                        <lineval1>myLine</lineval1>
                  </Line>
                  <Line>
                        <lineval1>myLine</lineval1>
                  </Line>
                  <Line>
                        <lineval1>myLine</lineval1>
                  </Line>
                  <Line>
                        <lineval1>myLine</lineval1>
                  </Line>
            </LINES>
      </HEAD>
      <HEAD>
            <headval1>myHeader</headval1>
            <LINES>
                  <Line>
                        <lineval1>myLine</lineval1>
                  </Line>
                  <Line>
                        <lineval1>myLine</lineval1>
                  </Line>
                  <Line>
                        <lineval1>myLine</lineval1>
                  </Line>
            </LINES>
      </HEAD>
      <HEAD>
            <headval1>myHeader</headval1>
            <LINES>
                  <Line>
                        <lineval1>myLine</lineval1>
                  </Line>
                  <Line>
                        <lineval1>myLine</lineval1>
                  </Line>
            </LINES>
      </HEAD>
</HEADS>
XSLT PROGRAM:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
   <xsl:output encoding="UTF-8" indent="yes" method="xml"/>
   <xsl:template match="/HEADS"><!--This should be the root name of your source XML eg <HEADS>xml data...</HEADS> if you don't have a single root match on "/" -->
     <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
       <asx:values>
         <OUTPUT><!--MUST be all caps, MUST match CALL TRANSFORMATION RESULTS parameter name (RESULTS OUTPUT = myABAPDataStructure), and MUST not contain an underscore!!!-->
           <xsl:for-each select="HEAD">
             <HEAD>            <!--ALL CAPS!!!-->
               <FIELD1>
                 <xsl:value-of select="headval1"/>
               </FIELD1>
               <FIELD2>
                 <xsl:value-of select="headval1"/>
               </FIELD2>
               <LINES>
                 <xsl:for-each select="LINES/Line">
                   <LINE>
                     <FIELD11>
                       <xsl:value-of select="lineval1"/>
                     </FIELD11>
                     <FIELD22>
                       <xsl:value-of select="lineval1"/>
                     </FIELD22>
                   </LINE>
                 </xsl:for-each>
               </LINES>
             </HEAD>
           </xsl:for-each>
         </OUTPUT>
       </asx:values>
     </asx:abap>
   </xsl:template>
</xsl:transform>
SAMPLE OF TRANSFORMED XML (MATCHES ABAP DATA STRUCTURE):
IF YOU TEST () YOUR TRANSFORMATION (IN XSLT_TOOL) WITH THE SAMPLE FILE AND IT DOESN'T LOOK LIKE THIS, YOUR TRANSFORMATION WILL FAIL. TAGS MUST BE ALL CAPS!!!!
<?xml version="1.0" encoding="UTF-8"?>
<asx:abap version = "1.0" xmlns:asx = "http://www.sap.com/abapxml">
      <asx:values>
            <OUTPUT>
                  <HEAD>
                        <FIELD1>myHeader</FIELD1>
                        <FIELD2>myHeader</FIELD2>
                        <LINES>
                              <LINE>
                                    <FIELD11>myLine</FIELD11>
                                    <FIELD22>myLine</FIELD22>
                              </LINE>
                              <LINE>
                                    <FIELD11>myLine</FIELD11>
                                    <FIELD22>myLine</FIELD22>
                              </LINE>
                              <LINE>
                                    <FIELD11>myLine</FIELD11>
                                    <FIELD22>myLine</FIELD22>
                              </LINE>
                              <LINE>
                                    <FIELD11>myLine</FIELD11>
                                    <FIELD22>myLine</FIELD22>
                              </LINE>
                        </LINES>
                  </HEAD>
                  <HEAD>
                        <FIELD1>myHeader</FIELD1>
                        <FIELD2>myHeader</FIELD2>
                        <LINES>
                              <LINE>
                                    <FIELD11>myLine</FIELD11>
                                    <FIELD22>myLine</FIELD22>
                              </LINE>
                              <LINE>
                                    <FIELD11>myLine</FIELD11>
                                    <FIELD22>myLine</FIELD22>
                              </LINE>
                              <LINE>
                                    <FIELD11>myLine</FIELD11>
                                    <FIELD22>myLine</FIELD22>
                              </LINE>
                        </LINES>
                  </HEAD>
                  <HEAD>
                        <FIELD1>myHeader</FIELD1>
                        <FIELD2>myHeader</FIELD2>
                        <LINES>
                              <LINE>
                                    <FIELD11>myLine</FIELD11>
                                    <FIELD22>myLine</FIELD22>
                              </LINE>
                              <LINE>
                                    <FIELD11>myLine</FIELD11>
                                    <FIELD22>myLine</FIELD22>
                              </LINE>
                        </LINES>
                  </HEAD>
            </OUTPUT>
      </asx:values>
</asx:abap>

Similar Messages

  • In which cases can the ABAP statement CALL TRANSFORMATION be used?

    Hi friends,
    here is my questions with options below.
    In which cases can the ABAP statement CALL TRANSFORMATION be used? (T/F)
    -To transform as iXML document object into and ABAP data structure using
    XSLT.
    - To transform an XML document contained in a string into another XML
    document
    using and XSLT program.
    - To get canonic XML display of an ABAP data structure.
    - To transform an XML document contained in an xstring into another XLM
    document using an ST program (Simple Transformation).
    - To transform and ABAP data structure into an SML document using ST.
    Kindly give me the expalnation to each statement with either True or False.

    CALL TRANSFORMATION is a new language element in ABAP that we can use to <b>call up the transformation</b>.
    The type of transformation:
    XML to XML
    XML to ABAP
    ABAP to XML or
    ABAP to ABAP is already determined by the two additions SOURCE and RESULT in CALL TRANSFORMATION.
    Check this link for more details.
    http://help.sap.com/saphelp_nw04/helpdata/en/a8/824c3c66177414e10000000a114084/content.htm
    Regards,
    Maha

  • Creating XML file Using Call Transformation

    Hello Friends,
          I have searched before posting thread, couldnt find anything.
          I am creating an XML file using Call Transformation. My internal table has 3 date fields and some other fields.  For some records I dont have values for the date fields. In that case my XML file is giving the date value as 0000-00-00 since I declared it as Date type.  This value 0000-00-00  is not accepted by the middle ware as the valid date.  I can not change it as String type as per the suggestion.
    In that case I am advised to skip printing the date field tag if it doesnt have value.
         Is there any way to skip the date field if it is empty. Any Suggestions please ?.
    Thanks
    Lakshmi.

    Hi,
    I had exactly the same problem before. When you call a transformation there is an option called initial_components. According to SAP if you use initial_components = 'SUPRESS' the empty fields should not being generated on the XML.
    Now, this didn't work for me and I have seen some people with the same problem. Here is how I solved this (maybe not the best way but it worked):
    First: My fields are all CHAR in my table
    Second: In the transformation, you can use conditional transformation to not display a tag if field is empty, here a piece of my transformation (I am using simple transformations):
       <tt:root name="ROOT"/>
         <tt:cond s-check="not-initial(ref('ROOT.L1_NM')) or not-initial(ref('ROOT.L2_NM'))">
              <TRNMTR_NM>
                <tt:cond s-check="not-initial(ref('ROOT.L1_NM'))">
                  <l1_nm>
                    <tt:value ref="ROOT.L1_NM"/>
                  </l1_nm>
                </tt:cond>
                <tt:cond s-check="not-initial(ref('ROOT.L2_NM'))">
                  <l2_nm>
                    <tt:value ref="ROOT.L2_NM"/>
                  </l2_nm>
                </tt:cond>
              </TRNMTR_NM>
            </tt:cond>
    As you can see, I first check if the fields have values.
    Hope it helps
    Edited by: carlosrv on Oct 4, 2011 8:22 PM

  • Problem with "CALL Transformation" in ABAP

    Hello All,
           I am creating XML from ABAP program and using CALL TRANSFORMATION. Everything works fine but when my XML is created sometimes in some "element" values it is truncating space between the texts. For example, I have a field "description" with value "Bon Apetite" it changes to "BonApetite" (space truncated) after transformation! I did research everywhere but could not find why this would happen! Please give me any feedback if you have any information.
    Thanks.
    Mithun

    Hello Mithun,
    when you use the call transformation statement you have to specifiy the xslt transformation used. As a first step you usually use the transformation with the name ID. This is a special transformation for making the asXML representation of abap data. Unfortunately if you look into this transformation you find the following:
    <xsl:transform version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    >
    <xsl:strip-space elements="*"/>
    <xsl:template match="/">
      <xsl:copy-of select="."/>
    </xsl:template>
    </xsl:transform>
    If I remember correctly when you use another transformation this will first call the ID transformation and after this the specified one. So it should not be possible to just copy ID transformation and remove the line. I'll have to think again how to avoid the behaviour.
    Best Regards
    Roman

  • Problem with CALL TRANSFORMATION xml - abap

    Hello!
    I got the following problems using call transformation to read a xml-file to local abap datatype!
    Simple xml file for testing:
    <BMECAT>
    <HEADER>
    asdf
    </HEADER>
    </BMECAT>
    XSLT file:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:template match="/">
        <xsl:value-of select="./BMECAT/HEADER"/>
      </xsl:template>
    </xsl:transform>
    The xslt transformation works with xslt-tester!
    My Source:
    DATA: xmlupl TYPE string,
    outputx TYPE XSTRING,
    lv_string TYPE string.
    * in xmlupl my xml import is stored
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    EXPORTING
    text = xmlupl " variable type string
    IMPORTING
    buffer = outputx. " variable type xstring
    TRY .
         CALL TRANSFORMATION path_to_xslt_file
           SOURCE XML outputx
         RESULT HEADER = lv_string.
    CATCH cx_xslt_exception INTO xslt_error.
         data: xslt_message type string .
         xslt_message = xslt_error->get_text( ).
    ENDTRY.
    After debugging in xslt_message is stored the following text:
    "The element abap was expected for the XML-ABAP transformation"
    Can anyone help me with this problem?
    Regards,
    Daniel

    hi
    good
    try this code
    Just look at this piece of code, I think it should help you.
      DATA : ITAB   TYPE TABLE OF SPFLI,
             L_XML  TYPE REF TO CL_XML_DOCUMENT.
      SELECT * FROM SPFLI INTO TABLE ITAB.
    CREATE THE XML OBJECT
      CREATE OBJECT L_XML.
    CONVERT THE DATA TO XML
      CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB[] ).
    DATA IS CONVERTED TO XML; DISPLAY THE XML-DOCUMENT
      CALL METHOD L_XML->DISPLAY.
    thanks
    mrutyun^

  • ABAP-Mapping with CALL TRANSFORMATION

    Hi everybody,
    I got an ABAP mapping that uses CALL TRANSFORMATION:
    TRY.
          CALL TRANSFORMATION (strxsltid)
            SOURCE XML IDOCXML_DOCUMENT
            RESULT XML result.
        CATCH cx_xslt_abap_call_error INTO lr_oref.
          text = lr_oref->get_text( ).
      ENDTRY.
    The TRANSFORMATION returns result THAT GETS ALREADY serialized!
    On base of the result I want to create an new output document:
    * Create output document
      DATA: li_odocument TYPE REF TO if_ixml_document.
      li_odocument = NEW_DOCUMENT.
    * Render document
      DATA: li_ostream TYPE REF TO if_ixml_ostream.
      li_ostream = li_streamfactory->create_ostream_xstring( result ).
    * Create renderer
      DATA: li_renderer TYPE REF TO if_ixml_renderer.
      li_renderer = li_ixmlfactory->create_renderer( ostream = li_ostream
                                                     document = li_odocument ).
      li_renderer->render( ).
    --> The problem is, that already CALL TRANSFORMATION creates a output document. so at the end of the mapping I got a new document wich includes the result of CALL TRANSFORMATION  and NEW_DOCUMENT in one document.
    How can I suppress CALL TRANSFORMATION from writing the output-stream?
    Thanks regards
    Mario
    Edited by: Mario Müller on Feb 24, 2010 2:27 AM

    no answers

  • XSLT, Call transformation,  Character Set

    Hi
    Using call transformation (XSLT scheme) to convert XML file to html the problem is that
    When HTML displayed in sap, - name 'Søren Fjællegård' is displayed like 'S#ren Fj#lleg#rd'
    What to do ? Any ideas  to handle  special character sets

    Hi Jon,
    What is the XSLT program that you're using to transform the XML?
    Can you try modifying the XSLT stylesheet and add or modify the following attribute.
    <xsl:output indent="yes"/>
    Regards,
    Erwin

  • Call transformation XSLT and long note string in XML

    Hi
    Using call transformation (XSLT scheme) to convert XML file to html the problem is that line breaks in xml are ignored when passing the call tranformation.
    <b>Note in xml look like:</b>
    <com:Note><![CDATA[
    Serie 87% 0,000000
    Amount in this period 01-01-2006 - 01-07-2006 - 180 days
    Currency 16.267.117,38 DKK
    Loan DKK 14.332.700,00
    Debt 7.358.534,23
    Indexsfactor 226,230
    ]]></com:Note>
    <b>When HTML displayed in sap, - note is just a long string which continue out of the screen. Note looks like:</b>
    Serie 87% 0,000000Amount in this period 01-01-2006 - 01-07-2006 - 180 daysCurrency 16.267.117,38 DKKDebt 7.358.534,23Indexsfactor 226,230
    <i>What to do ? Any ideas ?</i>

    Hi Jon,
    What is the XSLT program that you're using to transform the XML?
    Can you try modifying the XSLT stylesheet and add or modify the following attribute.
    <xsl:output indent="yes"/>
    Regards,
    Erwin

  • ABAP-XML conversion via call transformation

    Hi folks!
    I'm using a deep structure for returning the reply from a function module. To save my test data I wanted to generate an XML from this ABAP structure.
    I had in mind that I could use CALL TRANSFORMATION to get the asXML representation of the ABAP structure but I could not figure out how this works.
    Can somebody give me a hint how I could convert my deep ABAP structure into XML without much coding?
    Thanks!
    Birgit

    Hi stonefish,
    1. internal table -
    > Xml
       xml -
    > internal table
    2. this program will show both.
    3. It will do this for
        T001 table.
    4. Just copy paste in new program.
    REPORT abc.
    DATA
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    DATA : BEGIN OF itab OCCURS 0,
    a(100) TYPE c,
    END OF itab.
    DATA: xml_out TYPE string .
    DATA : BEGIN OF upl OCCURS 0,
           f(255) TYPE c,
           END OF upl.
    DATA: xmlupl TYPE string .
    FIRST PHASE
    FIRST PHASE
    FIRST PHASE
    Fetch Data
    SELECT * FROM t001 INTO TABLE t001.
    XML
    CALL TRANSFORMATION ('ID')
    SOURCE tab = t001[]
    RESULT XML xml_out.
    Convert to TABLE
    CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
      EXPORTING
        i_string         = xml_out
        i_tabline_length = 100
      TABLES
        et_table         = itab.
    Download
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filetype = 'BIN'
        filename = 'd:\xx.xml'
      TABLES
        data_tab = itab.
    SECOND PHASE
    SECOND PHASE
    SECOND PHASE
    BREAK-POINT.
    REFRESH t001.
    CLEAR t001.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename = 'D:\XX.XML'
        filetype = 'BIN'
      TABLES
        data_tab = upl.
    LOOP AT upl.
      CONCATENATE xmlupl upl-f INTO xmlupl.
    ENDLOOP.
    XML
    CALL TRANSFORMATION ('ID')
    SOURCE  XML xmlupl
    RESULT tab = t001[]
    BREAK-POINT.
    regards,
    amit m.

  • XSLT/ABAP

    i'm using "call transformation id" to serialize abap data objects to xml. But i would like to have that without the asx: elements, using an own namespace ns0:. How can i do that? Of course i can add a second step with a template xslt changing the asx namespace to the ns0 namepsace, but isnt it possible in one step?
    Is there a better forum to ask this? Its not really an abap question but i couldnt find a better place...

    have you defined in call transformations which objects you want to translate ??
    DATA:
      st_sdhd1   LIKE bapisdhd1,
      ta_sdtext TYPE TABLE OF bapisdtext,
      wa_sdtext TYPE bapisdtext,
      ta_schdl TYPE TABLE OF bapischdl,
      wa_schdl TYPE bapischdl,
      ta_cond TYPE TABLE OF bapicond,
      wa_cond TYPE bapicond,
      ta_parnr TYPE TABLE OF bapiparnr,
      wa_parnr TYPE bapiparnr,
      ta_sditm TYPE TABLE OF bapisditm,
      ta_ret2  TYPE TABLE OF bapiret2.
       CALL TRANSFORMATION ('ID')
        SOURCE XML it_xml_import
        RESULT order_header_in = st_sdhd1 order_conditions_in = ta_cond  order_partners = ta_parnr  order_text = ta_sdtext order_items_in = ta_sditm
    I get now my whole import xml directly in the appropiate tables
    perhaps this can also work the other way around, you have to check that.
    kind regards
    arthur
    Edited by: A. de Smidt on Nov 7, 2008 11:05 AM

  • Call Transformation

    Hi ,
    another and last question,  again question and possible answers,  which ones are true and which ones are false ?
    In which cases can the ABAP statement CALL TRANSFORMATION be used? (T/F)
    - To transform as iXML document object into and ABAP data structure using
    XSLT.
    - To transform an XML document contained in a string into another XML document
    using and XSLT program.
    - To get canonic XML display of an ABAP data structure.
    - To transform an XML document contained in an xstring into another XLM document
    using an ST program (Simple Transformation).
    - To transform and ABAP data structure into an SML document using ST.
    Thanks for your help,
    Arturo

    Hi Arturo Morales,
    Please check this link
    [XML Mapping|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a89312f8-0b01-0010-86b3-fdd7178e0534]
    reward if helpful
    raam

  • Creating an XML From a Deep Structure  using XSL Transformation

    Hi ABAPers,
    I have a requirement to use XSL Transformations on an ABAP deep type structure.
    Currently i have an API that fills in this deep structure and by using CALL TRANSFORMATION ID.... i will get the BIG XML having having 100s of nodes . But actualy form the deep structure i need only some NODES (say 50)... So i tried writing an XSLT
    in the transaction STRANS.. but on using this TRANSFORMATION which i wrote i am getting an error messgae like INVALID XML...
    Am i going in right track or is there a good solution...
    My sample transformation is as below...
    <xsl:transform version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:strip-space elements="*"/>
    <xsl:template match="/">
    <xsl:value-of select="DATA/NODE_ELEMENTS/UUID_KEY/UUID"/>
    <xsl:value-of select="DATA/NODE_ELEMENTS/SEMANTICAL_NAME"/>
    <xsl:value-of select="DATA/NODE_ELEMENTS/STRUCT_CAT"/>
    <xsl:value-of select="DATA/NODE_ELEMENTS/USAGE_CAT"/>
    <xsl:value-of select="DATA/NODE_ELEMENTS/RESTRICTED_IND"/>
    <xsl:value-of select="VALUES/DATA/NODE_ID"/>.
    </xsl:template>
    </xsl:transform>
    Please help me in solving this issue....
    Thanks,
    Linda.

    Hi Linda,
        I am replying based on your sample code.
       Try the below following suggestions.
       here 'GRPHDR' is the node where I am selecting the data.
               IGRPHDR is the name of the reference.
    First calling the transformation in you program.
    TYPES: BEGIN OF tl_hdr,
               msgid(20)    TYPE c,
                 END OF tl_hdr.
    DATA : t_hdr           TYPE STANDARD TABLE OF tl_hdr.
      GET REFERENCE OF t_hdr INTO l_result_xml-value.
        l_result_xml-name = 'IGRPHDR'.
        APPEND l_result_xml TO t_result_xml.
       TRY.
            CALL TRANSFORMATION yfi_xml_read
            SOURCE XML it_xml_data
            RESULT (t_result_xml).
          CATCH cx_root INTO l_rif_ex.
            l_var_text = l_rif_ex->get_text( ).
            l_bapiret-type = 'E'.
            l_bapiret-message = l_var_text.
            APPEND l_bapiret TO errormsgs.
            EXIT.
        ENDTRY.
    in XSL transformation
       First write a block of statement to specify from which node you are taking the data.
       No matter it is a node or sub-node.
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
      <xsl:strip-space elements="*"/>
    <xsl:template match="/">
          <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <IGRPHDR>  " reference name of internal table
              <xsl:apply-templates select="//GrpHdr"/>
            </IGRPHDR>
      </asx:values>
        </asx:abap>
    </xsl:template>
    Next select the data from the nodes under the nodes specified in the transformation.
    here msgid is the field i am selecting for value.
    <xsl:template match="GrpHdr">
        <item>
          <MSGID>  " field in the internal table t_hdr where data has to go
            <xsl:value-of select="MsgId"/>
          </MSGID>
        </item>
      </xsl:template>
    reply back if further clarification is needed.
    Thanks and regards,
    Kannan N

  • Help on Call Transformation

    Hi
    i have created a RFC and thru that i am submitting a report and calling that RFC in my EP.
    i make use of the FM "WWW_HTML_TO_LISTOBJECT" so that data mirror image of my report is also displayed in my portal.
    But the problem is i can't control it, For eg: if i click on "download to excel" it isnt working properly.
    how should i overcome this problem.
    Once Mr.Raja (one of the sdn member) suggested to use
    "call transformation" method, can you be specific to that, how should i use that in ALV report. where should i write "call transoformation" method. A sample code would be helpful.
    Thank you

    <b>Call Transformation</b>
    is for transforming XML using XSLT into a xml/html/abap itab, etc formats.
    of transforming abap itab to xml format.
    you cannot convert the html returned by your program into your required format using this mechanism.
    if you want to use this feature , then your report should be returning XML output.
    possible tranformation scenarios
    from XML to XML (only for XSLT),
    from XML to ABAP (for XSLT and simple transformations),
    from ABAP to XML (for XSLT and simple transformations),
    from ABAP to ABAP (only for XSLT),
    Regards
    Raja

  • Regarding Call Transformation

    Hi experts,
    Can any one tell what is call transformation used for and all also the use of  'id' given in the syntax below.
    CALL TRANSFORMATION id
    SOURCE (Internal table)
    RESULT (XML string )
    Thanks&regards,
    Karthik.

    Form SAP Help:
    Simple Transformations
    Simple Transformations (ST) is an SAP programming language for describing transformations between ABAP data and XML formats. ST is restricted to the two modes of serialization (ABAP to XML) and deserialization (XML to ABAP) of ABAP data, which are most important for data integration. Transformations from ABAP to ABAP and XML to XML, like in the more general XSLT are not possible in ST.
    In comparison with XSLT, the main advantages of ST programs are as follows:
    ST programs are declarative and thus easier to read
    ST programs only have serial access to the XML data and are therefore very efficient even with large data volumes
    ST programs describe serialization and deserialization simultaneously - that is, ABAP data serialized in XML with ST can also be deserialized with the same ST program.
    Simple transformations that can be called using CALL TRANSFORMATION must be in the repository. ST programs can be edited using the Transformation Editor. This is called up either with transaction STRANS or by choosing Edit Object u2192 More u2192 Transformation followed by Simple Transformation in the ABAP Workbench object navigator
    More information on Simple Transformations is available in the Knowledge Warehouse.
    Example (from help also )
    Simple Transformation Example
    Serialization of a nested structure. In the following ABAP program section, a nested structure struc1 is serialized to xml_string with the Simple Transformation st_trafo and deserialized with the same transformation.
    DATA: BEGIN OF struc1,
            col1 TYPE c LENGTH 10 VALUE 'ABCDEFGHIJ',
            col2 TYPE i VALUE 111,
            BEGIN OF struc2,
              col1 TYPE d VALUE '20040126',
              col2 TYPE t VALUE '084000',
            END OF struc2,
          END OF struc1.
    DATA: xml_string TYPE string,
          result     LIKE struc1.
    TRY.
        CALL TRANSFORMATION st_trafo
          SOURCE para = struc1
          RESULT XML xml_string.
        CALL TRANSFORMATION st_trafo
          SOURCE XML xml_string
          RESULT para = result.
      CATCH cx_st_error.
    ENDTRY.
    The Simple Transformation st_trafo has the following form:
    <tt:transform template="temp"
        xmlns:tt="http://www.sap.com/transformation-templates"
        version="0.1">
      <tt:root name="PARA"/>
      <tt:template name="temp">
        <X>
          <X1>
            <tt:value ref="PARA.COL1" />
          <X2>
            <tt:value ref="PARA.COL2" />
          <X3>
            <X1>
              <tt:value ref="PARA.STRUC2.COL1" />
            <X2>
              <tt:value ref="PARA.STRUC2.COL2" />
        </X>
    The transformation consists of a Template temp that defines the structure of the XML document and establishes relationships between value nodes and components of the structure. The result of the transformation is as follows (line breaks and indentations were inserted for clarification purposes):
    <X>
      <X1>ABCDEFGHIJ
      <X2>111
      <X3>
        <X1>2004-01-26
        <X2>08:40:00
    </X>
    The conversion of elementary data types is the same as for asXML. The reverse transformation generates the same content in the structure result as in struc1.
    Good luck.

  • EXCEL UPLOAD - CALL TRANSFORMATION

    Hi,
      I am uploading the data from .xml file using Fileupload UI element into the string sucessfully. But now i need to convert that string data into my internal table using the Call Transformation statement.
      I have the XSLT file for this but i don't know where to place this XSLT file and how to use it inthe Call transformation statement while uploading the data.
      CALL TRANSFORMATION 'XSLT File' SOURCE XML filecontent
                          RESULT itemlist = lt_employees.
    the bold XSLT file where we need to place in SAP to retrive the data into internal table.
    Please help me, it is urgest issue.
    Thanks in Advance
    Best Regards,
    Vijay

    Hello Vijay,
    call se80 and choose a package, then right-click on the package name and choose "Create" -> "Other(1)" -> "Transformation".
    Choose a name for this transformation (e.g. MY_TRANSF) and enter the code for the transformation in th editor. In your application you can use
    CALL TRANSFORMATION MY_TRANSF
       source XML ...
       result ....
    Regards,
    Rainer

Maybe you are looking for

  • Backing up and restoring using disk images.

    Hi there I want to create a disk image of a mac's HDD, then put the disk image onto secondary internal HDD, so that in the event of the mac going belly up, I can start from the OSX system disk, format the main drive, restore from the disk image on th

  • Boo Hoo - lost my iPhone 4S

    Hi all, I foolishly lefrt my phone in a 'hostile' environment yesterday and someone nabbed it. Reality appears to be that my carrier (Telus) nor Apple has much reason to care one way or the other. After all, a lost phone is more business for both of

  • Application Deployement Problem on AS

    i like to know that is there any problem regarding deployment on AS (application server), if we have only one form modeule and one content canvas with different stack canvasas on it. is there any standarad that form must have menu to deployee on AS W

  • Where is the "Comment" is saved from the timesheet of every task ?

    I want to know the timesheet column name "Comment" where these values are saving w.r.t timesheet period . In which database and which table.

  • Can't watch tv drama I've purchased on itune store

    Hi, I accidentally bought Glee season 1 on itune store in HD. I realized that I can't watch HD version on my mac mini for some reason.. I'm so sad since a) not only I can't watch the HD version, but b) it also blocks me from buying non-HD version of