2007 May 02 10:37 AM
Hi All,
I have a doubt regarding validation of selection screen fields Examp if I take material declared as selec-options:s_matnr for mara-matnr.
when I am validating I am doing like below.
select single matnr from mara into l_matnr where matnr eq s_matnr-low.
if sy-subrc ne 0.
error mesg.
endif.
select single matnr from mara into l_matnr where matnr eq s_matnr-high.
if sy-subrc ne 0.
error mesg.
endif.
I enterted material values in the selction screen say 100 to 150.
s_matnr-low is 100.
s_matnr-high is 150.
I have the materials data like this 99,101,104,159.For this case if we will do the above validation it wil give error since 90 is not there in db but actually speaking it should fetch 101.104,159 since this falls under the range of 99 to 150.Please let me know how can we do the validations for this type of scenarios?
Thanks&Regards
Mahesh
Hi All,
I have a doubt regarding validation of selection screen fields Examp if I take material declared as selec-options:s_matnr for mara-matnr.
when I am validating I am doing like below.
select single matnr from mara into l_matnr where matnr eq s_matnr-low.
if sy-subrc ne 0.
error mesg.
endif.
select single matnr from mara into l_matnr where matnr eq s_matnr-high.
if sy-subrc ne 0.
error mesg.
endif.
I enterted material values in the selction screen say 100 to 150.
s_matnr-low is 100.
s_matnr-high is 150.
I have the materials data like this 99,101,104,159.For this case if we will do the above validation it wil give error since 90 is not there in db but actually speaking it should fetch 101.104,159 since this falls under the range of 99 to 150.Please let me know how can we do the validations for this type of scenarios?
Thanks&Regards
Mahesh
2007 May 02 10:40 AM
hi,
instead of writing different select queries , write singl select like:-
select single matnr from mara into l_matnr where matnr in s_matnr.
if sy-subrc ne 0.
error mesg.
endif.
Regards
Nilesh
2007 May 02 10:42 AM
Hi
Here you can use the single select quety for your purpose.
As matnr is a selection parameter it contains low and high values at a time and validate.
Regards,
Sreeram
2007 May 02 10:43 AM
hi,
If you give a range of values in your selection screen,
The output will be inbetween those range..
Validation checks :- if all the range values are not in the database it will return you the error message..
Selection option is for range of values..
rewards,
regards,
nazeer
2007 May 02 10:46 AM
Like the select statement you are writing you are only validating the values which are in the high and low of the select option.... if you want ot validate all the data that you have enetered then try using
in bet s_matnr-low and s_matnr-high. or else s_matnr will also wrok but it will not validate the s_matnr-high and will show all the data which comes in the range till s_matnr-high though you migh have netered the high value wronmg..
Regards,
Jayant
Please award if helpful
2007 May 02 10:50 AM
Hi Mahesh,
Please Use the query like this:
Select single matnr from mara into l_matnr where matnr in s_matnr.
if sy-subrc ne 0.
error mesg.
endif.
The select query which you are using is wrong because you are checking only low and high value of the s_matnr field. which is wrong.
Use 'IN' instead of '='.
2007 May 02 10:53 AM
<b>Only validate for the lower value:</b>
AT SELECTION-SCREEN.
SELECT SINGLE mtart FROM t134 INTO l_mtart
WHERE mtart = s_mat-low.
IF sy-subrc <> 0.
MESSAGE e000 WITH text-016.
ENDIF
2007 May 02 10:56 AM
<b>Because if none of the material is invalid then only the error message should display. Otherwise, if atleast one material is valid then the processing sould continue with that material.</b>
2007 May 02 11:02 AM
Hi All,
I know how to validate the selection screen fields but the problem here is when I enter 100 to 150 since 100 mat is not there it gives error mesg but ideally speaking it should not give the error mesg since 101 is there and other values r there in the database.
Thanks&Regards
Mahesh
2007 May 02 11:13 AM
Hi,
That is because you are using s_matnr-low and s_matnr-high separately.Then it will take only 100 and 150.It won't take between 100 and 150.
If you want it to take between 100 and 150, then try this.
if not s_matnr[] is initial.
select single matnr from mara into l_matnr where matnr <b>in s_matnr</b>..
if sy-subrc ne 0.
error mesg.
endif.
endif.
2007 May 02 10:55 AM
Hi,
Try this and reward points by clicking the star on the left of reply,if it helps.
<b>if not s_matnr-low is initial.</b>
select single matnr from mara into l_matnr where matnr eq s_matnr-low.
if sy-subrc ne 0.
error mesg.
endif.
<b>endif.</b>
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |