Thursday, March 10, 2011

OOP ALV events

Lately, I always practice to develop my applications in OOP ALV. By using cl_gui_alv_grid class compared to the FM reuse_alv_grid*, I noticed that the former uses EVENTS for the buttons or the mouse clicks to capture user actions over the alv.

To learn more about this events, please download the guide here from SAP AG itself. To give you an idea about this reference, it contains and lists the basic guidelines in using cl_gui_alv_grid. Some of the codes that for example to capture event DATA_CHANGED is not being explained here.

To trigger the data changed event, you may insert the code below and you can set the action you may want your event be triggered:

"activate data_changed 
  CALL METHOD g_alv_grid_ref->register_edit_event
      i_event_id = cl_gui_alv_grid=>mc_evt_enter  
"trigger event after ENTER is pressed
*    i_event_id = cl_gui_alv_grid=>MC_EVT_MODIFIED  
"or trigger once you go to next cell after modification 
(without pressing ENTER)
      error      = 1
      OTHERS     = 2.

Thank you!

No comments:

Post a Comment