‎2011 Feb 24 4:38 AM
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,
‎2011 Feb 24 5:18 AM
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
‎2011 Feb 24 4:40 AM
You can use FM F4IF_INT_TABLE_VALUE_REQUEST and pass those 3 values only.
‎2011 Feb 24 5:18 AM
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
‎2011 Feb 24 5:46 AM
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.
‎2011 Feb 24 5:55 AM
Hi,
You have to write it under :
AT SELECTION-SCREEN on value-request for s_blart-lowand under
AT SELECTION-SCREEN on value-request for s_blart-highseparately.
Suzie
‎2011 Feb 24 6:40 AM
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
‎2011 Feb 24 6:41 AM
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
‎2011 Feb 24 6:49 AM
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
‎2011 Feb 24 12:09 PM
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...
‎2011 Feb 24 3:14 PM
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
‎2011 Feb 24 4:06 PM
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)
‎2011 Feb 25 7:10 AM
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.....
‎2011 Dec 12 10:38 PM