‎2008 May 15 6:10 PM
hi ,
if the end-user is entering some garbage like "-/-*" in the select-option.
how to do validations at selection-screen?
with regards
always learner
points will be rewarded if useful
‎2008 May 15 6:15 PM
Hi,
You can do as below:
at selection-screen.
if not sp_field[] is initial.
if sp_field CA '*-/'.
message 'Error' type 'E'.
endif.
endif.
Thanks,
Sriram Ponna.
‎2008 May 15 6:15 PM
Hi,
You can do as below:
at selection-screen.
if not sp_field[] is initial.
if sp_field CA '*-/'.
message 'Error' type 'E'.
endif.
endif.
Thanks,
Sriram Ponna.
‎2008 May 15 6:16 PM
‎2008 May 15 6:22 PM
Hello,
And depending of the domain of the field used in the select-options the ABAP do a self validations (without need of code).
For example if you use a numeric type, only numbers will be accepted in the select-options.
Regards,
‎2008 May 15 6:20 PM
Hi always,
Check them:
IF P_DATA CA '*'.
WRITE:/ 'Invalid'.
ENDIF.Replace them:
REPLACE ALL OCCURRENCES OF '*' IN P_DATA WITH ''.Regards,
Isaac Melendez
‎2008 May 15 6:27 PM
Hi,
We can do validation like this.
----
SELECTION-SCREEN
----
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE tit.
SELECT-OPTIONS: so_ebeln FOR v_ebeln OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b.
----
AT SELECTION-SCREEN ON
----
AT SELECTION-SCREEN ON so_ebeln.
PERFORM validate_ebeln.
&----
*& Form validate_ebeln
&----
FORM validate_ebeln.
SELECT ebeln
FROM ekpo
INTO TABLE it_ebeln
WHERE ebeln IN so_ebeln.
IF sy-subrc NE 0.
MESSAGE e020(z50871msg) WITH text-014.
ENDIF.
ENDFORM.
Not only the "-/-".....for any value which is not valid, this code gives error message.
Here , I am doing the validation for EBELN. According to ur requirement you can change this code.
Regards
Sandeep Reddy
‎2008 May 15 7:47 PM
hi check this..
if this not the database element then use this..
parameters: p_field(10) type c .
at selection-screen .
if p_field ca '-'.
message s000 with 'this is invalid'.
elseif p_field ca '*'.
message s000 with 'this is invalid'.
elseif p_field ca '/'.
message s000 with 'this is invalid'.
endif.
if it is a database field..
tables:mara .
select-options:s_matnr for mara-matnr .
data: v_matnr like mara-matnr .
select matnr from mara into v_matnr where matnr in s_matnr .
endselect .
if sy-subrc ne 0.
message s000 with 'the input is invalid'.
endif.
regards,
venkat
‎2008 Jul 25 4:15 AM