Start of Content Area

Procedure documentationExercise 3: Registering a System Event  Locate the document in its SAP Library structure

Usage

System events are passed on irrespective of the flow logic of the relevant screen.

In the previous exercise, you have registered event DLBCLICK as an application event. You now register this event as a system event.

Procedure

  1. Change the value of field wa_events-appl_event in the PBO module:
  2. wa_events-appl_event = SPACE.

  3. Comment out the call of method DISPATCH in the PAI module.
  4. Activate and start your program.

Check Your Work

Double-click in the text window. No text is displayed since the flow logic of the screen and the field transport are ignored.

Discussion

For system events, the PAI/PBO modules are not processed. This has the following consequences:

Advantages

Disadvantages

No field transport takes place when the event is triggered. This has the following consequences for accessing screen fields in event handler methods:

Note

This problem does not occur for output-only fields.

This means that as long as you do not access screen fields in read or write mode in an event handler method, this disadvantage has no effect.

Solution

The Control Framework provides method SET_NEW_OK_CODE . With this method, you can set an application-specific OK_CODE in an event handler method. After the event handler method, the Control Framework processes the PAI event in which you can access current screen fields in read and write mode.

Modify your program as follows:

  1. In the event handler method, comment out the line event_type = text-002. .
  2. In the event handler method, set application-specific OK code SHOW :
  3. CALL METHOD cl_gui_cfw=>set_new_ok_code
         exporting new_code = 'SHOW'.

  4. Read the OK code in the PAI module. To do this, add the following lines to your CASE query:
  5. when 'SHOW'.
         event_type = 'Doubleclick' (555).

  6. Activate and start your program.

The PAI event is now processed after the event handler method, and the text is displayed again.