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: 

Editable ALV Grid + onF4 event + Data_Changed event

Steven_UM
Contributor
0 Kudos

Hi,

I am using an editable ALV grid where I allow 2 fields to be filled with values - I registered the events 'onF4' and 'Data_Changed' and handle both events -

The problem is that apparently when a field gets an F4 event that the 'data changed' event is not being triggered anymore ... meaning that my program does not know that data has been changed when a user uses F4 to do the data selection. When I enter a value manually then the change event works fine ...

Is this the standard behaviour, a bug on release 4.6D or a programming flaw on my count ?

I can add code at the F4 handler that checks for any changes and deal with it but that would duplicate code ...

Anyone any thoughts on this ?

Regards,

Steven

7 REPLIES 7

Steven_UM
Contributor
0 Kudos

Hi,

I did some further investigations and to my suprise the event 'Data_Changed' is raised after all BUT before the 'onF4' event. The event object is empty and as such the code for checking what is changed is not executed ...

Can the order of events be reversed ?

What is the logic behind this ?

Steven

0 Kudos

Hi Steven

This is a normal behaviour:

<b>Linking F4 Help to Fields</b>

"...As usual, define, implement and register the event “onf4” at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the “onf4” event. For this you must prepare a table of type “LVC_T_F4” and register this table using the method “register_f4_for_fields”. While preparing table you must include a line for each field which will trigger F4 event. For each field in the structure;

- Pass the fieldname to ‘FIELDNAME’

- Set ‘REGISTER’ to make the field registered,

<b>- Set ‘GETBEFORE’ to provide field content transport before F4 in editable mode

- Set ‘CHNGEAFTER’ to make the data changed after F4 in editable mode.</b>"

And for your further works related with ALV, you can make use of the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference for ALV Grid Control"</a>.

Regards

*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

Steven_UM
Contributor
0 Kudos

Hi Serdar,

Thanks for pointing me in the good direction !

By changing the flags I got the events reversed BUT the data changed event object CL_ALV_CHANGED_DATA_PROTOCOL should have values within the internal table MT_MOD_CELLS but that one is very empty. In fact the whole object is rather inital ...

It seems that the actual change content is not being passed on towards the data event ...

Regards,

Steven

Former Member
0 Kudos

Hi Steven,

i have the same problem like you. How did you solve your problem?

Greetings Timo

Former Member
0 Kudos

Hi Steven,

Have you register the change event for the Grid?

YOu should do it by calling method

CALL METHOD aref_grid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_enter

herzelhaimharel_gilor
Participant
0 Kudos

hi ,

i was facing the same problem month ago .

and i added the line

grid->register_edit_event(

i_event_id = cl_gui_alv_grid=>mc_evt_modified ).

and the problem was solved .

just take look in E_ONF4_AFTER = 'X' .

this parameter say that after the field has got value .

Hi all,

this post is rather old, but as i faced the same problem and this post showed as first hit in my google-search, im sharing my solution:

I implemented my search help following this blog

How to implement F4 search help in OO ALV Grid

and the SAP-Example-Prog

BCALV_EDIT_08.


well i faced the same problem that the CHANGED_DATA event i registered got no cells and no rows so my further logic did not get executed.


The problem was in the F4 Event. Values of F4IF_INT_TABLE_VALUE_REQUEST have to be passed to  er_event_dat.i figured out, that i have typed in a wrong field-name and so the following event (CHANGED_DATA) was empty. I guess because the event was not able to match the fields.


Took me a while to figure out, that  er_event_data->m_data->fieldname is not the same than  lt_return_tab-fieldname of  F4IF_INT_TABLE_VALUE_REQUEST. It had to be lt_return_tab-retfield since this holds the filednames used in ALV.


hope it helps


regards

Stefan Seeburger