This is a day to day SAP and ABAP hands on work blog. I will publish my experiences with certain programming problems and how to overcome them in ABAP. I will mostly cover plain ABAP, BSP and WebDynpro.
Wednesday, October 15, 2014
Restricting Select-Options
If you ever wanted to restrict the possibilities of Select-Options, there is good news.
The FM 'SELECT_OPTIONS_RESTRICT' is the way to go.
#---------------------------------------------------------------------*
*# Sortierung-Options restrict to EQ
DATA: L_WA_RESTRICT TYPE SSCR_RESTRICT,
L_WA_OPTLIST TYPE SSCR_OPT_LIST,
L_WA_ASS TYPE SSCR_ASS.
* Only 'EQ'
L_WA_OPTLIST-NAME = 'OBJECTKEY1'.
L_WA_OPTLIST-OPTIONS-EQ = 'X'.
APPEND L_WA_OPTLIST TO L_WA_RESTRICT-OPT_LIST_TAB.
L_WA_ASS-KIND = 'S'.
L_WA_ASS-NAME = 'S_SORT'.
L_WA_ASS-SG_MAIN = 'I'.
L_WA_ASS-SG_ADDY = SPACE.
L_WA_ASS-OP_MAIN = 'OBJECTKEY1'.
APPEND L_WA_ASS TO L_WA_RESTRICT-ASS_TAB.
CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
EXPORTING
RESTRICTION = L_WA_RESTRICT.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Feel free to leave your comments here :)