Get Example source ABAP code based on a different SAP table
ABAP_DYNPRO - CFW Events This example shows how CFW events are handled.
ABAP_SOURCE_CODE ABAP_EXEC >
ABAP_DESCRIPTION Dynpro 100 contains an output field field> and a custom control called textedit>. The flow logic of dynpro 100 is: 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> are created with type E> and the function code INSERT> is created without a specific type. The program contains a local class called event_handler> with event handlers for the events F1> and F4> of the global class CL_GUI_TEXTEDIT>. When the program is executed, dynpro 100 instantiates objects of the classes CL_GUI_CUSTOM_CONTAINER> , CL_GUI_TEXTEDIT>, and event_handler> after PBO. The container control is linked with the custom control on the dynpro and the instance of the textedit> control is linked with this container. The events F1> and F4> of the textedit> control are registered using the method SET_REGISTERED_EVENTS> to ensure that they are passed to the current ABAP_ASINSTANCE . F1> is defined 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 dynpro is sent, the textedit> control is filled with the content of table text_tab>. As long as the dynpro is displayed, the user is allowed to edit the text. When INSERT> is selected, PAI is raised, and the current text from the textedit> control is passed to the table text_tab>. If F1> is selected on the textedit> control, the method handle_f1> is executed immediately. This assigns the content of the line to the field field>. Calling the method set_new_ok_code> raises PAI. This is the only way to ensure that the PBO is processed and the content of field> is sent to the dynpro. If F4> is selected on the textedit> control, PAI is raised. The method DISPATCH> is called and raises the method handle_f4 >. This assigns the content of the line to the field field>: Since the system then automatically returns to PAI processing, PBO is also processed and the field content is transported. In either case, regardless of whether the user chooses F1> or F4>, the content of the textedit> control is not passed to the internal table text_tab>. Consequently, the textedit> control is overwritten with the previous content of text_tab> after PBO.