on 01-03-2008 9:20 AM
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...
Hi,
Wouldn't be better to do it in java or use xslt?
As you showed, the message seems to not be complete. Is not necessary to handle the xml header?
regards.
roberti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
solved by me only!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.