Need Clarification on Looping in Message Mapping.
Hi All,
I'm trying to implement the Dynamic emailing as explained in the Michals blog.
/people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
I have this partially working for the scenario I have.
XI will be receiving a ORDRSP IDoc from an external system and XI needs to do the following.
1) Check the value of <b> E1EDP01-ABGRU </b> equals to Z2. If any of the E1EDP01-ABGRU has a value of Z2, it should do the following
a) Get the email address from the E1EDKA1-ILNNR and map it to the TO field as shown in the blog.
b) Get the values of BELNR-E1EDK01, MENEE, VPREI, POSEX, PEINH, ABGRT from the E1EDP01 segment and concatenate them all and map it to the Content tag as explained in Michals blog.
I have this process partially working. The XI interface is only mapping for the first occurrence of E1EDP01 and not the subsequent occurrences of E1EDP01 which matches the criteria ( E1EDP01-ABGRU = Z2)
Any help in getting fixing this problem??
Thanks
Make sure to define multiple target messages in your message and interface mappings, for the mail package message definition (occurrence = 0...unbounded).
Also, in the logic of your message mapping, you need to create a new mail package message only if E1EDP01-ABGRU = 'Z2'. Use it like this:
ABGRU --- EqualS --- createIf --- Mail
Constant[Z2]
Regards,
Henrique.
Similar Messages
-
Hi all,
I have a requirement and have been breaking my head on this .
Source Target
PO1 - 0 to 999999 Idoc Segment(E1EDK2)
Item No(field)
SCH 0 to 999999 (Node)
Here I have a Parent node PO1 which needs to be looped
and within that I have SCH segemet which gets repeated
the requirement is first I need to check the if the values in the SCH exist , If it exist then I need to take the two values from SCH and item number from PO1 segment an create a traget segment. If the SCH does not exist then i need to take the item level values and create a segment. The challenge here is, I have a loop within a loop and the target segment is only one.
Kindly help me with this scenario.
Regards
Venuhi,
this is possible
which sp are you running on?
if you can define global variables
you can define global arrays in which you'll store the results
then you need to put all values in one advanced function
and put them in map for example and do the looping
in your java function (with all values at once)
then put the result in the global array
from which you can take it out in any other function
(for all the rest of the tags)
but I don't know about the performance of this ...
maybe you can do the same in java mapping?
but I'm sure it can be done in message mapping too
Regards,
michal -
Hello XI Gurus,
I need your help in doing following mapping.
The source ORDERS02 Idoc contains is fields like
E1EDP01(segment) under this
E1EDP19(segment)-QUALF(field) = Z18
E1EDP19(segment)-QUALF(field) = Z39
E1EDP19(segment)-QUALF(field) = Z39
E1EDP19(segment)-QUALF(field) = Z39
E1EDP19(segment)-QUALF(field) = Z39
and the Target structure is like this
E1NTITM(segment) under this-
BAUTL(field)
we need to populate the E1NTITM segment in target system only when
E1EDP19-QUALF = Z39 , so here i got the idea how to get the E1NTITM segement. But BAUTL field will be populate in each E1NTITM segment only when E1EDP19-QUALF = Z18. It means, in the source structure contains one
E1EDP19-QUALF = Z18 and n number of E1EDP19-QUALF = Z39 fields. So E1NTITM segment will appear in the target n number of times and BAUTL field will be appear in each and every E1NTITM segment. if the source doesn't have
E1EDP19-QUALF = Z18 field then BAUTL field could't be there in target E1NTITM segment. For this i just have an idea like, we need to loop the E1EDP01 segment to check if there is any E1EDP19-QUALF = Z18 field is there but i don't no how to do the looping. Please help me how to solve this problem.Rao,
Based on your structure I created the logic, please find them below in the URL. If you think it's not correct, then reply back.
<b>Mapping</b>
http://www.flickr.com/photo_zoom.gne?id=1954590723&size=o
http://www.flickr.com/photo_zoom.gne?id=1954590729&size=o
<b>UDF</b>
http://www.flickr.com/photo_zoom.gne?id=1954590957&size=o
Just see the logic[ The UDF window belongs to SP14, so don't care] I believe u know how to create advanced UDF.
I used two UDF, find the code below.
<b>UDF - Generate</b>
int z39cnt =0;
int z18cnt =0;
for(int i=0;i<a.length;i++)
if(a<i>.equals("Z18"))
z18cnt+=1;
else if(a<i>.equals("Z39"))
z39cnt+=1;
if(z18cnt == 0)
result.addSuppress();
else
for( int j=0;j<z39cnt;j++)
result.addValue("BAUTL");
result.addContextChange();
<b>UDF - Generateroot</b>
int z39cnt=0;
for(int i=0;i<a.length;i++)
if(a<i>.equals("Z39"))
result.addValue("");
<b>Results</b>
http://www.flickr.com/photo_zoom.gne?id=1954590735&size=o
http://www.flickr.com/photo_zoom.gne?id=1954590737&size=o
If you find any difficulties in achieving the same then let me know.
raj. -
Hi,
I want to have a loop in message mapping.
For example:
Customers
Name (unbounded)
ID
GivenName
Adress (unbounded)
ID
City
ID is the key which determines which Given Name belongs to which city.
That should be transformed to
Customers
Customer (unbounded)
ID
GivenName
City
Now every Customer has is own element.
Does anybody have experience with that?
Regards,
UdoHi Udo,
can you this code with <b>advanced user function</b>:
(with three input values)
a, b, c
a - Customers-ID
b - Adress-ID
c - Adress-City
===============================================
for (int t =0; t<a.length; t++)
for (int j=0; j<b.length; j++)
if (a[t].equals(b[j]))
result.addValue(c[j]);
==================================================
Regards,
michal -
Hello,
I need some help for a message mapping.
In the source message is one element named options.
The value of this field is semicolon and bracket/comma separated value. e.g. skip;ignore;retry(1,2,3).
Each one of the semicolon separated values should be a own element in the target message. If one option has values in the brackets, this options should get some child's. For example:
<options>skip;ignore;retry(1,2,3)</options>
should be
<options>
<option value='skip'/>
<option value='ignore'/>
<option value='retry'>
<choices>
<choice>1</choice>
<choice>2</choice>
<choice>3</choice>
<choices>
</option>
</options>
Is it possible, to produce such message with the message editor?
Thanks and regards,
DanielHi Daniel,
Yes, its possible to produce such a message.But Have you defined message interface for the target structure described in your post?
You may need to write some user-defined functions / use susbstring operation to achieve what you need.
Regards,
Sridhar -
Test XML file and Message Mapping test tab not compatible
Hi all,
I need help in testing in message mapping test tab.
I have a xml data taken from SXMB_MONI which looks lik below
&?xml version='1.0' encoding='UTF-8'?>
-&ns0:MT_Order xmlns:ns0="http://test.com/xi/test">
-<Header>
<fld1>
<fld2>
-<Line>
<line1>
and in message mapping multimapping is used,so it looks like
ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
<ns1:KVNR_Senden_MT xmlns:ns1="urn:lsv.de/SENDER">
<Inhalt>
<KE/>
<VF/>
<BBNRAB/>
<BBNREP/>
how can test this xml in message mapping test tab?please don't consider the structure .I don't have them.So,i have pasted some dummy structureTry like this,
ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
<&ns1:MT_Order xmlns:ns0="http://test.com/xi/test">
<Header>
<fld1>
<fld2>
-<Line>
<line1> -
Problem while using Parameters in Message Mapping in Multi Mapping Scenario
Hi,
I am working on a scenario in PI 7.1, in which I need to pass output of Message Mapping as an input to ABAP Mapping.
In Message Mapping, I have used standard RFC Lookup function to call a Function Module from ERP system. For using RFC Lookup function, I have created a Import Parameter of Category "Adapter", and Type "RFC" in the Signature Tab of Message Mapping.
In Operation Mapping, I have specified both the mappings (that is., Message Mapping and ABAP Mapping).
In Interface Determination, I have also assigned a value to the Importing Parameter.
But whenever I trigger a message, it fails and gives message "The input-parameter Rec_RFC_ERP does not exist." (Rec_RFC_ERP is my Input Parameter name).
When I am using only Message Mapping in Operation Mapping; it's working absolutely fine that means something needs to be done with ABAP Mapping.
Any help will be highly appreciated.
Regards,
VarunRec_RFC_ERP is this the name of your RFC lookup adapter?? Did you test your mapping in Design time using the RFCAdapter dropdown???
Mapping Enhancement - RFC lookups in 7.1
/people/jin.shin/blog/2008/02/15/sap-pi-71-mapping-enhancements-series-graphical-support-for-jdbc-and-rfc-lookups
Regards,
Siva Maranani -
Unable to activate Message Mapping (Until i restart PI )
Dear all,
I am using PI 7.1.
I am trying to activate the message mapping objects in ESR. but it is not getting activated.
I see the following error message in the process log:
Activation of the change list canceled
Check result for Message Mapping: MMtest | urn:test
Starting compilation
Source text of object Message Mapping: MMtest | urn:test has syntax errors:
Source code has syntax error
The message mapping objects are simple one, and does not contain any UDFs.
Infact these message mapping object was successfully activated before.
when this occured for the first time yesterday, I restarted the PI server. then it worked.
But today, this problem is occuring again. I again restarted, it got activated.
I worked for sometime, and tried editing and activating, but again i see the same error message.
I am sure, it will work if i restart PI, but i cannot afford to restart these many times.
Has anyone faced this error message.
any inputs/help appreciated.
thanks
Ganeshwe have not changed the jdk version,
it seems that.. while compiling the message mapping into java classes, some conflicts are going on.
now to relplicate the problem, i need not try activating the message mapping object.
I can see the same error message when a do "Check" (F7) of the message mapping object.
Immediately after restarting the PI server, the MessageMapping compliation process seems to pick up the right classes/jars, so is successful.
but as the time goes on after we PI started and as we use PI, some of the mapping classes/jars values might be getting changed .. to disallow further compilation of message mapping
hmm.. thats the thought.. may need to investigate in 7.1
Ganesh -
Message Mapping - External Definitions
My Scenario
1) File1(Request with Employee Number) - Sent to XI (Async)
2) XI will send the Request over HTTP and will Receive the Response(Employee Details) (Synchronous)
3) The HTTP Response will be sent to File2(Employee Details) (Async)
The Request and Responses are XSD Messages. I have Imported them into External Definition in my Repository.
Created a File Request - Abstract - Asynchronous - Message interface
Created a HTTP Request-Response - Abstract - Synch - Message interface
Created a File Response - Abstract - Asynchronous - Message interface
Message Mapping: (I am stuck here)
I need to Map the File Request to HTTP Request
I need to Map the HTTP Response to File2Response
How can I creat the Message Mapping for the above situation?
Thanks.Hi,
You will need to create the following message mapping:
1. File Request - HTTP Request
2. HTTP Response - File Response
you can map Message Types to External Definitions and vice versa.
They should appear in the list for the relevant software component.
Or am I missimng something here ?
Cheers
colin. -
Help with Message Mapping - Context Change
I need help with the following message mapping. I am filtering by EMP_STAT in the Message Mapping. I have this working for the ROW structures, but I can get the HEADER/REC_COUNT field to calculate. I can do just a record count of ROW and get it to work, but I can't get it to work with the filter EMP_STAT = 'REG' added. I get a context error. Could someone send me the mapping code.
Sender XML----
<RECORD>
<ROW>
<EMPLOYEE>111</EMPLOYEE>
<EMP_STAT>REG</EMP_STAT>
</ROW>
<ROW>
<EMPLOYEE>222</EMPLOYEE>
<EMP_STAT>PT</EMP_STAT>
</ROW>
<ROW>
<EMPLOYEE>333</EMPLOYEE>
<EMP_STAT>REG</EMP_STAT>
</ROW>
</RECORD>
Receiver XML----
<RECORD>
<HEADER>
<REC_COUNT>2</REC_COUNT>
</HEADER>
<ROW>
<EMPLOYEE>111</EMPLOYEE>
<EMP_STAT>REG</EMP_STAT>
</ROW>
<ROW>
<EMPLOYEE>333</EMPLOYEE>
<EMP_STAT>REG</EMP_STAT>
</ROW>
</RECORD>Hello,
You can use this mapping
For REC_COUNT:
EMP_STAT -> equalsS: constant:REG -> ifWithoutElse -> removeContext -> count -> REC_COUNT
EMPLOYEE -> /
For ROW:
EMP_STAT -> equalsS: constant:REG -> ifWithoutElse -> removeContext -> ROW
EMPLOYEE -> /
For EMPLOYEE:
EMP_STAT -> equalsS: constant:REG -> ifWithoutElse -> removeContext -> SplitByValue -> EMPLOYEE
EMPLOYEE -> /
For EMP_STAT:
Constant: REG -> EMP_STAT
Hope this helps,
Mark -
How to know if Message mapping failed?
Hi gurus,
do anyone know how to determine in clean up method if a message mapping failed? i just want to know the status of the message mapping to put it in the trace.
RegardsThanks for your reply Abhishek,
but this is not exactly what i need.
Suppose following Graphical message mapping: two number A and B need to be divided, A/B. If B equal 0 (zero), this will throw Runtime Exception. In some point of my mapping (maybe at the end of it) i need to catch this Exception, or at least i need to know exception happened. I need to know it to update a table with message mapping status, eg succesfully executed, runtime error, etc.
Regards. -
Problem with Message-Mapping: Loop over Elements possible?
Hi all,
I want do create a Message-Mapping for an IDoc-to-File Scenario. In the Source Structure there are some Elements which can appear more than once (1..unbounded). I need a mechanism which loops over these elements and search for specified values. From the Element which contains an element with this specified value the mapping should write a value in the target structure.
Here a simple example (source structure) for better understanding:
<root>
<invoice>
<number> 10 </number>
<sum> 200.00 </sum>
</invoice>
<invoice>
<number> 20 </number>
<sum> 150.00 </sum>
</invoice>
<invoice>
<number> 30 </number>
<sum> 120.00 </sum>
</invoice>
</root>
Now the duty of the Mapping should be to search in the elements <invoice> for the number 30. And then the sum of the invoice with the number 30 should be written in a field of the target structure.
I tried it out with a constant togehter with an equalsS-function and an ifWithoutElse-function, but it is working only then, if the invoice with the number 30 has the first position in the root context.
Can anybody help me? Thanks
With kind regards
ChristopherHi,
Write a UDF to sum the required values and map to target node.
See while writing the UDF select the type as queue.
number -- removecontext-UDF targetnode
sum----removecontext--/
number abd sum or the two inputs
in UDF
int nsum = 0;
for(int i;i < number.length;i++){
if number(i).equals("30") then
nsum = nsum + valueOf(sum(i));
result.addValue(nsum); // convert the nsum into string
Regsrds
Chilla -
Message-Mapping: nested Loops over Elements
Hi Experts,
I have problems with my Message-Mapping in the IR. I have a source and a target structure. In the following I will give you easy examples of these structures:
<u>source structure:</u>
<E1EDP01>
<E1EDP19>
<QUALF> ... </QUALF>
<IDTNR> ... </IDTNR>
</E1EDP19>
<E1EDP19>
<QUALF> ... </QUALF>
<IDTNR> ... </IDTNR>
</E1EDP19>
</E1EDP01>
<E1EDP01>
<E1EDP19>
<QUALF> ... </QUALF>
<IDTNR> ... </IDTNR>
</E1EDP19>
<E1EDP19>
<QUALF> ... </QUALF>
<IDTNR> ... </IDTNR>
</E1EDP19>
</E1EDP01>
<u>target structure:</u>
<LineItem>
<IDTNR></IDTNR>
</LineItem>
<LineItem>
<IDTNR></IDTNR>
</LineItem>
That means:
For every <E1EDP01> in the source structure I create one <LineItem> in the target structure. One E1EDP01-Element can contain more than one E1EDP19-Elements. I have to loop over these E1EDP19-Elements, because I have to locate the Element <QUALF> with a given (fixed) value. The Mapping should put the value from the Element <IDTNR> from the source structure - where the QUALF-Element has this given value - in the IDTNR-Element of the target structure.
I tried it with a UDF, but only the first <IDTNR> in the target structure got filled.
Thanks for your help
ChristopherThank you,
but how I can set the Elements IDTNR and QUALF to the context E1EDP01?
In the splitByValue-Function do I need "each value"?
best regards
Christopher -
XI message mapping clarifications
Dear All
I would like to know if XI message mapping(graphical mapping) can be
used for mapping based on the order of elements given in the XML source
message.
For example I have a source message as below
Source XML:
<Source>
<givenname>Ramesh</givenname>
<givenname>Kumar</givenname>
<givenname>Ganapathy</givenname>
</Source>
semantic is first instance of <givenname> needs to be mapped <firstname> in target,
Second occurance of <givenname> needs to be mapped <secondname>,
Third occurance of <givenname> needs to be mapped <familyname>
Target XML
<Target>
<firstname>Ramesh</firstname>
<secondname>Kumar</secondname>
<familyname>Ganapathy</familyname>
</Target>
As I understand graphical mapping editor works based on Xpath
expressions, Is it possible to achieve such mapping schematics with
graphical mapping and UDF in XI.
Please note I cannot use Java, ABAP or XSLT mapping programme.
Can you provide me some hints on how to do this.
Thanks
SatishHi Chilla
This is how I am currently handling it. But my problem is
The number of UDF's keeps increasing if I have a fourth, fifth element to handle. I have to create new UDF for every new level added.
Is there a way I can do this with single UDF.
result.addValue(givenname(X));
X- will be the position and I can pass values as an argument to the UDF.
Again the problem here is when I have second argument to specify which value of input to pick up say for example givenname(1) or givenname(2)
The second argument expects an String[] array as argument and not string(when i assign a constant its a string).
So I cannot attach a constant to the second argument and pass the input.
Is there any functions that can return a String[] array as an output taking sting value as input.
Thanks
Satish -
A little help needed in message mapping
a little help needed in message mapping
I have to map one of the idoc header segments as many times as it occurs to each Idoc when using the split message funcionality
let us say we have the segment seg1 and there is a QUALF in it
<seg1>
<qualf>001</qualf>
</seg1>
<seg1>
<qualf>002</qualf>
</seg1>
then we use the vbeln to split the idoc into 2.
so if we have
<vbeln> 1 </vbeln>
and
<vbeln>2 </vbeln>
then 2 Idocs should be created like this
<Idoc>
<vbeln> 1 </vbeln>
<seg1>
<qualf>001</qualf>
</seg1>
<seg1>
<qualf>002</qualf>
</seg1>
</Idoc>
<Idoc>
<vbeln> 2 </vbeln>
<seg1>
<qualf>001</qualf>
</seg1>
<seg1>
<qualf>002</qualf>
</seg1>
</Idoc>
it is easy to create the segment by using createif with the QUALF field but my problem how to map the qualf twice for each idoc
Thanks.UseOneAsMany is the function you need to use.
It takes three parameters:
1 --- The node you want to duplicated
2 --- How many times you want to duplicated
3 --- The context you want to place for it.
Regards
Liang
Maybe you are looking for
-
Error while replicating data from MSSQL to HANA
Hello Colleagues, I have created SLT configuration where the replication has to happen from MSSQL database for NW BPM for 4 tables. I have also applied a transformation function to convert date columns in the BPM tables to right desired format while
-
How to localize LiveCycle Form in different languages ?
Dear All, I want to localize the captions of the fields in PDF Form developed using Adobe LiveCycle Designer 7.1. In order to do that, I figured out that have to prepare XML Data Source of all Captions and related text in the target language. The lan
-
Hi, I am trying to run the servicegen ant task withou running the setEnv.cmd file. My build process is very complex and I ned to include the WS generation in a standard way (run on a machine without wl install). I managed to do this withe wl6.1 stuff
-
I travel fulltime and use a mobile hotspot for my internet access. I use my apple TV mainly to be able to stream movies to my TV. Since the 6.0 update I can no longer controll when I update the Apple TV. This is more than an inconvenience since th
-
Photoshop CS activation problem
I am currently using Windows 7 and have to use Windows XP mode to use my Photoshop CS. My Windows XP mode became corrupt so I uninstalled it and re-installed. When I re-installed Photoshop CS I was unable to activate it online or by the automated p