Skip to Content

force user to use values from F4 help ?

i use a tableControl to show and edit some values. I added a complex search help to one of the fields of the underlying structure (i added the search help directly to the structure field; using foreign key relationships wasn't possible).

How can I assure that the user only enters values from the search help. Do I have to use "FIELD...SELECT" or is there a "more automatic" way?

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Posted on Dec 16, 2004 at 03:50 PM

    With event at ..

    at selection-screen on my_parameters.

    select * from my_table where ...

    if sy-subrc ne space.

    message E.....

    endif.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 16, 2004 at 03:53 PM

    Since your not using a foreign key with a check table, I believe that you have to do the checking yourself, whether with the "FIELD......SELECT" or checking it in a MODULE.

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 16, 2004 at 07:36 PM

    Hi Daniel,

    In the attributes screen of the field, there is a setting for 'Dropdown' and if you choose 'List box', then you can force the user to use values from your search help.

    Add a comment
    10|10000 characters needed characters exceeded

    • As Subramanian mentioned you need to use VRM_SET_VALUES function..

      Here is the code taken from another thread

      using listbox in report

      type-pools: vrm.
      data: name type vrm_id, 
            list type vrm_values, 
            value like line of list.
          clear list .
          refresh list .
          name = 'P_OBJ'. "Name of the screen field
          value-key = 'A'. value-text = 'Object A'.
          append value to list .
       
           value-key = 'B'. value-text = 'Object B'.
          append value to  list .
       
       
       call function 'VRM_SET_VALUES'
               exporting
                    id     = name
                    values = list.
      

      Regards

      Raja

  • Posted on Dec 20, 2004 at 08:15 PM

    Hi Daniel,

    Here is a sample code that I tested. Use it and let me know if it solves your problem.

    -


    type-pools: vrm.

    data: ls_shlp like ddshdescr.

    data: begin of li_selopt_tab occurs 0.

    include structure ddshselopt.

    data: end of li_selopt_tab.

    data: begin of li_fields occurs 0.

    include structure ddshoutfld.

    data: end of li_fields.

    data: begin of li_values occurs 0,

    matnr like mara-matnr,

    maktg like makt-maktg.

    data: end of li_values.

    data: l_id type vrm_id.

    data: li_vrm_values type vrm_values,

    ls_vrm_values like line of li_vrm_values.

    ls_shlp-shlpname = 'MAT1A'. ->Your search help

    ls_shlp-selmethod = 'M_MAT1A'.->Your selection method

    *-- Fill in the fields in your search help that you want

    • to display in the list box

    li_fields-fieldname = 'MATNR'.

    append li_fields.

    clear li_fields.

    li_fields-fieldname = 'MAKTG'.

    append li_fields.

    clear li_fields.

    *-- get the values for the search help

    call function 'F4_SELECT_FROM_SEARCH_HELP'

    exporting

    shlp = ls_shlp

    • MAX_SELECT = 0

    tables

    selopt_tab = li_selopt_tab

    fields = li_fields

    values = li_values

    exceptions

    invalid_shlpname = 1

    invalid_values_table = 2

    internal_error = 3

    others = 4.

    if sy-subrc <> 0.

    message id sy-msgid type sy-msgty number sy-msgno

    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    endif.

    loop at li_values.

    ls_vrm_values-key = li_values-matnr.

    ls_vrm_values-text = li_values-maktg.

    append ls_vrm_values to li_vrm_values.

    endloop.

    l_id = 'ZVAA_GRBIN_ITEM-ICG_MATNR'.

    (This is Your Table control screen field name)

    call function 'VRM_SET_VALUES'

    exporting

    id = l_id

    values = li_vrm_values

    exceptions

    id_illegal_name = 1

    others = 2.

    if sy-subrc <> 0.

    message id sy-msgid type sy-msgty number sy-msgno

    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    endif.

    -


    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.