Example for code as below is to check whether a string is number with decimal ','
or not :
REPORT Z_TEST.
LW_CREDIT_TEMP TYPE BSEG-DMBTR.
PARAMETER: p_input TYPE char14.
FIND ALL OCCURRENCES OF ',' IN p_input MATCH COUNT count.
Write: ' occurance of the , = ', count.
IF p_input CO '1234567890, ' and count <= 1.
WRITE: /'Yes, valid', p_input.
write: lw_credit_temp.
Else.
WRITE: /'invalid', p_input.
write: lw_credit_temp.
ENDIF.
-------------------------------------------
1)Input : 4,5
Output: 4,5 is valid
2)Input: e
output: e is invalid
No comments:
Post a Comment