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

select-options restrict

narendar_naidu
Active Participant
0 Likes
3,785

dear all,

Ive searched forums and then posting .i have to restrict document type in a selection screen with only three values.

VR,RD,DG.

i have used 'SELECT_OPTIONS_RESTRICT". but unable to understand where should i pass my three values .

please explain and correct me?

regards,

1 ACCEPTED SOLUTION
Read only

lijisusan_mathews
Active Contributor
0 Likes
3,121

Hi,

SELECT_OPTIONS_RESTRICT is used to restrict the options available for restricting select-options (ie. EQ, I, BT, LE etc.. ), and not to restrict teh values shown, as far as I understand.

F4IF_INT_TABLE_VALUE_REQUEST can be used for your requirement to display the values in F4. But you should probably also write validation for the fields to restrict manual entry of other values in these fields.

Suzie

12 REPLIES 12
Read only

GauthamV
Active Contributor
0 Likes
3,121

You can use FM F4IF_INT_TABLE_VALUE_REQUEST and pass those 3 values only.

Read only

lijisusan_mathews
Active Contributor
0 Likes
3,122

Hi,

SELECT_OPTIONS_RESTRICT is used to restrict the options available for restricting select-options (ie. EQ, I, BT, LE etc.. ), and not to restrict teh values shown, as far as I understand.

F4IF_INT_TABLE_VALUE_REQUEST can be used for your requirement to display the values in F4. But you should probably also write validation for the fields to restrict manual entry of other values in these fields.

Suzie

Read only

0 Likes
3,121

thanks for the replies,

now i have tried using 'F4IF_INT_TABLE_VALUE_REQUEST'. please correct me.

select-options : s_blart for t003-blart.

*EVENT

select blart from t003 into table t_t003 where blart = 'RV' OR Blart = 'DR' OR BLART = 'DG' .

if sy-subrc eq 0 and s_blart is not initial.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

exporting

retfield = 'BLART'

dynpprog = dyname

dynpnr = dynumb

dynprofield = 'S_BLART'

value_org = 'S'

tables

value_tab = t_t003.

endif.

under which event should i use this? and how to code for both s_blart-low and s_blart-high.

Read only

0 Likes
3,121

Hi,

You have to write it under :

AT SELECTION-SCREEN on value-request for s_blart-low

and under

AT SELECTION-SCREEN on value-request for s_blart-high

separately.

Suzie

Read only

0 Likes
3,121

Hi

write this under at selection screen on values request for s_blart-low. and s_blart-high.

they should be 2 different headings.

your selection should be like

select blart

from t003

into table t_t003

where blart in ('RV', 'DR', 'DG')

then pass yopur table in the FM.

i hope this will work for you

thanks

Lalit

Read only

0 Likes
3,121

I agree with Suzie, and the select from t003 do only once at initialization ...

Regards,

Klaus

Edited by: Klaus Babl on Feb 24, 2011 7:42 AM

Read only

0 Likes
3,121

Hi Naren

Try this

first

----


**F4 help to fetch Accounting Document Number

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_belnr-low.

lv_string = 'S_BELNR-LOW'.

**Fatch the Accounting No. List from database table

PERFORM select_belnr USING lv_string

CHANGING i_bkpf.

**Show F4 list

PERFORM f4_belnr_list USING lv_string

CHANGING s_belnr-low.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_belnr-high.

lv_string = 'S_BELNR-HIGH'.

**Fatch the Accounting No. List from database table

PERFORM select_belnr USING lv_string

CHANGING i_bkpf.

**Show F4 list

PERFORM f4_belnr_list USING lv_string

CHANGING s_belnr-high.

FORM select_belnr USING lv_string TYPE dfies-fieldname

CHANGING p_i_bkpf TYPE t_bkpf.

RANGES: s_belnr1 FOR bkpf-belnr.

CLEAR: p_i_bkpf.

CLEAR s_belnr1[].

**Fetch the values entered by user on selection screen

PERFORM read_selection_screen USING lv_string.

**Read the value

READ TABLE dynfields WITH KEY fieldname = lv_string.

IF sy-subrc = 0

AND dynfields-fieldvalue IS NOT INITIAL.

s_belnr1-low = dynfields-fieldvalue.

s_belnr1-sign = 'I'.

s_belnr1-option ='CP'.

APPEND s_belnr1.

ENDIF.

**Fetch the data from database table

SELECT belnr

FROM bkpf

INTO TABLE p_i_bkpf

WHERE bukrs GE space

AND belnr IN s_belnr1

AND gjahr GE space

AND blart EQ 'AB'.

**Remove Duplicate Records

SORT p_i_bkpf BY belnr.

DELETE ADJACENT DUPLICATES FROM p_i_bkpf.

ENDFORM. " SELECT_BELNR

FORM f4_belnr_list USING p_retfield

CHANGING p_belnr.

CLEAR: ret_tab.

**Call F4 Help Value-request

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = p_retfield

value_org = 'S'

TABLES

value_tab = i_bkpf

return_tab = ret_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

**Read the Value selected by user

READ TABLE ret_tab INTO w_ret_tab INDEX 1.

IF sy-subrc = 0.

p_belnr = w_ret_tab-fieldval.

ENDIF.

CLEAR: i_bkpf,

ret_tab.

ENDFORM. " F4_BELNR_LIST

FORM read_selection_screen USING p_dynfields TYPE dfies-fieldname.

CLEAR: dynfields.

REFRESH : dynfields.

**Append field name

dynfields-fieldname = p_dynfields.

APPEND dynfields.

**Fetch the field Values

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-cprog

dynumb = sy-dynnr

TABLES

dynpfields = dynfields.

ENDFORM. " READ_SELECTION_SCREEN

DECLARATION PART

TYPES: BEGIN OF ty_bkpf,

belnr TYPE bkpf-belnr,

END OF ty_bkpf.

TYPES: t_bkpf TYPE TABLE OF ty_bkpf.

Data: i_bkpf TYPE t_bkpf.

DATA: dynfields TYPE TABLE OF dynpread WITH HEADER LINE.

DATA: ret_tab TYPE STANDARD TABLE OF ddshretval,

w_ret_tab TYPE ddshretval.

Try the aboe code hope this will work for you.

thanks

lalit

Read only

Former Member
0 Likes
3,121

If you want to restrict the values then you can use LISTBOX instead of doing lot of coding......

But in this case you need to check the domain of the referred data element must contain only these three values...if not readily available create one...

Read only

Former Member
0 Likes
3,121

You should use FM SELECT_OPTIONS_RESTRICT to restrict users to only allow (I)nclude and (EQ)ual. Then validate the values so that only the values you want to allow have actually been entered.

If you allow the user to enter a high value or patterns, they can get around your validation.

Rob

Read only

0 Likes
3,121

As stated by Satyajit, you could probably create a new domain holding those three values... You will have to still code the validations to ensure that values entered on the Selection screen match the domain values (and additionally code FM SELECT_OPTIONS_RESTRICT If you want to restrict users from not entering other SELECT options)

Read only

0 Likes
3,121

If you are using a parameter as listbox, why do you need validations??????? It's kind of dropdown list......

Otherwise go for VALUE CHECK option of parameter, in this case it will be displayed as normal paramter but can have only the predefined values in domain....


PARAMETERS: p_test  TYPE vbtyp AS LISTBOX VISIBLE LENGTH 50,
            p_test1 TYPE vbtyp VALUE CHECK.

But the only limitation is the user can enter only one document type at a time.....But...if the requirement is that the user can enter all three values at a time in a select option, then use F4 help and restrict the select-option to accept only EQ in extension....

Also, validations should be in place to check if the user has entered any values apart from the predefined ones.....

Read only

narendar_naidu
Active Participant
0 Likes
3,121

thanks for the replies issue resolved