‎2006 Oct 04 6:08 PM
hello
I am using ALV display - classes (cont , grid etc...)
I am displaying an editable internal table
whenever i push the little button on the MATNR field - the one that display the sample options of MATNR...
its triggers the handle_data_changed event.
and for so the table "mt_inserted_rows" is deleted after this first touch of the screen.
how can i avoid this without using the sy-ucomm...
btw : to trigger the event manually i used the sy-ucomm.
thanks ahead
specially to those who understood the problem.
Eyal.
‎2006 Oct 04 8:19 PM
Hello Eyal
To be honest I do no really understand your problem, particularly what you mean by <i>"...the little button on the MATNR field - the one that display the sample options of MATNR</i>...".
However, I do understand how event handling of the grid control works:
- You have an editable grid control. The user has changed some data.
- When the user executes a function that will lead to PAI (e.g. ENTER, SAVE) then you must call the instance method CHECK_DATA_CHANGED otherwise the changes on the ALV list will not be transported to your itab in the ABAP program (nor will event DATA_CHANGED be raised)
- Since the user changed some data CHECK_DATA_CHANGED will raise event DATA_CHANGED. Now the changes are transported to the itab in ABAP.
- If, for example, you want to validate the changed data then you have to define an event handler (e.g. HANDLE_DATA_CHANGED).
That is the logic of event handling for editable grid controls.
Regards
Uwe
‎2006 Oct 04 8:19 PM
Hello Eyal
To be honest I do no really understand your problem, particularly what you mean by <i>"...the little button on the MATNR field - the one that display the sample options of MATNR</i>...".
However, I do understand how event handling of the grid control works:
- You have an editable grid control. The user has changed some data.
- When the user executes a function that will lead to PAI (e.g. ENTER, SAVE) then you must call the instance method CHECK_DATA_CHANGED otherwise the changes on the ALV list will not be transported to your itab in the ABAP program (nor will event DATA_CHANGED be raised)
- Since the user changed some data CHECK_DATA_CHANGED will raise event DATA_CHANGED. Now the changes are transported to the itab in ABAP.
- If, for example, you want to validate the changed data then you have to define an event handler (e.g. HANDLE_DATA_CHANGED).
That is the logic of event handling for editable grid controls.
Regards
Uwe
‎2006 Oct 15 9:24 AM
Hello Uwa.
Thanks for replying.
The little button on the MATNR field - its F4 func - when I push this button a window opens and I can choose which MATNR I want to use.
I'll try to describe the scenario:
- I want to enter a new record in my DB-table - insert line (which have the MATNR field).
- I want to choose which MATNR will be in this new line
- I push the little button (F4)
- When I do so it triggered the "Data_Changed"
- For now, the it_table does not change
- But, the system table which handled by the Data_Changed trigger - "mt_inserted_rows" - does change and now holds the new line's number and its value - NULL or ' '.
- After I insert all the other values I push the 'Save' button and its triggers the PAI which triggers the "Handle_Data_Change".
- But now, the "mt_inserted_rows" is now 'initial' and I all of its data is lost.
I need this table in order not to search the new it_table for its new record. (and insert it to my DB_table)
Hope it is more clear now.
thanks ahead
with regards.
Eyal Cohen.
‎2006 Oct 15 9:48 AM
‎2006 Oct 16 2:21 AM
Howdy Eyal,
Why dont you use the parameters that come through with the 'data_changed' event? It will set the flags (E_ONF4, E_ONF4_BEFORE, E_ONF4_AFTER). Is this what you mean, ie how to tell when this event was called by F4?
Also, I think 'so what?' if it disappears from mt_inserted_rows because afterwards it will be in mt_modified_rows instead. If you need to validate the whole row at once, then add a validation field/flag to your display table and flag it as technical in the fieldcat (fcat-tech = 'X'). You can manually set this flag when a row is ok.
Hope this helps,
Phil.
‎2006 Oct 16 9:26 AM
Hello phillip
Let me try to clear up my question.
I just don't want that the event - "data change" will be activate when i push the F4 button on some fields.
I didn't understand the first part of your answer - " It will set the flags (E_ONF4, E_ONF4_BEFORE, E_ONF4_AFTER). "
Although the second part of your answer is good and probably work - it is not an elegant solution
Thanks neway and with best regards.
Eyal.
‎2006 Oct 17 12:24 AM
Hi Eyal,
Let me clear up the first part of my answer.
If you look at cl_gui_alv_grid >> events tabs, you will see a data_changed event with 4 parameters - those 3 flags and a instance of cl_alv_changed_data_protocol.
Now in your event handler class you would be responding to these events with a method. Now the method probably just calls a form somewhere in your program - and it probably only passes the cl_alv_changed_data_protocol, and not the flags.
So the flags are definitely there in the event you just may not be using them in your form.
Also have a look at the public atrribute MT_DELTA_CELLS_INSERTED
of cl_gui_alv_grid
I'm not sure but this may keep a global record of changed data.
But if you want the data_changed event to be triggered when they manually enter data, but <b>not</b> when they use F4 - this will be very hard. You probably have to extend class cl_gui_alv_grid.
Or try using set_registered_events( ). You'll have to hunt the the attributes of cl_gui_alv_grid to find a likely event to turn off tho.
Cheers,
Phil.
Message was edited by: Phillip Manning