‎2008 Jul 03 4:31 AM
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.
‎2008 Jul 03 4:39 AM
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
‎2008 Jul 03 4:34 AM
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
‎2008 Jul 03 4:39 AM
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
‎2008 Jul 03 5:20 AM
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.
‎2008 Jul 03 5:36 AM
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
‎2008 Jul 03 5:41 AM
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
‎2008 Jul 03 6:00 AM
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.