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: 

select options restrication of ranges

Former Member
0 Kudos

Hello Experts.

in the selection screen i need to have an option to enter the movement types.suppose if user will give like 10 and 100.The system should not take all the values between 10 to 100 like select options. It SHOULD GIVE ONLY 10 AND 100 RECORDS so please tell me how to code this . Already i declared like .. select-options s_bwart for mseg-bwart. so please tell me how to restrict this even if i use select options also. Thanks for all the replies.

7 REPLIES 7

Former Member
0 Kudos

Hi

You dont need to do anything. Instead of the user giving 10 and 100 in the lower and the upper fields. He needs to use the extension and enter the single values 10 and 100. This way your program will take care of the selections. You need not do anything in the program.

Cheers

VJ

Former Member
0 Kudos

Use the FM SELECT_OPTIONS_RESTRICT to restrict the select-options.

Former Member
0 Kudos

write your select otipn as below

Select *

From MSEG

Into GT_MSEG

Where ( bwart EQ S_BWART-LOW

OR bwart EQ S_BWART-HIGH ) .

<b>OR</b>

Select *

From MSEG

Into GT_MSEG

Where bwart IN S_BWART.

LOOP AT GT_MSEG.

IF ( GT_MSEG-BWART <> S_BWART-LOW OR GT_MSEG-BWART <> S_BWART-HIGH ).

DELETE GT_MSEG.

ENDIF.

ENDLOOP.

Rewards if useful...........

Minal

Former Member
0 Kudos

Hi,

You can declare 2 parameters on the same line instead of declaring it as select options and later use these parameters in your select statement.

Regards,

Raghavendra

Former Member
0 Kudos

Dear,

This is quite simple.

Do like this in your declration.

SELECT-OPTIONS : S_BWART FOR MSEG-BWART NO-EXTENSION .

here you have single input field for BWART in your selection screen, with a arrow in front of it.

Click on this arrow and now enter all values which need to be entered.

10

100

and now only these which you put here is considered only.

reward if useful.

Amit Singla

Message was edited by:

Amit Singla

Former Member
0 Kudos

Hello Shiva,

If Functionally your select options can have only single values, then you can declare your select options with NO-INTERVALS. then the user can enter only single values. OR alternatively you can create a range object say r_bwart and fill the same with EQ for s_bwart-low and s_bwart-high. Further restriction on Select options can be achved by using the FM mentioned above.

Regards

Saket Sharma

Former Member
0 Kudos

Hi,

Use the below code.

TABLES: mseg.

SELECT-OPTIONS s_bwart FOR mseg-bwart.

DATA: BEGIN OF itab OCCURS 0,

bwart LIKE mseg-bwart,

END OF itab.

IF NOT s_bwart-low IS INITIAL AND

NOT s_bwart-high IS INITIAL.

WHILE s_bwart-low LE s_bwart-high.

itab-bwart = s_bwart-low.

APPEND itab.

s_bwart-low = s_bwart-low + 1.

ENDWHILE.

ELSEIF NOT s_bwart-low IS INITIAL.

LOOP AT s_bwart.

itab-bwart = s_bwart-low.

APPEND itab.

ENDLOOP.

ENDIF.

LOOP AT itab.

WRITE:/5 itab-bwart.

ENDLOOP.