2005 Aug 09 10:11 AM
Hi all,
I've a selection options plant:
select-option s_werks for marc-werks.
i want to display the error message if user inputs plant = 30xx or 30xx is within the range.
Currently, I use the codes below but i don't think it's smart enough, Is there a smarter way to do so?
AT SELECTION-SCREEN.
loop at s_werks.
if s_werks-sign = 'I'.
case s_werks-option = 'bt'.
...
endcase.
elseif s_werks-sign = 'E'.
case s_werks-option = 'bt'.
...
endcase.
endif.
endloop.
2005 Aug 09 11:31 AM
hi Macy,
It is as simple as this...
if '30xx' in s_werks.
<give error msg>
endif.
This will check for the value 30xx as a single value or even if entered as a range.
Hope this helps.
Remember to reward points to the reply that best answered your question.
Reg,
PP.
2005 Aug 09 10:30 AM
Hi,
Try this.
AT SELECTION-SCREEN.
loop at s_werks.
if ( ( s_werks-sign = 'I' or s_werks-sign = 'E' ).
and ( s_werks-option = 'bt' ) ).
...
endif.
endloop.
2005 Aug 09 10:45 AM
Hi Macy,
there might be faster ways than asking the database, but otherwise you will need a lot of coding to check all possible selections.
Try instead:
select werks into l_werks
up to 1 rows
from t001w
where werks in s_werks
and werks between '3000' and '3099'.
if sy-subrc eq 0.
message e398(00) with 'Please don't select 30xx!'.
endif.
So first where clause is from selection-screen, second you can define freely to match your 'forbidden zone' - maybe vlfkz = 'B' (distribution centers) or something else brings same result.
Regards,
Christian
2005 Aug 09 11:31 AM
hi Macy,
It is as simple as this...
if '30xx' in s_werks.
<give error msg>
endif.
This will check for the value 30xx as a single value or even if entered as a range.
Hope this helps.
Remember to reward points to the reply that best answered your question.
Reg,
PP.
2005 Aug 09 5:20 PM
Macy - you can use FM SELECT_OPTIONS_RESTRICT. It's well documented.
Rob