on 02-21-2011 12:59 PM
Hi Mapping Gurus,
I have an issue with UDF queues, I am really not good as of the momment with queues and arrays that's why I am seeking your help.
I have a mapping IDoc to FILE (fixed field); each row in the file will be generated for every IDoc item (1 row generated for every E1EDP01)
One target field in the row has a validation as follows:
If E1EDP05-KSCHL = VALUE1; then map -KPERC field of that E1EDP05's occurence to target field.
I can not achieve this with Standarad Functions only.
I encounter mismatch in the number of queues
For example I have one IDoc with seven E1EDP01, "each" having 4 E1EDP05 in it; "all" E1EDP05 has field KSCHL but only one has VALUE1; "not all" E1EDP05 has the field KPERC in it.
As you can see, there is already a mismatch in the number of queues between E1EDP05-KSCHL, E1EDP05-KPERC, and E1EDP01.
So if I have One IDoc with seven E1EDP01 having four E1EDP05 in it with having the VALUE1 on the second occurence of E1EDP05 on the second occurence of E1EDP01, my resulting file should consists of:
7 ROWS
on the 2nd ROW, the value of KPERC from the corresponding E1EDP05-KSCHL occurence will be mapped
While for the 1st, 3rd, 4th, 5th, 6th, 7th rows the field will be field with space.
***Previously I had a simple validation performed on this field, and it is populated in the correct ROW of the corresponding occurence of the E1EDP01 segment and for validation = false I have padded it with space successfully.
***The issue only arises on my new validation because of the mismatch in the queues thereby wrong value/context is being mapped
Given the requirement above, can someone provide me a UDF code wherein the UDF will take the occurrence of the KSCHL=VALUE1, determine on what occurrence of E1EDP01 it is, and map the corresponding KPERC value to the corresponding ROW
Hi Rahul,
Thanks for your replies, but the code you gave didn't solved it.
The whole point of my question was to achieve this requirement using 1 mapping step only.
I am running out of time to find the solution, so I decided to use a 2 step mapping, which almost readily solved the issue by mapWithDefault([]) to KPERC in 1st mapping step, this way on the second mapping step KPERC queue has the same # of queues of KSCHL already, instantly solved by that.
Thanks all for your time
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please try below UDF Code
int i;
for(i=0;i<KSCHL.length;i++){
if(KSCHL<i>.equals("VALUE1") )
{
result.addValue(""+KPERC<i>);
}
else
{
result.addValue(" ");
}
}
Regards,
Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
What I understand from your requirement is that for the E1EDP01-E1EDP05-KSCHL = VALUE1 corresponding KPERC should go in the output file Else a blank should be sent.
Keep the context of KSCHL and KPERC at E1EDP01 and provide as input to below UDF Code.
int i;
for(i=0;i<KSCHL.length;i++){
if(KSCHL<i>.equals("VALUE1") )
{
result.addValue(""+KPERC<i>);
}
}
Pass output of the udf to mapWithDefault(" ").
KSCHL and KPERC --> UDF --> mapWithDefault(" ") --> Target
Regards,
Rahul
Hi,
Can you please post the source code of the udf ?
Thanks,
Horia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There is no UDF yet.
The working solution previously was using Standard Functions only (combination of boolean & node functions & a UDF to pad spaces if validation returns false) --> this is for the simple validation
But as I have said we have a complex validation now described in my post above, and the previous combinations of Standard Functions only are not outputting my requirement, That is why I am considering a UDF to handle this complex validation (not the padding of spaces)
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
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.