Skip to Content

select-options restrict

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,

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Feb 24, 2011 at 05: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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Naren S

      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

  • Posted on Feb 24, 2011 at 04:40 AM

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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 24, 2011 at 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...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 24, 2011 at 03: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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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.....

  • Posted on Dec 12, 2011 at 10:38 PM

    thanks for the replies issue resolved

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.