‎2011 Aug 07 4:34 PM
Hi I have a screen where I need to include a seach help on the screen element. The element itself is just a generic char 8 field with no dictionary reference. I have tried using the VRM_SET_ VALUES in the PBO but as soon as I press enter it looses the value selected. So I have now tried the using the process on value_request but despite finding and populating 138 values in the search help pop up, the actual pop up screen shows a blank list, with the text at the bottom saying 138 values.
Any ideas what I am doing wrong?
Set list values
call function 'VRM_SET_VALUES'
exporting
id = lv_vrm_id
values = it_values
exceptions
id_illegal_name = 1
others = 2.
if sy-subrc <> 0.
MESSAGE I000 WITH 'Failed to populate username list values'.
endif.
process on value-request.
field my_field module fill_my_field.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'MY_FIELD
dynprofield = 'MY_FIELD'
value_org = ' '
dynpprog = progname
dynpnr = dynnum
tables
value_tab = it_values "it contains 2 fields that will be shown in the list box
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
‎2011 Aug 07 6:25 PM
hello,
I think VRM_SET_VALUES does not require to add in this case.
In parameter of value_tab of 'F4IF_INT_TABLE_VALUE_REQUEST' column name and type should be same as screen field.
Thanks.
‎2011 Aug 07 9:06 PM
When using 'F4IF_INT_TABLE_VALUE_REQUEST' try with value_org = 'S'
‎2011 Aug 08 6:14 AM
Hi,
If you want to put search help for any screen field you no need to use VRM_SET_VALUES
You can write the code on "Process on value Request" event
by using 'F4IF_INT_TABLE_VALUE_REQUEST'
SELECT PERNR
VORNA
NACHN FROM PB0002 INTO TABLE IT_VALUES.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'PERNR' " this field we are using from the above select query
PVALKEY = ' '
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_PERNR' " this is the screen element
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S' " we must provide
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = IT_VALUES " this is the internal table which contains list of possible values for the screen
FIELD_TAB = field
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
i think it will be useful .....
regards,
anil
‎2011 Aug 08 8:10 AM
I'm still having problems with this. Here is my VRM set values - the problem I have with this is as soon as i choose a value from the list and press enter, the value dissappears from the screen element:
data: lv_vrm_id(80) type c.
data: lv_key(3) type n value 1,
lv_index type sy-tabix.
data: it_values type standard table of vrm_value,
s_values type vrm_value.
lv_vrm_id = i_type.
lv_key = 1.
clear it_values.
loop at it_cabn into s_cabn
where ATNAM = i_type.
read table it_cawn into s_cawn with key atinn = s_cabn-atinn
binary search.
while s_cawn-atinn = s_cabn-atinn.
lv_index = sy-tabix.
s_values-key = 1.
s_values-text = s_cawn-ATWRT.
condense s_values-text.
append s_values to it_values.
add 1 to lv_key.
lv_index = lv_index + 1.
read table it_cawn into s_cawn index lv_index.
if sy-subrc <> 0.
exit.
endif.
endwhile.
endloop.
* Set list values
call function 'VRM_SET_VALUES'
exporting
id = lv_vrm_id
values = it_values
exceptions
id_illegal_name = 1
others = 2.
if sy-subrc <> 0.
* MESSAGE I000 WITH 'Failed to populate username list values'.
endif.And here is my code for the F4 lookup - the problem here is that the search help pop dispklays nothing depsite saying it has 138 values. I am wondering if its my it_values that is the wrong format, or is it the fact that my field type doesn't point to a dictionary element?
TYPES: BEGIN OF ty_values,
type(8),
descr(20),
END OF ty_values.
DATA: it_values TYPE STANDARD TABLE OF ty_values,
s_values type ty_values.
data: lv_key(3) type n value 1,
lv_index type sy-tabix.
* Build lookup values for wood type test
clear it_values.
loop at it_cabn into s_cabn
where atnam = i_type.
read table it_cawn into s_cawn with key atinn = s_cabn-atinn
binary search.
while s_cawn-atinn = s_cabn-atinn.
lv_index = sy-tabix.
* s_values-key = 1.
* s_values-value1 = s_cawn-atwrt.
s_values-type = s_cawn-atwrt.
append s_values to it_values.
lv_index = lv_index + 1.
read table it_cawn into s_cawn index lv_index.
if sy-subrc <> 0.
exit.
endif.
add 1 to lv_key.
endwhile.
endloop.
DATA: progname TYPE sy-repid,
dynnum TYPE sy-dynnr,
dynpro_values TYPE TABLE OF dynpread,
field_value LIKE LINE OF dynpro_values.
progname = sy-repid.
dynnum = sy-dynnr.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'ATWRT'
dynprofield = 'TYPE'
value_org = ' '
dynpprog = progname
dynpnr = dynnum
tables
value_tab = it_values "it contains 2 fields that will be shown in the list box
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc <> 0.
...
endif.
‎2011 Aug 08 8:39 AM
In this case, when using 'F4IF_INT_TABLE_VALUE_REQUEST' try using value_org = 'S' and very important USE dictionary elements instead of :
TYPES: BEGIN OF ty_values,
type(8),
descr(20),
END OF ty_values.
‎2011 Aug 08 9:44 AM
Hi,
The snippets given below may helpful to you.
data:lt_return type STANDARD TABLE OF DDSHRETVAL,
ls_return type DDSHRETVAL.
if it_values is not INITIAL.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'ATWRT'
dynprofield = 'TYPE'
value_org = 'S'
dynpprog = progname
dynpnr = dynnum
tables
value_tab = it_values "it contains 2 fields that will be shown in the list box
RETURN_TAB = lt_return
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc eq 0.
read table lt_return into ls_return index sy-tabix.
TYPE = ls_return-fieldval.
endif.
endif.
Regards,
Prakash K