This document itemizes the steps and the ABAP coding that is required to assign SAP reserved Function Keys (F1, F3 and F4) in custom push buttons of a custom screen in any Module Pool Program.
- Description and requirement of Assigning SAP reserved function keys on custom push button:
The description and the requirement of Assigning SAP reserved function keys like F1, F3 or F4 on custom push button is described as below:
In a module pool program, some custom screens are designed with some custom push button against which Function Keys like F2, F3, F4, F5 etc are assigned. SAP does not allow user directly to assign SAP reserved function keys (i.e. F1, F3 & F4) against any push button. But if any Module Pool program is developed for use with Radio Frequency (RF) devices using SAP Mobile Data Entry functionality, then it might be required to assign F1, F3 and F4 Function Keys against some custom push buttons to achieve different functionality.
Here our requirement was to design some custom screens with some custom push buttons against which Function Keys - F1 (to move from one screen to another screen, to save some data in temporary storage l), F3 (to go back to previous screen) and F4 (to scroll to next record in the temporary storage or to move to next screen) required to be assigned.
To meet this requirement firstly custom push buttons are designed in the custom screen.
For Assigning the Function Keys to custom push buttons following steps need to be done:
Firstly a Module Pool program is created & then Module is created to set PF status.
1. Now click on the created PF status (here it is “MAIN_9001 for screen 9001 MAIN_9002 for screen 9002”) and the following steps should be performed as shown in 'Step-1.jpg'.
2. This screen will come after clicking on the created PF Status as shown in 'Step-2.jpg'.
Here SAP reserved function keys like F1, F3 & F4 can not be assigned directly as it is not available in Freely Assigned & Recommended Function Keys.
3. Now go to the following path: Utilities (M) -> F key consistency as shown in 'Step-3,4,5.JPG'.
4. Here assign the Function code of the buttons that was created in the screen
as shown in 'Step-3,4,5.JPG'
.
Here in case of F4, function code (‘PB2’) of the push button is written in lower row as this row is for Screen-9002.
The more screens you will create in the Module pool program, a new place holder will be automatically added against each Function Keys.
5. Go to the following section and activate the current status.
Each time if you change anything in assigning function keys, you need to activate the current status as shown in 'Step-3,4,5.JPG'.
Now there will be two pushbuttons in Screen-9001.
One (PB1) is for moving to next screen by pressing F1 function key and another (PB3) is for exiting from current screen by pressing F3 function key.
There will be one pushbutton (PB2) in Screen-9002 which is used to return back to previous screen by pressing F4 function key.
Along with all these, we also need to ensure that we set the cursor on the created pushbutton if the screen does not have any input/output fields over there.
This can be achieved by implementing this code “SET CURSOR FIELD 'PB1' ” where PB1 is the function code of the pushbutton.