Skip to Content
0
Former Member
Jan 03, 2008 at 09:20 AM

Problem in ABAP Mapping (FILE to RFC Scenerio)

33 Views

Hi i am getting a problem in ABAP mapping which sending the data from File to RFC through XI.

My reciever Adapter (RFC) is unable to take the data!!

My data is like

210,000000000014,munish,SD

210,000000000015,ASHICH,MM

210,000000000016,muni,PM

210,000000000017,munigf,PMg

210,000000000018,munigf,PMgf

and the mapping program is like

method IF_MAPPING~EXECUTE.

BREAK-POINT.

  • * initialize iXML

type-pools: ixml.

class cl_ixml definition load.

  • create main factory

data: ixmlfactory type ref to if_ixml.

  • - 6 -

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 message content of tag <BookingCode>

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.

incode0 = idocument->get_elements_by_tag_name( 'MANDT' ).

incode = idocument->get_elements_by_tag_name( 'EMPNO' ).

incode1 = idocument->get_elements_by_tag_name( 'EMPNAME' ).

incode2 = idocument->get_elements_by_tag_name( 'DEPARTMENTNAME' ).

  • get XI header data (here: "Sender Service")

data: l_sender_service type string.

data: l_IT_DATA type string.

l_sender_service = param->get( if_mapping_param=>sender_service ).

l_IT_DATA = param->get( if_mapping_param=>sender_service ).

  • add trace (appears in message monitoring)

data: l_trace type string.

concatenate '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.

data: it_data type ref to if_ixml_document.

odocument = ixmlfactory->create_document( ).

  • create element 'SenderService' and add it to the document

data: msgtype type ref to if_ixml_element.

msgtype = odocument->create_simple_element(

name = 'ZTEST'

parent = odocument ).

  • create element 'SenderService' and add it to the output document

data: elementsender type ref to if_ixml_element.

data: it_date type ref to if_ixml_element.

data: item type ref to if_ixml_element.

  • elementsender = odocument->create_simple_element(

  • name = 'SenderService'

  • value = l_sender_service

  • parent = msgtype ).

it_date = odocument->create_simple_element(

name = 'IT_DATA'

*value = l_IT_DATA

parent = msgtype ).

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.

*value = l_IT_DATA

node_list_collection = idocument->get_elements_by_tag_name( 'MANDT' ).

while index < node_list_collection->get_length( ).

item = odocument->create_simple_element(

name = 'item'

parent = it_date ).

outcode0 = incode0->get_item( index ).

outcode = incode->get_item( index ).

outcode1 = incode1->get_item( index ).

outcode2 = incode2->get_item( index ).

irc = item->append_child( outcode0 ).

irc = item->append_child( outcode ).

irc = item->append_child( outcode1 ).

irc = item->append_child( outcode2 ).

add 1 to index.

endwhile.

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

  • - 7 -

renderer = ixmlfactory->create_renderer( ostream = ostream

document = odocument ).

irc = renderer->render( ).

endmethod.

the error coming in RWB is

MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: 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): 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 n

Plese help me out in solving the problem , the problem is in ABAP mapping code only...