As Simple As SY-ABCDE!
1. In a character string where you want to check whether a string contains any alphabets, try using this one!
e.g. TRANSLATE lv_var TO UPPERCASE.
IF lv_test CA sy-abcde. "Contains Any A to Z
.........
SY-ABCDE only checks for CAPITALS A-Z, hence the need to translate the variable to uppercase first.
2. To check whether a char datatype variable contains only numeric characters or not, use this:
e.g. IF lv_var CN '1234567890.' "Doesn't contain 0 to 9 and decimal point (.) .........
You might as well use sy-abcde to check if user has keyed in other than numerics characters, but it is safer to use the latter (1234567890.) because there is possibility that user might key in symbols as well.
NOTES: Logical Expressions for String Fields
CO - Contains
CN - Does Not Contain / Inverse of Contains
CA - Contains Any
NA - Contains None / Inverse of Contains Any
CS - Contains String
NS - Does Not Contain String / Inverse of Contains String
CP - Contains Pattern
NP - Does Not Contain Pattern / Inverse of Contains Pattern
Serkan AKKAVAK
Computer Engineer
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com
0 Comments