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

Validations in selection screen

Former Member
0 Likes
765

Hi experts,

In the selection screen when no record is entered how to validate so that it should not go to output.

same for alpha numerical charecters.

Regards,

Sunita.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
743

Hi Sunitha,

Try the following.

Say, the field is s_matnr.

for checking the initial condition.

At Selection-Screen on s_matnr.

if s_matnr[] is initial.

message 'Enter the required fields' type E.

endif.

for alpha numeric characters.

At selection-screen on s_matnr.

if not s_matnr[] in sy-abcde.

message 'Enter only characters' type E.

endif.

Hope this helps you.

Regards,

Chandra Sekhar

6 REPLIES 6
Read only

Former Member
0 Likes
743

Hi Sunitha,

Use AT SELECTION-SCREEN ON <fieldname> Event.

Please check this link

http://help.sap.com/saphelp_nw70/helpdata/en/79/34a237d9b511d1950e0000e8353423/frameset.htm

Best regards,

raan

Read only

Former Member
0 Likes
744

Hi Sunitha,

Try the following.

Say, the field is s_matnr.

for checking the initial condition.

At Selection-Screen on s_matnr.

if s_matnr[] is initial.

message 'Enter the required fields' type E.

endif.

for alpha numeric characters.

At selection-screen on s_matnr.

if not s_matnr[] in sy-abcde.

message 'Enter only characters' type E.

endif.

Hope this helps you.

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
743

Hi,

Please refer the code below:


"TO check the values in the selection Screen.

parameter : sp_bukrs like bsis-bukrs.

at selection-screen.

if sp_bukrs is initial.
message ' Input value in the Company Code field' type 'E'.
endif.

"Similar u can use of Relational operators to check for alpah numeric characters.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
743

Hi Sunita,

You can use the piece of code....

SELECTION-SCREEN: BEGIN OF BLOCK c1 WITH FRAME TITLE text-001.

PARAMETERS:p_prog(30) TYPE c.

SELECTION-SCREEN: END OF BLOCK c1.

AT SELECTION-SCREEN ON p_prog.

IF p_prog IS INITIAL.

MESSAGE 'Enter Program name' TYPE 'E'.

ELSEIF NOT p_prog ca sy-abcde.

MESSAGE 'Please enter charecters' TYPE 'E'.

ENDIF.

for the first 'IF' it checks whether the value enter or not.

for the second 'IF' it checks whether the entered values are alphanumeric or not. 'ca' indicates 'Contains Any'.Use 'ca'.

Edited by: Apan Kumar Motilal on Jul 3, 2008 6:59 AM

Read only

Former Member
0 Likes
743

hi Sunita,

you can use

At Selection-Screen on p_data.

if p_data is initial.

message e000 text-001(error message) type 'E' Display like "I" .

(it will give pop up information messge )

Leave list-processing ." this will leave the further processing of the progam

endif.

Reward if helpful

Amit

Edited by: Amit Kumar on Jul 3, 2008 6:46 AM

Read only

Former Member
0 Likes
743

Hi experts,

Thanks For your valuable answers.I have found the answer for my queiry

AT SELECTION-SCREEN ON s_bukrs.

IF NOT s_bukrs[] IS INITIAL.

SELECT SINGLE bukrs FROM bsid

INTO s_bukrs

WHERE bukrs IN s_bukrs.

ENDIF.

IF sy-subrc NE 0.

MESSAGE e002.

ELSEIF s_bukrs CA '*-/'.

MESSAGE e002.

ENDIF.

And This code work. Thanks All.

Regards,

Sunita.