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: 

at selection-screen

Former Member
0 Kudos

hi, iam new to this abap.

my query is..

i have designed the selection screen with four fields all with select options.

in selection screen i hav to check the validity of the parameters and display error message if invalid input are made

and also..

and also display information message and leave processing the list if no material data could be found according to the selection criteria

these is mentioned in the functional spec

where should i write the code for the above 2 conditions

let me know as soon

thanks and regards.

kiran rathod

9 REPLIES 9

Former Member
0 Kudos

Hi ,

Both the validation and the selection must be done in the AT SELECTION SCREEN event .

First perform the validation , if an error occurs display the error mssage , if no error was there select the data and if required display the warning message.

Regards

A.r

0 Kudos

plz send me the code so that i can solve my problem.

Former Member
0 Kudos

hi,

Do it in AT SELECTION-SCREEN event

Former Member
0 Kudos

Hi Kiran,

Try this:

Ans:U need to add it in the

AT SELECTION-SCREEN event

Eg:

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_data-low.

PERFORM get_data USING 'l'.

Form get_data.

select single required data from database table into itab where data=sdata-low.

if sy-subrc eq 0.

else.

message 'enter valid data' type 'E'.(or use message class)

endif.

ENDFORM .

Regards,

Kaveri

Former Member
0 Kudos

Hi,

Check the following code:

REPORT ZEXMP

LINE-SIZE 120

LINE-COUNT 64

MESSAGE-ID ZZ

NO STANDARD PAGE HEADING.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE XXXX.

SELECT-OPTIONS:S_VKORG FOR ZOPENITEMS-VKORG, "Sales Organization

S_VTWEG FOR ZOPENITEMS-VTWEG, "Dist. channel

S_SPART FOR ZOPENITEMS-SPART, "SalesDivision

S_COMP FOR ZDEMSUM-COMPANY_NAME, "Company

S_CHNAM FOR ZDEMSUM-CHANNEL_NAME, "Channel

S_DIVNAM FOR ZDEMSUM-DIVISION_NAME, "Division

S_WERKS FOR ZDEMSUM-PLANT, "Plant

S_KUNRG FOR ZOPENITEMS-KUNRG, "Payer

S_MATNR FOR ZOPENITEMS-MATNR, "Material

S_PSTYV FOR ZOPENITEMS-PSTYV, "Item Cat D10K954292

S_MATDIV FOR ZDSORGNAM-SPART_MAT, "Material Division

S_MMSTA FOR MARC-MMSTA. "Sales Status

PARAMETERS: P_DATE LIKE ZOPENITEMS-VDATU.

PARAMETERS : R_HDWE RADIOBUTTON GROUP G1 DEFAULT 'X', "HDWE files

R_MT RADIOBUTTON GROUP G1. "MT files

PARAMETERS : P_OUTFIL LIKE RLGRAP-FILENAME.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN.

  • Validation of material

IF NOT S_MATNR-LOW IS INITIAL.

SELECT SINGLE MATNR INTO MARA-MATNR

FROM MARA

WHERE MATNR = S_MATNR-LOW.

IF SY-SUBRC <> 0.

MESSAGE E001 WITH 'Please enter Valid Mateial No.'(012).

ENDIF.

ENDIF.

  • Validation of Sales organization

IF NOT S_VKORG-LOW IS INITIAL.

SELECT SINGLE VKORG INTO TVKO-VKORG

FROM TVKO

WHERE VKORG = S_VKORG-LOW.

IF SY-SUBRC <> 0.

MESSAGE E001 WITH 'Please enter Valid Sales org'(013).

ENDIF.

ENDIF.

  • Validation of Distribution channel

IF NOT S_VTWEG-LOW IS INITIAL.

SELECT SINGLE VTWEG INTO TVTW-VTWEG

FROM TVTW

WHERE VTWEG = S_VTWEG-LOW.

IF SY-SUBRC <> 0.

MESSAGE E001 WITH 'Please enter Valid Distribution channel'(014).

ENDIF.

ENDIF.

  • Validation of division

IF NOT S_SPART-LOW IS INITIAL.

SELECT SINGLE SPART INTO TSPA-SPART

FROM TSPA

WHERE SPART = S_SPART-LOW.

IF SY-SUBRC <> 0.

MESSAGE E001 WITH 'Please enter Valid Division'(015).

ENDIF.

ENDIF.

  • Validation of sales status

IF NOT S_MMSTA-LOW IS INITIAL.

SELECT SINGLE MMSTA INTO T141-MMSTA

FROM T141

WHERE MMSTA = S_MMSTA-LOW.

IF SY-SUBRC <> 0.

MESSAGE E001 WITH 'Please enter Valid Sales Status'(016).

ENDIF.

ENDIF.

Regards,

Bhaskar

0 Kudos

Hi,

As you have declared your select-options under a block.

You can check the validation for the whole block fields under

Event-

AT SELECTION-SCREEN ON BLOCK B1.

In this case all fields under a block is input enabled and

outside block fields input diabled.

And if you want to check every single input field i.e. you can do

that under Event-

AT SELECTION-SCREEN ON <Fieldname>.

In this case only wrong input field is input enabled and other fields are input disabled.

If you use AT SELECTION-SCREEN.

Then all the fields in the selection screen are input enabled.

So use ablove Corresponding EVENT as according to your requirements.

Under each EVENT give 'E' Type Message , Program will not be processed further.for wrong input.

regards,

Sujit

Edited by: Sujit Pal on Jun 28, 2008 7:15 AM

Former Member
0 Kudos

in AT SELECTION-SCREEN event

Former Member
0 Kudos

hi,

You can Validate ur material in

AT SELECTION-SCREEN ON <field> event.

U can check Validity and avalibility of material in this event block.

Rest if u want to validate each value seperately then use the above event otherwise put all fields under one block and validate them in

AT SELECTION-SCREEN ON BLOCK <block>

hope this will help.

reward if helpful

Sumit Agarwal

Former Member
0 Kudos

hi,

do all the validation in the AT SELECTION SCREEN events that are AT SELECTION SCREEN on field,

AT SELECTION SCREEN on block

or AT SELECTION SCREEN

whichever is applicable...

refer to the code below;

AT SELECTION-SCREEN on s_vbeln.

SELECT SINGLE vbeln " Sales document

FROM vbuk

INTO w_vbeln

WHERE vbeln IN s_vbeln.

IF sy-subrc <> 0.

MESSAGE e104(VF) WITH s_vbeln.

ENDIF. " IF SY-SUBRC <> 0

with luck,

pritam.