‎2009 Oct 12 3:52 PM
Hi Experts,
I have one query. I have one amount field. I wanted to validate that this field should not contain any text i.e. SY-ABCDE.
Example:
data: lv_var TYPE I.
LV_VAR = '100.00'.
IF LV_VAR NE SY-ABCDE.
"SOME MESSAGE
ENDIF.
While debugging I found that still control is going to inside above mentioned if condition.
Can anybody will suggest me how to write condition for it.
Thanks,
Neha
‎2009 Oct 12 4:01 PM
Hi ,
try this way...
data: lv_var TYPE I.
LV_VAR = '100.00'.
IF LV_VAR NE SY-ABCDE. "comment this
IF LV_VAR CA SY-ABCDE. "write CA if the variable contains any alphabets the below statement executes
"SOME MESSAGE
ENDIF.
Prabhudas
‎2009 Oct 12 3:58 PM
If you want to work with SY-ABCDE, you should code it like IF LV_VAR CA SY-ABCDE.
But since SY-ABCDE contains only the 26 latin alphabet characters (and that in caps only), I'd rather say:
IF LV_VAR NO '1234567890 .'.
<some message>
ENDIF.
‎2009 Oct 12 4:01 PM
Hi ,
try this way...
data: lv_var TYPE I.
LV_VAR = '100.00'.
IF LV_VAR NE SY-ABCDE. "comment this
IF LV_VAR CA SY-ABCDE. "write CA if the variable contains any alphabets the below statement executes
"SOME MESSAGE
ENDIF.
Prabhudas
‎2009 Oct 12 4:03 PM
>
> LV_VAR = '100.00'. => THis doesnt have a alphabetic value right??
> IF LV_VAR NE SY-ABCDE. ======> NE means not equal to.. and of course 100.00 is NE 'ABCD...XYZ"
> "SOME MESSAGE ==============> so it does in.
> ENDIF.
> While debugging I found that still control is going to inside above mentioned if condition.
> Neha
neha,
hope you understnad now
so for checking...
first do this...
translate lv_var to uppercase. " this is needed bychane the string contains lower case.. and sy-abcde doesnt contain lower case elements.
if lv_var CA sy-abcde.
message 'contains chars' type 'I'.
endif.Edited by: Soumyaprakash Mishra on Oct 12, 2009 8:33 PM