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

Mandatory parameter field in selection screen

Former Member
0 Likes
2,996

Hi Experts,

As there are 2 options to get the input from the user. When I use select options because I need to make the field mandatory, it displays the output(blank) whenever there is no input/irrelevant input. When I use parameters, I cannot make it mandatory.

I need to display text boxes in the selection screen which should be mandatory and should only proceed when the user enters relevant data.

Please note that I have put the validation in the select options for a field like month as:

if s_month-low > '12' or s_month < '1'.

     MESSAGE 'Please enter a valid month' type 'E'.

endif.

but for a id, there is a search help. If the user do not enter the value from a search help, it displays the blank output. How to put validation on this?

Regards

Mani

Hi Experts,

As there are 2 options to get the input from the user. When I use select options because I need to make the field mandatory, it displays the output(blank) whenever there is no input/irrelevant input. When I use parameters, I cannot make it mandatory.

I need to display text boxes in the selection screen which should be mandatory and should only proceed when the user enters relevant data.

Please note that I have put the validation in the select options for a field like month as:

if s_month-low > '12' or s_month < '1'.

     MESSAGE 'Please enter a valid month' type 'E'.

endif.

but for a id, there is a search help. If the user do not enter the value from a search help, it displays the blank output. How to put validation on this?

Regards

Mani

4 REPLIES 4
Read only

anupam_anand
Participant
0 Likes
1,525

Hi Mani,

You could use a list box to select values.

You can also have a AT SELECTION SCREEN on S_ID.

In this event, check if the ID lies in the check table. In case it doesn't, you can raise an error. The system will generate an error and the control will still be on the ID field for a valid value.

Let me know if it helped.

Thanks,

Anupam

Read only

ronaldo_aparecido
Contributor
0 Likes
1,525

Oi Mani

PARAMETERS: p_carrid TIPO spfli-carrid.


At selection screen  ON-SCREEN p_carrid.

(Here you write your validation)

SEE THIS LINK

https://help.sap.com/saphelp_nw04/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm

Read only

Former Member
0 Likes
1,525

Hi Mani,

You can do a validation at AT Selection Screen.Basically it will do a select single and try to fetch any line item.

A sample example as follows..

At Selection-Screen on S_DATE.

if S_date is not initial.

Perform validatedate.

Endif.

Form Validatedate.

Select single date

          from DB table

         where date in S_date.

endform.

if Sysubrc ne 0.

MESSAGE 'Please enter a valid month' type 'E'.

endif.

Regards,

Kannan

Read only

Former Member
0 Likes
1,525

Use below code

at selection on s_selection_option.

*"Write logic to validate selet option data.

Or if you want that if user has not entered anything and you want to select complete data then check select option before select.

If s_id IS NOT INITIAL .

select * from sflight INTO table it_sflight where field1 IN s_id .

ELSE.

select * from sflight INTO table it_sflight .

ENDIF.