Boolean Values in CALL TRANSFORMATION id ?

Hi,
I have Boolean values of the XSDBOOLEAN Domain, so ABAP->XML "id" transformation returns  "True" and "False" for these values. What I need are "X" and " " respectively.
The questions is: can I use the modified transformation "id" to replace the "True" and "False" with "X" and " ", and how the modified transformation should look like?
Thanks, Srdjan

I couldn't find domain XSDBOOLEAN in our system, however you should use the values defined in the Value range tab.
Peter

Similar Messages

  • 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

  • XML to ABAP internal table with CALL TRANSFORMATION

    I can't create a transformation that allow passing next XML file  to an internal table:
    Please, I need someone could help me, because I don t have XML knowledge
    << Moderator message - Everyone's problem is important. But the answers in the forum are provided by volunteers. Please do not ask for help quickly. >>
    Kind regards,
    Edited by: Rob Burbank on Jul 21, 2011 4:02 PM

    Hi Gastón Juarez,
    sorry, didn't see your post, you should have linked the previous to this one
    If we create a ZZZ transformation of type ST, it would be something like this (I didn't test). Note that I concatenated the date and time, because field operations in ST are not possible (we should use XSLT instead, but it's counter performant): 
    ... (here the usual header)
    <tt:root name="ABAP_X"/>
    <tt:template>
      <corailExport xmlns= " http://www.abc.com/corailExport_Transcou201D
    xmlns: xsi= " http://www.w3.org/2001/XMLSchema-instanceu201D
    xsi: schemaLocation= " http://www.abc.com/corailExport_Transco corailExport_Transco.xsd u201C>
        <exportDate><tt:skip></tt:skip></exportDate>
        <tt:loop ref=".ABAP_X" name="line">
          <transcodification>
                 <tt:attribute name="applyingDate" value-ref="$line.APPLYING_DATE"></tt:attribute>
            <previousCofor><tt:value ref="$line.OLD_COFOR"></tt:value></previousCofor>
            <newCofor><tt:value ref="$line.NEW_COFOR"></tt:value></newCofor>
          </transcodification>
        </tt:loop>
      </corailExport>
    </tt:template>
    The program:
    TYPES : BEGIN OF ty_x,
    applying_date TYPE string,
    old_cofor TYPE lifnr,
    new_cofor TYPE lifnr,
    END OF ty_x.
    DATA l_xml TYPE string.
    DATA lt_x TYPE TABLE OF ty_x.
    l_xml = 'your xml'.
    CALL TRANSFORMATION zzz
       SOURCE XML l_xml
       RESULT abap_x = lt_x.
    BR
    Sandra

  • Create a xml file from an internal table: CALL TRANSFORMATION

    Hello gurus,
    I want to create a xml file using data from scustom table. I will create an internal table and will select some records to it.
    I searched the forum and i discovered the call transformation, but when i execute the example program at the CALL TRANSFORMATION shows a dump screen.
    How we create a xml file from internal table??
    Please help me. I will mark the useful answers.

    I'm using if_ixml class to create xml documents
    TYPES: BEGIN OF xml_line,
             data(256) TYPE x,
           END OF xml_line.
    DATA: o_ixml          TYPE REF TO if_ixml,
          o_document      TYPE REF TO if_ixml_document,
          o_element       TYPE REF TO if_ixml_element,
          o_streamfactory TYPE REF TO if_ixml_stream_factory,
          o_ostream       TYPE REF TO if_ixml_ostream,
          o_renderer      TYPE REF TO if_ixml_renderer.
    DATA: t_xml_table     TYPE TABLE OF xml_line,
          v_xml_size      TYPE i.
    o_ixml = cl_ixml=>create( ).
    o_document = o_ixml->create_document( ).
    * The o_document have a set of methods to add elements, attributes, etc.
    o_element  = o_document->create_simple_element(
                      name = 'RootNode'
                      value = 'some text'
                      parent = o_document ).
    o_streamfactory = o_ixml->create_stream_factory( ).
    o_ostream = o_streamfactory->create_ostream_itable( table = t_xml_table ).
    o_renderer = o_ixml->create_renderer( ostream  = o_ostream document = o_document ).
    o_renderer->render( ).
    v_xml_size = o_ostream->get_num_written_raw( ).
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        bin_filesize = v_xml_size
        filename     = 'C:a.xml'
        filetype     = 'BIN'
      CHANGING
        data_tab     = t_xml_table.

  • XML to Internal table using XSLT by CALL TRANSFORMATION error

    Dear experts,
    I have to fetch the data from an XML file using XSLT into internal tables. The XML file is very big as following:-
    <?xml version="1.0" standalone="yes" ?>
    - <Shipment>
      <shipmentID>25091203S000778</shipmentID>
      <manifestDateTime>2009-12-03T20:16:52.00</manifestDateTime>
      <shipmentFacilityNumber>025</shipmentFacilityNumber>
      <shipmentFacilityAbbreviation>CHI</shipmentFacilityAbbreviation>
      <shipmentFacilityAddress1>810 KIMBERLY DRIVE</shipmentFacilityAddress1>
      <shipmentFacilityAddress2 />
      <shipmentFacilityCity>CAROL STREAM</shipmentFacilityCity>
      <shipmentFacilityState>IL</shipmentFacilityState>
      <shipmentFacilityPostalCode>601880000</shipmentFacilityPostalCode>
      <shipmentTruckCarrierCode>X150</shipmentTruckCarrierCode>
      <shipmentSourceCode>T</shipmentSourceCode>
      <userID>CAMPOSG</userID>
    - <Delivery>
      <primaryCustomerNumber>954371</primaryCustomerNumber>
      <primaryCustomerName>MIDWEST OFFICE SUPPLY</primaryCustomerName>
      <primaryCustomerAddress1 />
      <primaryCustomerAddress2>4765 INDUSTRIAL DR</primaryCustomerAddress2>
      <primaryCustomerCity>SPRINGFIELD</primaryCustomerCity>
      <primaryCustomerState>IL</primaryCustomerState>
      <primaryCustomerPostalCode>627030000</primaryCustomerPostalCode>
      <primaryCustomerPhoneNumber>2177535555</primaryCustomerPhoneNumber>
      <shuttleStopFacilityNumber />
      <billOfLadingNumber>25HZK99</billOfLadingNumber>
      <carrierProNumber />
      <shipmentTotalCartonCount>6</shipmentTotalCartonCount>
      <shipmentTotalWeight>266</shipmentTotalWeight>
    - <order>
      <orderNumber>25HZK99</orderNumber>
      <subOrderNumber />
      <dateProcessed>2009-12-03</dateProcessed>
      <primaryOrderNumber />
      <shipTruckCode>X150</shipTruckCode>
      <shipTruckDescription>UDS - ADDISON</shipTruckDescription>
      <shipTruckPriorityCode>01</shipTruckPriorityCode>
      <shipTruckGroupCode>01</shipTruckGroupCode>
      <shipTruckDepartureTime>20.00.00</shipTruckDepartureTime>
      <shipTruckDockID>07</shipTruckDockID>
      <ldpFacilityAbbreviation />
      <shuttleAvailableIndicator>N</shuttleAvailableIndicator>
      <shuttleMessageText />
      <crossDockFacilityCode />
      <crossDockTruckCode />
      <crossDockID />
      <subsidizedFreightTruckID />
      <customerPurchaseOrderNumber>623559</customerPurchaseOrderNumber>
      <headerTypeCode>P</headerTypeCode>
      <orderTypeID>RG</orderTypeID>
      <deliveryTypeID>DS</deliveryTypeID>
      <deliveryMethodCode />
      <customerBarCode />
      <customerReferenceData>25HZK99</customerReferenceData>
      <customerReferenceText />
      <customerRouteData>ZNED UNTED</customerRouteData>
      <customerRouteText>ROUTE</customerRouteText>
      <endConsumerPurchaseOrderNumber />
      <endConsumerPurchaseOrderText />
      <endConsumerName>CHARLESTON TRANS. FACILITY</endConsumerName>
      <endConsumerAddress1>HOMEWOOD DT PROGRAM DEPT. 3</endConsumerAddress1>
      <endConsumerAddress2>17341 PALMER BLVD.</endConsumerAddress2>
      <endConsumerAddress3 />
      <endConsumerCity>HOMEWOOD</endConsumerCity>
      <endConsumerState>IL</endConsumerState>
      <endConsumerPostalCode>60430</endConsumerPostalCode>
      <endConsumerCountryCode />
      <fillFacilityNumber>025</fillFacilityNumber>
      <shpFacilityNumber>025</shpFacilityNumber>
      <homeFacilityAbbrCode>STL</homeFacilityAbbrCode>
      <homeFacilityNumber>015</homeFacilityNumber>
      <multiCartonIndicator>Y</multiCartonIndicator>
      <primaryCustomerIndicator>Y</primaryCustomerIndicator>
      <shipToCustomerNumber>954371001</shipToCustomerNumber>
      <customerCompanyID>01</customerCompanyID>
      <customerTruckID>U888</customerTruckID>
      <customerTruckDescription>UDS - ADDISON</customerTruckDescription>
      <customerTruckDockID>13</customerTruckDockID>
      <thirdPartyBillCarrier />
      <thirdPartyBillID />
      <thirdPartyBillType />
      <qualityCheckIndicator>N</qualityCheckIndicator>
      <warehouseLaydownID />
      <packListPosition>I</packListPosition>
      <preferredPackingType>CTN</preferredPackingType>
      <preferredPackingMaterial>PAPER</preferredPackingMaterial>
      <preferedPackingInstructions />
      <totalOrderCartonQty>6</totalOrderCartonQty>
      <convertAddressIndicator>N</convertAddressIndicator>
      <dealerInstructionIndicator>Y</dealerInstructionIndicator>
      <dealerinstructions1>CPO#: 623559</dealerinstructions1>
      <dealerinstructions2>ATTN: DANA GRIFFIN</dealerinstructions2>
      <dealerinstructions3>INFO: 612</dealerinstructions3>
      <dealerinstructions4>ROUTE: ZNED UNTED</dealerinstructions4>
      <dealerinstructions5 />
      <dealerinstructions6 />
      <shippingInstructionsIndicator>N</shippingInstructionsIndicator>
      <shippingInstructions1 />
      <shippingInstructions2 />
      <shippingInstructions3 />
      <shippingInstructions4 />
      <shippingInstructions5 />
      <shippingInstructions6 />
      <specialInstructionsIndicator>N</specialInstructionsIndicator>
      <specialInstructions1 />
      <specialInstructions2 />
      <customeContainerDesc />
    - <carton>
      <deliveryCartonID>253370905995</deliveryCartonID>
      <shipIndicator>Y</shipIndicator>
      <deliveryPalletID>X150</deliveryPalletID>
      <consolidatedDeliveryCartonID />
      <scanDateTime>2009-12-03T19:36:12.00</scanDateTime>
      <cartonWeight>52</cartonWeight>
      <dropShipFlag>1</dropShipFlag>
      <carrierTrackingNumber />
      <carrierZoneID>0</carrierZoneID>
      <codAmount />
      <customerPackageAmount />
      <declaredValue />
      <residentialDeliveryIndicator />
      <serviceTypeCode>00</serviceTypeCode>
      <ssccCode>006860244400829393</ssccCode>
    - <Item>
      <shipPrefix>UNV</shipPrefix>
      <shipStockNumber>21200</shipStockNumber>
      <itemDescription>PAPER XERO/DUP WE LTR 20#</itemDescription>
      <orderQuantity>1</orderQuantity>
      <originalShipQuantity>1</originalShipQuantity>
      <shipQuantity>1</shipQuantity>
      <inventoryUnitCode>CT</inventoryUnitCode>
      <inventoryWeightQuantity>52.000</inventoryWeightQuantity>
      <upcNumber>00000000000000</upcNumber>
      <upcRetailCode>087547212004</upcRetailCode>
      <hazmatIndicator>N</hazmatIndicator>
      <serialRequiredIndicator>N</serialRequiredIndicator>
      <dealerMemoPO>S</dealerMemoPO>
      <cartonLineNumber>1</cartonLineNumber>
      <orderLineNumber>11</orderLineNumber>
      <originalOrderPrefix>UNV</originalOrderPrefix>
      <originalOrderStockNumber>21200</originalOrderStockNumber>
      <reasonCode />
    - <Item_Serial>
      <serialNumber />
      </Item_Serial>
        </Item>
      </carton>
       </order>
      </Delivery>
      </Shipment>
    This is not the complete XML file as it exceeds the 15000 characters and then I cann't post here. So I have deleted much part of it.
    The hierarchy is as following: Shipment->Delivery->Order->Carton->Item.
    I have created a XSLT for it which is working fine.
    But when I execute my report program it gives CX_SY_XSLT_FORMAT_ERROR saying that
    Transformation error:  Non-canonical structure of element name XML_OUTPUT.

    Dear experts,
    My report program is as following:-
    *& Report  Z_ASNTRNS
    REPORT  Z_ASNTRNS.
    *& Report  Z_ASNTRNS
    TYPE-POOLS: abap, ixml.
    TABLES: ZASN_SHIPMENT,ZASN_DELIVERY,ZASN_ORDER,ZASN_CARTON,ZASN_ITEM.
    *CONSTANTS gs_file TYPE string VALUE 'C:Documents and SettingsC5134126DesktopRajesh_kandakatlaSampleASNFile.xml'.
    This is the structure for the data from the XML file
    TYPES: BEGIN OF ts_item,
          ZSHIPMENT LIKE ZASN_ITEM-ZSHIPMENT,
          VBELN LIKE ZASN_ITEM-VBELN,
          ORDER_NUMBER LIKE ZASN_ITEM-ORDER_NUMBER,
          CARTON_ID LIKE ZASN_ITEM-CARTON_ID,
           ITEM LIKE ZASN_ITEM-ITEM,
           CARTON_LINE_NUM LIKE ZASN_ITEM-CARTON_LINE_NUM,
           CARTON_LINE_NUMBER LIKE ZASN_ITEM-CARTON_LINE_NUM,
          AEDAT(8),
          AEZET(6),
           ITEM_DESCRIPTION LIKE ZASN_ITEM-ITEM_DESCRIPTION,
           ORD_QTY(16),
           ORIGINAL_SHIP(16),
           SHIP_QTY(16),
           UPC_NUMBER LIKE ZASN_ITEM-UPC_NUMBER,
           DEALER_MEMO_PO(5),
           ORDER_LINE_NUM LIKE ZASN_ITEM-ORDER_LINE_NUM,
          STATUS LIKE ZASN_ITEM-STATUS,
           END OF ts_item.
    TYPES: BEGIN OF ts_carton,
          ZSHIPMENT LIKE ZASN_CARTON-ZSHIPMENT,
          VBELN LIKE ZASN_CARTON-VBELN,
          ORDER_NUMBER LIKE ZASN_CARTON-ORDER_NUMBER,
           CARTON_ID LIKE ZASN_CARTON-CARTON_ID,
          AEDAT(8),
          AEZET(6),
           SHIP_INDICATOR LIKE ZASN_CARTON-SHIP_INDICATOR,
           TRACKING_NUMBER LIKE ZASN_CARTON-TRACKING_NUMBER,
           ZZCARTON_WGT(18),
           Item type ts_item,
           END OF ts_carton.
    TYPES: BEGIN OF ts_order,
          ZSHIPMENT LIKE ZASN_ORDER-ZSHIPMENT,
          VBELN LIKE ZASN_ORDER-VBELN,
           ORDER_NUMBER LIKE ZASN_ORDER-ORDER_NUMBER,
          AEDAT(8),
          AEZET(6),
           SUB_ORDER LIKE ZASN_ORDER-SUB_ORDER,
           ORDER_DATE(8),
           PRIMARY_ORDER LIKE ZASN_ORDER-PRIMARY_ORDER,
           CUSTOMER_PO LIKE ZASN_ORDER-CUSTOMER_PO,
           PRIMARY_ID LIKE ZASN_ORDER-PRIMARY_ID,
           SHIP_TO LIKE ZASN_ORDER-SHIP_TO,
          ANZPK(5),
           carton type ts_carton,
           END OF ts_order.
    TYPES: BEGIN OF ts_delivery,
          ZSHIPMENT LIKE ZASN_DELIVERY-ZSHIPMENT,
          VBELN LIKE ZASN_DELIVERY-VBELN,
          AEDAT(8) TYPE C,
          AEZET(6) TYPE C,
           PRIMARY_CUSTOMER LIKE ZASN_DELIVERY-PRIMARY_CUSTOMER,
           BILL_OF_LADING LIKE ZASN_DELIVERY-BILL_OF_LADING,
           CARTON_COUNT(5),
           TOTAL_WEIGHT(18),
           order type ts_order,
           END OF ts_delivery.
    TYPES: BEGIN OF ts_shipment,
           ZSHIPMENT LIKE ZASN_SHIPMENT-ZSHIPMENT,
           MANIFEST_DATE_TIME(25),
          AEDAT(8) TYPE C,
          AEZET(6) TYPE C,
          SDATE(8) TYPE C,
          STIME(6) TYPE C,
           SFACILITY_NUMBER LIKE ZASN_SHIPMENT-SFACILITY_NUMBER,
           ZZCARRIERCODE LIKE ZASN_SHIPMENT-ZZCARRIERCODE,
           Delivery type ts_delivery,
           END OF ts_shipment.
    TYPES: BEGIN OF ts_shipment1,
           ZSHIPMENT LIKE ZASN_SHIPMENT-ZSHIPMENT,
           MANIFEST_DATE_TIME(25),
           SFACILITY_NUMBER LIKE ZASN_SHIPMENT-SFACILITY_NUMBER,
           ZZCARRIERCODE LIKE ZASN_SHIPMENT-ZZCARRIERCODE,
           PRIMARY_CUSTOMER LIKE ZASN_DELIVERY-PRIMARY_CUSTOMER,
           BILL_OF_LADING LIKE ZASN_DELIVERY-BILL_OF_LADING,
           CARTON_COUNT(5),
           TOTAL_WEIGHT(18),
           ORDER_NUMBER LIKE ZASN_ORDER-ORDER_NUMBER,
           SUB_ORDER LIKE ZASN_ORDER-SUB_ORDER,
           ORDER_DATE(8),
           PRIMARY_ORDER LIKE ZASN_ORDER-PRIMARY_ORDER,
           CUSTOMER_PO LIKE ZASN_ORDER-CUSTOMER_PO,
           PRIMARY_ID LIKE ZASN_ORDER-PRIMARY_ID,
           SHIP_TO LIKE ZASN_ORDER-SHIP_TO,
           CARTON_ID LIKE ZASN_CARTON-CARTON_ID,
           SHIP_INDICATOR LIKE ZASN_CARTON-SHIP_INDICATOR,
           TRACKING_NUMBER LIKE ZASN_CARTON-TRACKING_NUMBER,
           ZZCARTON_WGT(18),
           ITEM LIKE ZASN_ITEM-ITEM,
           CARTON_LINE_NUM LIKE ZASN_ITEM-CARTON_LINE_NUM,
           CARTON_LINE_NUMBER LIKE ZASN_ITEM-CARTON_LINE_NUM,
           ITEM_DESCRIPTION LIKE ZASN_ITEM-ITEM_DESCRIPTION,
           ORD_QTY(16),
           ORIGINAL_SHIP(16),
           SHIP_QTY(16),
           UPC_NUMBER LIKE ZASN_ITEM-UPC_NUMBER,
           DEALER_MEMO_PO(5),
           ORDER_LINE_NUM LIKE ZASN_ITEM-ORDER_LINE_NUM,
           END OF ts_shipment1.
    TYPES: BEGIN OF t_xml_line,
                 data(256) TYPE x,
               END OF t_xml_line.
    *Typdefinition für Airplus
    *READ THE DOCUMENTATION "LASG_XML_INVOICE_BTM"!!!
    VARs beginning with "a_" are ATTRIBUTES
    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_ostream         TYPE REF TO if_ixml_ostream,
          l_document        TYPE REF TO if_ixml_document,
          l_node            TYPE REF TO if_ixml_node,
          l_xml TYPE REF TO cl_xml_document,
          l_xmldata         TYPE string.
    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.
    DATA: xml_out TYPE string ,
          size type i.
    DATA: l_xml_x1   TYPE xstring.
    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.
    DATA: BEGIN OF l_itab occurs 0,
          data(256) type c,
          end of l_itab.
    TYPES : BEGIN OF TY_TEXT,
              data(255) type C,
            END OF TY_TEXT.
    DATA: F_XML TYPE STRING.
    DATA : LT_TEXT_OUT type table of TY_TEXT with header line.
    tables
    DATA: it_shipment    TYPE STANDARD TABLE OF ts_shipment,
          wa_shipment    TYPE  ts_shipment.
    *Errorvariables
    DATA: xslt_err   TYPE REF TO cx_xslt_exception,
          err_string TYPE string.
    PARAMETERS: pa_file TYPE localfile OBLIGATORY
    DEFAULT 'C:Documents and SettingsC5134126DesktopRajesh_kandakatlaSampleASNFile.xml'.
    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.
    here we use the CALL TRANSFORMATION method which calls
    the XSLT program "z_asnfile"
    TRY.
        CALL TRANSFORMATION ('Z_ASNFILE')
          SOURCE xml LT_TEXT_OUT[]
          RESULT xml_output = it_shipment
    catch any error, very helpful if the XSLT isn't correct
        CATCH cx_xslt_exception INTO xslt_err.
        err_string = xslt_err->get_text( ).
        WRITE: / 'Transformation error: ', err_string.
        EXIT.
      ENDTRY." setting a breakpoint to watch the workarea
    by the internal table "it_airplus"
           break-point.
      LOOP AT it_shipment INTO wa_shipment.
      ENDLOOP.
    *&      Form  get_xml_table
      FORM get_xml_table CHANGING l_xml_table_size TYPE i
                                  l_xml_table      TYPE STANDARD TABLE.
        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.
    Convert binary to text.
    CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
      EXPORTING
        INPUT_LENGTH          = 70000
                FIRST_LINE            = 0
                LAST_LINE             = 0
                APPEND_TO_TABLE       = ' '
                MIMETYPE              = ' '
        WRAP_LINES            = 'X'
              IMPORTING
                OUTPUT_LENGTH         =
      TABLES
        BINARY_TAB            = l_xml_table
        TEXT_TAB              = LT_TEXT_OUT
              EXCEPTIONS
                FAILED                = 1
                OTHERS                = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    "get_xml_table

  • XML file to Internal table through XSLT - Call Transformation

    Hi Friends,
    I am trying to work a scenario where i have a simple XML file and i need to convert the data in to an internal table. When i execute the XSLT seperately, it works fine. I get the output, but when it is invoked through a ABAP program, i am getting the error "The called method START_XSLT_DEBUGGER of the calss CL_WB_XSLT_DEBUGGER returned the exception CX_XSLT_FORMAT_ERROR"
    I feel my XSLT program is not correct, but i am unable to find out what the issue is. Any help is really apreciated. I have gone through the SDN forum replies. But could not figure out what is wrong with my program
    Below given are the details.
    My XML File:
    <?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 program:
    <xsl:transform 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" version="1.0">
      <xsl:strip-space elements="*"/>
      <xsl:output encoding="utf-8" indent="yes" omit-xml-declaration="yes"/>
      <!--xsl:template match="/"-->
      <xsl:template match="List">
        <asx:abap version="1.0">
          <asx:values>
            <T_ACTUAL>
              <xsl:for-each select="*">
                <ITEMQUALF>
                  <xsl:value-of select="ITEMQUALF" />
                </ITEMQUALF>
                <MATERIAL>
                  <xsl:value-of select="MATERIAL" />
                </MATERIAL>
              </xsl:for-each>
            </T_ACTUAL>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    In my ABAP program:
    REPORT  z_xslt_abap_2.
    TYPES:
      BEGIN OF ty_actual,
        itemqualf   TYPE char50,
        material    TYPE char50,
      END OF ty_actual,
      line_t(4096)  TYPE x,
      table_t       TYPE STANDARD TABLE OF line_t,
      ty_t_actual   TYPE STANDARD TABLE OF ty_actual.
    DATA:
      t_actual    TYPE ty_t_actual,
      t_srctab    TYPE table_t,
      v_filename  TYPE string.
    DATA: gs_rif_ex     TYPE REF TO cx_root,
          gs_var_text   TYPE string.
    v_filename = 'D:\XML\xslt_test.xml'.
    * Function call
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename = v_filename
        filetype = 'BIN'
      TABLES
        data_tab = t_srctab
      EXCEPTIONS
        OTHERS   = 1.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * Call Transformation
    TRY.
        CALL TRANSFORMATION (`ZXSLT_RAM`)
                SOURCE XML t_srctab
                RESULT     t_actual = t_actual.
      CATCH cx_root INTO gs_rif_ex.
        gs_var_text = gs_rif_ex->get_text( ).
        MESSAGE gs_var_text TYPE 'E'.
    ENDTRY .
    IF t_actual IS NOT INITIAL.
      WRITE: 'Success'.
    ENDIF.
    When i run the XSLT program seperately, this is the output that i get:
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
      <asx:values>
        <T_ACTUAL>
          <ITEMQUALF>ITEM1</ITEMQUALF>
          <MATERIAL>MAT1</MATERIAL>
          <ITEMQUALF>ITEM2</ITEMQUALF>
          <MATERIAL>MAT2</MATERIAL>
          <ITEMQUALF>ITEM3</ITEMQUALF>
          <MATERIAL>MAT3</MATERIAL>
        </T_ACTUAL>
      </asx:values>
    </asx:abap>
    I have been stuck with this for more than two days. If anyone can help me out with this, it would be really great. Please let me know, where i am going wrong.
    Thanks in advance.
    Best Regards,
    Ram.

    Hi,
    You can try this sample program, hopefully will help you.
    <a href="https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/readdatafromXMLfileviaXSLT+program&">Read Data From XML</a>.
    Regards,

  • 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 in Call transformation - xslt program

    Hi Experts,
    For the below XML file i have declared the XSLT Program  as described.
    i am not able to get the data into Internal table.
    Could you pls help me in where am i going wrong?
    Is it XSLT declaration or what?
    Data declarations
    TYPES: BEGIN OF TY_BH,
            RECORDTYPE(02), " Record Type
            DOCTYPE(02),      " Document type
            REFERENCE(16),      " Reference Document Number
            DOCUMENTDATE(08),      " Document Date in Document
            POSTINGDATE(08),      " Posting Date in the Document
            COMPANYCODE(04),      " Company Code
            CURRENCY(03),      " Currency Key
            EXCHANGERATE(08),      " Exchange rate
            PARK(01),  " Park document
            ITEMNUMBER(03), " Number of line item
           END OF TY_BH,
           BEGIN OF TY_HH,
             RECORDTYPE(02), " Record Type
             SOURCE(04),
             DESTINATION(04),
             TIMESTAMP(14),
           END OF TY_HH,
           BEGIN OF TY_TT,
             RECORDTYPE(02),
             TOTALRECORDS(10) TYPE N,
             TOTALVALUE(16),
           END OF TY_TT.
    TYPES: BEGIN OF TY_BL,
             RECORDTYPE(02),
             REFERENCE(16),
             REFLINEITEM(03),
             ACCTTYPE(01),
             DRCRINDICATOR(01),
             ACCOUNT(10),
             AMOUNT(13),
             VENDORNAME1(40),
             VENDORNAME2(40),
             VENDORNAME3(40),
             VENDORNAME4(40),
             STREET(40),
             CITY(40),
             POSTALCODE(10),
             COUNTRY(02),
             CONTACTPERSON(10),
             ALTERNATEPAYEECODE(10),
             ALTERNATEPAYEENAME1(40),
             ALTERNATEPAYEENAME2(40),
             ALTERNATEPAYEENAME3(40),
             PAYMENTTERMS(04),
             BASELINEDATE(08),
             PAYMENTMETHODS(01),
             ALLOCATION(18),
             LINEITEMTEXT(50),
             TAXCODE(02),
             TAXAMOUNT(13),
             WHTAXCODE(02),
             WHTAXBASE(13),
             FUND(10),
             FUNDCENTER(16),
             COSTCENTER(10),
             INTERNALORDER(12),
             TAXAUTOMATICALLY(01),
             SPECIALGLINDICATOR(01),
           END OF TY_BL.
    DATA: GT_BH     TYPE STANDARD TABLE OF TY_BH,
          GS_BH     TYPE TY_BH,
          GT_BL     TYPE STANDARD TABLE OF TY_BL,
          GS_BL     TYPE TY_BL,
          GT_HH     TYPE STANDARD TABLE OF TY_HH,
          GS_HH     TYPE TY_HH,
          GT_TT     TYPE STANDARD TABLE OF TY_TT,
          GS_TT     TYPE TY_TT.
    DATA: GT_RESULT_XML5 TYPE ABAP_TRANS_RESBIND_TAB,
          GS_RESULT_XML5 TYPE ABAP_TRANS_RESBIND.
    DATA: GS_RIF_EX     TYPE REF TO CX_ROOT,
          GS_VAR_TEXT   TYPE STRING.
    DATA: BEGIN OF GT_XML,
             HH TYPE TY_HH,
             BH LIKE TABLE OF GT_BH,
             BL LIKE TABLE OF GT_BL,
             TT TYPE TY_TT,
           END OF GT_XML.
    DATA: GT_ITAB       TYPE STANDARD TABLE OF CHAR2048,
          GS_ITAB TYPE CHAR2048.
    I have the below file read into internal table GT_ITAB.
    XML File
    <?xml version="1.0" encoding="utf-8"?>
    <ABCInbound xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\XYZSchema\ABCInbound.xsd">
    <HH>
    <RecordType>HH</RecordType>
    <Source>ABC</Source>
    <Destination>XYZ</Destination>
    <TimeStamp>20050909220546</TimeStamp>
    </HH>
    <BH>
    <RecordType>BH</RecordType>
    <DocType>AB</DocType>
    <Reference>2205516125</Reference>
    <DocumentDate>20080909</DocumentDate>
    <PostingDate></PostingDate>
    <CompanyCode>ABC</CompanyCode>
    <Currency>INR</Currency>
    <ExchangeRate>1.0000</ExchangeRate>
    <Park></Park>
    <ItemNumber>2</ItemNumber>
    </BH>
    <BL>
    <RecordType>BL</RecordType>
    <Reference>2205516125</Reference>
    <RefLineItem>1</RefLineItem>
    <AcctType>K</AcctType>
    <DrCrIndicator>H</DrCrIndicator>
    <Account>01000003</Account>
    <Amount>364.00</Amount>
    <VendorName-1>TOM &amp; JERRY IS MY</VendorName-1>
    <VendorName-2> NAME TO BE PAID</VendorName-2>
    <VendorName-3>1987566Z</VendorName-3>
    <VendorName-4>22</VendorName-4>
    <Street>UCX STREET</Street>
    <City>ROAD 4</City>
    <PostalCode>515004</PostalCode>
    <Country>IND</Country>
    <ContactPerson></ContactPerson>
    <AlternatePayeeCode></AlternatePayeeCode>
    <AlternatePayeeName-1></AlternatePayeeName-1>
    <AlternatePayeeName-2></AlternatePayeeName-2>
    <AlternatePayeeName-3></AlternatePayeeName-3>
    <PaymentTerms></PaymentTerms>
    <BaselineDate></BaselineDate>
    <PaymentMethods></PaymentMethods>
    <Allocation></Allocation>
    <LineItemText>item text</LineItemText>
    <TaxCode></TaxCode>
    <TaxAmount>0.00</TaxAmount>
    <WHTaxCode></WHTaxCode>
    <WHTaxbase>0.00</WHTaxbase>
    <Fund></Fund>
    <FundCenter></FundCenter>
    <CostCenter></CostCenter>
    <InternalOrder></InternalOrder>
    <TaxAutomatically></TaxAutomatically>
    <SpecialGLIndicator></SpecialGLIndicator>
    </BL>
    <TT>
    <RecordType>TT</RecordType>
    <TotalRecords>1</TotalRecords>
    <TotalValue>222</TotalValue>
    </TT>
    </ABCInbound>
    Call transformation as below
    GET REFERENCE OF GT_XML INTO GS_RESULT_XML5-VALUE.
    GS_RESULT_XML5-NAME = 'IABC'.
    APPEND GS_RESULT_XML5 TO GT_RESULT_XML5.
    TRY.
        CALL TRANSFORMATION Z_XML_TO_ABAP5
        SOURCE XML GT_ITAB
        RESULT (GT_RESULT_XML5).
      CATCH CX_ROOT INTO GS_RIF_EX.
        GS_VAR_TEXT = GS_RIF_EX->GET_TEXT( ).
        MESSAGE GS_VAR_TEXT TYPE 'E'.
    ENDTRY.
    WHEN I CHECK GT_XML its initial.
    XSLT Program Z_XML_TO_ABAP5 is like below.
    Pls let me know if my xslt declaration is wrong.
    <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>
            <IABC>
              <xsl:apply-templates select="//ABCInbound"/>
            </IABC>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <xsl:template match="ABCINBOUND">
        <item>
          <RECORDTYPE>
            <xsl:value-of select="RecordType"/>
          </RECORDTYPE>
          <SOURCE>
            <xsl:value-of select="Source"/>
          </SOURCE>
          <DESTINATION>
            <xsl:value-of select="Destination"/>
          </DESTINATION>
          <TIMESTAMP>
            <xsl:value-of select="TimeStamp"/>
          </TIMESTAMP>
          <RECORDTYPE>
            <xsl:value-of select="RecordType"/>
          </RECORDTYPE>
          <DOCTYPE>
            <xsl:value-of select="DocType"/>
          </DOCTYPE>
          <REFERENCE>
            <xsl:value-of select="Reference"/>
          </REFERENCE>
          <DOCUMENTDATE>
            <xsl:value-of select="DocumentDate"/>
          </DOCUMENTDATE>
          <POSTINGDATE>
            <xsl:value-of select="PostingDate"/>
          </POSTINGDATE>
          <COMPANYCODE>
            <xsl:value-of select="CompanyCode"/>
          </COMPANYCODE>
          <CURRENCY>
            <xsl:value-of select="Currency"/>
          </CURRENCY>
          <EXCHANGERATE>
            <xsl:value-of select="ExchangeRate"/>
          </EXCHANGERATE>
          <PARK>
            <xsl:value-of select="Park"/>
          </PARK>
          <ITEMNUMBER>
            <xsl:value-of select="ItemNumber"/>
          </ITEMNUMBER>
          <RECORDTYPE>
            <xsl:value-of select="RecordType"/>
          </RECORDTYPE>
          <REFERENCE>
            <xsl:value-of select="Reference"/>
          </REFERENCE>
          <REFLINEITEM>
            <xsl:value-of select="RefLineItem"/>
          </REFLINEITEM>
          <ACCTTYPE>
            <xsl:value-of select="AcctType"/>
          </ACCTTYPE>
          <DRCRINDICATOR>
            <xsl:value-of select="DrCrIndicator"/>
          </DRCRINDICATOR>
          <ACCOUNT>
            <xsl:value-of select="Account"/>
          </ACCOUNT>
          <AMOUNT>
            <xsl:value-of select="Amount"/>
          </AMOUNT>
          <VENDORNAME1>
            <xsl:value-of select="VendorName-1"/>
          </VENDORNAME1>
          <VENDORNAME2>
            <xsl:value-of select="VendorName-2"/>
          </VENDORNAME2>
          <VENDORNAME3>
            <xsl:value-of select="VendorName-3"/>
          </VENDORNAME3>
          <VENDORNAME4>
            <xsl:value-of select="VendorName-4"/>
          </VENDORNAME4>
          <STREET>
            <xsl:value-of select="Street"/>
          </STREET>
          <CITY>
            <xsl:value-of select="City"/>
          </CITY>
          <POSTALCODE>
            <xsl:value-of select="PostalCode"/>
          </POSTALCODE>
          <COUNTRY>
            <xsl:value-of select="Country"/>
          </COUNTRY>
          <CONTACTPERSON>
            <xsl:value-of select="ContactPerson"/>
          </CONTACTPERSON>
          <ALTERNATEPAYEECODE>
            <xsl:value-of select="AlternatePayeeCode"/>
          </ALTERNATEPAYEECODE>
          <ALTERNATEPAYEENAME1>
            <xsl:value-of select="AlternatePayeeName1"/>
          </ALTERNATEPAYEENAME1>
          <ALTERNATEPAYEENAME2>
            <xsl:value-of select="AlternatePayeeName2"/>
          </ALTERNATEPAYEENAME2>
          <ALTERNATEPAYEENAME3>
            <xsl:value-of select="AlternatePayeeName3"/>
          </ALTERNATEPAYEENAME3>
          <PAYMENTTERMS>
            <xsl:value-of select="PaymentTerms"/>
          </PAYMENTTERMS>
          <BASELINEDATE>
            <xsl:value-of select="BaselineDate"/>
          </BASELINEDATE>
          <PAYMENTMETHODS>
            <xsl:value-of select="PaymentMethods"/>
          </PAYMENTMETHODS>
          <ALLOCATION>
            <xsl:value-of select="Allocation"/>
          </ALLOCATION>
          <LINEITEMTEXT>
            <xsl:value-of select="LineItemText"/>
          </LINEITEMTEXT>
          <TAXCODE>
            <xsl:value-of select="TaxCode"/>
          </TAXCODE>
          <TAXAMOUNT>
            <xsl:value-of select="TaxAmount"/>
          </TAXAMOUNT>
          <WHTAXCODE>
            <xsl:value-of select="WHTaxCode"/>
          </WHTAXCODE>
          <WHTAXBASE>
            <xsl:value-of select="WHTaxbase"/>
          </WHTAXBASE>
          <FUND>
            <xsl:value-of select="Fund"/>
          </FUND>
          <FUNDCENTER>
            <xsl:value-of select="FundCenter"/>
          </FUNDCENTER>
          <COSTCENTER>
            <xsl:value-of select="CostCenter"/>
          </COSTCENTER>
          <INTERNALORDER>
            <xsl:value-of select="InternalOrder"/>
          </INTERNALORDER>
          <TAXAUTOMATICALLY>
            <xsl:value-of select="TaxAutomatically"/>
          </TAXAUTOMATICALLY>
          <SPECIALGLINDICATOR>
            <xsl:value-of select="SpecialGLIndicator"/>
          </SPECIALGLINDICATOR>
          <RECORDTYPE>
            <xsl:value-of select="RecordType"/>
          </RECORDTYPE>
          <TOTALRECORDS>
            <xsl:value-of select="TotalRecords"/>
          </TOTALRECORDS>
          <TOTALVALUE>
            <xsl:value-of select="TotalValue"/>
          </TOTALVALUE>
        </item>
      </xsl:template>
    </xsl:transform>
    I able to get if declare only for BL and BH in separate xslt transformations.
    Regards,
    Simha

    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^

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

  • Problem with Call Transformation (ABAP to XML)

    Hello
       I call the tranformation function to serialize. I want to convert a ABAP internal table into XML.One of the column type is of time(t). On transformation, the values are changed.
      Ex : If I have  a value of 000009 (time format), on calling transformation it gets converted to 00:00:09. I dont want this conversion. I want to have the value as it is. I cant change the column data type from time to string.
    Regards
    Raghavendra

    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^

  • CALL TRANSFORMATION on Unicode WebAS 6.20: No valid source context supplied

    Hello,
    in the last day's I was stuck into a strange problem. I had to develop a Web Service Client on our Web AS 6.20 Unicode system. I followed the Blog <a href="/people/durairaj.athavanraja/blog/2004/09/20/consuming-web-service-from-abap">Consuming Web Service from ABAP</a>. The problem was that my CALL TRANSFORMATION always throwed an exception "No valid source context supplied". I've tested the transformation with a local copy of the XML the Web Service returned and it works quite well. I had a look into the Documentaion of CALL TRANSFORMATION and it says:
    == Documentation Quote Begin ==
    Addition 3a
    ... SOURCE  XML sxml
    Effect
    Specification of the transformation source
    Transfer the XML document sxml using addition 3a. The following three possibilities exist for specifiying sxml:
    The XML document can be in an ABAP variable sxml of the type STRING or XSTRING or in an internal standard table sxml of the elementary line type C.
    == Documentation Quote End ==
    So there should be no difference between STRING and XSTRING. But there is a difference! Here is my testcase which I've derived from my Blog <a href="/people/gregor.wolf3/blog/2006/06/27/geocode-business-partner-with-google-maps">Geocode Business Partner with Google Maps</a>:
    <b>XSLT Transformation - ZGOOGLE_GEOCODE_TO_ABAP</b>
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asx="http://www.sap.com/abapxml" xmlns:kml="http://earth.google.com/kml/2.0" version="1.0">
      <xsl:template match="/">
        <asx:abap version="1.0">
          <asx:values>
            <GEOCODE>
              <LON>
                <xsl:value-of select="substring-before(kml:kml/kml:Response/kml:Placemark/kml:Point/kml:coordinates,',')"/>
              </LON>
              <LAT>
                <xsl:value-of select="substring-before(substring-after(kml:kml/kml:Response/kml:Placemark/kml:Point/kml:coordinates,','),',')"/>
              </LAT>
              <ALT>
                <xsl:value-of select="substring-after(substring-after(kml:kml/kml:Response/kml:Placemark/kml:Point/kml:coordinates,','),',')"/>
              </ALT>
            </GEOCODE>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    <b>ABAP Report</b>
    REPORT  z_gw_test_geocode.
    DATA:
    BEGIN OF geocode,
      lon TYPE string,
      lat TYPE string,
      alt TYPE string,
    END OF geocode.
    DATA: client TYPE REF TO if_http_client,
           url TYPE string,
           c_xml TYPE string,
           x_xml type xstring.
    * Build URL to call Googe Maps Geocoding
    CONCATENATE 'http://maps.google.com/maps/geo?'
      'q=Tacherting,+DE'
      '&output=xml'
      '&key=ABQIAAAA2WL-mG7HpdSjlxystL3uBhRvBuAcdiWwcJAQgt9kNvfse-yNqBQuxwHkHo31WjTJ_RzVPIhXNludVg'
      INTO url.
    ****Create the HTTP client
    CALL METHOD cl_http_client=>create_by_url
      EXPORTING
        url    = url
      IMPORTING
        client = client
      EXCEPTIONS
        OTHERS = 1.
    client->send( ).
    client->receive( ).
    ****Get the response content in Character format
    c_xml = client->response->get_cdata( ).
    ****Get the response content as Binary
    x_xml = client->response->get_data( ).
    ****Transform XML as String to ABAP Values
    DATA: xslt_err TYPE REF TO cx_xslt_exception,
          error_text TYPE string.
    WRITE: / 'Transformation with STRING'.
    TRY.
        CALL TRANSFORMATION zgoogle_geocode_to_abap
        SOURCE XML c_xml
        RESULT geocode = geocode.
      CATCH cx_xslt_exception INTO xslt_err.
        error_text = xslt_err->get_text( ).
        WRITE: / error_text.
    ENDTRY.
    WRITE: / 'LON: ', geocode-lon.
    WRITE: / 'LAT: ', geocode-lat.
    WRITE: / 'ALT: ', geocode-alt.
    ****Transform XML as XString to ABAP Values
    WRITE: / 'Transformation with XSTRING'.
    TRY.
        CALL TRANSFORMATION zgoogle_geocode_to_abap
        SOURCE XML x_xml
        RESULT geocode = geocode.
      CATCH cx_xslt_exception INTO xslt_err.
        error_text = xslt_err->get_text( ).
        WRITE: / error_text.
    ENDTRY.
    WRITE: / 'LON: ', geocode-lon.
    WRITE: / 'LAT: ', geocode-lat.
    WRITE: / 'ALT: ', geocode-alt.
    <b>Result</b>
    This is the result on our 6.20 Unicode System:
    Transformation with STRING
    No valid source context supplied
    LON:
    LAT:
    ALT:
    Transformation with XSTRING
    LON:  12.570504
    LAT:  48.078269
    ALT:  0
    I've tried it on our 6.20 and 6.40 NON-Unicode systems and the result was:
    Transformation with STRING
    LON:  12.570504
    LAT:  48.078269
    ALT:  0
    Transformation with XSTRING
    LON:  12.570504
    LAT:  48.078269
    ALT:  0
    Finaly I've tried it on our Solutin Manager 4.0 which runs on Web AS 7.00 and is also a Unicode installation. Here the result is correct:
    Transformation with STRING
    LON:  12.570504
    LAT:  48.078269
    ALT:  0
    Transformation with XSTRING
    LON:  12.570504
    LAT:  48.078269
    ALT:  0
    So now what to do? I've found nothing in OSS regarding this behaviour. Any tips? I also try a OSS Message.
    Regards
    Gregor

    Hi,
    Can you tell me about your project on short notes. For information.
    Regards
    R.Rajendran

  • HELP IN CALL TRANSFORMATION

    hi all,
    the xml structure which i use in call transformation is below my problem is that some time i dont get the data for some fields(marked as bold) in the xml file which i get. for example if i get 10 orders in a file for one order i dont get the codes part and wheni use CALL TRANSFORMATION the data below the <b>codes</b>  (in the xml structure) is not been filled in the internal table.
    wht should i do to get the data into my table.
    <tt:root name="ROOT"/>
      <tt:template>
        <SHIP_REQUESTS>
          <tt:ref name="ROOT">
            <SENDER_ID tt:value-ref="SENDER_ID"/>
            <RECEIVER_ID tt:value-ref="RECEIVER_ID"/>
            <SEND_DATE tt:value-ref="SEND_DATE"/>
            <SEND_TIME tt:value-ref="SEND_TIME"/>
            <TOTAL_REQUESTS tt:value-ref="TOTAL_REQUESTS"/>
          </tt:ref>
          <tt:loop name="SHIP_REQUESTS" ref="ROOT.SHIP_REQUEST">
            <SHIP_REQUEST>
              <SHIP_ORDER_ID tt:value-ref="$ref.SHIP_ORDER_ID"/>
              <tt:group>
                  <tt:cond frq="?">
                     <CUSTOMER_PO_NUMER tt:value-ref="$ref.CUSTOMER_PO_NUMER"/>
                  </tt:cond>
              </tt:group>
             <b> <CODES TYPE="SHIPPING_CONDITION">
                <VALUE tt:value-ref="$ref.SHIPPING_CONDITION"/>
              </CODES></b>
              <DATE_TIME TYPE="CUST_PO">
                <DATE tt:value-ref="$ref.DATE_TIME.DATE"/>
                <TIME tt:value-ref="$ref.DATE_TIME.TIME"/>
              </DATE_TIME>
              <INCOTERMS tt:value-ref="$ref.INCOTERMS"/>
              <tt:loop name="SHIP_REQUEST" ref="$ref.ORDER_TEXT">
                <ORDER_TEXT>
                  <TEXT_ID tt:value-ref="$ref.TEXT_ID"/>
                  <LANGU tt:value-ref="$ref.LANGU"/>
                  <FORMAT_COL tt:value-ref="$ref.FORMAT"/>
                  <tt:group>

    thanks

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

  • UCCX 10.5 Scripting: Allowing a CAD Task Button to Change A Boolean Value to Skip a Screen Pop

    Good Morning All...
    I've found some wonderful information on here in the past and I'm hoping you all can assist me now.
    I have a CCX Script (10.5(1)SU1) that is working beautifully. Within the CAD integration there is a screen pop which sends an ANI value to a corporate application to bring up customer information, this is also working with no issue. I've been given a request from the call center manager to put a task button on the agents' CAD instance to allow them to turn off these screen pops in the event that they need to be on the same screen for longer than the work/wrap-up time between calls.
    My Questions Are These:
    1. I know I can use a task button to set an Enterprise Data value i.e. skip_pop = true (skip_pop being tied to the Boolean value in the script). That being said, I can't change the value until the call reaches the agent and that is too late in the process to stop the prompt from running. Is there a better/different way that I am not thinking off to allow the agent to interact with Boolean value before the call arrives to the agent?
    2. Am I completely off base? Is there a much better way that I can do this in general?
    I am at your mercy and your help is greatly appreciated.
    Thank you
    Justin

    Hey Aaron:
    So I'm in the midst of working through this mess for a button push and I've hit a wall. Perhaps you'll have some insight? In my CDA (see screen shot) I've configured an HTTP action that is in theory sending the agent ID and a value of true.
    In my child script (attached) I have a Get HTTP contact info where I am looking for "Agent_ID" and "sPopState" when I do a test run with a reactive debug I am getting success but the database is basically adding lines but with no information in either column (I have verified that my DB is working correctly).
    Do you by chance have any idea what I might be missing? I'd like to think I'm close but I'm getting into dark territory for my experience level.
    As always, your help and expertise are greatly appreciated.
    Thanks,
    Justin

Maybe you are looking for

  • Can't remember game center email... HELP!

         My little brother has two game center accounts and accidentally signed out of one without looking at which email he had used.  We have tried every email possible and no luck finding the account he had used.  If you know anything about how to fin

  • Error while creating PR, 'No Procurement defined for material 150'

    Hi, I am trying to create purchase requisition. I am getting the following errors, 'No Procurement defined for material 150' and 'Enter G/L Account'. Please help me to correct these errors. Thanks in adv. Regards, Eswar Edited by: Eswar K on Jan 7, 2

  • BAPI_PO_CHANGE : Payment Terms

    Hi, I have problems with BAPI_PO_CHANGE, the  Payment Terms  aren't updated. Some body has a suggestion, please! regards. Marisol.

  • Transaction for EPI-Use

    I am unable to locate transaction /use/cds3 for EPI Use

  • Oracle Developer Suite New Version !!!

    hi , i heared that Oracle intend to release a new version of Oracle iDS , is that right , and if so what are the new features , does any body know !? , Thanks