‎2007 Jun 22 8:27 AM
hi friends,
i have a parameter (var1) which is declared as String .now i want a function module which will not allow any other datatype otherthan number (type N) to be entered in that variable.is there any function module like that?would appreciate if u help me.
thanks and regards,
kanti
‎2007 Jun 22 8:30 AM
I think this should be done as validation after input only. But, no matter what data you enter, since it will be compatible with String type, ti will not throw an error. You can do this validation for other data types maybe, but I doubt if it will work on a string.
‎2007 Jun 22 8:33 AM
Hi Kanti
You don't need a function module.
You can do this by using the following statement:
if var1 ca '0123456789'.
...
endif.
<b>CA</b> Contains Any: True, if operand1 contains at least one character from operand2. Upper/lower case and trailing blanks are taken into account for both operands. If operand1 or operand2 is of type string and initial, the logical expression is always false. If result of the comparison is positive, sy-fdpos contains the offset of the first character in operand1 that is also contained in operand2. If the result of the comparison is negative, sy-fdpos contains the length of operand1.
Regards
‎2007 Jun 22 8:37 AM
Hi Kanti,
Take help from this code:
Data : Str_num TYPE string.
str_num = ' 0123456789'.
IF number CO str_mob.
.......................
ELSE.
Eroor Message.................
ENDIF.
Regards,
Sandeep kaushik