Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

F4 help for OO ALV Grid

Former Member
0 Kudos

Hi,

I want to implement F4 search help for some cells in ALV grid. I added the necessary class methods and the program runs fine and displays the list of values to be chosen. The relevant fields are editable and F4 enabled in the field catalogue.The function (F4IF_INT_TABLE_VALUE_REQUEST) returns a value but the cell in ALV grid is not updated. How can I pass the returned value to the cell in ALV grid?

Thx

Ali

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

please check the below code for using the FM F4IF_INT_TABLE_VALUE_REQUEST. Try using like this

PERFORM value_request_arbpl TABLES gi_return_tab.

IF NOT gi_return_tab[] IS INITIAL.

LOOP AT gi_return_tab INTO gs_return_tab WHERE fieldname = 'ARBPL'.

s_arbpl-low = gs_return_tab-fieldval.

ENDLOOP.

ENDIF.

************************************************************************

      • FORMS ***

************************************************************************

&----


*& Form value_request_abrpl

&----


  • For providing the F4 functionality.

----


  • -->P_GI_RETURN_TAB Internal Table for getting the values

----


FORM value_request_arbpl TABLES pi_gi_return_tab TYPE gt_return_tab.

  • structure for getting the possible values from crhd.

TYPES : BEGIN OF lt_crhd,

arbpl TYPE crhd-arbpl,

END OF lt_crhd.

  • Internal table definition.

DATA : li_fields_tab TYPE STANDARD TABLE OF dfies,

li_crhd TYPE STANDARD TABLE OF lt_crhd.

  • Work Area definition.

DATA : ls_fields_tab TYPE dfies.

  • ls_crhd type gt_crhd.

  • Working variable definition.

DATA : lw_repid TYPE sy-repid.

REFRESH : pi_gi_return_tab.

MOVE : k_arbpl TO ls_fields_tab-fieldname,

'CRHD' TO ls_fields_tab-tabname.

APPEND ls_fields_tab TO li_fields_tab.

  • selecting possible values to put in the matchcode

SELECT arbpl

INTO TABLE li_crhd

FROM crhd

WHERE verwe = k_im34.

  • Preparation of the matchcode

lw_repid = sy-repid.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'ARBPL'

dynpprog = lw_repid

dynpnr = sy-dynnr

TABLES

value_tab = li_crhd

field_tab = li_fields_tab

return_tab = pi_gi_return_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc = 0.

SORT pi_gi_return_tab BY fieldname .

ENDIF.

ENDFORM. " value_request_arbpl

After using this, use the method check_data_changed of class cl_gui_alv_grid for

implementing the change.

Hope this will solve your problem.

7 REPLIES 7

Clemenss
Active Contributor
0 Kudos

Hi Ali,

it may be the same as it is anywhere: You have to put the value into the cell and refresh the display.

Regards,

Clemens

Former Member
0 Kudos

Hi Clemens,

I tried to pass the value using parameters of the er_data_changed method but received an error. I don't know where to write the returned value, the internal table that is dispalyed or somewhere else?

Thx,

Ali

Former Member
0 Kudos

Check Standard program in SE38

BCALV_EDIT_08 Integrate Non-Standard F4 Help

BCALV_F4 Possible entries

BCALV_GRID_EDIT_DELTA Example Report for F4 Help of the ALV Grid

BCALV_GRID_F4_HELP_APPLICATION

BCALV_GRID_F4_HELPM01

BCALV_TEST_GRID_EDIT F4 Help

BCALV_TEST_GRID_F4_HELP Example Report for F4 Help of the ALV Grid

Rewards if useful...............

Minal

Former Member
0 Kudos

Hi,

please check the below code for using the FM F4IF_INT_TABLE_VALUE_REQUEST. Try using like this

PERFORM value_request_arbpl TABLES gi_return_tab.

IF NOT gi_return_tab[] IS INITIAL.

LOOP AT gi_return_tab INTO gs_return_tab WHERE fieldname = 'ARBPL'.

s_arbpl-low = gs_return_tab-fieldval.

ENDLOOP.

ENDIF.

************************************************************************

      • FORMS ***

************************************************************************

&----


*& Form value_request_abrpl

&----


  • For providing the F4 functionality.

----


  • -->P_GI_RETURN_TAB Internal Table for getting the values

----


FORM value_request_arbpl TABLES pi_gi_return_tab TYPE gt_return_tab.

  • structure for getting the possible values from crhd.

TYPES : BEGIN OF lt_crhd,

arbpl TYPE crhd-arbpl,

END OF lt_crhd.

  • Internal table definition.

DATA : li_fields_tab TYPE STANDARD TABLE OF dfies,

li_crhd TYPE STANDARD TABLE OF lt_crhd.

  • Work Area definition.

DATA : ls_fields_tab TYPE dfies.

  • ls_crhd type gt_crhd.

  • Working variable definition.

DATA : lw_repid TYPE sy-repid.

REFRESH : pi_gi_return_tab.

MOVE : k_arbpl TO ls_fields_tab-fieldname,

'CRHD' TO ls_fields_tab-tabname.

APPEND ls_fields_tab TO li_fields_tab.

  • selecting possible values to put in the matchcode

SELECT arbpl

INTO TABLE li_crhd

FROM crhd

WHERE verwe = k_im34.

  • Preparation of the matchcode

lw_repid = sy-repid.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'ARBPL'

dynpprog = lw_repid

dynpnr = sy-dynnr

TABLES

value_tab = li_crhd

field_tab = li_fields_tab

return_tab = pi_gi_return_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc = 0.

SORT pi_gi_return_tab BY fieldname .

ENDIF.

ENDFORM. " value_request_arbpl

After using this, use the method check_data_changed of class cl_gui_alv_grid for

implementing the change.

Hope this will solve your problem.

0 Kudos

Hi Kasinath,

Thanks for the answer.

I have already used fm F4IF_INT_TABLE_VALUE_REQUEST and can receive a value from this fm. IT is after this point that I can't go on. How can I call er_data_changed correctly to pass the returned value to the cell?

Regards,

Ali

0 Kudos

Hi Ali,

You have to trigger the event data_changed by calling the method check_data_changed of CL_GUI_ALV_GRID to pass the return value to the cell.

If u feel it not understanding, paste your code here. so that I can suggest you.

0 Kudos

Hello Kasinath,

Here is the code for my F4 processing event. I know I have to add some code after the fm and tried to update the cell using modify_cell method of er_data_changed but it did not work and gave an error.

FORM on_f4 USING P_E_FIELDNAME

ROW_ID

P_ER_EVENT_DATA

P_ET_BAD_CELLS

P_E_DISPLAY

IR_DATA_CHANGED

TYPE REF TO cl_alv_changed_data_protocol.

DATA: BEGIN OF value_charg OCCURS 0,

charg like zpp_kpduzelt-charg,

END OF value_charg.

DATA: charg like gt_list-charg,

lgort like gt_list-lgort.

DATA : ls_mod_cell TYPE lvc_s_modi ,

ls_del_cell TYPE lvc_s_moce ,

lv_value TYPE lvc_value .

DATA : ls_mod_row like line of gt_list.

*§5 define fields and field-symbols for data-update

field-symbols: type lvc_t_modi.

data: ls_modi type lvc_s_modi.

*

*§6 assign the cell table fieldsymbol to the dereferenced data table and

  • fill the table.

  • assign p_er_event_data->m_data->* to <itab>.

  • SORT ir_data_changed->mt_mod_cells BY row_id .

*

  • LOOP AT ir_data_changed->mt_mod_cells

  • INTO ls_mod_cell.

  • ENDLOOP.

case p_e_fieldname.

when 'CHARG'.

read table gt_list index row_id.

select mcha~charg into value_charg-charg

from mcha

where werks = werks and

matnr = gt_list-matnr.

append value_charg.

endselect.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'CHARG'

value_org = 'S'

  • DYNPPROG = SY-REPID

  • DYNPNR = SY-DYNNR

  • DYNPROFIELD = 'PRUEFLOS'

TABLES

value_tab = value_charg

  • field_tab = field_tab

return_tab = return_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc = 0.

move return_tab-fieldval to charg.

  • ls_mod_cell-row_id = row_id.

  • ls_mod_cell-fieldname = 'CHARG'.

move charg to lv_value.

ENDIF.

when 'LGORT'.

endcase.

ENDFORM.

Thanks in advance

Ali