ALV - back button
Hi,
How can you put a popup screen when you click on the "back" arrow for an ALV report to say "Save before leaving"?
I know that to activate the save function in alv, you have to use the function '&DATA_SAVE' in your program.
But the "Back" arrow is already activated. I just need to implement the popup screen before it goes to the previous screen.
Thanks very much,
Shae
Here is some code for an ALV Grid control.
In the variable "changed" we keep whether the data in the control has changed.
We also use the event "data_changed".
I hope that i helped you a little.
PS take a look at this address
DATA: event_receiver TYPE REF TO lcl_event_receiver,
g_container TYPE scrfname VALUE 'MY_CONTAINER',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container,
changed type c.
...
...
...
*---------------------------------------------------------------------*
* CLASS lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS.
*---------------------------------------------------------------------*
* CLASS lcl_event_receiver IMPLEMENTATION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
PERFORM data_changed USING er_data_changed.
ENDMETHOD.
ENDCLASS.
...
...
...
* Create the objects for the container and the ALV control
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
* Create the object for event reciver and register the handler method
* for this object when data changes or a button pressed
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_data_changed FOR grid1.
* Call method of grid to register event ENTER in ALV control
CALL METHOD grid1->register_edit_event EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
...
...
...
*&---------------------------------------------------------------------*
*& Form data_changed
*&---------------------------------------------------------------------*
FORM data_changed USING rr_data_changed TYPE REF TO
cl_alv_changed_data_protocol.
...
...
...
changed = 'X'.
...
...
...
ENDFORM. " data_changed
Thank you very much, but is there no way of doing it using the CALLBACK_USER_COMMAND or the CALLBACK_PF_STATUS_SET forms?