Technical Articles
The long sentence at SAP script editor
Recently checked a few remediations of ancient SAP Script forms, and encounter the command line being too long that even 2 lines are not enough to accommodate. Seniors could think ‘/=’ or ‘=’ for wrapped lines will do but actually, it will not.
Please find below my testing results for various approaches to deal with long sentences at the script editor:
- Line Feed and Extended Line ‘/=’ will not extend the command line, which will turn to text output like a comment line;
- Extended Line ‘=’ will not extend the command line; which will turn to text output like a comment line;
- Shift+F8 will work but have line limitations. If multiple conditions reach the limit then can’t use this approach if it’s too long;
Besides, if one long sentence has been split into different lines with TAG ‘/:’ at the editor of Script forms like below, it’ll not work for sure as well.
We can see those sentences from the second line with the initial ‘/:’ can’t be recognized correctly.
Even if correct IF/ESLEIF has been added per line, it’ll not execute correctly as it’s been treated separately instead of one single line with all those conditions.
Conclusion:
- If the sentence is not very long which can be handled with SHIFT+F8 then using SHIFT+F8 as the first option;
- Otherwise, if the sentence is very long and my suggestion is to split this single long sentence into smaller conditions check like below:
/: IF &VBDKA-VKORG& = 'AB10' OR &VBDKA-VKORG& = 'AB11'
/: SET COUNTRY 'MY'
/: ELSEIF &VBDKA-VKORG& = 'AB20' OR &VBDKA-VKORG& = 'AB22'
/: SET COUNTRY 'MY'
/: ELSEIF &VBDKA-VKORG& = 'AB30' OR &VBDKA-VKORG& = 'AB31'
/: SET COUNTRY 'MY'
/: ELSE
/: SET COUNTRY 'US'
/: ENDIF
Btw, use Utilities->Form Info to verify the updates which is far more convenient than default Editors per windows~