cancel
Showing results for 
Search instead for 
Did you mean: 

validation for selectoption using s_matnr

Former Member
0 Kudos

hi,

can any one provide the program for writing the validation of a selection screen using select-option statement.

Ex: s_matnr

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Bhargav, can you please elaborate your issue so that you can get the exact response. Kindly elaborate your point.

Regards.

Naveen

Former Member
0 Kudos

Hi Bhargav,

Welcome to SDN!!

Validation for <b>SELECT-OPTIONS</b> can be performed the same way as you validate a <b>PARAMETER</b>. Perhaps you are concerned with the fact that <b>SELECT-OPTIONS</b> represent a range/set of values as opposed to a single value.

<b>SELECT-OPTIONS</b> have <b>LOW</b> and a <b>HIGH</b> value. Your approach could be to validate either of/both the values. This is primarily because, <b>HIGH</b> is an optional field. You might not even have a value there at times to validate.

For example.


 SELECT matnr FROM mara WHERE matnr EQ s_matnr-low.
 
 IF SY-SUBRC NE 0.
   MESSAGE ID WITH 'Material does not exist'.
 ENDIF.

Hope this helps.

Best Regards,

Sanyam

andreas_mann3
Active Contributor
0 Kudos

Hi,

...

addition to Sanyam:

AT SELECTION-SCREEN ON s_matnr.

SELECT count( * ) into sy-dbcnt

FROM mara WHERE matnr in s_matnr.

IF SY-SUBRC NE 0.

MESSAGE ID WITH 'Material does not exist'.

ENDIF.

Andreas