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.
Similar Messages
-
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?
HectorHi,
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.. -
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
GoutamSolved
-
Performance in XI / PI ABAP mapping class
Hi,
I have to do some ABAP mapping for XI / PI scenarios. First of all number of messages is huge, messages can be very large,
so my question is where to pay special attention because of performance. Is there some blog on net with suggestions? I saw and read lot of ABAP mapping blogs, but I have never found one where is it performance explained.
br
marioHi there.
The performace problem of the ABAP Mappings in XI/PI is not related to the code itself. When coding, just keep in mind alll you have said: "messages are huge, and lot's of messages". This way, you should keep the code as sharp as possible within the class methods you will use.
Now, the real problem in ABAP mapping is ther ABAP mapping itself. Don't forget that PI usually (and ideally) processes the message mappins (or java mappings) in the java stack. If you are creating an ABAP mapping, you are telling PI to send the work to the integration server (ABAP stack), and then retrive the result from it.
If you can, use message mapping or java mapping for best performance. If you cannot, use ABAP mapping but having all this in mind. Hope this helped.
Regards,
Valter Oliveira. -
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. -
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,
YomeshHi Yomesh,
Did you solve this problem. If yes could you please tell. I am also facing the same problem.
Regards,
Dinakar -
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 -
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,
MattHi,
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. -
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. -
Abap mapping and variable substitution in File adapter
Hi experts!!.
I am new in abap mapping, but I can do one abap mapping succesfully, but my problem is:
I need to do a variable substitution in my file receiver adapter:
Target directory = %cliente&/out
File Name Scheme = TC%Fecha%.EFI
¿Using abap mapping is this possible? How I can do it?.
Please is very urgent.
Thanks in advance, and best regarts.Yes you can,.
DynamicConfigurationKey key = DynamicConfigurationKey.create(
http://sap.com/xi/XI/System/File,
FileName);
will become
DynamicConfigurationKey key = DynamicConfigurationKey.create(
http://sap.com/xi/XI/System/File,
Directory);
In the receive file adapter all you would need to do is select Adapter Specifc Attributes --> File Name and Directory and givce some dummy values for the filename and directroy. In the runtime values will be taken from the SOAP header which you set in the mapping.
Regards
Bhavesh -
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. -
Hi
I am looking for the ABAP mapping scenario, Can anyone send me the link
Thanks
PRHi PR,
I don't think there are many examples on ABAP mapping for 7.1, but there is hardly any difference from previous versions. So, search for an example based on 7.0.
If you face any problem, you can come back to the forum anytime
regards,
Neetesh -
Exception handling in BPM and ABAP mapping
Hello all,
We have a BPM with this structure:
. REC (receiver)
. <begin BLOCK1>
. TRANSFORMATION1 (Abap Mapping)
. <begin EXCEPT> (exception branch)
. CONTROL (Cancel Process)
. <end EXCEPT>
. <end BLOCK1>
The same exception is assigned to the block; to the mapping and to exception branch.
The problem is that, when in the Abap Mapping the exception CX_MAPPING_FAULT is raised, the exception branch seems to be ignored and so, the BPM doesn't finish.
This problem only occurs in some of ours BPMs, because the same thing, when done in other BPMs, works fine.
I know i can change the BPM to turn around this problem, but i would very much like to know the solution to this.
Please, help us with this posting.
thanks in advance
Filipe BarreiraHi again,
We are in SP19, witch invalidates the note 921757 listed.
Also, i made an abap mapping witch only raises the exception. So i think it is not an ABAP error.
Also the XML seems to be correct, because this is a duplicates check routine. A message (with the same data) already entered previously (we trying to avoid another entry).
In the trace analysis for the message, it is stated that the exception has occurred:
<?xml version="1.0" encoding="utf-8" ?>
- <MappingTrace>
<Trace level="1" type="T">Mapping-Namespace:http://xi.es/suministros</Trace>
<Trace level="1" type="T">Mapping-Name:IM_SALIDAS_TESTE1</Trace>
<Trace level="1" type="T">Mapping-SWCV:7CE651C00ABC11DBCBF0C8E8C0A901F6</Trace>
<Trace level="1" type="T">Mapping-Step:1</Trace>
<Trace level="1" type="T">Mapping-Type:R3_ABAP</Trace>
<Trace level="1" type="T">Mapping-Program:ZCLTD_MM_SALIDAS_CARGA_TESTE</Trace>
<Trace level="1" type="T">Creating Abap mapping. Classname =ZCLTD_MM_SALIDAS_CARGA_TESTE</Trace>
<Trace level="1" type="T">CALL APPLICATION MAPPING.</Trace>
<Trace level="1" type="T">Application error in mapping program ZCLTD_MM_SALIDAS_CARGA_TESTE, error code: , error text:</Trace>
</MappingTrace>
the problem is that the process keeps running.
regards Filipe Barreira -
Processing xml in abap mapping
Hi all,
I use abap mapping to create XML from Idoc, I use if_ixml interface to do it.
In my code I use method get_elements_by_tag_name (on object if_ixml_document)
to find all elements with the same name:
I checked my mapping in SXI_MAPPING_TEST and it is working when I put formatted idoc
(with many lines, one tag in one line).
But when I put one long line with all tags in one line (XI receives idoc in such format from ECC)
method get_elements_by_tag_name does not return any result.
I checked also others searching methods but without results.
It looks like only first 255 characters are processed. When element, which I am looking for,
is in further position, it is not finding.
Does anyone know what is a root cause of such situation and how can I resolve my problem?
Best Regards,
PrzemekHi,
get_elements_by_tag_name work fine for all my abap mappings so you must be doing wrong something else
the code from this page works for IDOCs also:
http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/content.htm
with small changes to the nodes so maybe compare it with yours
Regards,
Michal Krawczyk -
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...
Maybe you are looking for
-
How to change the default Path of Prompt Played by MicroApp
Hi I need to store all the Self Service application prompts in dedicated Media Server. I can modify location of all the Media files by passing the related URL form CVP application, however I need to know how to change the default location of Prompt f
-
hi, in case of make to stock/project sales etc -a/c determination will happen based on KOFK ctype for which posting will happen to FI & CO i want to know what value exactly gets posted to controlling Pl suggest
-
Hi Everyone, Our client wants to send Electronic Fund Transfers using Idocs/EDI What are the steps involved in configuring fbzp for EDI? What are the steps involved in setting Idocs and EDI to achieve the task? Thanks and Regards, Genie
-
Posting datewise report needed MCE5
Hi To get the report MCE5 by posting date what table I should refer to create Zreport. Thanks, Kiran
-
Logging out of apple id w/o knowing password
I have two apple id's. One of the id's is associated with an old, no longer active, email account. This is the account that i am signed into on my iPhone. However I want to use my most current apple id (i.e. one that has my current email address a