cancel
Showing results for 
Search instead for 
Did you mean: 

method to find if the entered text is numeric or string

Former Member
0 Kudos

I have an input field mapped with an attribute of type string.

I want to validate if the user entered a numeric value then convert it to string type and if its a text like "abcd" then throw an error message "Please enter numeric value"

the reason i am not using INT4 as a data type is that it shouws 0 on the input field as a default value which is not as per the requirement.

How can i do that ?

Regards, Amol

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi amol...

you can make use of the system field sy-abcde.

this checks for anycharecters in the given string. first conver the string to capital letters using translate. then use condition, if string ca sy-abcde. if there is only characters then it goes inside the if else... it moves on o the else part.

--regards,

alex b justin

Former Member
0 Kudos

Hi Alex,

if we use 'if string ca sy-abcde',then it will goes inside the loop if it conatins atleast one character.

so we have to use 'if string co sy-abcde'.

If u r going to check whether it is Numeric,Use 'if string na sy-abcde'.

Thanks & Regards,

Padmam.