on 05-06-2009 4:16 PM
Hi,
Please helpme out to write an UDF here.
The line item in the IDOC segment called Z1DISPLY having 2 fields GROUPID and ITEMID
Here i need to maintain a mapping based on the following conditions
if the field ITEMID has a value X then add B infront of the value of GROUPID and map to target field.
if the field ITEMID has not a value X
Check if this value is the first one that appears in the list then map the value of GROUPID to the target field.
Also check If this value appears the second time in the list (without ITEMID= X) then add D in front of the value of GROUPID and map this to target field.
Thanks & Regards,
Y.Raj
Hello Yeshwantraj,
If I understood your problem properly here is a UDF that will do the whole thing for you.
public void myUDF(String[] ITEMID,String[] GROUPID,ResultList result,Container container){
int i,j,flgtest;
// Consider both ITEMID and GROUPID exists same no of time.
// Then loop for all values of ITEMID
for (i=0;i<ITEMID.length;i++){
// if the field ITEMID has a value X then add B infront of the value of GROUPID and map to target field.
if (ITEMID<i>.equals("X"){
result.addValue("B"+GROUPID<i>);
}
else{
flgtst = 0;
// Test how many times ITEMID has existed earlier.
for(j=0;j<i;j++){
if (ITEMID<i>.equals(ITEMID[j]))
{
flgtst++
}
}
// Check if this value is the first one that appears in the list
// then map the value of GROUPID to the target field.
if (flgtst == 0){
result.addValue(GROUPID<i>);
}
// Also check If this value appears the second time in the list (without ITEMID= X)
// then add D in front of the value of GROUPID and map this to target field.
if (flgtst == 0){
result.addValue("D"+GROUPID<i>);
}
}
}
Let me know if this is working fine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please give me the solutions ....as how can i do this above conditions..
Thanks for your valuable suggestions.
kind Regards,
Y.Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.