on 10-14-2008 5:36 PM
Hi experts,
i am facing a slight problem with my UDF:
the scenario is idoc to jdbc, my problem is as follow:
in my source I have:
IDOC
>E1EDKA1 1..1
>>NAME1 1..1
>E1EDP01 1..999
>>E1EDPA1 1..999
>>>PARVW 1..999
>>>NAME1 1..999
in my target i create as many segments than there is E1EDP01
The problem is for each E1EDP01 I have several E1EDPA1 that itself contains several times the couple PARVW and NAME1.
And my condition is as follow: in E1EDPA1, I have to take the value of NAME1 for PARVW = YZ or XZ, and the value of NAME1 in E1EDPKA1 if i dont find YZ or XZ in E1EDPA1
My udf works when in each segment it is true, but does not work when in one segment the condition is missing:
for example, I have:
IDOC
>E1EDKA1
>>NAME1=name_header
>E1EDP01
>>E1EDPA1
>>>PARVW = AB
>>>NAME1 = name_AB
>>>PARVW = AC
>>>NAME1 = name_AB
>>>PARVW = YZ
>>>NAME1 = name_YZ1
>E1EDP01
>>E1EDPA1
>>>PARVW = AD
>>>NAME1 = name_AD
>>>PARVW = AE
>>>NAME1 = name_AE
>>>PARVW = XZ
>>>NAME1 = name_XZ1
in my target I must have:
statementName
>statement_name
>>action
>>table
>>access
>>>field_name = name_YZ1
statementName
>statement_name
>>action
>>table
>>access
>>>field_name = name_XZ1
I manage to get the result with the following UDF
for (int i = 0; i < PARVW.length; i++) {
if (("YZ".equals(PARVW<i>.trim()))){
result.addValue(NAME_poste<i>);
}
else if (("XZ".equals(PARVW<i>.trim()))){
result.addValue(NAME_poste<i>);
}
//else {
//result.addValue(NAME_header[0]);
//}
}
but as soon as i uncomment the else part (in order to get the value of NAME1 in the header part when PARVW is not equal to XY or XZ), it does not work.
another example is :
IDOC
>E1EDKA1
>>NAME1=name_header
>E1EDP01
>>E1EDPA1
>>>PARVW = AB
>>>NAME1 = name_AB
>>>PARVW = AC
>>>NAME1 = name_AB
>>>PARVW = YZ
>>>NAME1 = name_YZ1
>E1EDP01
>>E1EDPA1
>>>PARVW = AD
>>>NAME1 = name_AD
>>>PARVW = AE
>>>NAME1 = name_AE
then I must have:
statementName
>statement_name
>>action
>>table
>>access
>>>field_name = name_YZ1
statementName
>statement_name
>>action
>>table
>>access
>>>field_name = name_header
hope I've been clear enough, any help will be rewarded,
thanks a lot,
Jamal
try this..
int i = 0;
boolean found = false;
for ( ; i < PARVW.length; i++)
{
if (("YZ".equals(PARVW<i>.trim())) || ("XZ".equals(PARVW<i>.trim()) ) )
{
found = true;
break;
}
}
if ( found )
{
result.addValue(NAME_poste<i>);
}
else
{
result.addValue(NAME_header[ 0] );
}
Edited by: Anand on Oct 14, 2008 7:08 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes it is like this, E1EDPA1 can appear several times with PARVW and NAME1 different.
The problem is solved though thanks to Anand, it works perfectly fine thanks to his UDF!!!
THANKS again friends,
kind regards,
Jamal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
E1EDPA1 1..999
PARVW 1..999
NAME1 1..999
The problem is for each E1EDP01 I have several E1EDPA1 that itself contains several times the couple PARVW and NAME1.
Are you sure it is like this ?
Usually the PARVW and NAME1 will appear only once in each occurence of E1EDPA1 and there will be multiple E!EDPA1 for each partner function.
regards,
Advait
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
thx for your help, the problem is that I get only one value as output
regards,
jamal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
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.