Application Development and Automation 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: 
Read only

how to do validations for select-options

Former Member
0 Likes
588

Hi gurus,

can you suggest me

how to do validations for select-options

Thanks&ragards,

Kals.

5 REPLIES 5
Read only

Former Member
0 Likes
561

Hi,

validating select-options can be done as below.

For the select-option s_vkorg.....

AT SELECTION-SCREEN .

IF NOT S_VKORG[] IS INITIAL.

SELECT SINGLE VKORG

FROM TVKO

INTO (TVKO-VKORG)

WHERE VKORG IN S_VKORG.

IF SY-SUBRC <> 0.

MESSAGE E002.

ENDIF.

ENDIF.

u can display a message if there s no VKORG is existing for the one u ve entered in the select-option else it ll pick the VKORG from the corresponding table TVKO.

hope its clear.

Revert back for any other queries.

Regards,

Ramya

Read only

Former Member
0 Likes
561

Hi,

validating select-options

For the select-option s_vkorg.....

AT SELECTION-SCREEN .

IF NOT S_VKORG[] IS INITIAL.

SELECT SINGLE VKORG FROM TVKO

INTO (TVKO-VKORG)

WHERE VKORG IN S_VKORG.

IF SY-SUBRC 0.

error message.

ENDIF.

ENDIF.

Regards,

Sandesh

reward point if helpful

Read only

Former Member
0 Likes
561

Hi,

data: v_num type i.

select-options: s_date for sy-datum,

s_num for v_num.

at selection-screen.

if s_date-low is initial.

message 'Pls enter Low value' type 'E'.

endif.

if v_num-low > '2000'.

message 'Pls enter value below 2000' type 'S'.

endif.

Read only

Former Member
0 Likes
561

HI,

TABLES: BKPF.

TYPES: BEGIN OF TY_BKPF,

BUKRS TYPE BUKRS, "COMPANY CODE

GJAHR TYPE GJAHR, "FISCAL YEAR

MONAT TYPE MONAT, "FISCAL PERIOD

DATA: T_BKPF TYPE TABLE OF TY_BKPF,

W_BKPF TYPE TY_BKPF.

SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS: S_CODE FOR BKPF-BUKRS,

S_YEAR FOR BKPF-GJAHR,

S_PERIOD FOR BKPF-MONAT.

SELECTION-SCREEN: END OF BLOCK B1.

----


  • AT SELECTION-SCREEN *

----


IF S_CODE IS INITIAL OR S_YEAR IS INITIAL OR S_PERIOD IS INITIAL.

MESSAGE E000(0) WITH 'ENTER VLAUES'.

ENDIF.

SELECT SINGLE * FROM BKPF WHERE BUKRS IN S_CODE.

IF SY-SUBRC <> 0.

MESSAGE E000(0) WITH 'ENTER VALID VALUES'.

ENDIF.

reward if useful

thanks and regards

Read only

Former Member
0 Likes
561

Validations for select-options can be done as follows:

*For vaildating a particular field when data is entered i that field and enter pressed

AT SELECTION-SCREEN ON s_variable.

if s_variable[] is not initial.

<Codes for validation>

endif.

Or you can write

AT SELECTION-SCREEN .

if s_variable[] is not initial.

<Codes for validation>

endif.