There are various ways in which users can interact with screens.
Filling Input Fields
Users can enter values in any input field on the screen, or change the value using the mouse, in the case of radio buttons and checkboxes. The contents are placed in the corresponding screen field. Filling an input field does not normally trigger the PAI event. Exceptions to this are Checkboxes and Radio Buttons with Function Codes and input fields with Drop Down Boxes.
Triggering the PAI Event
There is a series of user actions that conclude the user's interaction with the screen in the SAP GUI and pass control back to the runtime environment on the application server, where the PAI event is triggered.
Choosing a pushbutton on the screen
Selecting a checkbox or radio button to which a function code is assigned.
Choosing a function in the menu, standard toolbar, or application toolbar.
Choosing a function key on the keyboard.
Selecting an entry from a drop down box.
All of these actions have in common that they are linked to a function code.
The function code of a pushbutton, checkbox, radio button, or dropdown box on the screen is set in the corresponding element attributes.
The function codes in menus, the standard toolbar, and the application toolbar are set in the GUI status.
The function codes of function keys are also assigned in the GUI status.
If the OK_CODE field in the element list has a name (and is therefore assigned to the corresponding screen field), it is filled with the corresponding function code when the user chooses the function. If there is a field in the ABAP program with the same name, you can find out the function that the user chose by querying its contents in a PAI module. If the OK_CODE field does not have a name, the PAI event is still triggered, but there is no screen field into which the function code can be passed. Note also that the OK_CODE field is filled with the contents of the identically-named field in the ABAP program in the PBO event.
The PAI event is always triggered when the user resizes a screen containing elements for which the Resizing attribute is active. This applies to table controls, subscreens, and custom controls.