Method PAI1
Use
For PAI there are two methods, namely PAI1 and PAI2.
Method PAI1 merely checks whether the data in the SCR tables and SCR structures is correct. If errors exist, the method sends an error message to the message handler of the BRF maintenance environment. As long as errors exist on a screen, you can only exit the screen by using an exit command.
Method PAI1 must not contain any coding that refers to itself. You must implement this coding in method PAI_CONTROL.
Sample source text:
Only the main parts of the source text are mentioned below.
METHOD if_maintenance_brf~pai1 .
IF NOT ls_brf144_scr-param_ref IS INITIAL.
CALL METHOD cl_aux_brf=>get_line_brf150
EXPORTING
iv_applclass = ds_brf150-applclass
iv_expression = ls_brf144_scr-param_ref
IMPORTING
es_brf150 = ls_brf150
EXCEPTIONS
nothing_found = 1
short_text_missing = 2
OTHERS = 3.
IF sy-subrc = 1 OR sy-subrc = 3.
MESSAGE e312(brf) WITH ls_brf144_scr-param_ref ds_brf150-applclass INTO lv_dummy.
CALL FUNCTION 'BRF_MESSAGE_ADD' ENDIF.
Description:
You use this method to check the consistency and correctness of user entries related to the SCR structures and SCR tables of the current subscreen. You can find examples in every maintenance class of the BRF.
The above extract from the source text gives you an impression of how you can perform error handling. The method checks whether the operand PARAM_REF actually exists.
In detail, the following is performed in the above source text:
-
The call of method CL_AUX_BRF=>GET_LINE_BRF150 delivers details of the expression in LS_BRF144_SCR, PARAM_REF if this expression exists.
-
If this call is successful, it is continued in the PAI1 method.
-
If the subexpression is not found (meaning SY-SUBRC is 1), message e312(brf) is created and transferred to the message handler.
Consider the following:
-
The message is not output directly here, but saved in the LV_DUMMY field.
-
In actual fact, all relevant SY fields (such as SY_MSGID, and so on) are set.
-
-
-
The call of method ADD_MESSAGE takes the relevant SY fields and saves the message in the message handler.