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: 

Customized F4 help in Object-Oriented ALV

Former Member
0 Kudos

Hi all,

Would really appreciate it if anyone can help me out here. Thanks in advance.

I have a problem creating a customized F4 help for an editable column in Object-Oriented ALV.

I am using F4IF_INT_TABLE_VALUE_REQUEST. I am able to call the F4 help and obtain the selected value from the hit list (I know it through the debugger). But my main problem is to put the value back onto the ALV cell.

Anyone has met similar problems and found solution to it? Or does anyone have sample code on F4 help that uses F4IF_INT_TABLE_VALUE_REQUEST in <b>Object-Oriented ALV</b>?

Q1. In F4IF_INT_TABLE_VALUE_REQUEST, do I use the following fields to return the value back to the ALV cell:

  • dynpprog = sy-repid

  • dynpnr = sy-dynnr

  • dynprofield = 'ZCOURSEID'

or do I use the table specified in the return_tab in F4IF_INT_TABLE_VALUE_REQUEST?

Q1a. If its the former, what should I put in the dynprofield? The row-id? Or simply the column name of the ALV grid?

Q1b. If its the latter, what do I do with the table specifid in return_tab?

I have looked through sample ALV problems in SLIS. But hasn't found the solution to my problem. So Thanks to anyone who can help out here.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check for bold line statement in your program.


*  Set handler for F4 help on new characteristic value.
    set handler w_event_receiver->handle_help_charval
                         for w_grid.
*
* Specify fields for input help
    perform specify_helpfields.
form specify_helpfields.
* Local variables
* Work areas
  data : wal_fieldshelp type lvc_s_f4.
* Internal tables
  data : tl_fieldshelp  type lvc_t_f4.

  wal_fieldshelp-fieldname  = c_sernr.
  wal_fieldshelp-register   = c_check.
<u><i><b>  wal_fieldshelp-chngeafter = c_check.</b></i></u>
  append wal_fieldshelp to tl_fieldshelp.
  clear wal_fieldshelp.

  call method w_grid->register_f4_for_fields
       exporting
         it_f4  = tl_fieldshelp.
endform.                    " specify_helpfields

and then you can handle this data by using data_changed or data finshed events.

Regards,

Raghav

5 REPLIES 5

Former Member
0 Kudos

Hi,

Check for bold line statement in your program.


*  Set handler for F4 help on new characteristic value.
    set handler w_event_receiver->handle_help_charval
                         for w_grid.
*
* Specify fields for input help
    perform specify_helpfields.
form specify_helpfields.
* Local variables
* Work areas
  data : wal_fieldshelp type lvc_s_f4.
* Internal tables
  data : tl_fieldshelp  type lvc_t_f4.

  wal_fieldshelp-fieldname  = c_sernr.
  wal_fieldshelp-register   = c_check.
<u><i><b>  wal_fieldshelp-chngeafter = c_check.</b></i></u>
  append wal_fieldshelp to tl_fieldshelp.
  clear wal_fieldshelp.

  call method w_grid->register_f4_for_fields
       exporting
         it_f4  = tl_fieldshelp.
endform.                    " specify_helpfields

and then you can handle this data by using data_changed or data finshed events.

Regards,

Raghav

0 Kudos

Check these standard programs:

BCALV_F4

BCALV_GRID_F4_HELP_APPLICATION

BCALV_GRID_F4_HELPM01

BCALV_TEST_GRID_F4_HELP

0 Kudos

Hi,

Yes, I already had the chngeafter field set but the selected-value on the F4 hit list still does not appear back in the ALV cell. I do not need a data_changed method just for it to appear in the ALV cell right? Any other suggestions? Thank you.

0 Kudos

Hi,

May be you have to do twot things, one is you have to refresh the grid and you should handle data_changed method though you are not doing any thing.

Regards,

Raghav

0 Kudos

Hi,

thanks to all who helped. I have managed to solve the problem on my own. For anyone interested to know the solution:

My program has to create a customized field_tab (i name it "gs_field_tab" of structure dfies) for the F4 help (because the fields are extracted from many tables, and FM, and I also have to change the column names to be more user friendly when it appears on the hit list).

<u>The <b>WRONG</b> way:</u>

So after customizing the field_tab, I used the default gs_field_tab-fieldname (which appears like F0001 for the 1st column, F0002 for the 2nd column and so on- u can check it in debugger mode) in F4IF_INT_TABLE_VALUE_REQUEST like this (F0001 is the column that contains the value I want to put it back to the cell- the ZCOURSEID):

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

<b> retfield = 'F0001'</b>

dynpprog = sy-repid

dynpnr = sy-dynnr

<b> dynprofield = 'ZZUPLOADENLIST-ZCOURSEID'</b>

value_org = 'S'

TABLES

value_tab = git_help_data

FIELD_TAB = gs_field_tab

return_tab = lt_f4

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

The above code does not work for ALV grid (it can pop up the hit list and get the selected value but it can't put the selected value back to the cell), although I have used it successfully before, in selection screen parameters.

<u>The<b> Solution</b></u>

So after many trials and errors, i changed the fieldname in the gs_field_tab to be the same as the field in the structure (my ALV mirrors a structure ZZUPLOADENLIST and ZCOURSEID is the column which I have to create a customized F4) like this: gs_field_tab-fieldname = 'ZCOURSEID' and changed the retfield to ZCOURSEID and it finally works!

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

<b> retfield = 'ZCOURSEID'</b>

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'ZZUPLOADENLIST-ZCOURSEID'

value_org = 'S'

TABLES

value_tab = git_help_data

return_tab = lt_f4

FIELD_TAB = gs_field_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

I don't have to handle data_changed method nor refresh the grid for it to work. But thanks Raghavendra for the suggestion.