07-23-2007 12:50 PM
Hi abapers,
In selection screen am having field s_matnr.
After giving input as * and pressing F4 its fetches all the materials.But i want to restrcit using * and then pressing F4.
How can i do it.
07-23-2007 12:55 PM
Hi,
Check if there is any search help assignment at the field-level or at the Data elemet level.
If there is then may be you can think of using a search help exit and then checking the import paramters value there.
If there is no Search help and you are using a code at Process on VALUE-EQUEST 0r POV module then you can easily check the value there and raise an error saying please enter a different value etc.
Regards,
Sesh
07-23-2007 12:53 PM
Hi,
Use the FMs, SELECT_OPTIONS_RESTRICT & RS_INT_SELOPT_RESTRICT
<b>Example Code</b>
REPORT selectoptionsrestrict.
* Author : Lakshmi Sunitha
* Date : February 19, 2003
* Include type pool SSCR
TYPE-POOLS sscr.
TABLES :
marc.
* defining the selection-screen
select-options :
s_matnr for marc-matnr,
s_werks for marc-werks.
* Define the object to be passed to the RESTRICTION parameter
DATA restrict TYPE sscr_restrict.
* Auxiliary objects for filling RESTRICT
DATA : optlist TYPE sscr_opt_list,
ass type sscr_ass.
INITIALIZATION.
* Restricting the MATNR selection to only EQ and 'BT'.
optlist-name = 'OBJECTKEY1'.
optlist-options-eq = 'X'.
optlist-options-bt = 'X'.
APPEND optlist TO restrict-opt_list_tab.
ass-kind = 'S'.
ass-name = 'S_MATNR'.
ass-sg_main = 'I'.
ass-sg_addy = space.
ass-op_main = 'OBJECTKEY1'.
APPEND ass TO restrict-ass_tab.
* Restricting the WERKS selection to CP, GE, LT, NE.
optlist-name = 'OBJECTKEY2'.
optlist-options-cp = 'X'.
optlist-options-ge = 'X'.
optlist-options-lt = 'X'.
optlist-options-ne = 'X'.
APPEND optlist TO restrict-opt_list_tab.
ass-kind = 'S'.
ass-name = 'S_WERKS'.
ass-sg_main = 'I'.
ass-sg_addy = space.
ass-op_main = 'OBJECTKEY2'.
APPEND ass TO restrict-ass_tab.
CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
EXPORTING
restriction = restrict
EXCEPTIONS
TOO_LATE = 1
REPEATED = 2
SELOPT_WITHOUT_OPTIONS = 3
SELOPT_WITHOUT_SIGNS = 4
INVALID_SIGN = 5
EMPTY_OPTION_LIST = 6
INVALID_KIND = 7
REPEATED_KIND_A = 8
OTHERS = 9
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Sudheer
07-23-2007 12:55 PM
Hi,
Check if there is any search help assignment at the field-level or at the Data elemet level.
If there is then may be you can think of using a search help exit and then checking the import paramters value there.
If there is no Search help and you are using a code at Process on VALUE-EQUEST 0r POV module then you can easily check the value there and raise an error saying please enter a different value etc.
Regards,
Sesh
07-23-2007 12:56 PM
hi
Try using the function module SELECT_OPTIONS_RESTRICT.
reward points if helpful
krishna
07-23-2007 1:00 PM
Hi ,
Actually i want to restrict inputting ' * ' in my selection screen.
I think its not possibe in 'SELECT_OPTIONS_RESTRICT'.
Thnks in advance
Ramya
07-23-2007 1:15 PM
Hi,
1. we cannot control/stop
from KEYin in *, in any field.
2. The other option would be to
check (after start-of-selection),
if the select option contains * or is empty (empty means all records)
3. like this.
start-of-selection.
if s_matnr-low CS '*'
message 'do not enter *' type 'I'.
leave list-processing.
endif.
*--- further code to fetch and display data.
regards,
amit m.