cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CPI: SubString Function Issue while mapping target field

babruvahana
Contributor
9,835

Hi Experts,

I working on a mapping where I need to restrict the char length of the source field.

If the character length is less than the character count defined in the substring function, the mapping fails with String out of index

The same mapping workings in PI. But it failed in CPI.

Is it a normal behavior or I am doing wrong with my mapping or any other ways to achieve this simple mapping in CPI?

Any pointers would be of great help.

View Entire Topic
bhalchandrasw
Contributor

Hi babruvahana,

Use function ifS instead of function if.

Function 'if' evaluates all expressions before assigning the value. Function 'ifS' evaluates the condition first and then evaluates the required expression.

You are getting the error because when length is less than 30 the expression substring is evaluated anyhow.

SAP Note 1090369 explains the difference. In your PI system, the note might not have been applied, therefore it worked.

In general, always use ifS and ifSWithoutElse instead of if and ifWithoutElse.

Hope this helps,

Bala