on 01-24-2006 9:23 PM
Hi all,
I'm working on following mapping scenario.
Source
-
Name Occurrences Type
E1EDKA1 0..99 Node
-PARVW 0..1 String
-IHREZ 0..1 String
Target
-
HEADER 0..unbounded Node
-REFERNCE 0..1 String
PARVW can have values..AG,WE,LF, not necessarily in the same sequence. When PARVW = LF, I wanna copy the corresponding IHREZ value to field REFERENCE in target structure . Note that IHREZ is an optional field, it may not be present for all partner functions. I created a advanced function with the following code.
for(int i=0; i<parvw.length; i++)
if (parvw<i>.equals("LF"))
result.addValue(ihrez<i>);
But this function is generating the following o/p queue
Input
-
PARVW IHREZ
AG <blank>
LF 12324
WE <blank>
Output
-
SUPPRESS
12324
SUPPRESS
Since the first element in the queue is SUPPRESS, there is no element REFERENCE getting created.
Any help is highly appreciated.
Thanks in advance
Praveen
Hi Praveen,
You need not have use any userdefined function, please use the following mapping (text preview).
mapping for HEADER :
/root_target/HEADER =removeContexts(ifWithoutElse(and(stringEquals( /root_source/E1EDKA1/PARVW =, const()), exists(/root_source/E1EDKA1/ IHREZ=)), /root_source/E1EDKA1/IHREZ =))
mapping for REFERNCE :
/root_target /HEADER/ REFERNCE=SplitByValue( removeContexts(ifWithoutElse(and(stringEquals( /root_source/E1EDKA1/PARVW =, const()), exists(/root_source/E1EDKA1/ IHREZ=)), /root_source/E1EDKA1/IHREZ =)))
Regards,
KNS Kumar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
Thanks for your inputs. I solved it using the following advanced user defined function.
Cache entire Queue
String[] a = new String[100];
int i,j ;
j = 0;
for(i=0; i<parvw.length; i++)
if (! parvw<i>.equals(ResultList.CC) &&
! parvw<i>.equals(ResultList.SUPPRESS) )
a[j++] = parvw<i>;
for(i=0; i<a.length; i++)
if (a<i> != null && a<i>.equals("LF"))
result.addValue(ihrez<i>);
Kumar, I tried your solution..it works too..
Points for a few and thanks for the rest
praveen
Hi Praveen,
Go thru the link
http://help.sap.com/saphelp_nw04/helpdata/en/63/308c4024d26e1de10000000a1550b0/content.htm
Thanks and Regards
Vishal Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
use the node function <i>RemoveContexts</i> after your function.
But I do not see way you use a user defined function, you can do this with an equalS - if construction.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
what about:
String empty = " ";
for(int i=0; i<parvw.length; i++)
if (parvw.equals("LF"))
{
result.addValue(ihrez);
}
else
{
result.addValue(empty);
}
can you try this as I have no access to the XI right now
Regards,
michal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
have a look at the createIf function
prepared as user advanced function:
http://help.sap.com/saphelp_nw04/helpdata/en/7d/028c4057d5701de10000000a1550b0/content.htm
Regards,
michal
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.