Application Development 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: 

Restricting Select Options to Multiple Single Entries

Former Member
0 Kudos

Hi All,

I have a requirement where we have two select options. I need to restrict only One of the select options to only accept multiple single entries. I have tried using the 'SELECT_OPTIONS_RESTRICT' Function module. But it provided little help to me.

Please check the below code.

*******************************************************************

gv_w_opt_list-name = 'A'.

gv_w_opt_list-options-eq = 'X'.

APPEND gv_w_opt_list TO gv_w_res-opt_list_tab.

gv_w_ass-kind = 'A'.

gv_w_ass-name = 'YTRADE_DESC'.

gv_w_ass-sg_main = '*'.

gv_w_ass-sg_addy = 'N'.

gv_w_ass-op_main = 'A'.

APPEND gv_w_ass TO gv_w_res-ass_tab.

  • It allows to restrict intervals for select-options in selection screen

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

EXPORTING

program = sy-repid

restriction = gv_w_res

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.

**********************************************************************

Please help me if you have any information related to this requirement. Relevant anwers will be surely rewarded.

Regards

Nagaraj

6 REPLIES 6

Former Member
0 Kudos

hi

"no intervals" with select option will give this functionality.

if i am wrong correct me.

0 Kudos

Hi All,

I have even checked the documentation. And I forgot to mention that I gave NO INTERVALS for the select options which I want to restrict. The problem is if I use

In the code,

  • gv_w_ass-kind = 'A'. " To specific Select options

The restrict works for both the select options .

But if I use

in the code

  • gv_w_ass-kind = 'S'. "Only to specific Select-options

Then the restrict does not work for any of the select options.

Please let me know your answers and suggestions.

Regards,

Nagaraj

0 Kudos

I have a code sample I use in a report. Result is only EQ and no intervals and no excludes

LOAD-OF-PROGRAM.

********************************************************************************

  • Subscreen: Select Options for delivery *

******************************************************************************

SELECTION-SCREEN BEGIN OF SCREEN 1100 AS SUBSCREEN

NO INTERVALS.

SELECT-OPTIONS:

so_dlvno FOR /scwm/s_aspq_tu-docno

MODIF ID dlv .

SELECTION-SCREEN END OF SCREEN 1100.

********************************************************************************

  • Subscreen: Select Options Restrictions *

******************************************************************************

  • Include type pool SSCR

TYPE-POOLS sscr.

  • Define the object to be passed to the RESTRICTION parameter

DATA restrict TYPE sscr_restrict.

  • Auxiliary objects for filling RESTRICT

DATA t_opt_list TYPE sscr_opt_list.

DATA ass TYPE sscr_ass.

CLEAR ass.

ass-kind = 'S'. "Apply only to the named SELECT-OPTION

ass-name = 'SO_DLVNO'. "This is name of the SELECT-OPTION

ass-sg_main = 'I'. "I = ONLY Inclusions; * = Both

ass-op_main = 'NOINTERVALS'. "This must match opt_list-name

APPEND ass TO restrict-ass_tab.

  • Create t_opt_list entry to specify capabilities of S_BUKRS.

CLEAR t_opt_list.

t_opt_list-name = 'NOINTERVALS'."This must match ass_tab-op_main

t_opt_list-options-bt = space. "Do not permit BETWEEN

t_opt_list-options-cp = space. "Do not permit MATCHES-PATTERN

t_opt_list-options-eq = 'X'. " 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 = space. "Do not permit NOT-BETWEEN

t_opt_list-options-ne = space. "Do not permit NOT-EQUAL

t_opt_list-options-np = space. "Do not permit NO-PATTERN-MATCH

APPEND t_opt_list TO restrict-opt_list_tab.

  • Call function module

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

EXPORTING

restriction = restrict

EXCEPTIONS

too_late = 1

repeated = 2

not_during_submit = 3

db_call_after_report_call = 4

selopt_without_options = 5

selopt_without_signs = 6

invalid_sign = 7

report_call_after_db_error = 8

empty_option_list = 9

invalid_kind = 10

repeated_kind_a = 11

OTHERS = 12.

  • Exception handling

IF sy-subrc NE 0.

...

ENDIF.

Edited by: Suhel Awad on Feb 1, 2011 3:06 PM

0 Kudos

No intervals, etc., only works on MAIN screen...the ADDITIONAL screen, accessed via the button to the right of select-options is not limited by the no intervals statement. The function module mentioned, if coded for correctly, will do precisely what is needed. Read the documentation....takes a little work the first time you use the FM, but it's a gem....

0 Kudos

I work with no intervals in subscreen? And it works. The effect is that only 1 field is shwon. For more restrictions you need FM

Edited by: Suhel Awad on Feb 2, 2011 8:52 AM

Former Member
0 Kudos

Use 'NO INTERVALS' and 'NO-EXTENSION' for select option.

s_vkorg FOR vbak-vkorg NO INTERVALS NO-EXTENSION.

Or you can use parameter instead of select-option which will accept only one value.

Regards,

Aparna