Create XML transformation in SAP R/3 4.7

Hi Experts,
Kindly let me know the transaction for creating xml transformation in sap r/3 4.7, if there is any.
Though i could not find anything through tstc or se93.
Is there any other way of creating xml transformation in r/3 4.7. There is a tcode STRANS in ecc6.0 but not in 4.7.
Also, please help me resolving this issue of converting abap data to xml file: -
is the following xml structure possible with transformation or by any other method.
<Process_Order>
     <item>
               <PO Number> PO123334 </PO Number>
               <Header_mat> Mat123 </Header_mat>
               <BOM>
                      <PDLabels>
                              <PDLabel>
                                     <PCode>P123456</PCode>
                                     <Batch>123ABC</Batch>
                                     <Quantity>6000</Quantity>
                                     <PDDCode>1234567890</PDDCode>
                             </PDLabel>
                             <PDLabel>
                                    <PCode>P234567</PCode>       
                                    <Batch>567DEF</Batch>
                                    <Quantity>6000</Quantity>
                                    <PDDCode></PDDCode>
                             </PDLabel>
                    </PDLabels>
                   <PDCartons>
                            <PDCarton>
                                   <PCode>P556677</PCode>
                                   <Batch>589GFT</Batch>
                                   <Quantity>1200</Quantity>
                                   <PDDCode></PDDCode>
                            </PDCarton>
                  </PDCartons>
             </BOM>
    </item>
     <item>
               <PO Number> PO123334 </PO Number>
               <Header_mat> Mat123 </Header_mat>
               <BOM>
                      <PDLabels>
                              <PDLabel>
                                     <PCode>P123456</PCode>
                                     <Batch>123ABC</Batch>
                                     <Quantity>6000</Quantity>
                                     <PDDCode>1234567890</PDDCode>
                             </PDLabel>
                             <PDLabel>
                                    <PCode>P234567</PCode>       
                                    <Batch>567DEF</Batch>
                                    <Quantity>6000</Quantity>
                                    <PDDCode></PDDCode>
                             </PDLabel>
                    </PDLabels>
                   <PDCartons>
                            <PDCarton>
                                   <PCode>P556677</PCode>
                                   <Batch>589GFT</Batch>
                                   <Quantity>1200</Quantity>
                                   <PDDCode></PDDCode>
                            </PDCarton>
                  </PDCartons>
             </BOM>
    </item>
</Process_Order>
What i mean to ask is, is the hierarchy to this structural level is attainable using either transfomation or any other alternative.
Thanks a lot in advance !
Shreya

oops the message structure has gone bad ........
What i meant was : --
<Process_Order>
  <item>
               <PO Number> PO123334 </PO Number>
               <Header_mat> Mat123 </Header_mat>
               <BOM>
                      <PDLabels>
                              <PDLabel>
                                     <PCode>P123456</PCode>
                                     <Batch>123ABC</Batch>
                                     <Quantity>6000</Quantity>
                                     <PDDCode>1234567890</PDDCode>
                             </PDLabel>
                             <PDLabel>
                                    <PCode>P234567</PCode>       
                                    <Batch>567DEF</Batch>
                                    <Quantity>6000</Quantity>
                                    <PDDCode></PDDCode>
                             </PDLabel>
                    </PDLabels>
                   <PDCartons>
                            <PDCarton>
                                   <PCode>P556677</PCode>
                                   <Batch>589GFT</Batch>
                                   <Quantity>1200</Quantity>
                                   <PDDCode></PDDCode>
                            </PDCarton>
                  </PDCartons>
             </BOM>
    </item>
</Process_Order>

Similar Messages

  • How to create xml entity in sap

    hi,
      kindly tell me process of creating xml entity in sap.
    regrad's
    vineet

    Hi Vineet ,
    You can use function module "SDIXML_DATA_TO_DOM" to convert the data in internal table to XML form. This function module is used to create the structure for XML document.
    After this you use FM "SDIXML_DOM_TO_XML".
    Hope this helps you!!!!
    Regards,
    Nikhil

  • Creating XML transformation using multiple internal tables

    <b>Hi everyone,</b><br />
    <br />
    <b>I'm trying to transforme 3 internal tables (from customer master data) into a single XML document.</b><br />
    <p />
    DATA:   BEGIN OF wtab OCCURS 0 ,<br />
            kunnr LIKE kna1-kunnr, "Customer ID<br />
            ktokd LIKE kna1-ktokd, <br />
            land1 LIKE kna1-land1, <br />
            name1 LIKE kna1-name1, <br />
            ort01 LIKE kna1-ort01, <br />
            pstlz LIKE kna1-pstlz, <br />
            spras_iso LIKE kna1-spras, <br />
            smtp_addr LIKE adr6-smtp_addr, <br />
            stras LIKE kna1-stras, <br />
              END OF wtab.<br />
    <br />
    DATA:   BEGIN OF wtab_o OCCURS 0 ,<br />
            kunnr LIKE knvv-kunnr, "Customer ID<br />
            vkorg LIKE knvv-vkorg, "Sales organisation<br />
            waers LIKE knvv-waers, <br />
            END OF wtab_o.<br />
    <br />
    DATA:   BEGIN OF wtab_p OCCURS 0 ,<br />
            kunnr LIKE knvp-kunnr, "Customer ID<br />
            vkorg LIKE knvp-vkorg, "Sales organisation<br />
            parvw LIKE knvp-parvw, <br />
            kunn2 LIKE knvp-kunnr,<br />
              END OF wtab_p.<br />
    <p />
    <b>The internal tables are related to each other as follows:*</b><br />
    <br />
    wtab-kunnr = wtab_o-kunnr<br />
    <br />
    AND<br />
    <br />
    wtab_o-vkorg = wtab_p-vkorg<br />
    wtab_o-kunnr = wtab_p-kunnr<br />
    <br />
    <b>I couldn't figure out how to declare this relationship when calling the transformation. Is it possible?</b><br />
    <p />
    ABAP<br />
    <br />
    <br />
    REFRESH : gt_source_itab.<br />
    CLEAR : g_rxml.<br />
    <br />
      GET REFERENCE OF wtab INTO gs_source_wa-value.<br />
      gs_source_wa-name = 'DEBMAS04'.<br />
      APPEND gs_source_wa TO gt_source_itab.<br />
    <br />
      GET REFERENCE OF wtab_o INTO gs_source_wa-value.<br />
      gs_source_wa-name = 'E1KNVVM'.<br />
      APPEND gs_source_wa TO gt_source_itab.<br />
    <br />
    GET REFERENCE OF wtab_p INTO gs_source_wa-value.<br />
      gs_source_wa-name = 'E1KNVPM'.<br />
      APPEND gs_source_wa TO gt_source_itab.<br />
    <br />
      TRY.<br />
          CALL TRANSFORMATION Z_XSLT_CLIENT<br />
          SOURCE (gt_source_itab)<br />
          RESULT XML g_rxml<br />
          OPTIONS xml_header = 'without_encoding'.<br />
    CATCH cx_root INTO gs_rif_ex.<br />
    <br />
          gs_var_text = gs_rif_ex-&gt;get_text( ).<br />
          MESSAGE gs_var_text TYPE 'E'.<br />
        ENDTRY.<br />
    <br />
    <br />
    Transformation Z_XSLT_CLIENT:<br />
    <br />
    <br />
    &lt;xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   xmlns:sap="http://www.sap.com/sapxsl"&gt;<br />
    &lt;xsl:output indent="yes" encoding="UTF-16" method="xml" version="1.0"/&gt;<br />
    &lt;xsl:strip-space elements="*"/&gt;<br />
    &lt;xsl:template match="/"&gt;<br />
    &lt;DEBMAS04&gt;<br />
    &lt;xsl:apply-templates select="//DEBMAS04/item"/&gt;<br />
    &lt;/DEBMAS04&gt;<br />
    &lt;/xsl:template&gt;<br />
    &lt;xsl:template match="DEBMAS04/item"&gt;<br />
         &lt;IDOC&gt;<br />
           &lt;xsl:attribute name="BEGIN"&gt;1&lt;/xsl:attribute&gt;<br />
           &lt;E1KNA1M&gt;<br />
            &lt;xsl:attribute name="SEGMENT"&gt;1&lt;/xsl:attribute&gt;<br />
            &lt;KUNNR&gt;<br />
               &lt;xsl:value-of select="KUNNR"/&gt;<br />
            &lt;/KUNNR&gt;<br />
            &lt;KTOKD&gt;<br />
               &lt;xsl:value-of select="KTOKD"/&gt;<br />
            &lt;/KTOKD&gt;<br />
            &lt;LAND1&gt;<br />
               &lt;xsl:value-of select="LAND1"/&gt;<br />
            &lt;/LAND1&gt;<br />
            &lt;NAME1&gt;<br />
               &lt;xsl:value-of select="NAME1"/&gt;<br />
            &lt;/NAME1&gt;<br />
            &lt;ORT01&gt;<br />
               &lt;xsl:value-of select="ORT01"/&gt;<br />
            &lt;/ORT01&gt;<br />
            &lt;PSTLZ&gt;<br />
               &lt;xsl:value-of select="PSTLZ"/&gt;<br />
            &lt;/PSTLZ&gt;<br />
            &lt;SPRAS_ISO&gt;<br />
               &lt;xsl:value-of select="SPRAS_ISO"/&gt;<br />
            &lt;/SPRAS_ISO&gt;<br />
            &lt;SMTP_ADDR&gt;<br />
               &lt;xsl:value-of select="SMTP_ADDR"/&gt;<br />
            &lt;/SMTP_ADDR&gt;<br />
            &lt;STRAS&gt;<br />
               &lt;xsl:value-of select="STRAS"/&gt;<br />
            &lt;/STRAS&gt;<br />
             &lt;xsl:apply-templates select="//E1KNVVM/item"/&gt;<br />
           &lt;/E1KNA1M&gt;<br />
      &lt;/IDOC&gt;<br />
    &lt;/xsl:template&gt;<br />
    &lt;xsl:template match="E1KNVVM/item"&gt;<br />
       &lt;E1KNVVM&gt;<br />
             &lt;xsl:attribute name="SEGMENT"&gt;1&lt;/xsl:attribute&gt;<br />
             &lt;VKORG&gt;<br />
               &lt;xsl:value-of select="VKORG"/&gt;<br />
             &lt;/VKORG&gt;<br />
             &lt;WAERS&gt;<br />
               &lt;xsl:value-of select="WAERS"/&gt;<br />
             &lt;/WAERS&gt;<br />
           &lt;xsl:apply-templates select="//E1KNVPM/item"/&gt;<br />
       &lt;/E1KNVVM&gt;<br />
    &lt;/xsl:template&gt;<br />
    &lt;xsl:template match="E1KNVPM/item"&gt;<br />
       &lt;E1KNVPM&gt;<br />
             &lt;xsl:attribute name="SEGMENT"&gt;1&lt;/xsl:attribute&gt;<br />
             &lt;PARVW&gt;<br />
               &lt;xsl:value-of select="PARVW"/&gt;<br />
             &lt;/PARVW&gt;<br />
             &lt;KUNN2&gt;<br />
               &lt;xsl:value-of select="KUNN2"/&gt;<br />
             &lt;/KUNN2&gt;<br />
       &lt;/E1KNVPM&gt;<br />
    &lt;/xsl:template&gt;<br />
    &lt;/xsl:transform&gt;<br />
    <br />
    <b>The way the call transformation is now, for each line in table wtab (DEBMAS04) I'm getting all the lines in table wtab_o (E1KNVVM) and table wtab_p (E1KNVPM)</b><br />
    <p />
    <br />
    Thank you for your help,<br />
    <br />
    Giselle<br />
    <p />

    Hi Giselle,
    I think it's possible (using xsl:if for instance), but an easier way is to nest your internal tables declarations (wtab_o inside wtab, kunnr becomes useless, and wtab_p inside wtab_o), and use the SAP standard "ID" transformation (no need for a custom XSL transformation). You'll get a slightly different result, but I don't think you want something very sophisticated.
    Sandra

  • Creating Simple transformation for an XML data having deep structure

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

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

  • Dynamic title for Chart created by an xml-file in SAP ChartDesigner

    Hello everybody.
    I created an xml-file with SAP ChartDesigner for using it in my abap program. I import this file as a MIME-Object.
    Everything works fine, i declared my charts and all my values.
    But now I need a dynamic title on the top.
    And know that I can give a title in my xml. But it's not dynamic.
    I looked into the xml file and the path for the title is:
    SAPChartCustomizing
    Elements
    ChartElements
    Title
    and then Caption.
      p_ixml_doc = g_ixml->create_document( ).
      l_encoding = g_ixml->create_encoding( byte_order = if_ixml_encoding=>co_little_endian character_set = 'utf-8' ).
      p_ixml_doc->set_encoding( l_encoding ).
      l_chartdata = p_ixml_doc->create_simple_element( name = 'SAPChartCustomizing' parent = p_ixml_doc ).
      l_elements =   p_ixml_doc->create_simple_element( name = 'Elements' parent = l_chartdata ).
      l_chartelements = p_ixml_doc->create_simple_element( name = 'ChartElements' parent = l_elements ).
      l_title = p_ixml_doc->create_simple_element( name = 'Title' parent = l_chartelements ).
      l_element = p_ixml_doc->create_simple_element( name = 'Caption' parent = l_title ).
      l_element->if_ixml_node~set_value( 'QRK-Mittelwert' ).
    In my opinion, it's the right path :/
    My other values i declare like this.
    l_series = p_ixml_doc->create_simple_element( name = 'Series' parent = l_chartdata ).
      l_series->set_attribute( name = 'label' value = 'TO' ).
      l_series->set_attribute( name = 'customizing' value = 'Series1' ).
      loop at gt_mw into gs_mw.
        lv_tabix = sy-tabix.
        l_point = p_ixml_doc->create_simple_element( name = 'Point' parent = l_series ).
        l_element = p_ixml_doc->create_simple_element( name = 'Value' parent = l_point ).
        l_element->set_attribute( name = 'type' value = 'x' ).
        l_element->if_ixml_node~set_value( lv_tabix ).
        l_element = p_ixml_doc->create_simple_element( name = 'Value' parent = l_point ).
        l_element->set_attribute( name = 'type' value = 'y' ).
        l_element->if_ixml_node~set_value( '35.00' ).
      endloop.
    It works...and i already checked this solution for my title, but it didn't work.
    I call the xml file with the method cl_wb_mime_repository:
    CALL METHOD cl_wb_mime_repository=>load_mime
        EXPORTING
          io              = lv_io
        IMPORTING
          bin_data        = lt_xmlr
        CHANGING
          language        = sy-langu
        EXCEPTIONS
          no_io           = 1
          illegal_io_type = 2
          not_found       = 3
          error_occured   = 4
          OTHERS          = 5.
      CHECK sy-subrc = 0.
    *-- Convert raw to xstring
      CREATE OBJECT lo_conv.
      LOOP AT lt_xmlr INTO ls_xmlr.
        CALL METHOD lo_conv->convert
          EXPORTING
            inbuff    = ls_xmlr
            outbufflg = 25000
          IMPORTING
            outbuff   = lv_xstr.
        CONCATENATE p_xml lv_xstr INTO p_xml IN BYTE MODE.
    Maybe somebody can help me.
    Thanks a lot.

    I got it!
    This thread helped me.
    [http://forums.sdn.sap.com/thread.jspa?threadID=1343796|http://forums.sdn.sap.com/thread.jspa?threadID=1343796]

  • Create xml tag dynamically within simple transformation

    Hi all together,
    I'm faceing the following problem:
    There is a internal table provided, consisting of name/value-pairs. Something like
    ls_struc-name = 'NAME1'.
    ls_struc-value = 'XYZ'.
    append ls_struc to lt_struc
    ls_struc-name = 'CITY1'.
    ls_struc-value = 'Munich'.
    append ls_struc to lt_struc
    and so on.
    I have to create this XML (with simple transformation):
    <NAME1>XYZ</NAME1>
    <CITY1>Munich</CITY1>
    Everythings works fine so far (tables, values etc.), but I have problems with creating the XML-Tag, e.g <NAME1> from "$line.name" within the transformation. I don't have any information about the data structure (therefore "call transaction id" does not work).
    Any hint is useful!!!
    Best regards,
    Thomas

    Exaple program for creating XML file from abap
    REPORT  z_xit_xml_dom_create.
      TYPE-POOLS: ixml.
      TYPES: BEGIN OF xml_line,
              data(256) TYPE x,
             END OF xml_line.
      DATA: l_ixml            TYPE REF TO if_ixml,
            l_streamfactory   TYPE REF TO if_ixml_stream_factory,
            l_ostream         TYPE REF TO if_ixml_ostream,
            l_renderer        TYPE REF TO if_ixml_renderer,
            l_document        TYPE REF TO if_ixml_document.
      DATA: l_element_flights TYPE REF TO if_ixml_element,
            l_element_airline TYPE REF TO if_ixml_element,
            l_element_flight  TYPE REF TO if_ixml_element,
            l_element_from    TYPE REF TO if_ixml_element,
            l_element_to      TYPE REF TO if_ixml_element,
            l_element_dummy   TYPE REF TO if_ixml_element,
            l_value           TYPE string.
      DATA: l_xml_table       TYPE TABLE OF xml_line,
            l_xml_size        TYPE i,
            l_rc              TYPE i.
      DATA: lt_spfli          TYPE TABLE OF spfli.
      DATA: l_spfli           TYPE spfli.
      START-OF-SELECTION.
    *   Fill the internal table
        SELECT * FROM spfli INTO TABLE lt_spfli.
    *   Sort internal table
        SORT lt_spfli BY carrid.
    *   Start filling xml dom object from internal table
        LOOP AT lt_spfli INTO l_spfli.
          AT FIRST.
    *       Creating a ixml factory
            l_ixml = cl_ixml=>create( ).
    *       Creating the dom object model
            l_document = l_ixml->create_document( ).
    *       Fill root node with value flights
            l_element_flights  = l_document->create_simple_element(
                        name = 'flights'
                        parent = l_document ).
          ENDAT.
          AT NEW carrid.
    *       Create element 'airline' as child of 'flights'
            l_element_airline  = l_document->create_simple_element(
                        name = 'airline'
                        parent = l_element_flights  ).
    *       Create attribute 'code' of node 'airline'
            l_value = l_spfli-carrid.
            l_rc = l_element_airline->set_attribute( name = 'code' value = l_value ).
    *       Create attribute 'name' of node 'airline'
            SELECT SINGLE carrname FROM scarr INTO l_value WHERE carrid EQ l_spfli-carrid.
            l_rc = l_element_airline->set_attribute( name = 'name' value = l_value ).
          ENDAT.
          AT NEW connid.
    *       Create element 'flight' as child of 'airline'
            l_element_flight  = l_document->create_simple_element(
                        name = 'flight'
                        parent = l_element_airline  ).
    *       Create attribute 'number' of node 'flight'
            l_value = l_spfli-connid.
            l_rc = l_element_flight->set_attribute( name = 'number' value = l_value ).
          ENDAT.
    *     Create element 'from' as child of 'flight'
          CONCATENATE l_spfli-cityfrom ',' l_spfli-countryfr INTO l_value.
          l_element_from  = l_document->create_simple_element(
                      name = 'from'
                      value = l_value
                      parent = l_element_flight  ).
    *     Create attribute 'airport' of node 'from'
          l_value = l_spfli-airpfrom.
          l_rc = l_element_from->set_attribute( name = 'airport' value = l_value ).
    *     Create element 'to' as child of 'flight'
          CONCATENATE l_spfli-cityto ',' l_spfli-countryto INTO l_value.
          l_element_to  = l_document->create_simple_element(
                      name = 'to'
                      value = l_value
                      parent = l_element_flight  ).
    *     Create attribute 'airport' of node 'from'
          l_value = l_spfli-airpto.
          l_rc = l_element_to->set_attribute( name = 'airport' value = l_value ).
    *     Create element 'departure' as child of 'flight'
          l_value = l_spfli-deptime.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'departure'
                      value = l_value
                      parent = l_element_flight ).
    *     Create element 'arrival' as child of 'flight'
          l_value = l_spfli-arrtime.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'arrival'
                      value = l_value
                      parent = l_element_flight ).
    *     Create element 'type' as child of 'flight'
          CASE l_spfli-fltype.
            WHEN 'X'.
              l_value = 'Charter'.
            WHEN OTHERS.
              l_value = 'Scheduled'.
          ENDCASE.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'type'
                      value = l_value
                      parent = l_element_flight ).
        ENDLOOP.
        IF sy-subrc NE 0.
          MESSAGE 'No data into db table ''spfli'', please run program ''SAPBC_DATA_GENERATOR'' with transaction ''SA38''' TYPE 'E'.
        ENDIF.
    *   Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
    *   Connect internal XML table to stream factory
        l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
    *   Rendering the document
        l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                                              document = l_document ).
        l_rc = l_renderer->render( ).
    *   Saving the XML document
        l_xml_size = l_ostream->get_num_written_raw( ).
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            bin_filesize = l_xml_size
            filename     = 'c:\temp\flights.xml'
            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.

  • Create XML file from ABAP with SOAP Details

    Hi,
    I am new to XML and I am not familiar with JAVA or Web Service. I have searched in SDN and googled for a sample program for creating XML document from ABAP with SOAP details. Unfortunately I couldn't find anything.
    I have a requirement for creating an XML file from ABAP with SOAP details. I have the data in the internal table. There is a Schema which the client provided and the file generated from SAP should be validating against that Schema. Schema contains SOAP details like Envelope, Header & Body.
    My question is can I generate the XML file using CALL TRANSFORMATION in SAP with the SOAP details?
    I have tried to create Transformation (Transaction XSLT_TOOL) in SAP with below code. Also in CALL transformation I am not able to change the encoding to UTF-8. It's always show UTF-16.
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:template match="/">
        <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
          <SOAP:Header>
            <CUNS:HeaderInfo>
              <CUNS:InterfaceTypeId>10006</InterfaceTypeId>
              <CUNS:BusinessPartnerID>11223344</BusinessPartnerID>
              <CUNS:SchemaVersion>1.0</SchemaVersion>
              <CUNS:DateTime>sy-datum</DateTime>
            </CUNS:HeaderInfo>
          </SOAP:Header>
          <SOAP:Body>
            <xsl:copy-of select="*"/>
          </SOAP:Body>
        </SOAP:Envelope>
      </xsl:template>
    </xsl:transform>
    In ABAP program, I have written below code for calling above Transformation.
      call transformation ('Z_ID')
           source tab = im_t_output[]
           result xml xml_out.
      call function 'SCMS_STRING_TO_FTEXT'
        exporting
          text      = xml_out
        tables
          ftext_tab = ex_t_xml_data.
    Please help me how to generate XML file with SOAP details from ABAP. If anybody have a sample program, please share with me.
    Is there any easy way to create the XML file in CALL Transformation. Please help.
    Thanks

    Try ABAP forum, as it seems not to be PI related.

  • Create xml file with nested internla table or with header & item tables

    Hi I have a requirement like, I need to create an xml file for header and item details. For 1 header there may be multiple line items.
    I did search in forums some where I came to know that we can use XSL:IF to achieve this. but I could not able to do this.
    I tried with using nested internal tables also but now luck.
    can anybody please suggest how can we create xml for header and item detials.
    <xsl:transform version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:sap="http://www.sap.com/sapxsl"
      xmlns:asx="http://www.sap.com/abapxml"
      exclude-result-prefixes="asx"
    >
    <xsl:template match="/">
      <OrbisomRequest>
        <xsl:attribute name="Version">
          <xsl:value-of select="11.1"/>
        </xsl:attribute>
        <xsl:attribute name="IssuerID">
          <xsl:value-of select="1"/>
        </xsl:attribute>
        <xsl:for-each select="asx:abap[1]/asx:values[1]/T_FINAL[1]/*">
    <CreateApprovedPurchaseRequest
           RerquestID="{VBLNR}"
           CommonName="User1"
           Amount="{WRBTR}"
           Comment="TestComment"
           CurrencyCode="978"
           PurchaseType="All"
           SupplierName="All"
           VCardAlias="PurchaseCard"
           ValidFrom="1M"
           CurrencyType="B">
                    <CDFs>
                      <Invoice> <xsl:value-of select="BELNR"/> </Invoice>
                      <Amount> <xsl:value-of select="WRBTR"/> </Amount>
                    </CDFs>
          </CreateApprovedPurchaseRequest>
        </xsl:for-each>
      </OrbisomRequest>
    </xsl:template>
    </xsl:transform>
    here belnr and wrbtr will be my item details. for each payment document I can have multiple invoices. in CDF I need to display the invoices for that particular payment document.
    what conditions can I put there before CDFs to make the item internal table to loop based on header internal table.
    Regards,
    Ranganadh.

    Looks like you have already created the transformation "Z_ID"
    Take a look at the following thread, it answers many of the questions you have asked:
    [ABAP data to XML conv with UTF-8 encoding and custom namespace|Re: ABAP data to XML conv with UTF-8 encoding and custom namespace;
    Che

  • File size problem when performing XML Transformation into Excel

    Hi All,
    We are performing XML Transformation in ABAP which can open in Excel and saving to common share. But the file size of excel is around 50MB. After opening the excel and save with diffrent name the file is getting compressed and its below 1MB. So what kind of settings does we need to make to the transformation code which will create the excel files with less memory/size??
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
    <tt:root name="AAAAAAA"/>
    <tt:root name="BBBBBBBB"/>
    <tt:root name="CCCCCCCC"/>
    <tt:template>
    <?mso-application progid="Excel.Sheet"?>
    <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:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
    xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:html="http://www.w3.org/TR/REC-html40">
       <ProtectObjects>True</ProtectObjects>
       <ProtectScenarios>True</ProtectScenarios>
      </WorksheetOptions>
    </Worksheet>
    </Workbook>
    </tt:template>
    </tt:transform>
    <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
    </DocumentProperties>
    <CustomDocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
      <ContentTypeId dt:dt="string">0x01010049B4763FE606154C9C9BC639FE7EE179</ContentTypeId>
    </CustomDocumentProperties>
    <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
      <Colors>
       <Color>
        <Index>0</Index>
        <RGB>#FF0000</RGB>
       </Color>
       <Color>
        <Index>1</Index>
        <RGB>#FFE4B5</RGB>
       </Color>
       <Color>
        <Index>2</Index>
        <RGB>#FFF8DC</RGB>
       </Color>
       <Color>
        <Index>3</Index>
        <RGB>#000000</RGB>
       </Color>
      </Colors>
    </OfficeDocumentSettings>
    <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
      <WindowHeight>7305</WindowHeight>
      <WindowWidth>11340</WindowWidth>
      <WindowTopX>0</WindowTopX>
      <WindowTopY>0</WindowTopY>
      <TabRatio>334</TabRatio>
      <ProtectStructure>True</ProtectStructure>
      <ProtectWindows>False</ProtectWindows>
    </ExcelWorkbook>
    </DocumentProperties>
    <CustomDocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
      <ContentTypeId dt:dt="string">0x01010049B4763FE606154C9C9BC639FE7EE179</ContentTypeId>
    </CustomDocumentProperties>
    <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">

    Hi Raghu,
    have a look at the XLSX file generated by Excel, you'll see that it's simply a zipped file. So you can't do it with a transformation, but you need CL_ABAP_ZIP class. I advise you to look at the abap2xslx project ABAP code (currently 3.0) to see how it works.
    Best regards,
    Sandra

  • ABAP to XML Transformation Dynamic Element Generation

    Hi all,
    I have created a deep structure and used simple transformation in XSLT Tool to create XML file. But I would like to generate some elements dynamically. Desired XML output is in the attachments.
    There is a way to do that if had used XSLT Program instead of simple transformation (dynamic xml nodes using xslt - Stack Overflow) but XSLT Program does not create fields from structures automatically like simple transformation.
    So, is there any way to do that using simple transformation ?
    Thanks.

    The error is related to your web browser software or release, because it can't support utf-16 xml file (for example, IE 6 doesn't support it).
    Your output file contains <?xml version="1.0" encoding="utf-16"?> in your ECC 6 system because your SAP system is Unicode, and you used a variable of character type behind RESULT XML. When it's character, SAP converts the XML into SAP code page. If you use a byte type behind RESULT XML, SAP doesn't convert, and you'll get the XML data in the encoding of the transformation (defined here: <xsl:output encoding="ISO-8859-1" ...).
    I guess you have choosen ISO-8859-1 because your 4.7 system issued a file with that encoding.
    So, the only thing you have to do, in the call transformation statement, is to store the result into a table of X255 (instead of table of CHAR2048).
    Edited by: Sandra Rossi on Jul 6, 2010 4:14 PM CET:
    You must also download using filetype = 'BIN'

  • XML transformation for internal table

    Hi Experts,
    Here is the sample transformation code which is generated for a transformation I had created.
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates" xmlns:ddic="http://www.sap.com/abapxml/types/dictionary" xmlns:def="http://www.sap.com/abapxml/types/defined">
      <tt:root name="ROOT" type="?"/>
      <tt:root name="ZPAYLOAD" type="ddic:ZPAYDATA"/>
      <tt:template>
       <payload-data>
        <record>
         <rec-data>
          <tt:loop ref=".ZPAYLOAD">
            <DATA tt:value-ref = 'DATA'/>
          </tt:loop>
         </rec-data>
        </record>
        </payload-data>
      </tt:template>
    </tt:transform>
    Here I am passing an internal table with only one field which has three lines say 'Line1', 'Line2',' Line3' to the multi-line structure 'DATA' in the transformation.
    when I receive the XML structure from transformation, It looks as like below.
    <payload-data>
    <record>
    <rec-data>
    <DATA>Line1</DATA>
    <DATA>Line2</DATA>
    <DATA>Line3</DATA>
    </payload-data>
    </record>
    </rec-data>
    However I want the XML structure like
    <payload-data>
    <record>
    <rec-data>
    <DATA>
    Line1
    Line2
    Line3
    </DATA>
    </payload-data>
    </record>
    </rec-data>
    Is it possible to receive the XML structure like above in the XML transformation?
    It would be great, if you can provide the solution at the earliest.
    Thanks in Advance.
    Regards
    K Arasu

    Hi kaushik,
    have you found a solution to this problem? I have the same requirement.
    Best regards
    Gregor

  • Using XML Transformations in CR Runtime or Viewer

    Using Crystal Reports 2008 I have created a report and written an XML Transformation to export the report when it's been run.  When I select the Export function I'm asked:
       1. The Format (XML) and Destination (Disk File)
       2. To choose and XML exporting format (my transformation)
       3. The export file name
    The file is then created
    The report is then made available to my users via the Crystal Report Runtime.  When they run the report the expected report is displayed, however, when they try to export although they can select the XML format they cannot select the destination or the XML exporting format.  The XML file that is created is empty, i.e. it has no content.
    I've also looked at using the Crystal Reports Viewer but this can't even export to XML.
    How can I enable them to select the destination and XML export format without providing them with the full Crystal Reports?

    Hi Colin,
    Your developer can fin samples here: http://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsSDKSampleApplications
    And if he posts and searches on the SDK forum he'll find samples also.
    Don

  • Custom xml transformer provider for xml iview template

    I have been trying to get a custom simple xml transformer to work, which will show up in the xml iview template.  I have seen the SAP Help docs and the recent weblogs on the subject.  I can't get this simple transform functionality to work.  I can get as far as registering my own transformer, however I get an error on the page when trying to use it: "Error while using XML iView, please contact your system administrator."  My understanding was all I needed to do was provide a xsl, a transformers.xml file, and a service reference in the portalapp.xml.
    All I really want to do is take some xml docs I created and display them in the portal.  I know that I can write a quick java app to do this myself.  However, I am trying to use the built in functionality of the portal (which it appears no one is using except for RSS feeds).
    I would prefer to have the output be htmlb from my xsl file.  My understanding was that I should create my own xml tranformer provider and then also use the XHTMLB --> HTMLB built in transformer.
    Has anyone been successful in trying to create their own xml transformer for the xml iView?
    I am wasting a lot of time trying to use methods in the SAP Help Docs, is it worth the effort to use the transformer method?
    Eager to award points,
    Sean

    Hi
    I have successfully deployed a transformer by doing the following:
    In PAR, in /dist/xml/XSLLibrary/Transformers, put XSL
    In /dist/xml, put transformers.xml file that describes the XSL
    In portalapp.xml, add registry entry for transformer and service entry for transformer service.
    If you want, you can send transformer PAR and I can look at it ([email protected]).
    There could be something wrong with the XSL; this would be more complicated to diagnose.
    Daniel

  • Custom XML Transformer Error

    I have created a custom XML Transformer using the SAP Library article:
    http://help.sap.com/saphelp_nw04/helpdata/en/e1/98e14110340b7fe10000000a155106/frameset.htm
    I created the project and uploaded the PAR file but when I try to create an XML iView I get to the part where I enter the URL and when I click "Next" I get the following error:
    Caused by: com.sapportals.portal.prt.core.broker.PortalApplicationNotFoundException: Could not find portal application com.sap.portal.EmptyTransformersProvider...
    In the PAR Structure section it says - The Par File must have the following folder structure:
    dist->PORTAL-INF->portalapp.xml
    dist->PORTAL-INF->xml->XSLLibrary->Transformers (My custom XSL File (stock.xsl) is HERE)
    dist->PORTAL-INF->xml->Transfomers.xml
    This I have completed however, it also shows two files under the project:
    EmptyTransformersProvider.etz
    com.sap.portal.EmptyTransformersProvider.par
    What are these files and how do I create/add them? 
    I noted that the name of the Project created here is EmptyTransformersProvider but my project is named ep_sts does this matter?
    Also if it matters:  this is a DC which I created in NWDS using Enterprise Portal->Portal Application Module.
    Lastly I have tested the XSL using Internet explorer and an XML File and it workes fine so I would assume it is not the XSL causing the error.

    Hello
    As i've created my own transform according to the tutorial, it doesnt appear in the list of available transforms either in the xml iview wizard or editor.
    Any idea ?
    previously I had the same error resolved by naming the project with the right name.
    Thanks

  • How do I upload XML files into sap table?

    Dear all,
    I found some methods that upload xml into SAP,
    but there doesn’t work under 4.6c.
    Can someone tell me how to upload XML files into
    sap under 4.6c?
    THX!

    hi,
    You can convert XML to abap using transformations. Simple transformations is a proprietary SAP programming language that describes the transformation of ABAP data to XML (serialization) and from XML to ABAP data (deserialization).
    goto SE80->workbench->edit object(or other objects)->in object selection chose more tab and then choose the transformation radio button and write a name and click create new.
    Here you enter your transformation like
    <xsl:transform version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:sap="http://www.sap.com/sapxsl"
    >
    <xsl:strip-space elements="*"/>
    <xsl:template match="/">
      <xsl:copy-of select="."/>
    </xsl:template>
    </xsl:transform>
    You can use this transfomation in your program using call transformation. You can find more info on call transformation in help.
    Hope this helps.
    Regards,
    Richa

Maybe you are looking for

  • Is it possible to call the Print Quote functionality from Custom ADF page

    Hi, We are researching if it is possible to call the Print Quote functionality from the Custom ADF application. Goal is to pop up the PDF report upon clicking the Print Quote button on the custom page. Is it possible ? Atleast advice on the direction

  • Linking between projects

    Is there any way I can move one completed project to put with another one? I am currently using imovie 4! Also just bought ilife 6 so I can burn using and external dvd drive but causing problems on my emac so have gone back to the projects on my powe

  • How to call driver program internal table in a form

    how to call driver program internal table in a form? Given below is my code TABLES: VBRK,VBAK,ADRC,KNA1,VBRP,VBAP,J_1IMOCOMP. DATA: BEGIN OF IT_CUST_ADD OCCURS 0, STREET LIKE ADRC-STREET, NAME LIKE ADRC-NAME1, POST_CODE LIKE ADRC-PSTCD1, CITY LIKE AD

  • Palm phone call record

    I am no longer able to access the phone log on my Treo 650 by pushing the send buttom twice. the automatically generated incoming and outgoing phone log seems to have vanished. Can anyone offer some asssistance please? Post relates to: Treo 650 (Unlo

  • Unable to locate page align set-up

    I recently changed all 4 ink cartridges, but the print is printing blank pages.  unable to locate the page alignment set-up