on ‎2020 Jun 22 4:57 PM
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.


Help others by sharing your knowledge.
AnswerRequest clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 13 | |
| 8 | |
| 6 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.