on 10-07-2010 4:35 AM
Hi Experts,
I am working on IDOC to File scenario, in message mapping i have to read segment of idoc (occurence of this segment is 0..4) and check the key of this segment and accordingly pass the value. I am creating a UDF to send the data in target field
My logic in UDF is as follows
if id = BB and payment = V
return variable1
else
return variable2
this logic is not working
Note: The id BB is in second line of the segment and first line of the segment has id BA.
Please help me to send me the correct logic.
Regards,
Shradha
Hi,
After analysing this issue i come to know that the if condition is using data from 2 different segments
Segment1 (key fiiqualli)
The occurence of this segment is 0....4, Inside this segment i have 2 rows first row has Key Fiiqualli = BA, second row has key Fiiqualli = BB
Segment2 (Key payment id)
The occurence of this segment is 0....1
Inside this segment i have only 1 row with Key payment ID= V
Now if i write the condition if fiiqualli = BB and payment ID = V
return 1
else
return 2
Here if condition fails for second line but works for first line because it is unable to read payment ID for second row as payment id is in different segment.
Is there any way to read the data from two different segment where the occurence of one segment is 0..4 and other is 0..1
Regards,
Shradha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
U havent mentioned ur question correctly???
What i have understood is that:
Source:
<E1IDB02 SEGMENT="1">
<FIIQUALI>BA</FIIQUALI>
</E1IDB02>
<E1IDB02 SEGMENT="1">
<FIIQUALI>BB</FIIQUALI>
</E1IDB02>
<Payment>
<PaymentId>V</PaymnetId>
</Payment>
Target Required:
<G_SSG2>
<S_FII>
<C_C088>
<D_1131>10</D_1131>
</C_C088>
</S_FII>
</G_SSG2>
<G_SSG2>
<S_FII>
<C_C088>
<D_1131>15</D_1131>
<C_C088>
</S_FII>
</G_SSG2>
If yes?? then use this UDF:
for(int i=0;i<var1.length;i++)
{
if(var1<i>.equals("BB") && var2[0].equals("V"))
{
result.addValue("15");
}
else
{
result.addValue("10");
}
}
Mapping:
1)E1IDB02 ---G_SSG2
2) FIIQUALIremovecontext
-
UDF-SplitByVlaue--S_FII
PaymentId----
3) FIIQUALIremovecontext
-
UDF-SplitByVlaue---C_C088
PaymentId----
4) FIIQUALIremovecontext
-
UDF-SplitByVlaue---D_1131
PaymentId----
Thanks
Amit
Hi,
Paste ur input XML structure and the desired output structure??
i think u need to take care abt the context...
Thanks
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
My source and target structure are as follows
My requirement is if FIIQUALI = BB than return D_1131 = 25 else D_1131= 20.
+Source IDOC structure:+
- <E1IDB02 SEGMENT="1">
<FIIQUALI>BA</FIIQUALI>
<FIIBKENN>206151</FIIBKENN>
<FIIBKCDE>013</FIIBKCDE>
<FIIBKNAM>BARCLAYS BANK PLC</FIIBKNAM>
<FIIBKORT>NORTHAMPTON NN1 4YD</FIIBKORT>
<FIIBLAND>GB</FIIBLAND>
<FIIKONTO>18150680</FIIKONTO>
<FIIKWAER>USD</FIIKWAER>
<CTABNAME>Norman Jackson</CTABNAME>
<FIIBRANCH>NTHAMPTON WELLINBOROUGH RD</FIIBRANCH>
</E1IDB02>
- <E1IDB02 SEGMENT="1">
<FIIQUALI>BB</FIIQUALI>
<FIIBKENN>BOFAUS3NWDC</FIIBKENN>
<FIIBKCDE>002</FIIBKCDE>
<FIIBKUKN>054001204</FIIBKUKN>
<FIIBKUCD>003</FIIBKUCD>
<FIIBKNAM>BOFA</FIIBKNAM>
<FIIBKORT>WASHINGTON DC</FIIBKORT>
<FIIBLAND>US</FIIBLAND>
<FIIKONTO>1920901042</FIIKONTO>
<FIIKNAME>VERISIGN INC</FIIKNAME>
</E1IDB02>
Target File structure:
- <G_SSG2>
- <S_FII>
<D_3035>OR</D_3035>
- <C_C078>
<D_3194>18150680</D_3194>
</C_C078>
- <C_C088>
<D_1131>25</D_1131>
<D_3434>206151</D_3434>
<D_1131_2>154</D_1131_2>
<D_3055_2>133</D_3055_2>
<D_3432>BARCLAYS BANK PLC</D_3432>
<D_3436>NORTHAMPTON NN1 4YD</D_3436>
</C_C088>
</S_FII>
</G_SSG2>
- <G_SSG2>
- <S_FII>
<D_3035>BF</D_3035>
- <C_C078>
<D_3194>1920901042</D_3194>
<D_3192>VERISIGN INC</D_3192>
</C_C078>
- <C_C088>
<D_1131>20</D_1131>
<D_3434>BOFAUS3NWDC</D_3434>
<D_1131_2>154</D_1131_2>
<D_3055_2>133</D_3055_2>
<D_3432>BOFA</D_3432>
<D_3436>WASHINGTON DC</D_3436>
</C_C088>
</S_FII>
</G_SSG2>
Regards,
Shradha
Hi Amit,
I tried the same mapping. I am getting following error when i am testing my mapping
Exception:[com.sap.aii.mappingtool.tf7.FunctionException: Cannot cast 'BB' to boolean] in class com.sap.aii.mappingtool.flib7.Bool method equalsBoolean[BB, BB, com.sap.aii.mappingtool.tf7.rt.Context@78a7b003] com.sap.aii.utilxi.misc.api.BaseRuntimeException: Exception:[com.sap.aii.mappingtool.tf7.FunctionException: Cannot cast 'BB' to boolean] in class com.sap.aii.mappingtool.flib7.Bool method equalsBoolean[BB, BB, com.sap.aii.mappingtool.tf7.rt.Context@78a7b003]
Regards,
Shradha
Thanks for your help
I have the same scenario in my second field mapping, but i have 2 fields in if condition
if fiiquali = BB and paymentid = V
return 10
else
return 15.
In this case i tried to use standard function AND from boolean. But i am not getting desired result. Am i missing something.
Also i like to know what is the impact if i map source parent segment(G_SSG2) -> removecontext-> target parent segment(G_SSG2)
since i am reading multiple lines, whether remove context will be helpful or not.
Regards,
Shradha
Hi Amit
I tried the same way. But it not working. Although when i run my mapping in test mode than i am getting correct values.
Is it because i have 2 lines in my segment?
Please see my mapping below
FIIQUALI
equalS
Constant
[BB] Constant15
AND ifthenelse D_1131
PAYMENT
equalS
Constant Constant10
[V]
Thanks
Shradha
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.