ABAP mapping Document

hi,
Can Anyone Share with me some good ABAP mapping Document..
Thanks

Hi,
Please refer these links and weblogs.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
http://help.sap.com/saphelp_nw70/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/frameset.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
/people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
/people/ricardoandres.maienza/blog/2007/04/06/how-to-call-xi-abap-mapping-via-rfc
/people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
https://wwwn.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
/people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
https://websmp101.sap-ag.de/~sapdownload/011000358700003082332004E/HowToABAPMapping.pdf
/people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
/people/r.eijpe/blog
ABAP Mapping Vs Java Mapping.
Re: Message Mapping of type ABAP Class not being shown
Check this thread
Re: ABAP Mappings in SAP XI
Hope these links  will help you to close these threads.
Regards
Aashish Sinha
PS : reward points if helpful and don't forget to close thread.

Similar Messages

  • Abap mapping for content conditions routing in a flat-flat scenario

    Dear Experts.
    I have a flat-flat file scenario. Based on the content of the input file, I need to route data to the receiver.The source flat file will have several IDOC details.
    Assume two fields FIELD1 and FIELD2 in different segments of the IDOC. My requirement is if FIELD1 of an IDOC = "XYZ" and FIELD2 of the same IDOC = "PQR", then this  IDOC's details has to be passed to the receiver.
    I have tried to implement the above condition at interface determination in graphical mapping.
    In the graphical mapping,  the problem is:
    Assuming there are 3 idocs in the input file.
    FIELD1 of IDOC[1] = 'XYZ' and FIELD2 of IDOC[1] = 'PQR'
    FIELD1 of IDOC[2] = 'LMN' and FIELD2 of IDOC[2] = 'RST'
    FIELD1 of IDOC[3] = 'ABC' and FIELD2 of IDOC[3] = 'DEF' .
    Now, if none of the IDOCs in the input file satisfy my requirement,the message mapping should not be called at all. But in my case its failing because FIELD1 of IDOC[1] and FIELD2 of IDOC[3] together are satisfying the condition and hence the message mapping is getting called.
    And I need to check this condition IDOC wise. Both the conditions has to be satisfied in the same IDOC.
    The question is very similar to the one posted by SHOBHA HB. (Topic:Receiver determination(or Interface determination) and conditional routing )
    but, due to complexities in the graphical mapping,  we have decided to go for the ABAP mapping instead.
    Kindly help, by mentioning the steps I should follow for this interface, the logic basically. I already have paths to some basic ABAP mapping documents from SDN, so, kindly refrain from posting general URLS for definition or history of ABAP mapping.
    IF you could guide me on this interface, It would be really helpful.
    regards,
    giri raj

    Hi,
    /people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
    This document will help you to create ABAP Mapping .
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how%20to%20use%20abap-mapping%20in%20xi%203.0.pdf
    How to Use ABAP Mapping in Exchange Infrastructure 3.0 (NW2004)
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
    SAP Network Blog: How to call XI ABAP Mapping via RFC
    /people/ricardoandres.maienza/blog/2007/04/06/how-to-call-xi-abap-mapping-via-rfc
    SAP Network Blog: Testing ABAP Mapping
    /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
    /people/udo.martens/blog/2006/08/23/comparing-performance-of-mapping-programs
    An ad-on
    /people/michal.krawczyk2/blog/2006/09/20/xi-abap-mapping-logs--more-standard-better-visibility
    Regards

  • IDOC-XI-FILE Scenario: Error in ABAP Mapping

    Dear All,
    I am working on IDOC-XI-Flat FIle scenario in which I am using ABAP Mapping as per document "How To Convert an IDoc-XML
    structure to a flat file and vice versa in XI 3.0".
    I created one customized Idoc for this. The Idoc is reacing XI but its flat file is not getting created. Its giving me following error:
    <SAP:Stack>Error in mapping program Z_ABAP_MAPPING_PACKING_LIST (type SAP-ABAP, kernel error ID UNCAUGHT_EXCEPTION) An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled locally, nor declared in a RAISING clause Dereferencing of the NULL reference.</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
    I have also gone thru threads posted for the same topic earlier but still I am not been to resolve this error.
    Please help me out in resolving this error.
    Regards,
    N.Jain

    HI,
       Log saying that, u have problem in the mapping program.
      i.e Z_ABAP_MAPPING_PACKING_LIST
       the problem is due declaration of data.
       i hope that, you have some methods.
       those are declared under intialization section in mapping program.
      please use start of selection before the method.
    other wise, it will come under intilization section.
    warm regards
    mahesh.

  • How To Guide on ABAP mapping (How to Use ABAP-Mapping in XI 3.0).

    Hi,
    I am looking for this document: How To Guide on ABAP mapping (How to Use ABAP-Mapping in XI 3.0), and not able to find it.
    Can anybody please point me the location, to look for, or post the document.
    Thanks,
    Namadev

    Hi Namadev Chillal  ,
    These r the links containing PDF docs which u r looking for:
    how to create a flat file out of an IDoc-XML by means of an ABAP mapping program and the J2EE File Adapter.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
    Excellent PDF Document on Mapping
    http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf
    Mapping Development with the ABAP Workbench
    http://help.sap.com/saphelp_nw04/helpdata/en/10/5abb2d9df242f6a62e22e027a6c382/content.htm
    ABAP Mappings
    http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/content.htm

  • Problem in ABAP mapping

    Hi ,
    I am working with a scenerio where i have 2 diff system to send the data depending upong the sending payload data.
    I am using ABAP mapping where i am able to send accros the data, below is my code
    METHOD IF_MAPPING~EXECUTE.
      BREAK-POINT.
      * initialize iXML
      TYPE-POOLS: IXML.
      CLASS CL_IXML DEFINITION LOAD.
      DATA: L_IXML TYPE REF TO IF_IXML.
    *creating the Interface by calling the create method in class C_IXML
      CALL METHOD CL_IXML=>CREATE
    EXPORTING
       TYPE   = 0
        RECEIVING
          RVAL   = L_IXML.
    create stream factory
      DATA: STREAMFACTORY TYPE REF TO IF_IXML_STREAM_FACTORY.
      CALL METHOD L_IXML->CREATE_STREAM_FACTORY
        RECEIVING
          RVAL = STREAMFACTORY.
    create input stream
      DATA: ISTREAM TYPE REF TO IF_IXML_ISTREAM.
      CALL METHOD STREAMFACTORY->CREATE_ISTREAM_XSTRING
        EXPORTING
          STRING = SOURCE
        RECEIVING
          RVAL   = ISTREAM.
    *This iXML factory can create an empty XML document object named IDOCUMENT.
    initialize input document
      DATA:  IDOCUMENT TYPE REF TO IF_IXML_DOCUMENT.
      CALL METHOD L_IXML->CREATE_DOCUMENT
        RECEIVING
          RVAL = IDOCUMENT.
    parse input document
      DATA: IPARSER TYPE REF TO IF_IXML_PARSER.
      CALL METHOD L_IXML->CREATE_PARSER
        EXPORTING
          DOCUMENT       = IDOCUMENT
          ISTREAM        = ISTREAM
          STREAM_FACTORY = STREAMFACTORY
        RECEIVING
          RVAL           = IPARSER.
      IPARSER->PARSE( ).
      DATA: EL_ELEMENT TYPE REF TO IF_IXML_ELEMENT,
            VALUE TYPE STRING.
      DATA: ROOT TYPE REF TO IF_IXML_ELEMENT.
    get message content of tag
      DATA: INCODE  TYPE REF TO IF_IXML_NODE_COLLECTION,
            INCODE1 TYPE REF TO IF_IXML_NODE_COLLECTION,
            INCODE2 TYPE REF TO IF_IXML_NODE_COLLECTION,
            INCODE0  TYPE REF TO IF_IXML_NODE_COLLECTION.
      CALL METHOD IDOCUMENT->GET_ELEMENTS_BY_TAG_NAME
        EXPORTING
         DEPTH     = 0
          NAME      = 'MANDT'
         NAMESPACE = 'urn:sap-com:document:sap:rfc:functions'
        RECEIVING
          RVAL      = INCODE0 .
      CALL METHOD IDOCUMENT->GET_ELEMENTS_BY_TAG_NAME
      EXPORTING
         DEPTH     = 0
        NAME      = 'EMPNO'
         NAMESPACE = 'urn:sap-com:document:sap:rfc:functions'
      RECEIVING
        RVAL      = INCODE.
      CALL METHOD IDOCUMENT->GET_ELEMENTS_BY_TAG_NAME
    EXPORTING
         DEPTH     = 0
    NAME      = 'EMPNAME'
         NAMESPACE = 'urn:sap-com:document:sap:rfc:functions'
    RECEIVING
    RVAL      = INCODE1.
      CALL METHOD IDOCUMENT->GET_ELEMENTS_BY_TAG_NAME
    EXPORTING
         DEPTH     = 0
    NAME      = 'DEPARTMENTNAME'
         NAMESPACE = 'urn:sap-com:document:sap:rfc:functions'
    RECEIVING
    RVAL      = INCODE2.
      DATA: URI TYPE STRING.
      URI = 'urn:sap-com:document:sap:rfc:functions'.
    * build up output document =============================================
    create output document
      DATA: ODOCUMENT TYPE REF TO IF_IXML_DOCUMENT.
      CALL METHOD L_IXML->CREATE_DOCUMENT
        RECEIVING
          RVAL = ODOCUMENT.
    DATA: RET_VALUE TYPE I.
    **At this point you can add the nodes (elements, attributes) into the document. First you have to declare the root element node.
      DATA: L_ELEMENT_ROOT TYPE REF TO IF_IXML_ELEMENT.
      DATA: NODE_LIST_COLLECTION TYPE REF TO IF_IXML_NODE_COLLECTION.
    add node to the output document
      DATA: OUTCODE0 TYPE REF TO IF_IXML_NODE.
      DATA: OUTCODE  TYPE REF TO IF_IXML_NODE.
      DATA: OUTCODE1 TYPE REF TO IF_IXML_NODE.
      DATA: OUTCODE2 TYPE REF TO IF_IXML_NODE.
      DATA: INDEX1 TYPE SY-INDEX.
      DATA: INDEX TYPE SY-INDEX.
      DATA IRC TYPE I.
      TYPES:  BEGIN OF TY_IMPORT,
               MANDT             TYPE MANDT,
               EMPNO             TYPE STRING,
               EMPNAME           TYPE STRING,
               DEPARTMENTNAME    TYPE STRING,
         END OF TY_IMPORT.
      DATA: IT_IMPORT TYPE STANDARD TABLE OF TY_IMPORT.
      DATA: WA_IMPORT TYPE                 TY_IMPORT.
      CALL METHOD IDOCUMENT->GET_ELEMENTS_BY_TAG_NAME
        EXPORTING
       DEPTH     = 0
          NAME      = 'MANDT'
       NAMESPACE = ''
        RECEIVING
          RVAL      =  NODE_LIST_COLLECTION.
      DATA: LENGTH TYPE I.
      CALL METHOD NODE_LIST_COLLECTION->GET_LENGTH
        RECEIVING
          RVAL = LENGTH.
      WHILE INDEX < LENGTH.
       CALL METHOD IDOCUMENT->FIND_FROM_NAME
         EXPORTING
           DEPTH     = index
           NAME      = 'EMPNO'
           NAMESPACE = ''
         RECEIVING
           RVAL      = EL_ELEMENT .
        CALL METHOD INCODE0->GET_ITEM
          EXPORTING
            INDEX = INDEX
          RECEIVING
            RVAL  = OUTCODE0.
       EL_ELEMENT = IDOCUMENT->FIND_FROM_NAME( 'MANDT' ).
        VALUE = OUTCODE0->GET_VALUE( ).
        WA_IMPORT-MANDT  = VALUE.
        CLEAR: VALUE.
        CALL METHOD INCODE->GET_ITEM
          EXPORTING
            INDEX = INDEX
          RECEIVING
            RVAL  = OUTCODE.
       EL_ELEMENT = IDOCUMENT->FIND_FROM_NAME( 'EMPNO' ).
        VALUE = OUTCODE->GET_VALUE( ).
        WA_IMPORT-EMPNO  = VALUE.
        CLEAR: VALUE.
        CALL METHOD INCODE1->GET_ITEM
          EXPORTING
            INDEX = INDEX
          RECEIVING
            RVAL  = OUTCODE1.
       EL_ELEMENT = IDOCUMENT->FIND_FROM_NAME( 'EMPNAME' ).
        VALUE = OUTCODE1->GET_VALUE( ).
        WA_IMPORT-EMPNAME  = VALUE.
        CLEAR: VALUE.
        CALL METHOD INCODE2->GET_ITEM
          EXPORTING
            INDEX = INDEX
          RECEIVING
            RVAL  = OUTCODE2.
       EL_ELEMENT = IDOCUMENT->FIND_FROM_NAME( 'DEPARTMENTNAME' ).
        VALUE = OUTCODE2->GET_VALUE( ).
        WA_IMPORT-DEPARTMENTNAME  = VALUE.
        CLEAR: VALUE.
        APPEND WA_IMPORT TO IT_IMPORT.
        CLEAR WA_IMPORT.
        ADD 1 TO INDEX.
      ENDWHILE.
      TYPES: BEGIN OF TY_DATA,
              DATA TYPE STRING,
                    END OF TY_DATA.
      DATA: IT_DATA TYPE STANDARD TABLE OF TY_DATA,
            WA_DATA TYPE TY_DATA.
      DATA: SSSS TYPE STRING.
      IF SOURCE IS NOT INITIAL.
        CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
          EXPORTING
            IM_XSTRING  = SOURCE
            IM_ENCODING = 'UTF-8'
          IMPORTING
            EX_STRING   = SSSS.
      ENDIF.
    render document ======================================================
    create output stream
      DATA: XX TYPE STRING.
      DATA: XX_1 TYPE STRING.
      DATA: XX1 TYPE STRING.
      DATA: XX2 TYPE STRING.
      DATA: T1 TYPE STRING VALUE ''.
      DATA: T TYPE STRING VALUE '<DATA><MANDT>'.
      LOOP AT IT_IMPORT INTO WA_IMPORT.
       CLEAR: XX1.
       IF SY-TABIX = 1.
        IF WA_IMPORT-EMPNO = '000000000022'.
          CONCATENATE  T WA_IMPORT-MANDT '</MANDT>'
         '<EMPNO>' WA_IMPORT-EMPNO '</EMPNO>'
         '<EMPNAME>' WA_IMPORT-EMPNAME '</EMPNAME><DEPARTMENTNAME>'
         WA_IMPORT-DEPARTMENTNAME '</DEPARTMENTNAME></DATA>'
          INTO XX1   .
         IF SY-TABIX = 1.
         ELSE.
          CONCATENATE    XX1   XX_1 INTO XX_1.
         ENDIF.
        ELSE.
          CONCATENATE  T WA_IMPORT-MANDT '</MANDT>'
    '<EMPNO>' WA_IMPORT-EMPNO '</EMPNO>'
    '<EMPNAME>' WA_IMPORT-EMPNAME '</EMPNAME><DEPARTMENTNAME>'
    WA_IMPORT-DEPARTMENTNAME '</DEPARTMENTNAME></DATA>' INTO XX1   .
          CONCATENATE XX1 XX INTO XX.
         ENDIF.
        ENDIF.
        AT LAST.
          CONCATENATE '<?xml version="1.0" encoding="UTF-8"?><ns1:ZTEST1 xmlns:ns1="urn:sap-com:document:sap:rfc:functions">'
        XX_1 INTO XX_1.
          CONCATENATE  XX_1 '</ns1:ZTEST1>' INTO XX_1.
          CALL FUNCTION 'ECATT_CONV_STRING_TO_XSTRING'
    EXPORTING
      IM_STRING         = XX_1
    IM_ENCODING       = 'UTF-8'
    IMPORTING
    EX_XSTRING        = RESULT.
        EX_LEN            = .
          CONCATENATE '<?xml version="1.0" encoding="UTF-8"?><ns1:ZTEST1 xmlns:ns1="urn:sap-com:document:sap:rfc:functions">'
    XX        INTO XX.
          CONCATENATE XX '</ns1:ZTEST1>' INTO XX.
         CONCATENATE XX_1 XX INTO XX.
          CALL FUNCTION 'ECATT_CONV_STRING_TO_XSTRING'
            EXPORTING
              IM_STRING         = XX
             IM_ENCODING       = 'UTF-8'
           IMPORTING
             EX_XSTRING        = RESULT
        EX_LEN            =
        ENDAT.
      ENDLOOP.
    ENDMETHOD.
    here above result parameter will have the target data..But it sends the that same data to both the system , If i will be able to recursively call this method, then i be able to solve the prob easily as first time result will send one data to one system and next time to other system,

    Hi munish,
    I dont think there is any thing wrong with the ABAP code.
    Try testing your ABAP mapping using transaction code SXI_MAPPING_TEST in XI.
    Enter the Details asked and then enter TEst data in XML format.. 
    Also, you can make use of the Trace element to find out if there is any thing wrong with the code.
    Include the following Statements after every step in the ABAP code to ensure that the particular step is completed successfully.
    data : l_trace type string.
    concatenate l_trace '<Message you want to display>' into l_trace.
    trace->trace(level = '<level>'
    message =l_trace).  
    The trace is visible in SXMB_MONI (click on "Trace" in the left pane to view).
    using this you will get to know i the code is functioning as desired.
    Regards,
    Yashaswee.

  • Parser error in ABAP mapping

    Hi ,
      i am using the following ABAP mapping program
    method if_mapping~execute .
    data: t_edidc type table of edi_dc40,
    ls_edidc type edi_dc40,
    ls_edidc_h type edi_dc40,
    t_edidd type table of edi_dd40,
    ls_edidd_h type edi_dd40,
    ls_idx_xmb type idx_xmb,
    t_result type string,
    t_resultc type string,
    t_resultd type string.
    data: ls_idx1 type idxporsm59.
    data: t_segtyp type table of edilsegtyp,
    el_segtyp type edilsegtyp,
    el_released type segdefrel,
    el_error_text type string.
    =======================
    0. parse input document
    =======================
    initialize iXML
    type-pools: ixml.
    break-point.
    class cl_ixml definition load.
    create main factory
    data: ixmlfactory type ref to if_ixml.
    break-point.
    ixmlfactory = cl_ixml=>create( ).
    create stream factory
    data: streamfactory type ref to if_ixml_stream_factory.
    streamfactory = ixmlfactory->create_stream_factory( ).
    create input stream
    data: istream type ref to if_ixml_istream.
    istream = streamfactory->create_istream_xstring( source ).
    initialize input document
    data: idocument type ref to if_ixml_document.
    idocument = ixmlfactory->create_document( ).
    parse input document
    data: iparser type ref to if_ixml_parser.
    iparser = ixmlfactory->create_parser( stream_factory = streamfactory
    istream = istream
    document = idocument ).
    iparser->parse( ).
    =================================================
    1. get IDoc header data and connection parameters
    =================================================
    data: el_message_id type sxmsguid.
    el_message_id = param->get( if_mapping_param=>message_id ).
    data: el_element type ref to if_ixml_element.
    el_element = idocument->find_from_name( 'TABNAM' ).
    ls_edidc-tabnam = el_element->get_value( ).
    el_element = idocument->find_from_name( 'MANDT' ).
    ls_edidc-mandt = el_element->get_value( ).
    el_element = idocument->find_from_name( 'DOCNUM' ).
    ls_edidc-docnum = el_element->get_value( ).
    el_element = idocument->find_from_name( 'STATUS' ).
    ls_edidc-status = el_element->get_value( ).
    el_element = idocument->find_from_name( 'OUTMOD' ).
    ls_edidc-outmod = el_element->get_value( ).
    el_element = idocument->find_from_name( 'TEST' ).
    if not el_element is initial.
    ls_edidc-test = el_element->get_value( ).
    endif.
    el_element = idocument->find_from_name( 'IDOCTYP' ).
    ls_edidc-idoctyp = el_element->get_value( ).
    el_element = idocument->find_from_name( 'CIMTYP' ).
    if not el_element is initial.
    ls_edidc-cimtyp = el_element->get_value( ).
    endif.
    el_element = idocument->find_from_name( 'MESTYP' ).
    ls_edidc-mestyp = el_element->get_value( ).
    el_element = idocument->find_from_name( 'STDVRS' ).
    if not el_element is initial.
    ls_edidc-stdvrs = el_element->get_value( ).
    endif.
    el_element = idocument->find_from_name( 'STD' ).
    if not el_element is initial.
    ls_edidc-std = el_element->get_value( ).
    endif.
    el_element = idocument->find_from_name( 'STDMES' ).
    ls_edidc-stdmes = el_element->get_value( ).
    el_element = idocument->find_from_name( 'SNDPOR' ).
    ls_edidc-sndpor = el_element->get_value( ).
    el_element = idocument->find_from_name( 'SNDPRT' ).
    ls_edidc-sndprt = el_element->get_value( ).
    el_element = idocument->find_from_name( 'SNDPRN' ).
    ls_edidc-sndprn = el_element->get_value( ).
    el_element = idocument->find_from_name( 'RCVPOR' ).
    ls_edidc-rcvpor = el_element->get_value( ).
    el_element = idocument->find_from_name( 'RCVPRT' ).
    ls_edidc-rcvprt = el_element->get_value( ).
    el_element = idocument->find_from_name( 'RCVPRN' ).
    ls_edidc-rcvprn = el_element->get_value( ).
    el_element = idocument->find_from_name( 'CREDAT' ).
    ls_edidc-credat = el_element->get_value( ).
    el_element = idocument->find_from_name( 'CRETIM' ).
    ls_edidc-cretim = el_element->get_value( ).
    el_element = idocument->find_from_name( 'SERIAL' ).
    ls_edidc-serial = el_element->get_value( ).
    ls_edidc-direct = '2'.
    move-corresponding ls_edidc to ls_idx_xmb.
    Connection data to application system to get IDoc metadata
    select single * from idxporsm59 into ls_idx1
    where port = ls_edidc-sndpor
    and client = ls_edidc-mandt.
    ls_idx_xmb-port = ls_edidc-sndpor.
    ls_idx_xmb-rfcdest = 'NONE'. "not necessary
    Get DOCREL and SAPREL
    el_element = idocument->find_from_name( 'DOCREL' ).
    if not el_element is initial.
    ls_edidc-docrel = el_element->get_value( ).
    else.
    select segtyp into table t_segtyp from idxidocsyn
    where port = ls_edidc-sndpor
    and idoctyp = ls_edidc-idoctyp
    and cimtyp = ls_edidc-cimtyp.
    loop at t_segtyp into el_segtyp.
    select released into el_released from idxedisdef
    where port = ls_edidc-sndpor
    and segtyp = el_segtyp
    and actrelease = 'X'.
    endselect.
    if el_released gt ls_edidc-docrel.
    ls_edidc-docrel = el_released.
    endif.
    endloop.
    endif.
    ======================================
    2. convert XML to IDoc table structure
    ======================================
    break-point.
    call function 'IDX_XML_TO_IDOC'
    exporting
    xml_data = source
    guid = el_message_id
    edidc40 = ls_edidc
    idx_xmb = ls_idx_xmb
    typ_def = 'X'
    tables
    idoc_control_40 = t_edidc
    idoc_data_40 = t_edidd
    exceptions
    unknown_xml = 1
    customizing_error = 2
    no_data_found = 3
    syntax_error = 4
    others = 5.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    To keep the original DOCNUM uncomment the following 8 lines of coding
    Otherwise a new DOCNUM will be created
    LOOP AT t_edidc into ls_edidc_h.
    ls_edidc_h-DOCNUM = ls_edidc-DOCNUM.
    modify t_edidc from ls_edidc_h.
    ENDLOOP.
    LOOP AT t_edidd into ls_edidd_h.
    ls_edidd_h-DOCNUM = ls_edidc-DOCNUM.
    modify t_edidd from ls_edidd_h.
    ENDLOOP.
    =========================================
    3. convert IDoc table structure to string
    =========================================
    call function 'ZSOTR_SERV_TABLE_TO_STRING'
    EXPORTING
    FLAG_NO_LINE_BREAKS = ' '
    LINE_LENGTH = 0
    LANGU = SY-LANGU
    importing
    text = t_resultc
    tables
    text_tab = t_edidc.
    convert IDoc table structure to string
    call function 'ZSOTR_SERV_TABLE_TO_STRING'
    EXPORTING
    FLAG_NO_LINE_BREAKS = ' '
    LINE_LENGTH = 0
    LANGU = SY-LANGU
    importing
    text = t_resultd
    tables
    text_tab = t_edidd.
    concatenate t_resultc t_resultd into t_result.
    convert string to xstring
    call function 'SCMS_STRING_TO_XSTRING'
    exporting
    text = t_result
    MIMETYPE = ' '
    ENCODING =
    importing
    buffer = result.
    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.
    endmethod.
    <b> i am getting the following parse error in FM IDX_XML_TO_IDOC :
    " unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment "
    can anybody help
    points will be given
    Regards</b>

    HI,
    is it possible that you have to use "-" instead of "=" in this [ixmlfactory = cl_ixml=>create( ).] line ?
    regards,
    gordon

  • ABAP Mapping: ostream with multiple sibling tags (ixml_document_fragment ?)

    Hallo,
    during ABAP Mapping I have the following problem:
    I want to return a message to XI Java stack in the following format:
    <?xml version="1.0"?><ns0:MT_FILE_PAXAR_INB xmlns:ns0="http://logimoda.com/ns_paxar">
    <Recordset>
    [... child tags which values are retrieved from fields of each record of an internal table]
    </Recordset>
    </ns0:MT_FILE_PAXAR_INB>
    I want n <Recordset>, one for each record of the internal table "t_etichette", which is populated by:
    CALL FUNCTION 'ZXI_ETICHETTE_COMPOSIZIONE_PEZ'
    Now, i'm not able to append n sibling <Recordset>, only one is appended to parent <ns0:MT_FILE_PAXAR_INB>.
    I guess the solution is ixml_document_fragment or using someway an iteration, but I don't know how...
    Any suggestion?
    Thanks all in advance:)
    PS below my current source code:
    METHOD if_mapping~execute .
    1.0 Def. Data Types - Start **********************************
      DATA:
            wa_t_richieste  TYPE          zppst_input_etichette_pezzo,
            t_richieste     TYPE TABLE OF zppst_input_etichette_pezzo,
            wa_t_etichette  TYPE          zppst_output_etichette_pezzo,
            t_etichette     TYPE TABLE OF zppst_output_etichette_pezzo,
            wa_t_logelab    TYPE          zppst_esito_etichette_pezzo,
            t_logelab       TYPE TABLE OF zppst_esito_etichette_pezzo.
    1.1 Def. Data Types - End   **********************************
    initialize iXML
      TYPE-POOLS: ixml.
      CLASS cl_ixml DEFINITION LOAD.
    create main factory
      DATA: ixmlfactory TYPE REF TO if_ixml.
      ixmlfactory = cl_ixml=>create( ).
    create stream factory
      DATA: streamfactory TYPE REF TO if_ixml_stream_factory.
      streamfactory = ixmlfactory->create_stream_factory( ).
    create input stream
      DATA: istream TYPE REF TO if_ixml_istream.
      istream = streamfactory->create_istream_xstring( source ).
      DATA: val_nodo  TYPE string,
            nome_nodo TYPE string,
            nome_el   TYPE string
      DATA: ta_data TYPE STANDARD TABLE OF ztabxml,
            wa_data TYPE ztabxml.
    parse input document =================================================
    initialize input document
      DATA: idocument TYPE REF TO if_ixml_document.
      idocument = ixmlfactory->create_document( ).
    parse input document
      DATA: iparser TYPE REF TO if_ixml_parser.
      iparser = ixmlfactory->create_parser( stream_factory = streamfactory
                                            istream = istream
                                            document = idocument ).
      iparser->parse( ).
      DATA: element  TYPE REF TO if_ixml_element.
      DATA: articolo TYPE REF TO if_ixml_element.
      DATA: collo    TYPE REF TO if_ixml_element.
      DATA: l_trace  TYPE string.
      DATA: child    TYPE REF TO if_ixml_node.
      DATA: nr_art   TYPE REF TO if_ixml_node_collection.
      DATA: dest    TYPE rfcdest,
            wa_cust TYPE zxi_cust,
            mandt   TYPE sy-mandt.
      SELECT SINGLE * FROM zxi_cust INTO wa_cust
             WHERE parname1 = 'RFC_DEST'
               AND parname2 = 'R/3'.
      dest  = wa_cust-parvalue1.
      mandt = dest+7(3).
    1.2 Mapping XML -> items      ************************************
      CLEAR    nome_nodo.
      CLEAR    child.
      CLEAR    ciclo.
      element = idocument->find_from_path_ns(
                                     path    =
    '/RIGA'
                                 default_uri = '' ).
      nome_el = element->get_name( ).
      ciclo = 'true'.
      WHILE ciclo = 'true'.
    Mandante
        MOVE mandt TO wa_t_richieste-mandt.
        IF nome_el = 'RIGA'.
          child = element->get_first_child( ).
          WHILE child IS BOUND.
            nome_nodo = child->get_name( ).
            val_nodo  = child->get_value( ).
            CASE nome_nodo.
              WHEN 'COD_MSGEXPORT'.
    Identificativo da Logimoda
                MOVE val_nodo TO wa_t_richieste-zcodeidoc.
              WHEN 'C0001'.
    Commessa
                MOVE val_nodo TO wa_t_richieste-j_3acomord.
            ENDCASE.
            child = child->get_next( ).
          ENDWHILE.
          APPEND wa_t_richieste TO t_richieste.
          CLEAR: wa_t_richieste.
          element ?= element->get_next( ).
          IF NOT element IS BOUND.
            EXIT.
          ENDIF.
          nome_el = element->get_name( ).
        ELSE.
          ciclo = 'false'.
        ENDIF.
      ENDWHILE.
    1.3 call RFC     ************************************************
      DATA: return TYPE sy-subrc.
      DATA: t_return TYPE TABLE OF bapiret2.
      DATA: st_return TYPE bapiret2.
      DATA: mess_exc TYPE string.
      DATA: t_error_text TYPE string.
      CLEAR: return.
      CLEAR: t_return.
      REFRESH: t_return.
      CALL FUNCTION 'ZXI_ETICHETTE_COMPOSIZIONE_PEZ'
        DESTINATION
        dest
       EXPORTING
    TO DO: Y or N ??
         fl_alv       = ' '
        TABLES
          t_richieste  = t_richieste
          t_etichette  = t_etichette
          t_logelab    = t_logelab
        EXCEPTIONS
          no_richieste = 1
          no_etichette = 2
          no_plant     = 3
          OTHERS       = 4.
      IF ( ( sy-subrc <> 0 )      AND
           ( dest <> 'MZ1CLNT400' )
        DATA subrc TYPE sy-subrc.
        CASE subrc.
          WHEN 1.
           LOOP AT t_logelab INTO st_logelab WHERE type EQ 'E'.
            CONCATENATE 'ABAP MAPPING ERROR: '
                         'NO_RICHIESTE'
                         INTO mess_exc.
            trace->trace( level = '1'
                          message = mess_exc ).
            RAISE EXCEPTION TYPE cx_mapping_fault
                  EXPORTING error_code = '90'
                            error_text = 'NO_RICHIESTE'.
           ENDLOOP.
          WHEN 2.
          WHEN 3.
          WHEN OTHERS.
        ENDCASE.
      ENDIF.
    1.4 build up output document *****************************************
      DATA: ret_value TYPE i.
      DATA: uri       TYPE string.
      uri = 'http://logimoda.com/ns_paxar'.
    create output document
      DATA: odocument TYPE REF TO if_ixml_document.
      odocument = ixmlfactory->create_document( ).
    Test - Start ***********
    DATA: root_ns TYPE REF TO if_ixml_namespace_decl.
    root_ns = odocument->create_namespace_decl(
          name   = 'ns0'
          prefix = 'ns0'
          uri    =  uri ).
    ret_value = odocument->set_namespace_prefix(
    prefix = 'ns0'
    ret_value = odocument->set_namespace_uri(
    uri = 'ns0'
    root = odocument->create_element_ns(
    name   = 'ns0'
    prefix = 'ns0'
    uri    = 'http://logimoda.com/ns_paxar'
    Test - End   ***********
    create root XML tag
      DATA: root TYPE REF TO if_ixml_element.
      root = odocument->create_simple_element_ns(
         name   = 'MT_FILE_PAXAR_INB'
         prefix = 'ns0'
         uri    = uri
        value = temp
         parent = odocument ).
      DATA: ns_xml_attr TYPE REF TO if_ixml_attribute.
      ns_xml_attr = odocument->create_attribute_ns(
      name   = 'ns0'
      prefix = 'xmlns'
      uri    = 'http://logimoda.com/ns_paxar'
      ret_value = ns_xml_attr->set_value( uri ).
      ret_value = root->set_attribute_node_ns(
       new_attr = ns_xml_attr
    create recordset tag (<= see ref. in FTP Comm. Channel)
      DATA: recordset TYPE REF TO if_ixml_element.
    recordset = odocument->create_simple_element(
        name = 'Recordset'
        value = temp
        parent = root ).
    Test - Start ***********
      DATA: doc_fragm TYPE REF TO if_ixml_document_fragment.
      doc_fragm = odocument->create_document_fragment( ).
    create recordset tag (<= see ref. in FTP Comm. Channel)
      recordset = odocument->create_simple_element(
         name = 'Recordset'
        value = temp
         parent = doc_fragm ).
      DATA: ref_child TYPE REF TO if_ixml_node.
      ret_value = root->insert_child(
      new_child = doc_fragm
      ref_child = ref_child
    DATA: recordset_array TYPE REF TO if_ixml_node_collection.
    recordset_array->append_item(recordset_el).
    Test - End   ***********
    XI Inbound Message: MT_FILE_PAXAR_INB
      DATA: zcodeidoc       TYPE REF TO if_ixml_element.
      DATA: j_3acomord      TYPE REF TO if_ixml_element.
      DATA: werks           TYPE REF TO if_ixml_element.
      DATA: trilog_yseason  TYPE REF TO if_ixml_element.
      DATA: temp TYPE string.
      LOOP AT t_etichette INTO wa_t_etichette.
    HERE IS THE PROBLEM, HOW TO DO IT ?
        ret_value = root->insert_child(
         new_child = recordset
         ref_child = recordset
        CLEAR temp.
        MOVE wa_t_etichette-zcodeidoc TO temp.
        zcodeidoc  = odocument->create_simple_element(
        name = 'ZCODEIDOC'
         value = temp
        parent = recordset ).
        CLEAR temp.
        MOVE wa_t_etichette-j_3acomord TO temp.
        j_3acomord  = odocument->create_simple_element(
           name = 'j_3acomord'
         value = temp
           parent = recordset ).
        CLEAR temp.
        MOVE wa_t_etichette-werks TO temp.
        werks  = odocument->create_simple_element(
         name = 'WERKS'
         value = temp
         parent = recordset ).
        CLEAR temp.
       MOVE wa_t_etichette-trilog_yseason TO temp.
        trilog_yseason  = odocument->create_simple_element(
           name = 'trilog_yseason'
         value = temp
           parent = recordset ).
        CLEAR wa_t_etichette.
      ENDLOOP.
    render document ======================================================
    create output stream
      DATA: ostream TYPE REF TO if_ixml_ostream.
      ostream = streamfactory->create_ostream_xstring( result ).
    create renderer
      DATA: renderer TYPE REF TO if_ixml_renderer.
      DATA irc TYPE i.
      renderer = ixmlfactory->create_renderer( ostream = ostream
      document = odocument ).
      irc = renderer->render( ).
    1.4 for debug ********************************************************
    Uploading Files and Manipulating their Content
    (SAP Library - Business Server Pages)
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ba/78d3c747b24546ab1c1499a054d8a5/content.htm
      DATA: conv_out TYPE REF TO cl_abap_conv_out_ce.
      conv_out = cl_abap_conv_out_ce=>create(
               encoding = 'UTF-8'
               endian = 'L' ).
    conversion string => xstring *********************************
    conv->convert( EXPORTING data = out
                    IMPORTING buffer = result ).
    conversion xstring => string *********************************
      DATA: outxml TYPE string.
      DATA: conv_in   TYPE REF TO cl_abap_conv_in_ce.
      conv_in = cl_abap_conv_in_ce=>create( input = result ).
      conv_in->read( IMPORTING data = outxml ).
    store file txt on PC for test purpose - Start          ********
      DATA: dataset_str_xml  TYPE string,
            debug_allowed(1) TYPE c,
            l_xml_size       TYPE i.
        dataset_str_xml = '/usr/sap/XIT/ZXI_PARAX_TEST_XML.xml'.
        OPEN DATASET dataset_str_xml FOR OUTPUT
             IN TEXT MODE ENCODING DEFAULT.
        TRANSFER outxml TO dataset_str_xml.
        CLOSE DATASET dataset_str_xml.
    store file txt on PC for test purpose - End            ********
    ENDMETHOD.

    create recordset tag (<= see ref. in FTP Comm. Channel)
    recordset = odocument->create_simple_element(
    name = 'Recordset'
    value = temp
    parent = doc_fragm ).
    this object must be created inside your loop...

  • Problem in parsing in ABAP mapping

    Hi all , In our ABAP mapping  we are trying to create a DOM tree from a XML file but we are getting the error in the following statement
    l_rc = if_iparser->parse( ).
    when we track the error using
    i = l_error->get_line( ). (result 0)
    i = l_error->get_column( ). (result 2017)
    str = l_error->get_reason( ). (Expected '<' or '/>' tag)
    but strange thing is we can open the file using Stylus studio/ Altova / IE ..so may the problem is not in the XML file ....Has anybody faced the problem before ??
    Kind regarrds
    Goutam

    Hi,
    Have a look at this link.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
    I guess,your code may have problem.
    Try doing this from document.
    iparser = ixmlfactory->create_parser( stream_factory = streamfactory
    istream = istream
    document = idocument ).
    iparser->parse( ).
    Regards,
    Akshay Jamgaonkar.
    Hope this will help.

  • Regarding Java mapping and ABAP Mapping

    Hello,
         If I suppose to do Java mapping or ABAP mapping, Is there any pre requisite to perform these two mappings?
    If exist what they are?
    How to perform them?
    Thank you

    Hello jyotsna,
    Java mapping can be used when you have complex mapping structures.
    We can do most of the times for our requirements through Graphical mapping.
    When the structures are very complex to build you can go for SAX (Simple API for XML) or DOM (Document Object Model) parsers.
    Message mapping internally generates DOM parser.
    Java Mapping in XI
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=java+mapping&adv=false&sortby=cm_rnd_rankvalue#
    SAP Network Blog: Implementing a Java Mapping in SAP PI
    /people/carlosivan.prietorubio/blog/2007/12/21/implementing-a-java-mapping-in-sap-pi
    Java Mapping (SAP Library - Partner Connectivity Kit)
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    SAP Network Blog: XI Java Mapping Helper (DOM)
    /people/alessandro.guarneri/blog/2007/03/25/xi-java-mapping-helper-dom
    SAP Network Blog: Testing and Debugging Java Mapping
    /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
    Binary Conversion in XI - Java Mapping - Code Gallery - Wiki
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/binary%2bconversion%2bin%2bxi%2b-%2bjava%2bmapping
    SAP Network Blog: "JAVA MAPPING", an alternate way of reading a CSV file
    /people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file
    ABAP mappings run on ABAP Stack and are developed in the ABAP workbench of the Integration Server.
    You normally do not need to use the ABAP mappings and is preferable for someone with ABAP programming background. I should say JAVA functions would suffice any complex scenarios.
    refer step by step guides for ABAP Mapping
    ABAP Mapping
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=abap+mapping&adv=false&sortby=cm_rnd_rankvalue#
    How to Use ABAP Mapping in Exchange Infrastructure 3.0 (NW2004)
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
    SAP Network Blog: Testing ABAP Mapping
    /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
    SAP Network Blog: How to call XI ABAP Mapping via RFC
    /people/ricardoandres.maienza/blog/2007/04/06/how-to-call-xi-abap-mapping-via-rfc
    SAP Network Blog: XI: ABAP mapping logs - more standard = better visibility
    /people/michal.krawczyk2/blog/2006/09/20/xi-abap-mapping-logs--more-standard-better-visibility
    SAP Network Blog: Dynamically sending a mail to the PO creator using XSLT- ABAP Mapping
    /people/rahul.nawale2/blog/2006/11/01/dynamically-sending-a-mail-to-the-po-creator-using-xslt-abap-mapping
    You need to provide the name of your mapping program maually , you see it is an input box.
    just provide the name of abap mapping program it will work.
    and one more thing you cannot test abap mapping program in integration builer you need to test in abap only.
    use tcode: SXI_MAPPING_TEST for testing abap mapping
    Thanks,
    Satya
    Reward points if it is useful..

  • Sproxy and abap mapping

    Hi All,
    1.how can i get the data into sproxy(application system) from integration builder(integration server)?.
    2.how to do setting in TC SM59 for http destination for this?
    3.pls give abap mapping scenario
    Thanks & Regards,

    Hi Srinivas
    <b>for more details check these also</b>
    <b>How to use abap mapping in XI</b>
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
    <b>Have a look at this document...</b>
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
    Hi Refer this Pdf
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
    This Blog also
    /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
    /people/ricardoandres.maienza/blog/2007/04/06/how-to-call-xi-abap-mapping-via-rfc
    Help link - http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/content.htm
    <b>
    An excellent How to guide on the same -</b> https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
    /people/udo.martens/blog/2006/08/23/comparing-performance-of-mapping-programs
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/15ecdf90-0201-0010-d792-941a3c3c30a4
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a6638
    https://wwwn.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
    /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
    https://websmp101.sap-ag.de/~sapdownload/011000358700003082332004E/HowToABAPMapping.pdf
    /people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
    /people/r.eijpe/blog
    ABAP Mapping Vs Java Mapping.
    Re: Message Mapping of type ABAP Class not being shown
    <b>Start with this...........</b>
    /people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
    This document will help you to create ABAP Mapping .
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how%20to%20use%20abap-mapping%20in%20xi%203.0.pdf
    /people/ricardoandres.maienza/blog/2007/04/06/how-to-call-xi-abap-mapping-via-rfc
    /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
    Thanks!!

  • ABAP MAPPING : Getting An Error

    hi all
    i am using a scenario where i am sending data from r/3(prog)>xi>R/3(RFC).
    in between i am using ABAP MAPPING
    i am getting an error:
    ERROR:  "" MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: java.lang.StringIndexOutOfBoundsException: String index out of range: -7: com.sap.aii.af.rfc.afcommunication.RfcAFWException: java.lang.StringIndexOutOfBoundsException: String index out of range: -7""
    the ABAP MAPPING which i am using:
    METHOD IF_MAPPING~EXECUTE.
      BREAK-POINT.
      * initialize iXML
      TYPE-POOLS: IXML.
      TYPE-POOLS: IXML.
      DATA: L_IXML TYPE REF TO IF_IXML.
    *creating the Interface by calling the create method in class C_IXML
      CALL METHOD CL_IXML=>CREATE
    EXPORTING
       TYPE   = 0
        RECEIVING
          RVAL   = L_IXML.
    create stream factory
      DATA: STREAMFACTORY TYPE REF TO IF_IXML_STREAM_FACTORY.
      CALL METHOD L_IXML->CREATE_STREAM_FACTORY
        RECEIVING
          RVAL = STREAMFACTORY.
    create input stream
      DATA: ISTREAM TYPE REF TO IF_IXML_ISTREAM.
      CALL METHOD STREAMFACTORY->CREATE_ISTREAM_XSTRING
        EXPORTING
          STRING = SOURCE
        RECEIVING
          RVAL   = ISTREAM.
    *This iXML factory can create an empty XML document object named IDOCUMENT.
    initialize input document
      DATA:  IDOCUMENT TYPE REF TO IF_IXML_DOCUMENT.
      CALL METHOD L_IXML->CREATE_DOCUMENT
        RECEIVING
          RVAL = IDOCUMENT.
    parse input document
      DATA: IPARSER TYPE REF TO IF_IXML_PARSER.
      CALL METHOD L_IXML->CREATE_PARSER
        EXPORTING
          DOCUMENT       = IDOCUMENT
          ISTREAM        = ISTREAM
          STREAM_FACTORY = STREAMFACTORY
        RECEIVING
          RVAL           = IPARSER.
      IPARSER->PARSE( ).
      DATA: ROOT TYPE REF TO IF_IXML_ELEMENT.
    get message content of tag
      DATA: INCODE  TYPE REF TO IF_IXML_NODE_COLLECTION,
            INCODE1 TYPE REF TO IF_IXML_NODE_COLLECTION,
            INCODE2 TYPE REF TO IF_IXML_NODE_COLLECTION,
            INCODE0  TYPE REF TO IF_IXML_NODE_COLLECTION.
      CALL METHOD IDOCUMENT->GET_ELEMENTS_BY_TAG_NAME
        EXPORTING
         DEPTH     = 0
          NAME      = 'MANDT'
         NAMESPACE = ''
        RECEIVING
          RVAL      = INCODE0 .
      CALL METHOD IDOCUMENT->GET_ELEMENTS_BY_TAG_NAME
      EXPORTING
         DEPTH     = 0
        NAME      = 'EMPNO'
         NAMESPACE = ''
      RECEIVING
        RVAL      = INCODE.
      CALL METHOD IDOCUMENT->GET_ELEMENTS_BY_TAG_NAME
    EXPORTING
         DEPTH     = 0
    NAME      = 'EMPNAME'
         NAMESPACE = ''
    RECEIVING
    RVAL      = INCODE1.
      CALL METHOD IDOCUMENT->GET_ELEMENTS_BY_TAG_NAME
    EXPORTING
         DEPTH     = 0
    NAME      = 'DEPARTMENTNAME'
         NAMESPACE = ''
    RECEIVING
    RVAL      = INCODE2.
      DATA: URI TYPE STRING.
      URI = 'urn:sap-com:document:sap:rfc:functions'.
    * build up output document =============================================
    create output document
      DATA: ODOCUMENT TYPE REF TO IF_IXML_DOCUMENT.
      CALL METHOD L_IXML->CREATE_DOCUMENT
        RECEIVING
          RVAL = ODOCUMENT.
      DATA: RET_VALUE TYPE I.
    *At this point you can add the nodes (elements, attributes) into the document. First you have to declare the root element node.
      DATA: L_ELEMENT_ROOT TYPE REF TO IF_IXML_ELEMENT.
      CALL METHOD ODOCUMENT->CREATE_ELEMENT_NS
        EXPORTING
          NAME   = 'ZTEST1'
          PREFIX = 'ns1'
          URI    = 'urn:sap-com:document:sap:rfc:functions'
        RECEIVING
          RVAL   = L_ELEMENT_ROOT.
      DATA: L_ELEMENT_NODE TYPE REF TO IF_IXML_ELEMENT.
      CALL METHOD ODOCUMENT->CREATE_SIMPLE_ELEMENT
        EXPORTING
          NAME      = 'ZTEST1'
         NAMESPACE = 'xmlns ns1 urn:sap-com:document:sap:rfc:functions'
          PARENT     = ODOCUMENT
       VALUE     = '?xml version="1.0" encoding="UTF-8"?'
        RECEIVING
          RVAL      = L_ELEMENT_ROOT.
      DATA: ATTRIBUTE TYPE REF TO IF_IXML_ATTRIBUTE.
      CALL METHOD ODOCUMENT->CREATE_ATTRIBUTE_NS
        EXPORTING
          NAME   = 'ZTEST1'
          PREFIX = 'xmlns'" ns1="urn:sap-com:document:sap:rfc:functions"'
          URI    = 'urn:sap-com:document:sap:rfc:functions'
        RECEIVING
          RVAL   = ATTRIBUTE.
      RET_VALUE = ODOCUMENT->SET_NAMESPACE_PREFIX(
    PREFIX = 'ns1').
      CALL METHOD ATTRIBUTE->SET_VALUE
        EXPORTING
          VALUE = URI
        RECEIVING
          RVAL  = RET_VALUE.
      CALL METHOD L_ELEMENT_ROOT->SET_ATTRIBUTE_NODE_NS
        EXPORTING
          NEW_ATTR = ATTRIBUTE
        RECEIVING
          RVAL     = RET_VALUE.
      DATA: NODE_LIST_COLLECTION TYPE REF TO IF_IXML_NODE_COLLECTION.
    add node to the output document
      DATA: OUTCODE0 TYPE REF TO IF_IXML_NODE.
      DATA: OUTCODE  TYPE REF TO IF_IXML_NODE.
      DATA: OUTCODE1 TYPE REF TO IF_IXML_NODE.
      DATA: OUTCODE2 TYPE REF TO IF_IXML_NODE.
      DATA: INDEX1 TYPE SY-INDEX.
      DATA: INDEX TYPE SY-INDEX.
      DATA IRC TYPE I.
      CALL METHOD IDOCUMENT->GET_ELEMENTS_BY_TAG_NAME
        EXPORTING
       DEPTH     = 0
          NAME      = 'MANDT'
       NAMESPACE = ''
        RECEIVING
          RVAL      =  NODE_LIST_COLLECTION.
      DATA: LENGTH TYPE I.
      CALL METHOD NODE_LIST_COLLECTION->GET_LENGTH
        RECEIVING
          RVAL = LENGTH.
      WHILE INDEX < LENGTH.
        CALL METHOD IDOCUMENT->CREATE_SIMPLE_ELEMENT
          EXPORTING
            NAME      = 'DATA'
       NAMESPACE = ''
            PARENT     = L_ELEMENT_ROOT
       VALUE     =
          RECEIVING
            RVAL      =  L_ELEMENT_NODE .
        CALL METHOD INCODE0->GET_ITEM
          EXPORTING
            INDEX = INDEX
          RECEIVING
            RVAL  = OUTCODE0.
        CALL METHOD INCODE->GET_ITEM
          EXPORTING
            INDEX = INDEX
          RECEIVING
            RVAL  = OUTCODE.
        CALL METHOD INCODE1->GET_ITEM
          EXPORTING
            INDEX = INDEX
          RECEIVING
            RVAL  = OUTCODE1.
        CALL METHOD INCODE2->GET_ITEM
          EXPORTING
            INDEX = INDEX
          RECEIVING
            RVAL  = OUTCODE2.
        CALL METHOD L_ELEMENT_NODE->APPEND_CHILD
          EXPORTING
            NEW_CHILD = OUTCODE0
          RECEIVING
            RVAL      = IRC.
        CALL METHOD L_ELEMENT_NODE->APPEND_CHILD
          EXPORTING
            NEW_CHILD = OUTCODE
          RECEIVING
            RVAL      = IRC.
        CALL METHOD L_ELEMENT_NODE->APPEND_CHILD
          EXPORTING
            NEW_CHILD = OUTCODE1
          RECEIVING
            RVAL      = IRC.
        CALL METHOD L_ELEMENT_NODE->APPEND_CHILD
          EXPORTING
            NEW_CHILD = OUTCODE2
          RECEIVING
            RVAL      = IRC.
        ADD 1 TO INDEX.
      ENDWHILE.
    render document ======================================================
    create output stream
      DATA: OSTREAM TYPE REF TO IF_IXML_OSTREAM.
      CALL METHOD STREAMFACTORY->CREATE_OSTREAM_XSTRING
        EXPORTING
          STRING = RESULT
        RECEIVING
          RVAL   = OSTREAM.
    DATA: IPARSER TYPE REF TO IF_IXML_PARSER.
      CALL METHOD L_IXML->CREATE_PARSER
        EXPORTING
          DOCUMENT       = ODOCUMENT
          ISTREAM        = ISTREAM
          STREAM_FACTORY = STREAMFACTORY
        RECEIVING
          RVAL           = IPARSER.
      IPARSER->PARSE( ).
    create renderer
      DATA: RENDERER TYPE REF TO IF_IXML_RENDERER.
      CALL METHOD L_IXML->CREATE_RENDERER
        EXPORTING
          DOCUMENT = ODOCUMENT
          OSTREAM  = OSTREAM
        RECEIVING
          RVAL     = RENDERER.
      IRC = RENDERER->RENDER( ).
    ENDMETHOD.
    plz help me out ASAP
    thnks
    kalyan

    hi
        all
    now the situation is that i am able to send the data to R/3,
    But in RWB-->MessageMonitoring ->version>Message Contents i am getting a error :
    *XML Parsing Error: not well-formed
    Location: http://aipid:50000/mdt/messagecontentservlet?attachment=0
    Line Number 1, Column 176:*
    <?xml version="1.0"?><ns1:ZTEST1 xmlns:ns1="urn:sap-com:document:sap:rfc:functions"><DATA><MANDT>210</MANDT><EMPNO>000000000023</EMPNO><EMPNAME>C</EMPNAME></DATA></ns1:ZTEST1 xmlns:ns1="urn:sap-com:document:sap:rfc:functions">
    it is not converted into XML ,the underline is the error which it is showing.
    it would be great if any one can figure it out what might be the cause of this error
    thanks
    kalyan

  • Receiver determintation using Abap Mapping

    Hi,
    I configured a scenario in which I'm using extended receiver determination to determine the receiver of an incoming message. (The reason for this is that there is only one XI system and two ECC systems - DEV and QAS. By means of the setting in a customizing table it can be determined whether the message is sent to DEV or QAS. The message can't be sent to both systems because it is a synchronous interface). The receiver determination calls an Interface Mapping which has target interface Receiver Determination. I made an Abap Mapping program in which the customize table is read and the output message is formed as follows (according to the structure of the Receivers message):
          lrf_output_document = lrf_ixml_factory->create_document( ).
          lrf_receivers = lrf_output_document->create_simple_element( name = 'Receivers'
                                                                      parent = lrf_output_document ).
          lrf_receiver  = lrf_output_document->create_simple_element( name = 'Receiver'
                                                                      parent = lrf_receivers ).
          lrf_element   = lrf_output_document->create_simple_element( name = 'Party'
                                                                      value = ' '
                                                                      parent = lrf_receiver ).
          lrf_element->set_attribute( name = 'agency'
                                                 value = ' ' ).
          lrf_element->set_attribute( name = 'scheme'
                                                value = ' ' ).
          lrf_element   = lrf_output_document->create_simple_element( name = 'Service'
                                                        value  = 'DEV'
                                                        parent = lrf_receiver ).
    To fill the RESULT field a stream factory is instantiated and a XSTRING is created. When I send a message to the system, the receiver determination dumps: Error when parsing receiver listLength of XML document 129 Error when parsing receiver listLength of XML Document 129 System expected the element 'Receivers'
    Looks like the XSTRING has not got the right structure and can not be parsed into the Receivers message. However, when I create a CSTRING, the message looks OK. I also changed the encoding (Codepage 4103).
    When I replace the Abap mapping with a message mapping, the receiver determination works OK. However, in that case it is not possible to read the customizing table. I really need the Abap mapping.
    Has anyone ever filled the Receivers massage by means of Abap mapping. Any feedback will be appreciated!

    Hi,
    there is a easier way - totally based on my blogs
    create an abap mapping that will feed the dynamicconfiguration in ABAP (with z "Z" namespace) - similar thing shown in my blog
    /people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping
    and you don't need to create the XML in ABAP mapping just parse it, fill DC and send the same source to the target
    (so you don't change the XML)
    then add a message mapping to your interface mapping in which you will only use dynamicconfig value
    to populate the receiver segment
    nice and clean way
    Regards,
    Michal Krawczyk

  • Abap mapping: remove a parent or child node.

    Hi all,
    I will trying to remove a parent node (and all childs related to it) or a specific child (field) om my XML input message to obtain a new output message.
    Reading the meaning of the methods remove_node and remove child (if_ixml_node) I can not find a solution in writing the right Abap code.
    My ouput document is so defined:
    data: outcode type ref to if_ixml_node.
    I receive the following error message when I try to find all possibilities.
    Runtime Errors         OBJECTS_OBJREF_NOT_ASSIGNED_NO
    If someone can give me a simple code for solving my issue, I will appreciate this.
    Thanks,
    Regards,
       Giovanni

    Hi,
    this link explain the signature that is how to use all the methods  including the method u want
    [http://help.sap.com/saphelp_nw04/helpdata/en/bb/57669ddca511d4990b00508b6b8b11/frameset.htm]
    and this for complete library for ABAP mapping[http://help.sap.com/saphelp_nw04/helpdata/en/bb/57669ddca511d4990b00508b6b8b11/frameset.htm]
    Thanks and regards,
    Kubra Fatima.

  • ABAP Mapping XPATH Expression

    Hello to all,
    I'm trying to create a ABAP    based mapping without xslt, as xslt-mapping is running in a timeout.
    Is there a way to execute XPATH expressions on a document?
    The method "get_elements_by_name" isn't helpfull, as I need to specify a certain path within the xml-document.
    Thanks for your suggestions.
    Best regards,
    Christian

    I dont think it will be possible untill you include XSLT mapping in to ABAP mapping as you would need a compiler for XPATH expressions.

  • [ABAP Mapping] No output

    Hey,
    try to do a scenario like "How to use ABAP mapping in SAP XI 3.0", but got no output.
    Is it correct that we don't need a namespace for abap mapping? In the "How to" document the namespace field is empty, but in sxmb_moni he says:
    <b>  <SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: error while processing the request to rfc-client: com.sap.aii.af.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: could not get functionname from XML requst: com.sap.aii.af.rfc.RfcAdapterException: failed to read funtionname from XML document: missing namespace declaration(2)</SAP:AdditionalText> </b>
    But he takes the ABAP mapping, because in ABAP code I create following trace node:
    <i>  DATA: l_trace TYPE string.
      CONCATENATE 'Chris Sender Service = ' l_sender_service INTO l_trace.
      trace->trace( level = '1'
      message = l_trace ).</i>
    And in sxmb_moni he got it:
    <i><Trace level="1" type="T">Chris Sender Service =BS_Reisebuero2</Trace> </i>
    In sxi_mapping_test he writes, that the mapping was successful, but didn't create the output structure. Do I have a wrong ABAP code? Could it be, that I have a wrong append_child??
    Here it is (it equals the how to):
    <i>
    METHOD if_mapping~execute.
    initialize iXML
      TYPE-POOLS: ixml.
      CLASS cl_ixml DEFINITION LOAD.
    create main factory
      DATA: ixmlfactory TYPE REF TO if_ixml.
      ixmlfactory = cl_ixml=>create( ).
    create stream factory
      DATA: streamfactory TYPE REF TO if_ixml_stream_factory.
      streamfactory = ixmlfactory->create_stream_factory( ).
    create input stream
      DATA: istream TYPE REF TO if_ixml_istream.
      istream = streamfactory->create_istream_xstring( source ).
    parse input document =================================================
    initialize input document
      DATA: idocument TYPE REF TO if_ixml_document.
      idocument = ixmlfactory->create_document( ).
    parse input document
      DATA: iparser TYPE REF TO if_ixml_parser.
      iparser = ixmlfactory->create_parser( stream_factory = streamfactory
      istream = istream
      document = idocument ).
      iparser->parse( ).
    **********get source elements**********************************
    get message content of tag <carrid>
      DATA: carrid TYPE REF TO if_ixml_node_collection.
      carrid = idocument->get_elements_by_tag_name( 'carrid' ).
    get message content of tag <connid>
      DATA: connid TYPE REF TO if_ixml_node_collection.
      connid = idocument->get_elements_by_tag_name( 'connid' ).
    get message content of tag <fldate>
      DATA: fldate TYPE REF TO if_ixml_node_collection.
      fldate = idocument->get_elements_by_tag_name( 'fldate' ).
    ***********get meta datas****************************************
    get XI header data (here: "Sender Service")
      DATA: l_sender_service TYPE string.
      l_sender_service = param->get( if_mapping_param=>sender_service ).
    add trace (appears in message monitoring)
      DATA: l_trace TYPE string.
      CONCATENATE 'Chris Sender Service = ' l_sender_service INTO l_trace.
      trace->trace( level = '1'
      message = l_trace ).
    build up output document =============================================
    create output document
      DATA: odocument TYPE REF TO if_ixml_document.
      odocument = ixmlfactory->create_document( ).
    create element SXIDEMO_AIRL_FLIGHT_CHECKAVAIL and add it to the document
      DATA: sxidemo TYPE REF TO if_ixml_element.
      sxidemo = odocument->create_simple_element(
                           name = 'SXIDEMO_AIRL_FLIGHT_CHECKAVAIL_chris'
                           parent = odocument ).
    add FLIGHT_KEY node to the output document
      DATA: flight_key TYPE REF TO if_ixml_node.
      flight_key = carrid->get_item( index = 0 ).
      DATA irc TYPE i.
      irc = sxidemo->append_child( flight_key ).
    ***********add elements to output document *******************
    add carrid node to the output document
      DATA: outcode1 TYPE REF TO if_ixml_node.
      outcode1 = carrid->get_item( index = 0 ).
      irc = flight_key->append_child( outcode1 ).
    add connid node to the output document
      DATA: outcode2 TYPE REF TO if_ixml_node.
      outcode2 = connid->get_item( index = 0 ).
      irc = flight_key->append_child( outcode2 ).
    add fldate node to the output document
      DATA: outcode3 TYPE REF TO if_ixml_node.
      outcode3 = fldate->get_item( index = 0 ).
      irc = flight_key->append_child( outcode3 ).
    Testen einer manuellen eingabe
      outcode1 = odocument->create_simple_element(
                              name = 'passengerName'
                              value = 'Christian Riekenberg'
                              parent = flight_key ).
    render document ======================================================
    create output stream
      DATA: ostream TYPE REF TO if_ixml_ostream.
      ostream = streamfactory->create_ostream_xstring( result ).
    create renderer
      DATA: renderer TYPE REF TO if_ixml_renderer.
      renderer = ixmlfactory->create_renderer( ostream = ostream
      document = odocument ).
      irc = renderer->render( ).
    ENDMETHOD.
    </i>
    thanks
    chris
    Message was edited by:
            Christian Riekenberg

    Hi,
    I took a working scenario, that is runnable with java- and graphical mapping.
    Just change it to ABAP-Mapping.
    I just had forget to include the namespace into abap mapping. So the output has to look like:
    <ns1:SXIDEMO_AIRL_FLIGHT_CHECKAVAIL <b>xmlns:ns1="urn:sap-com:document:sap:rfc:functions"</b>>
    That was the missing namespace. Another problem was my created structure. I used the function append_child with a wrong input.
    Your tip, that I'm able to use the debugger in
    sxi_mapping test was great. So points for you!
    Message was edited by:
            Christian Riekenberg

Maybe you are looking for

  • Java Troubles

    I have a problem with my install java software, it won't run websites that require java. I am trying to access a web pages that requires Java applet 1.4.2. i have J2SE 1.4.2 and J2SE 5.0.. Yet the web page still won't load i tried firefox and safari

  • What are all these duplicates in iTunes 11?

    Why am I seeing all these duplicates in an album in iTunes 11? How can I get rid of them? Why do some have download from iCloud buttons? I don't want to think. What's going on here. What has Apple done to a nice simple interface? doug

  • Project Allocations

    Project Gurus This may be pretty straight forward for you guys. In my company they want to true up project with GL every month. To be more specific, Projects should equal GL by Department and Account balance every month. For example, if the total lab

  • LVS show's no data and error message 1010

    I have installel LVS at 3 customers with the instruction. After now 2 day I have at 2 customers in all reports "no data". At 1 customer the LVS viewer has a error message: "Error #1010" LVS service ist started, AddOn is installed and Starttyp "Obliga

  • Viewing all pics in an album group

    Hi there. I am using Photoshop Elements 6.0. I have created album groups and then sub albums. For instance, I have an album group called "Digital Pictures 2007" and then have 12 albums in that album group, one for each month. What I am now trying to