on 06-11-2021 6:30 AM
Hello everyone,
I am naive in SAP PI and not ready to deal with UDFs strongly.
I have requirement of splitting an input string and assign to the target field. I tried to achieve this using graphical mapping function SUBSTRING and working fine. But want to do this dynamically using UDF. Please can I get the logic code for UDF.
E.g Input="123456778822337654341234567788123456" Result should be as below:
Output
<input>
<input>
<Item1>1234567788</Item1>
</input>
<Header2>
<Item2>2233765434</Item2>
</Header2>
<Header2>
<Item2>1234567788</Item2>
</Header2>
<Header2>
<Item2>123456</Item2>
</Header2>
</input>
Anticipating positive response.
Thanks and regards,
Krushna Band
Hi Krushna ,
Try the below code :
Set Execution type as All value of Context. Aurgument for input : inp.
String message = inp[0];
int len = 10;
for (int i = 0; i < message.length(); i += len)
{
result.addValue(message.substring(i, Math.min(i + len, message.length())));
result.addValue(ResultList.CC);
}
Result :
Thanks,
Manoj K
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.