cancel
Showing results for 
Search instead for 
Did you mean: 

Exception:[java.lang.StringIndexOutOfBoundsException: String index out of range: 7]

former_member216332
Participant
0 Kudos

Hello experts,

I have three fields in play the Filler, Collect_No & Value_Parts. Below is a description of each field.

FIELDMAX LENGTHVALUEDATATYPE
Filler21RRF57657E012345612340030023004200String
Collect_No10String
Value_Parts240RRF5765String

When using the substring function (0....7)on the Filler value, & mapping it to  Value_Parts, the value RRF5765 is obtained.

Applying the very same function on Filler & mapping it to Collect_No gives the below exception

"

Exception:[java.lang.StringIndexOutOfBoundsException: String index out of range: 7] in class com.sap.aii.mappingtool.flib3.TextFunctions method substring[, com.sap.aii.mappingtool.tf3.rt.Context@3ff71112]

"

Please help me with the issue.

Any thought on the issue is appreciated.

Thanks in Advance

Sam

Accepted Solutions (0)

Answers (2)

Answers (2)

Harish
Active Contributor
0 Kudos

Hi Sam,

adding to the Inaki's comment, you can use the length function to check the length before substring. Substring function would not validate the length and through exception when required length data is not in the input.

It would be better to use UDF for substring then standard substring function.

Regards,

Harish

iaki_vila
Active Contributor
0 Kudos

Hi Sam,

Check the queue values. you are using the substring function with a item with length lower than 7 characters, then the function throws the exception. Perhaps in the first case all items are filled and in the second case you have any empty item.

Regards.