on 07-30-2008 10:26 AM
Hi Experts,
Please help me in mapping the below requirement.
[Mapping image|https://weblogs.sdn.sap.com/weblogs/images/251907394/G60toG25.jpg] (source & target format)
In the above image you can see the source and target format,
the requirement is, we have 'B' node which is 0..unbounded and one field 'fehlercode' in source and fields in target as fehlercode1,fehlercode2, & fehlercode3.
the source field Fehlercode under B node has to be mapped to the target fehlercode1,fehlercode2,fehlercode3.
i.e: the first occurrence from source has to be mapped to Fehlercode1
and second occurrence has to be mapped to Fehlercode2
and third occurrence has to be mapped to Fehlercode3
If more than three occurrence the next can be ignoredu2026
for the above requirement I used the following udf
public void index1(String[] field,ResultList result,Container container){
result.addValue(field[0]); }
for mapping fehlercode1.
public void index1(String[] field,ResultList result,Container container){
result.addValue(field[1]); }
for mapping fehlercode2.
public void index1(String[] field,ResultList result,Container container){
result.addValue(field[2]); }
for mapping fehlercode3.
The above mentioned udf are working perfectly when the occurance of B node under A node is more than 3 times in source. But when occurance of B node is less than 3 in any of the context then I am getting the following error.
'RuntimeException in Message-Mapping transformation: Exception:
[java.lang.ArrayIndexOutOfBoundsException: 1]
in class com.sap.xi.tf._G60FinalToG25Final_MM_ method index2
$[com.sap.aii.mappingtool.tf3.CBufIter@9f9b2c]'.
could anyone help me to overcome this issue.
Thanks & regards,
RDS
u can chk in udf for the ocurence of source field.
public void index1(String[] field,ResultList result,Container container){
if(field.length>0)
result.addValue(field[0]); }
similarly:
public void index1(String[] field,ResultList result,Container container){
if(field.length>1)
result.addValue(field[1]); }
and
public void index1(String[] field,ResultList result,Container container){
if(field.length>2)
result.addValue(field[2]); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check ur function(node function ->splitbyvalue).
use multiple mapping concept
Get this link help:
http://www.saptechies.com/multiple-occurrence-of-file-to-single-occurrence-of-rfc/
thanks,
Sendil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.