on 12-16-2004 3:42 PM
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?
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.
-
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to use FM <b>VRM_SET_VALUES</b> to show the values in the list.
If you are writing a report program, call the above FM in <b>AT SELECTION-SCREEN ON VALUE-REQUEST OF FIELDNAME.</b> and if you are doing module programming, you need to use
PROCESS ON VALUE-REQUEST.
MODULE MYMODULE.
Double click on this module, and inside it call the above FM.
There is enough help provided with the FM to know how to use it.
Regards,
Subramanian V.
As Subramanian mentioned you need to use VRM_SET_VALUES function..
Here is the code taken from another thread
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With event at ..
at selection-screen on my_parameters.
select * from my_table where ...
if sy-subrc ne space.
message E.....
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.