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

Restricting Select Option Entries

Former Member
0 Likes
1,377

Hi ,

I have a requirement where i have check that there is only one entry in select option value at AT SELECTION SCREEN.

How can i handle that.

Thanks.

Khan

Hi ,

I have a requirement where i have check that there is only one entry in select option value at AT SELECTION SCREEN.

How can i handle that.

Thanks.

Khan

8 REPLIES 8
Read only

FredericGirod
Active Contributor
0 Likes
1,302

add to your select-options : no-extension.

and if you do not want intervales : no intervals

Read only

Former Member
0 Likes
1,302

Give No-Intervals and N0-Extension while declaring the select-options

Read only

Former Member
0 Likes
1,302

AT SELECTION SCREEN.

*IF S_DATE IS YOUR SELECT OPTION ..

DESCRIBE TABLE S_DATE LINES V_LINES.

IF V_LINES > 1.

*GIVE ERROR MESSAGE

ENDIF.

Read only

Former Member
0 Likes
1,302

Hi,

at selection-screen section use this code:

at selection-screen.

number_lines = lines( so_options ).

if number_lines > 1.

......leave, exit, ......

endif.

zd.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,302

You can use any of these 4 :

(1) use the options

NO-EXTENSION 
NO INTERVALS

(2) call Function Module

SELECT_OPTIONS_RESTRICT

(3) create a variant which restrict the option and use it in transaction definition

(4) count the number of values.

DESCRIBE TABLE <select-option>

Regards

Read only

Former Member
0 Likes
1,302

Hi All,

thanks for your reply.

But my requirement goes on like this :

SELECT-OPTIONS: s_cpudt FOR gv_cpudt.

the user may enter different dates like :

01.09.2004

05.11.2005

02.10.2006

I want to restrict such values.

User can enter dates like :

01.09.2004 to 10.05.2005

Thanks

Read only

0 Likes
1,302

so try : no intervals

after the select-options description.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,302

The function module SELECT_OPTIONS_RESTRICT may do that, with this function module, you can restrict input to EQ or BT to meet you requirements.

You may not allow the user to exclude records or use any option you don't want to be used for performance/programmatic purpose.

Sample :

  TYPE-POOLS: sscr.

  DATA: restrict TYPE sscr_restrict,
        opt_list TYPE sscr_opt_list,
        ass TYPE sscr_ass.
* create an option "ALL" which allow each mode
  CLEAR opt_list.
  MOVE 'ALL' TO opt_list-name.
  MOVE 'X' TO: opt_list-options-bt,
               opt_list-options-cp,
               opt_list-options-eq,
               opt_list-options-ge,
               opt_list-options-gt,
               opt_list-options-le,
               opt_list-options-lt,
               opt_list-options-nb,
               opt_list-options-ne,
               opt_list-options-np.
  APPEND opt_list TO restrict-opt_list_tab.
* create a restricted option, say only EQ allowed
  CLEAR opt_list.
  MOVE 'EQU' TO opt_list-name.
  MOVE 'X' TO opt_list-options-eq.
  APPEND opt_list TO restrict-opt_list_tab.
* Affect ALL to all select-options
  CLEAR ass.
  MOVE: 'A'          TO ass-kind,
        '*'          TO ass-sg_main,
        'ALL'        TO ass-op_main.
  APPEND ass TO restrict-ass_tab.
* Affect the EQU restriction to your select-option
  CLEAR ass.
  MOVE: 'S'          TO ass-kind,
        'S-DATE'    TO ass-name, " your select-optionsd
        'I'          TO ass-sg_main,  " no exclude
        'EQU'        TO ass-op_main. " only EQ
  APPEND ass TO restrict-ass_tab.
* Let the Function module do the job 
  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
       EXPORTING
            restriction = restrict
       EXCEPTIONS
            OTHERS      = 1.

All this coding should be executed at INITIALIZATION event.

Regards