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
Similar Messages
-
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.JainHI,
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. -
Error in ABAP Mapping (type SAP-ABAP, kernel error ID UNCAUGHT_EXCEPTION)
Hi ,
Scenario: Manually Purchase Order is created, automatically Sales Order should be created in the Target System through PI,
I have used Message Mapping which is working fine for single Customer and Vendor,
For Multiple Customers and Vendors i am using one ZTABLE, Only Message Mapping is not sufficient to my requirement.
Now i am using both Message Mapping and ABAP Mapping at a time in Interface Mapping. I created the class and done the development., whene i run the scenario i am getting the error as below,
*<SAP:Stack>Error in mapping program ZCL_SD_IDTO_POSO (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>*
*</SAP:Error>*
Please let me know.
Best Regards
VamsiHave u seen the ABAP mapping guide?
Refer this series to the ABAP mapping section.https:///people/sravya.talanki2/blog/2006/12/26/aspirant-to-learn-sap-xiyou-won-the-jackpot-if-you-read-this-part-ii
It will be very handy and useful. -
ABAP Mapping Programm error Urgent
I am getting mapping error in ABAP Mapping programm. plz help me how to solve
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!--
Request Message Mapping
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
<SAP:Category>Application</SAP:Category>
<SAP:Code area="MAPPING">APPLICATION_PROGRAM_ERROR</SAP:Code>
<SAP:P1>Z_HBS_PAYROLL_MAPPING</SAP:P1>
<SAP:P2>SAP-ABAP</SAP:P2>
<SAP:P3>UNCAUGHT_EXCEPTION</SAP:P3>
<SAP:P4>Program Z_HBS_PAYROLL_MAPPING=========CP Include Z_HBS_PAYROLL_MAPPING=========CM001 Line 1</SAP:P4>
<SAP:AdditionalText />
<SAP:ApplicationFaultMessage namespace="" />
<SAP:Stack>Error in mapping program Z_HBS_PAYROLL_MAPPING (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>
</SAP:Error>Hi,
I think this exception you need to catch it in the ABAP..
This may help u- http://help.sap.com/saphelp_47x200/helpdata/en/55/bff20efe8c11d4b54a006094b9456f/content.htm
just cross verify with this guide-
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
Regards,
moorthy -
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
ShobhaHi,
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 -
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
GoutamHi,
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. -
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
kalyanhi
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 -
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,
GiovanniHi,
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 for Error handling in Proxy to JDBC
Hi All,
I am working on a proxy to jdbc scenario in which we have to throw validation errors to NWPM(Net Weaver Process Monitor Tool)
I am following the below steps,
step 1 - In message mapping a UDF is created to catch errors and store them in a variable using dynamic configuration
step 2 - writing abap mapping for handling this thrown exception and im reading the dynamic configuration in the abap class and raising exception. The exception format expected is
SAP:Error SOAP:mustUnderstand="" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SAP:Category>XIServer</SAP:Category>
<SAP:Code area="RCVR_DETERMINATION">NO_RECEIVER_CASE_ASYNC</SAP:Code>
<SAP:P1>ZPI_THROW_EXCEPTION</SAP:P1>
<SAP:P2>001</SAP:P2/>
<SAP:P3>Mandatory field is missing[BUKRS] </SAP:P3>
<SAP:AdditionalText />
<SAP:Stack>No receiver could be determined</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
I have written the following ABAP code to achieve this:
method IF_MAPPING~EXECUTE.
DATA l_record type mpp_dynamic.
DATA error type String.
getting dynamic configuration value
filled in by any previous mapping
CALL METHOD DYNAMIC_CONFIGURATION->GET_RECORD
EXPORTING
NAMESPACE = 'http://sap.com/xi/XI/System/ERROR'
NAME = 'ERROR'
RECEIVING
RECORD = l_record.
error = l_record-value.
*raising exception with our message
RAISE EXCEPTION TYPE CX_MAPPING_FAULT
EXPORTING
TEXTID =
PREVIOUS =
ERROR_CODE = '001'
ERROR_TEXT = error .
RAISE EXCEPTION TYPE CX_MAPPING_FAULT
EXPORTING
TEXTID =
PREVIOUS =
ERROR_CODE = '003'
ERROR_TEXT = error .
endmethod.
I am gettign the following message for our code:
SAP:Error SOAP:mustUnderstand="" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SAP:Category>XIServer</SAP:Category>
<SAP:Code area="RCVR_DETERMINATION">NO_RECEIVER_CASE_ASYNC</SAP:Code>
<SAP:P1 />
<SAP:P2 />
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText />
<SAP:Stack>No receiver could be determined</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
Could you please help in finding the solution for getting currect error message from ABAP class?
Edited by: SwethaC on Jan 21, 2011 8:18 AMThe error is due to RFC Call fail from PI system to your ECC Application System.
Check your RFC Destination for ECC System type 3 in PI System.
When you are receiving data from ECC System using Proxies & again you are going to ECC System for Validation.
Why you are not doing this validation on ECC System only in your proxy code ?
In your proxy code, it will be much better for performance to check your data there on same system. -
Abap Mapping: error in accessing to DynamicConfiguration.
Hi All,
I have been trying to put a value into Dynamic Configuration repository with the following abap code.
DATA: l_record TYPE MPP_DYNAMIC.
l_record-namespace = 'http://name1/ca/result1'.
l_record-name = 'FileName'.
l_record-value = '/mydir/dir1/File01.xml'.
CALL METHOD dynamic_configuration->add_record
EXPORTING
record = l_record.
I receive the following dump.
Runtime Errors OBJECTS_OBJREF_NOT_ASSIGNED_NO
Except. CX_SY_REF_IS_INITIAL
Date and Time 25.03.2009 11:06:10
Short text
Access using a 'ZERO' object reference is not possible.
What happened?
Error in the ABAP application program.
The current ABAP program "Z_XI_MAPPING_TEST_03==========CP" had to be
interrupted because it contains
a statement that cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was n
caught in
procedure "IF_MAPPING~EXECUTE" "(METHOD)", nor was it propagated by a R
clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
An attempt was made to access a component with a 'ZERO' object
reference (points to 'nothing').
An object reference must point to an object (an instance of a class)
before it can be used to access a component.
Either the reference has not yet been set or it was set to 'ZERO' using
a CLEAR statement.
I am executing my test outside PI, by launching the report Z_MAPPING_TEST as explained in a blog.
In java evironment it is necessary to create an istance of a object for saving the value of the variable 'FileName' inside the Dynamic Configuration repository.
I do not know if it is necessary to create (before) an istance of the Dynamic Configuration in abap mapping or if the method add_record do this.
The meaning of my test is to get the name file from the Dynamic Configuration repository set in a previous step in a flow where the abap mapping will be launched.
Any suggestion will be well appreciated.
Many thanks in advance for your kind cooperation.
Regard,
GiovanniHi,
in your ABAP mapping code, instead of l_record-namespace = 'http://name1/ca/result1' use below:
l_record-namespace = 'http://sap.com/xi/XI/System'.
Then re-run your scenario.
Regards,
Rajeev Gupta -
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,
RPHi 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 -
Getting Error in java mapping: Parsing empty source. Root element expected!
Hi Experts,
I am using java mapping for schema validation of input message. I have followed all the standard procedures and implemented the java class in the interface mapping.
My interface mapping is like this:
OrderData --->Java Class ---SchemaValidate
Mesg Map ---OrderData_to_BAP --->BAPI Msg
So first I want to validate the schema of the input message. If the input message is invalid then XI should throw an exception. Then I use the actual message mapping to map the input order data to the BAPI input parameters.
In the java code I am using xerces parser.
The java code works fine when I run it as a standalone application.
The interface mapping also works fine if I don't include the java mapping. Ofcourse schema validation does not happen.
But when I test the interface mapping by including the java mapping then I am getting the error:
Call method execute of the application Java mapping SchemaValidate
Java mapping SchemaValidate completed. (execute() of SchemaValidate
com.sap.aii.utilxi.misc.api.BaseRuntimeException: Parsing an empty source. Root element expected!
What am I doing wrong? Why it is not getting the root element?
My Java code is as follows:
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.StreamTransformationException;
import java.io.*;
import java.util.Map;
import javax.xml.parsers.*;
import org.xml.sax.helpers.*;
import org.xml.sax.*;
import org.apache.xerces.jaxp.*;
Sample mapper for SAP-XI
@author Gopal
public class SchemaValidate implements StreamTransformation {
//Constants when using XML Schema for SAX parsing.
static final String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String W3C_XML_SCHEMA =
"http://www.w3.org/2001/XMLSchema";
static final String JAXP_SCHEMA_SOURCE =
"http://java.sun.com/xml/jaxp/properties/schemaSource";
Injection of mapping parameters
from integration engine
@param map Map with configuration data
public void setParameter(Map map) {
Mapping implementation
@param inputStream Input data from integration engine
@param outputStream Output data to integration engine
public void execute(InputStream inputStream,
OutputStream outputStream)
throws StreamTransformationException {
try {
// obtain an object of class javax.xml.parsers.SAXParser,
SAXParserFactory spf = SAXParserFactoryImpl.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);
SAXParser sp = spf.newSAXParser();
// setup the schema file
sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
sp.setProperty(JAXP_SCHEMA_SOURCE, new File("IOReqMsgSchema.xsd"));
//parse the input xml using the given schema
sp.parse(inputStream, new ParseErrorHandler());
catch(SAXException se) {
se.printStackTrace();
catch ( Exception e ) {
throw new StreamTransformationException( e.getMessage() );
My input message is :
<?xml version="1.0" encoding="UTF-8"?>
<ns0:OrderCreate_request xmlns:ns0="mynamespace">
<ORDER>HTEST1234567</ORDER>
<ORDER_TYPE>z001</ORDER_TYPE>
<ORDER_NAME>Test Order</ORDER_NAME>
<CO_AREA>INTC</CO_AREA>
<CCTR_POSTED>1234567890888888888</CCTR_POSTED>
<CURRENCY>USD</CURRENCY>
<PERSON_RESP>12345679</PERSON_RESP>
</ns0:OrderCreate_request>
Kindly help! please this is urgent!!!!!!
Thanks
Gopal
Edited by: gopalkrishna baliga on Feb 28, 2008 9:34 AMHi Stefan,
I did the code changes to return output stream and the java code works perfectly in standalone mode in my PC.
But when I use the same in the Java mapping with XI then It throws an error "Getting Error in java mapping: Parsing empty source. Root element expected!".
My XI J2EE server has JDK1.4.3.11.
Is there any limitation of using SAX parser in XI? If Yes, then which parser should be used for schema validation in XI?
I have included the XSD file for schema validation along with class files in the .jar file. This jar file is then imported in XI repository. Is the XI engine not able to read the XSD file?
Do I have to handle reading XSD file differently? Any suggession how?
Is this parser error due to some security access?
Kindly help me! I have been struggling with this problem since 2 weeks. I will be greatfull to you if you can help me.
Thanks
Gopal -
Hi,
My system is running on XI 3.0 SP9, I am using abap mapping for conversion idoc xml structure to flat file structure. But I am getting the error as shown below.
Appreciate for your response.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Request Message Mapping
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
<SAP:Category>Application</SAP:Category>
<SAP:Code area="MAPPING">APPLICATION_PROGRAM_ERROR</SAP:Code>
<SAP:P1>ZCL_ABAP_MAPPING4X</SAP:P1>
<SAP:P2>R3_ABAP</SAP:P2>
<SAP:P3>UNCAUGHT_EXCEPTION</SAP:P3>
<SAP:P4 />
<SAP:AdditionalText />
<SAP:ApplicationFaultMessage namespace="" />
<SAP:Stack>Error in mapping program ZCL_ABAP_MAPPING4X (type R3_ABAP, kernel error ID UNCAUGHT_EXCEPTION)</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
Regardsm
Mallikarjun.MHave u seen the ABAP mapping guide?
Refer this series to the ABAP mapping section.https:///people/sravya.talanki2/blog/2006/12/26/aspirant-to-learn-sap-xiyou-won-the-jackpot-if-you-read-this-part-ii
It will be very handy and useful. -
Abap mapping - Error in Control Framework
Hi Gurus,
Scenario: IDOC - -- XI -
Http (post)
i am using ABAP mapping for IDOC to XML. I am able to test it using sxi_mapping_test which gives me output XML. But, when i test the scenario from RWB, it fails with "SYSFAIL" error in inbound queue as per moni.
error - "Error in Control Framework".
Looks like it did not even go to message mapping pipeline step.
Please help.
Thank you,
mkHI,
Hope you have done all the necessary pre-requisites for ABAP mapping
This may help u- http://help.sap.com/saphelp_47x200/helpdata/en/55/bff20efe8c11d4b54a006094b9456f/content.htm
just cross verify with this guide-
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
Please also try to debug as follows...
put a break point inside your class/method....
goto tcode SXI_MAPPING_TEST....give in the configuation details of your scenario...and when you execute, give the IDOC-XML, copy it from SXMB_MONI where you are getting the error....
when you execute, it shoudl stop at the break point that you had set in your class....continue debugging using 'F6' function key, and check where you are hitting this error...
The chances are that the FM that converts IDOC-XML to flat file format might not have been executed correctly...
Thanks
Swarup -
Error text missing in raising exception (In ABAP mapping)
Hi,
iam using ABAP Mapping for 1 interface.
Based on some condition i am raising exception with error text. When i executed this in SXI_Mapping_test it's showing the Error text. But when i execute the interface directly error text is missing in the Error details.
can any one figure out y its not coming..
regards
KishoreHi,
I think you need to write the error to mapping trace.
http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/content.htm
Regards
Vijaya
Maybe you are looking for
-
Safari will not run a signed applet on mac os x 10.5.7 with new Java update
Hi Everyone, I've got a problem that hopefully you guys can help me solve. I have an applet that runs on windows, mac and linux that is signed by a verisign certificate my work has. The certificate is valid and everything works just fine on windows a
-
Read only error after instalation
I was using the Arch 0.7 beta2 build for a while and everything was, more or less, fine, I finally decited to update to 0.7 and now after I install I get a buch or "filesystem is read-only" errors and then it frezes when starting hotplug, I love Arc
-
Hi all When I am creating sales order, i get an error message 'Version 0 is not defined for fiscal year 2008 'How to fix this? Thanks DM
-
Hello there, I installed CPO on my vm and after installtion when i run my CPO server i got error " The remote server return an unexpected response : (502) can't connect " I also want to make sure one thing while setup CIAC 3.0 , what is my authentica
-
Requests could not appear in Production Server
Hi, I have an strange issue here, we have recently installed the Production server, and i added that server in the STMS using the standard 3 system configuration ,the issue i am facing here is i could not see the requests which are in transport direc