Hi,
Have you checked his link
https://wiki.scn.sap.com/wiki/display/XI/Split+Mapping+using+UDF
?
Regards.
Hi Chandra,
You mean to say target is one field with occurrence, 0..unbounded ?
Regards
Baski
Hi Chandra,
Please find the logic below.
Mapping screen
UDF Elements
Count Parameter
In the code, Count is used as constant which specifies the length of each string that should be split from the Input String. This can be passed as normal constant or parameter. In your case, it should be 3.
The parameter can be varied based on the requirement.
Length Condition Handled
If the input string can't be split up into equal sub strings, [For e.g AAABBBC(length7) is to be split into strings of length 3] we are padding tilde symbol at last of source string for initial splitting and finally removing the same while posting to the target.
UDF Code
int len = Inp[0].length();
int Mod = len % Count[0];
if( Mod != 0)
{
Inp[0] = String.format("%0$-" +(len+Count[0]-Mod)+ "s", Inp[0]).replace(' ','~');
}
String out;
for(int i=0;i<len;i=i+Count[0])
{
out = Inp[0].substring(i,Count[0]+i);
if( i == len-Mod)
{
out = out.replace("~","");
}
Res.addValue(out);
}
Mapping Test 1 [Count -3]
Mapping Test 2 [Count -3]
Mapping Test 3 [Count -4]
Could you please let us know if this is helpful.
Regards
Baski
Add comment