10-15-2008 9:31 AM
Hi All,
I have a ALV grid with 2 fields.
I implemented F4 for field1 using the FM below.
I get a list of values as expected when i use 'F4', however the selected value is not written back to the ALV grid field!
What am i missing here?
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = lv_retfield_name
value_org = 'S'
tables
value_tab = lt_f4tabletmodel
field_tab = lt_return_tab
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
Note: the internal table lt_return_tab[], contains the value i selected, but i expect this to be written to the ALV grid field for which F4 was performed.
Thanks in advance and Regards
Dev
10-15-2008 10:28 AM
are you using Object Oriented ALV. if so check the example BCALV_EDIT_08 . after you select the value you have to update the value and use refresh_table_display method.
10-15-2008 11:27 AM
Hi,
I'll try to be more precise.
I have a ALV grid with 2 columns.
I add a row to a grid.
For the first field in the newly added row, i perform a F4 using the FM mentioned.
I get the values also.So far so good.
However on selecting a value from the popup, the value doesnt' get transferred to the grid
The refresh_table_display method instead also removes the new line i added to the grid!!!
More pointers?
Thanks in advance.
Dev
10-15-2008 11:35 AM
10-15-2008 11:52 AM
*Method definition
***********
handle_on_f4
for event onf4 of cl_gui_alv_grid
importing e_fieldname
E_FIELDVALUE "Importing Type LVC_VALUE
es_row_no
er_event_data
et_bad_cells
e_display.
***********
*Method implementation
**********************
method handle_on_f4.
type-pools sesi .
data: lt_f4tabletmodel type table of str_classification_values,
ls_f4tabletmodel type str_classification_values,
lt_return_tab type table of ddshretval,
ls_return_tab type ddshretval,
lv_retfield_name type dfies-fieldname,
lr_class_metadata type ref to cl_er_class_metadata,
lt_class_systems type stty_er_classification_system,
wa_class_systems type line of stty_er_classification_system,
lv_class_system type string.
call method cl_er_class_metadata=>s_instance
receiving
r_instref = lr_class_metadata.
if registry_name is initial.
message i100(ws_tool). exit.
endif.
read from cache-DB
try.
call method lr_class_metadata->read_db_data
exporting
i_registry = registry_name
importing
e_tab_classification_systems = lt_class_systems.
endtry.
loop at lt_class_systems into wa_class_systems.
clear ls_f4tabletmodel.clear lv_class_system.
lv_class_system = wa_class_systems-tmodel_key.
ls_f4tabletmodel-class_name = lv_class_system.
append ls_f4tabletmodel to lt_f4tabletmodel.
endloop.
lv_retfield_name = 'CLASS_NAME'.
f4-Popup
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = lv_retfield_name
value_org = 'S'
tables
value_tab = lt_f4tabletmodel
return_tab = lt_return_tab
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.
get Value that has been chosen in F4-Help
read table lt_return_tab into ls_return_tab index 1. "Always only one entry...
If empty, nothing has been chosen on the F4-Help, so just return
check ls_return_tab is not initial.
change datatable, adding new F4 Data
case e_fieldname.
when 'CLASS_NAME'.
<lf_f4_data>-class_VALUE = ls_return_tab-fieldval.
when 'CLASS_VALUE'.
<lf_f4_data>-class_VALUE = ls_return_tab-fieldval.
endcase.
endmethod.
10-15-2008 12:45 PM
<lf_f4_data> is your internal table ..? where are you modifying the record of the internal table..? and after modification call the refresh_table_display method.
10-15-2008 10:49 AM
hi ,
in the function module u have to pass the parameter dynpro field.
ex: dynprofield = 'P_ID_LOW' // that is ur parameter or select option low or high.
Rgds.,
subash