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.

Similar Messages

  • File to IDoc : XML parsing in ABAP mapping

    Hi,
    In ABAP mapping I want to parse all of the incoming XML strings to internal table.Later I add few more fields to this table and transfer them to IDOC adapter in IDOC-XML format.In thsi case how do i get all of the input file data(converted from XML) into internal table using XML parsing in ABAP Mapping?
    Thansk in advance,
    RP

    Hi Amil,
    I insert into table but not immediately,I want all the parsed xml data into internal table and do something before I insert into DB /send it to IDOC.
    I knwo how to get single Xml parsing,but how to get multple records(looping xml parse) to internal table?
    Thanks,
    RP
    Edited by: RP@261 on Jun 3, 2009 2:14 PM

  • Automatic IDOC parse in ABAP Mapping?

    Hi,
    I'm creating a very complex mapping in an IDOC -> PI -> File scenario and I'm using ABAP Mapping to do that.
    I already know how to parse an inbound xml but it's a "heavy" job and the code finishes very "hardcoded".
    As you know, SAP uses the structure EDIDD to send/receive IDOC data generically. So I'm sure that internally SAP has a method/function or something to convert the XML data sent by PI to that EDIDD data structure when you send an Idoc through PI. I can't found that, do you know if it exists?
    Thanks

    You can use function module IDX_XML_TO_IDOC to convert the XML to IDOC type internal tables.
    Check for other function module in function group IDOC_ADAPTER_MB.
    KK

  • 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: XML iterative parsing.

    Hi All,
    I am trying to parse an XML file which structure is the following.
    <Order>
      <BookingCode>AAAAA</BookingCode>
           <F1>
           <F1>
           <F2>
           <F2>
    <BookingCode>BBBBBB</BookingCode>
           <F1>
           <F1>
           <F2>
           <F2>
    </Order>
    More exactly I try to check all values of tag name "BookingCode" up to the end of the XML file. The number of occurrences of "BookingCode" is not determinated.
    Is it necessary a loop after collecting a list of occurrences of "BookingCode"?
    I am trying to use:
    data: node_iterator type ref to if_ixml_node_iterator.
    node_iterator = incode->CREATE_ITERATOR( ).
    data: emp_node type ref to if_ixml_node.
    emp_node = node_iterator->GET_NEXT( ).
    data: emp_node_list type ref to if_ixml_node_list.
    emp_node_list = emp_node->GET_CHILDREN( ).
    data: emp_node_list_lenth type I.
    emp_node_list_lenth = emp_node_list->GET_LENGTH( ).
    Using the debugging I can not find exactly the behaviour.
    Any suggestion for solving my issue will be well appreciated.
    Thanks in advance.
    Regards,
        Giovanni

    Hi,
    referring to a document in the net, I am trying to define the loop for understanding the behaviour but I receive the abend:
    document: Understanding and working with ABAP Mapping (Steps to be followed in ABAP Mapping classes )
    data: emp_node_list_iterator type ref to if_ixml_node_iterator.
    data: emp_subnode type ref to if_ixml_node.
    DO emp_node_list_lenth TIMES.
         emp_subnode = emp_node_list_iterator->get_next( ).
    Abend:
    Runtime Errors         OBJECTS_OBJREF_NOT_ASSIGNED_NO
    Except.                CX_SY_REF_IS_INITIAL
    Thanks in advance for your kind support.
    Regards,
        Giovanni

  • Abap mapping problem

    Hi friends,
    I am trying Abap mapping in my scenario.
    I am using DOM parsers
    By default the first line of the output xml document generated is
    <b><?xml version="1.0" ?></b>
    But I want to add encoding to it. i.e it should be
    <b><?xml version="1.0" encoding="UTF-8"?></b>
    I have written the code to change this , but it is not working. my code is
    data: temp1 type string.
    temp1 = 'UTF-8'.
    data : encode type ref to IF_IXML_ENCODING.
    encode->set_character_set( CHARSET = 'UTF-8' ).
    data: odocument type ref to if_ixml_document.
    odocument = ixmlfactory->create_document( ).
    odocument->SET_ENCODING( encode ).
    This code is giving exception
    - <u><CX_XMS_SYSTEM_ERROR>
      <ID>APPLICATION_PROGRAM_ERROR</ID>
      <P1>Z_COSTCENTER_ABAP_MAPPING</P1>
      <P2>SAP-ABAP</P2>
      <P3>UNCAUGHT_EXCEPTION</P3>
      <P4>Program Z_COSTCENTER_ABAP_MAPPING=====CP Include Z_COSTCENTER_ABAP_MAPPING=====CM001 Line 1</P4>
      <INFO />
      <CATEGORY />
      <AREA />
      <RETRY />
      </CX_XMS_SYSTEM_ERROR>
      <CX_XMS_SYSERR_MAPPING />
      </cls:CX_XMS_SYSERR_MAPPING>
    - <cls:CX_SY_NO_HANDLER id="o215">
    - <CX_ROOT>
      <TEXTID>1F09B73915F6B645E10000000A11447B</TEXTID>
      <PREVIOUS href="#o216" />
      <KERNEL_ERRID>UNCAUGHT_EXCEPTION</KERNEL_ERRID>
    - <INTERNAL_SOURCE_POS>
      <PROGID>196</PROGID>
      <CONTID>47</CONTID>
      </INTERNAL_SOURCE_POS>
      </CX_ROOT>
      <CX_NO_CHECK />
    - <CX_SY_NO_HANDLER>
      <CLASSNAME><b>CX_SY_REF_IS_INITIAL</b></CLASSNAME>
      </CX_SY_NO_HANDLER></u>
    Can anyone please tell me how to add the encoding parameter in the Output XML document which we are building through ABAP MAPPING.
    Thanks,
    Yomesh

    Hi Yomesh,
    Did you solve this problem. If yes could you please tell. I am also facing the same problem.
    Regards,
    Dinakar

  • Problem in the ABAP mapping

    hi all ,
    We are facing a strange problem in ABAP mapping , we are uisng the  below syntax
        if_node_collection = if_idocument->get_elements_by_tag_name( 'E1MVKEM').
        l_rows = if_node_collection->get_length( )
    It is not showing the exact no of  E1MVKEM segments. Suppose it has 3 segments l_rows is '2'. Now in our custom code ( we have created a DOM from the XML) then used the same syntax, it is working fine ...
    Has anybody faced the same problem b4????
    Kind Ragards
    Goutam

    Solved

  • Problem with ABAP mapping

    Hi...
    I have  the following issue: I create an ABAP mapping class and activate it, but when I test the mapping via TC SXI_MAPPING_TEST it doing nothing, that is, in the result page, in the option TRACE its throw the following message: No mapping configured.
    Previously:
    1.- Create DT, MT and MI for each interfaces.
    2.- Create IM in wich put the name of the ABAP class of the mapping (and activate too).
    3.- Check in the IM the namespaces of both MT.
    Do I miss something?
    Hector

    Hi,
    Where did you created your ABAP mapping . is it in R3 instance of XI or in external R3?.
    If you are in R3 of XI then you can test it with SXI_MAPPING_TEST
    see the below links for more details
    /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
    ABAP mapping
    Testing ABAP mapping
    http://help.sap.com/saphelp_nw04/helpdata/en/de/705c3c3806af06e10000000a11402f/frameset.htm
    /people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach
    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/media/uuid/06114a70-0701-0010-5db6-93dbadaed321?prtmode=navigate
    /people/r.eijpe/blog/2006/02/19/xml-dom-processing-in-abap-part-iiia150-xml-dom-within-sap-xi-abap-mapping
    /people/r.eijpe/blog/2006/02/20/xml-dom-processing-in-abap-part-iiib150-xml-dom-within-sap-xi-abap-mapping
    Regards
    Chilla..

  • Has any one ever met this kind of ABAP-mapping problem ??

    Dear all,
    our scenario is:     
    (remote)MQ(ssl connection)->(local)MQ-(jms)>XI---(proxy)>ECC
    I met a very strange question during mapping which we use  abap mapping inside xi.
    the message come out from the abap mapping step.after the abap-mapping, the generated target message still has the source message concatenated with. it occurs only when all servers integrated together, but not occurs when we mannully put the source msg at local MQ (means this way, it works all right).
    even during error case, it still can go through all the remaining steps of IE, and the out bound jms adapter then goes into the
    target SAP ECC system, but of cause at the final step, it will reach u2018CX_ST_GROUP_MISSING_CASEu2019 error (this is because the message is not a valid xml file, and abap proxy can not consume it...
    sample file after abap mapping:
    <?xml version="1.0" encoding="utf-8"?>
    <ns:MT_MQIVMessage xmlns:ns="urn:ianes:mqiv">
         <MQIVMessage>
         <MQIVPayload> ..data..</MQIVPayload>
         </MQIVMessage>
    </ns:MT_MQIVMessage>
    <?xml version="1.0"?>
    <ns:MT_K2 xmlns:ns="urn:ianes:prp:ipsc">
         <header> .header.</header>
         <data>..data...</data>
    </ns:MT_K2>

    Dear expert,
    after detail analysis, i found the 1st place that the soap header was wrongly set...
    in call adater setp...
    <SAP:Sender>
      <SAP:Service>BS_PRP</SAP:Service>
      <SAP:Interface namespace="urn:ianes:ext:ips">MI_MQIV_outb</SAP:Interface>
      </SAP:Sender>
      <SAP:Receiver>
      <SAP:Party agency="" scheme="" />
      <SAP:Service>BS_SAP</SAP:Service>
      <SAP:Interface namespace="urn:ianes:prp:ipsc">MI_K3</SAP:Interface>
      </SAP:Receiver>
      <SAP:Interface namespace="urn:ianes:prp:ipsc">MI_K5</SAP:Interface>
      </SAP:Main>
    you can see the k5  was wrong set to k3
    correct soap header should be this
    <SAP:Sender>
      <SAP:Service>BS_PRP</SAP:Service>
      <SAP:Interface namespace="urn:ianes:ext:ips">MI_MQIV_outb</SAP:Interface>
      </SAP:Sender>
    - <SAP:Receiver>
      <SAP:Party agency="" scheme="" />
      <SAP:Service>BS_SAP</SAP:Service>
      <SAP:Interface namespace="urn:ianes:prp:ipsc">MI_K5</SAP:Interface>
    - <SAP:Mapping notRequired="M">
      <SAP:ObjectId>RXmJZiHCMPynqzPehi20YQ==</SAP:ObjectId>
      <SAP:SWCV>z+4XcK+qEduCcMP2oNwEVQ==</SAP:SWCV>
      <SAP:SP>-1</SAP:SP>
      </SAP:Mapping>
      </SAP:Receiver>
      <SAP:Interface namespace="urn:ianes:prp:ipsc">MI_K5</SAP:Interface>
      </SAP:Main>
    i guess this is the root of error, does any one give some hints on this ?
    Thanks
    Wu

  • ABAP Mapping - Queue problem

    Hello experts,
    I have an idoc for a PO that has 3 line items and within each line item there is a segment that is repeated twice.  I need to capture the segment that has PARVW = 'ZS' in each item while supressing the others ('ZW') in my PO output.
    <PO>
    <item>
      <1>
        <Partner>
           <ZS>
           <Name1>
        <Parnter>
           <ZW>
           <Name2>
      <2>
        <Partner>
           <ZS>
           <Name1>
        <Parnter>
           <ZW>
           <Name2>
      <3>
        <Partner>
           <ZS>
           <Name1>
        <Parnter>
           <ZW>
           <Name2>
    The mapping I have is checking Partner-PARVW = 'ZS' (using text function EqualsS) using the context for Partner. 
    I've tried many other variations but I've been unable to grab only the ZS partner information.
    Any ideas?
    Thanks,
    Matt

    Hi,
    This could be easily fixed using graphical mapping by following the methods from this example:
    [http://help.sap.com/saphelp_nw04/helpdata/en/e6/e6ae42e0fac911e10000000a1550b0/frameset.htm]
    But, looks like you are using a ABAP mapping here. For this we will have to look at the logic you're using to collect the data from the idoc.
    In my case (2 mappings I developed in ABAP), first I read all the data from the source structure and store it into an internal table. Then map the data from internal table to target structure.
    Regards,
    Sumant.

  • When we wil go for abap mapping ??

    Hi,
    As we know there are graphical, XSLT, JAVA mappings are there apart from ABAP mapping. I have gone through below weblog.
    /people/udo.martens/blog/2006/08/23/comparing-performance-of-mapping-programs
    and also help.
    http://help.sap.com/saphelp_nw04/helpdata/en/12/05731a10264057badc32d3d3957015/frameset.htm
    None of them says ABAP mapping is either faster or stable as compared to other mappings. Even though it is the case, still when we will go for abap mapping ??
    Is it like that it is totally depend on the available resources in hand ??
    thanks
    kumar

    > The SAP XI/PI mapping is the most efficient as it
    > only loads the part of the source message that are
    > used to create the target message(s) at runtime.
    >
    > Java and XSLT have to load the whole message into
    > memory to process the message. This can be
    > inefficient and if dealing with large messages can
    > cause issues.
    About your statement.
    If you consider the field mapping (or UDF) runtime, then you are correct. But if you consider the whole mapping runtime, you also have to "load" the full message in message mapping, obviously. What happens is that it is transparent to the developer, since loading and parsing is done by standard. But message mapping also deals with loading and parsing the whole message (and it is done with Java underneath). Then I don't think message mapping will have a significantly better/worse performance, when compared with Java mappings (performing normal xml processing methods).
    As for XSLT, the performance problems happens because you have a XSLT processor running over Java VM. Then, if you have heavy load on it, the mapping runtime will consume the resources necessary to run the xslt processor (which is, by itself, very resource consuming) and also to treat that heavy input.
    Regards,
    Henrique.

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

  • ABAP Mapping :: for multi files

    Dear Experts,
    We are doing an Idoc to file interface, using ABAP mapping.
    This is 1:n mapping i.e receiver message interface is 0..unbounded.
    We have achieved the mapping for 1:1. But when I test for multi, i get an error in moni saying
    Parsing error after multi mapping.Expected Message<i> instead of Item
    Item is the name of the node that has to be created multiple times.
    Has anyone done multi mapping in ABAP?? Any idea why this error....may be we are missing something.
    Any idea as to how we can progress???
    Thanks in advance
    Regards
    Shobha

    Hi,
    Surely u can use an ABAP mapping for this.
    Sounds like your problem is your not using correct output structure for multi mapping.
    As with any type of multi mapping your structure should reflect this. Your target payload must thus have the following structure:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
         <ns0:Message1>
              <unboundedPayload/>
         </ns0:Message1>
    </ns0:Messages>
    The <unboundedPayload> element in above should of course be replaced with your actual payload - I believe 'Item' in your case, if that is in fact the root node of your actual payload.
    Regards,
    Daniel

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