How to implement different PF-STATUS types?

PF-STATUS is used to allow the user to communicate with the system where the defined function codes direct the user actions to the ABAP program. In dialog programming, there are three types of pf-status available for the developer, namely normal screen, dialog box and context menu (see screenshot below)


In this tutorial, I will discuss the last two statuses on how to create and implement into your ABAP applications.

A. Dialog Box Status – this status works when your screen type is defined as modal dialog box. Normally, this type of status is used with a popup screen where it is called upon using the keywords CALL SCREEN xxx STARTING AT x1 y1. Take note the keywords STARTING AT as this is the keywords to make it as a popup screen.

In order to use and implement this status, follow the steps detailed below.

STEPS:1. First, set your screen type as modal dialog box.


2. Once set, create a PF-STATUS with a type of Dialog Box as seen below.


In this next screen, there are two default commands: Ok and exit. So for demo purposes, I use the exit function. I just type any command name for this function. So it depends again on you, what you want to call each commands.


3. Then on the PBO of your screen, set the PF-STATUS you declared above.


4. Save and activate your program. Try to run and display the popup screen. Click the small “x” button at the upper right of the popup screen and it will close the screen. This is one of the applications of a dialog box status.




B. Context Menu Status – this status is triggered when the user pressed the right mouse key or SHIFT F10, a list of command is shown on the screen. It allows user to select list of functions dynamically defined. It can be assigned to the following screen elements namely: Input/output fields, Text fields, Table controls, Group boxes, subscreens pushbuttons, checkboxes, or radio buttons.

Please note that in my sample, I added a textbox in my screen. In this textbox, I will add here the context menu status. So in your implementations, it could be other screen elements. To implement, follow these steps.

STEPS:
1. Open your screen where you will add your context menu. In my case, it is Screen 200. As can be seen below, the added textbox.


2. Double click this screen element to display the screen painter attributes. On the field ON_CTMENU_, enter a name for your context menu. In my sample, I entered “Context”. So it depends on you what you want to call.


3. Go back to your program and create the GUI status. From the status type, select context menu.


4. In the screen menu, add your function codes. In my sample below, I added the following function codes: ADD, EDIT, DEL and EXIT. So it depends on your requirement, what function codes to be added here. By the way, the part in blue is not shown initially. In order to display it, just pressed the ENTER key or double click the parameter in black.


5. After setting the GUI status, create a subroutine. Take note the name of the routine as it must be the same as the one you defined in the screen painter attribute. Then instantiate a class with reference to CL_CTMENU. Call the method LOAD_GUI_STATUS exporting the program name, status name and the class.


6. Save and activate your program. Try to run. Press right click on the textbox and the context menu you defined then be displayed.


Enjoy Reading... Keep on visiting. :)

No comments:

Post a Comment