REPORT ZCHECK_ALPHA_NUMERIC.
* Declare the variable
* For Length
data: serial_length type i.
* For Alpha numeric
data: str type string.
data: valid_characters type string.
* Fill in those valid characters you need to check
concatenate '0123456789' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
'abcdefghijklmnopqrstuvwxyz' into valid_characters.
* User Input
parameters testchar(10) default '12345abc'.
* Get User Input
str = testchar.
* The Checks
if str co valid_characters.
write: / str, 'Characters are OK'.
else.
write: / str, 'Characters are NOT OK'.
endif.
* Check if length is equal to 10 characters
serial_length = strlen( str ).
if serial_length <> 10.
write: / str, 'Not 10 Digit'.
endif.
*-- End Program
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com
Social Plugin