This report is describes how to restrict the select
options.
REPORT selectoptionsrestrict.
* 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
?nbs! p; 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.
ABAP Tips by : Nitin
Related ABAP Topics:
Table
CDHDR and CDPOS Usage
Get help for your ABAP problems
Do you have
a ABAP Question?
SAP Books
SAP Certification,
Interview Questions, Functional, Basis Administration and ABAP Programming
Reference Books
More ABAP Tips
Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com
All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
All product names are trademarks of their respective
companies. The site www.erpgreat.com is in no way affiliated with
SAP AG.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
The content on this site may not be reproduced
or redistributed without the express written permission of
www.erpgreat.com or the content authors.
|