Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Enable Exclude Options Only : Using SELECT_OPTIONS_RESTRICT

Former Member
0 Likes
4,224

Hello Experts,

I have select options for one field. I would like to include only "Excluded Single Values" Tab Only.

Can anybody will suggest me how to do that?

I had tried to use various ways but didn't succeed.

Below sample code for your reference.

TYPE-POOLS sscr.

TABLES :

marc.

  • defining the selection-screen

select-options :

s_matnr for marc-matnr.

  • 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-nb = 'X'.

optlist-options-ne = 'X'.

  • optlist-options-np = '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.

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.

START-OF-SELECTION.

Regards,

Amit

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,935

AFAIK it is not possible as you can only allow both or include only tabs (values allowed in SG_MAIN field in SSCR_ASS). So you can only display only include tab with mandatoty NE option, which will not be very user-friendly.

Try to restrict your select-option to a list of EQ values, and in your program AT SELECTIOn-SCREEN map the select-option to a range type, converting I-EQ records to E-EQ and use this range in your SELECT options.

Keep also in mind that usually SQL optimizers dislike Exclusions...

Regards,

Raymond

2 REPLIES 2
Read only

Former Member
0 Likes
1,935

Hi,

Please check the below threads, You too can search as this has been answered many a times

http://forums.sdn.sap.com/search.jspa?threadID=&q=Display%22ExcludeSingleValues%22tabonlyinaSelectOptiondialog+&objID=&dateRange=all&numResults=30

Cheerz

Ramchander Rao.K

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,936

AFAIK it is not possible as you can only allow both or include only tabs (values allowed in SG_MAIN field in SSCR_ASS). So you can only display only include tab with mandatoty NE option, which will not be very user-friendly.

Try to restrict your select-option to a list of EQ values, and in your program AT SELECTIOn-SCREEN map the select-option to a range type, converting I-EQ records to E-EQ and use this range in your SELECT options.

Keep also in mind that usually SQL optimizers dislike Exclusions...

Regards,

Raymond