Archive

Posts Tagged ‘ALV event’

SAP ALV Tutorial – Handling Data Change

December 8th, 2009 No comments

In previous article, we have already set alv editable, but we still need to validate the input data as well as save the input data to the database. In another case, we also need to change according to user’s event.

As we can now make our alv Grid editable we may require controlling input data. The alv Grid has events data_changed and data_changed_finished. The former method is triggered just after the change at an editable field is perceived. Here you can make checks for the input. And the second event is triggered after the change is committed. You can select the way how the control perceives data changes by using the method register_edit_event. You have two choices:

1. After return key is pressed: To select this way, to the parameter event_id pass cl_gui_alv_grid=>mc_evt_enter.
2. After the field is modified and the cursor is moved to another field: For this, pass cl_gui_alv_grid=>mc_evt_modifies to the same parameter.

Read more…

SAP ALV Tutorial – Event

October 17th, 2009 No comments

This article deals with event handling in SAP ALV and mechanism behind it. In a nutshell, ALV Grid is an implementation of custom control. You must be very familiar with the dynpro programming. In dynpro programming, we general have two events: PBO and PAI. If user have some actions in the frontend screen, the event PAI will be triggered and program can have different reactions according to different function codes. In the custom control, things become a slight different. It will trigger an specific event, if user does some actions in the frontend. There are two types of event: system event and application event.

The only difference of the two events are the sequence of triggering event handler method and the PAI event.

System event: A system event is triggered before any automatic field checks (for example,required fields) have taken place on the screen, and before any field transport. The PAI and PBO events are not triggered. Consequently, you cannot access any values that the user has just changed on the screen. Furthermore, there is no field transport back to the screen after the event, so values that you have changed in the event handling are not updated onthe screen.

The handler method that you defined for the event is called automatically by the system.However, you can use the method set_new_ok_code to set a new value for the OK_CODE field. This then triggers the PAI and PBO modules, and you can evaluate the contents of the OK_CODE field as normal in a PAI module.

Application event: This event is processed in the PAI event. Consequently, all field checks and field transport has taken place. If you want the event handler method to be called at a particular point in your application program, you must process the event using the static method CL_GUI_CFW=>DISPATCH.

Read more…

SAP ALV – Double Click Event

September 12th, 2009 2 comments

Below code example is to display the purchase orders as per selection screen. This program also deals with the double click event. If user double click one line in purchase order number column, the screen will navigate to transaction code ME23N to display the selected PO.

Read more…