Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

validations

Mohamed_Mukhtar
Active Contributor
0 Kudos
72

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos
49

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.

7 REPLIES 7

Former Member
0 Kudos
50

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.

0 Kudos
49

thanks ...........

0 Kudos
49

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,

Former Member
0 Kudos
49

Hi always,

Check them:

IF P_DATA CA '*'.
  WRITE:/ 'Invalid'.
ENDIF.

Replace them:

REPLACE ALL OCCURRENCES OF '*' IN P_DATA WITH ''.

Regards,

Isaac Melendez

Former Member
0 Kudos
49

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

Former Member
0 Kudos
49

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

Mohamed_Mukhtar
Active Contributor
0 Kudos
49

thx