‎2010 Apr 12 11:13 AM
Hi guys ,
I would like to restrict a select options. When I push the botton "multiple selection" in my select
options I would like that I can see only 2 tabs 'Exclude individual values' and 'Exclude intervals'.
I tried with the FM 'SELECT_OPTIONS_RESTRICT', but It doesn't work. When I execute sy-subrc = 5
'INVALID_SIGN' and I can't resolve it.
My code is:
SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS: S_BUDAT FOR BKPF-BUDAT,
S_BELNR FOR BKPF-BELNR,
S_HKONT FOR BSEG-HKONT, <----*restric this*
S_BLART FOR BKPF-BLART,
S_BSTAT FOR BKPF-BSTAT.
SELECTION-SCREEN: END OF BLOCK B2.INITIALIZATION.
CLEAR T_OPT_LIST.
T_OPT_LIST-NAME = 'S_HKONT'.
T_OPT_LIST-OPTIONS-EQ = 'X'.
T_OPT_LIST-OPTIONS-GE = 'X'.
APPEND T_OPT_LIST TO RESTRICT-OPT_LIST_TAB.
CLEAR T_ASS_TAB.
T_ASS_TAB-KIND = 'A'. "Apply only to the named SELECT-OPTION
T_ASS_TAB-NAME = 'S_HKONT'. "This is name of the SELECT-OPTION
T_ASS_TAB-SG_MAIN = 'I'.
T_ASS_TAB-OP_MAIN = 'S_HKONT'. "This must match opt_list-name
APPEND T_ASS_TAB 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.Thanks in advance.
Best Regards.
Edited by: Ana Marà on Apr 12, 2010 12:13 PM
‎2010 Apr 12 11:26 AM
Try This
CLEAR T_ASS_TAB.
T_ASS_TAB-KIND = 'S'. " Apply only to the named SELECT-OPTION "Changed from A to S"
T_ASS_TAB-NAME = 'S_HKONT'. "This is name of the SELECT-OPTION
T_ASS_TAB-SG_MAIN = 'I'.
T_ASS_TAB-SG_ADDY = SPACE "New Added"
T_ASS_TAB-OP_MAIN = 'S_HKONT'. "This must match opt_list-name
APPEND T_ASS_TAB TO RESTRICT-ASS_TAB.Regards
Vinod
Edited by: Vinod Kumar on Apr 12, 2010 3:57 PM
‎2010 Apr 12 11:32 AM
Hy Vinod,
I put the code into a perform and now sy-subrc it's ok .
Thanks for your answer.
You know about the field T_ASS_TAB-SG_MAIN = 'I'. "I = ONLY Inclusions; * = Both.
If I put 'I' , I only see the tabs 'Individual values' and 'Interval values' , Are there any option that exclude? ( so I only want see 'Exclude Individual value'
and 'Exclude intervals').
Thanks a lot.
‎2010 Apr 12 11:34 AM
yes you can use E as well to exclude the values
cheers
S.Janagar
‎2010 Apr 12 11:40 AM
Hi,
you´ll have to activate this options
NB
NE
NP
in t_opt_list instead of EQ and GE
‎2010 Apr 12 11:40 AM
‎2010 Apr 12 11:42 AM
Hi
E is not recognized by SAP. Possible values are I or space.
‎2010 Apr 12 11:52 AM
Yes jorge, you are right, If we pass 'E' it system doesn't do any thing, it simply shows the normal options. I
Type group "SSCR" also mentioned the possible values for "sg_main" as
sg_main like rsrestrict-sign, " (only) I, SPACE = bothRegards
Vinod
‎2010 Apr 15 5:13 PM
Solution;
INICIALIZATION.
PERFORM INICIALIZACION_SELECT_OPTION.
FORM INICIALIZACION_SELECT_OPTION.
DATA: T_OPT_LIST TYPE SSCR_OPT_LIST, "switches controlling each option
T_ASS_TAB TYPE SSCR_ASS, "select-options to be restricted
RESTRICT TYPE SSCR_RESTRICT, "structure holding above 2 tables
TEXTO TYPE STRING,
L_SUBRC(4) TYPE N.
CLEAR T_ASS_TAB.
T_ASS_TAB-KIND = 'S'. "Apply only to the named SELECT-OPTION
T_ASS_TAB-NAME = 'S_HKONT'. "This is name of the SELECT-OPTION
T_ASS_TAB-SG_MAIN = 'I'. "I = ONLY Inclusions; * = Both
T_ASS_TAB-SG_ADDY = SPACE.
T_ASS_TAB-OP_MAIN = 'WHATEVER'. "This must match opt_list-name
APPEND T_ASS_TAB TO RESTRICT-ASS_TAB.
crear las restricviones del select option en t_opt_list.
CLEAR T_OPT_LIST.
T_OPT_LIST-NAME = 'WHATEVER'."This must match ass_tab-op_main
T_OPT_LIST-OPTIONS-BT = SPACE. "Do not permit BETWEEN
T_OPT_LIST-OPTIONS-CP = SPACE. " permit MATCHES-PATTERN
T_OPT_LIST-OPTIONS-EQ = SPACE. " Permit EQUALS
T_OPT_LIST-OPTIONS-GE = SPACE. "Do not permit GREATER-OR-EQUAL
T_OPT_LIST-OPTIONS-GT = SPACE. "Do not permit GREATER-THAN
T_OPT_LIST-OPTIONS-LE = SPACE. "Do not permit LESS-OR-EQUAL
T_OPT_LIST-OPTIONS-LT = SPACE. "Do not permit LESS-THAN
T_OPT_LIST-OPTIONS-NB = 'X' . "Do not permit NOT-BETWEEN
T_OPT_LIST-OPTIONS-NE = 'X'. "Do not permit NOT-EQUAL
T_OPT_LIST-OPTIONS-NP = 'X'. "Do not permit NO-PATTERN-MATCH
APPEND T_OPT_LIST TO RESTRICT-OPT_LIST_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.
ENDFORM.