Skip to Content
0
Jun 11 at 05:30 AM

Splitting a string(Input) and assigning to different fields in a target using UDF(Dynamic Substring)

68 Views Last edit Jun 11 at 05:34 AM 2 rev

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