sapdev logo background
sapdev logo sapdev logo
Comments

SAP DYNPRO CUSTOM CONTROL ABEXA documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

Screens, CFW Events
The example shows how to handle CFW events.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
Screen 100 contains an output field field and a custom control called textedit . The flow logic of screen 100 is as follows:
PROCESS BEFORE OUTPUT.
MODULE status_0100.
PROCESS AFTER INPUT.
MODULE cancel AT EXIT-COMMAND.
MODULE user_command_0100.
In the GUI status SCREEN_100, the function codes BACK ,
EXIT , and CANCEL have been created with type E and the function code INSERT has been created without any specific type.

The program contains a local class called event_handler with event handlers for the events F1 and F4 of global class CL_GUI_TEXTEDIT . When the program is executed, screen 100 instantiates objects of the classes CL_GUI_CUSTOM_CONTAINER ,
CL_GUI_TEXTEDIT , and event_handler at the PBO event.
The container control is linked to the custom control on the screen, and the instance of the textedit control is linked to this container. Since the events F1 and F4 of the
textedit control are to be passed to the application server, the
SET_REGISTERED_EVENTS method is used to register them, defining
F1 as a system event and F4 as an application event. The event handling methods of the instance handle of the class
event_handler are registered as handlers for the events.
Before the screen is sent, the textedit control is filled with the contents of table text_tab . As long as the screen is displyed, the user is allowed to edit the text. When INSERT is chosen, the PAI event is triggered, and the current text from the
textedit control is copied into table text_tab .
If the user chooses the F1 key on the textedit control, the system immediately executes the handle_f1 method, assigning the row contents to the field field. Calling the
SET_NEW_OK_CODE method triggers the PAI event. This is the only way to ensure that the PBO event is also processed and the contents of field are passed to the screen.
If the user chooses the F4 key on the textedit control, PAI is triggered. By calling the DISPATCH method, the system executes the handle_f4 method, assigning the row contents to the field field. Since the system then automatically returns to PAI processing, PBO is also processed and the field contents are transported.
In either case, regardless of whether the user chooses F1 or
F4 , the contents of the textedit control are not passed to the internal table text_tab . Consequently, the textedit control is overwritten with the previous contents of text_tab at the PBO event.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




DYNPRO_CONTEXT_MENU_ABEXA
DYNPRO_DICT_ABEXA




comments powered by Disqus