SET PF-STATUS

Basic form 1

SET PF-STATUS pfstat.

Extras:

1. ... EXCLUDING f oder ... EXCLUDING itab

2. ... IMMEDIATELY

3. ... OF PROGRAM progname

Effect

Sets a GUI (Graphical User Interface) status pfstat which can be up to 20 characters long. There are many of these statuses in the GUI of a program. Each one describes which functions are available and how you can select these via menus and menu bars or by pressing function keys or pushbuttons. For further information about this, refer to the Menu Painter documentation.
Each status has a name which may be up to 8 characters long.

Setting a status makes the functions contained therein selectable.

This method allows you to vary the available functions according to the current screen, list level and/or previous program flow.

The current status is stored in the system field SY-PFKEY.

A status remains valid for the duration of a transaction or until you set a new status.

Note

You can use a namespace prefix with status names.

Example

Event in program:

START-OF-SELECTION.
  SET PF-STATUS 'MAIN'.
  WRITE SY-PFKEY.

AT USER-COMMAND.
  CASE SY-UCOMM.
    WHEN 'F001'.
      SET PF-STATUS '0001'.
      WRITE SY-PFKEY.
    ...
  ENDCASE.

Produces a list (contents MAIN) with a GUI framework which allows you to select functions assigned to the the status MAIN. If you choose the function code F001 (e.g. from the menu or by pressing a pushbutton), you trigger the event AT USER-COMMAND. This generates a secondary list (contents 0001) with a GUI framework which allows you to select functions assigned to the status 0001. On returning from the secondary list to the basic list the status MAIN is reactivated.

Example

PBO module:

MODULE PBO_100 OUTPUT.
  SET PF-STATUS 'S001'.
ENDMODULE.

Displays the screen 100 with a GUI framework which allows you to select functions assigned to the status S001.

Note

If you want to set a status for a screen, you must do so during the PBO event. The system always searches for the status pfstat in the GUI of the main program of the current program group . (However, see also the addition OF PROGRAM progname.)

Example

PROGRAM PROGRAM1.
...
PERFORM UP1 IN PROGRAM PROGRAM2.
...


PROGRAM PROGRAM2.
...
FORM UP1.
SET PF-STATUS 'ABCD'
ENDFORM:

The status ABCD of program PROGRAM1 is activated if PROGRAM1 is the program specified in the transaction definition.

Notes

Addition 1

... EXCLUDING f ... EXCLUDING itab


Effect

Deactivates one or more of the status functions, so that they cannot be selected. Specify the appropriate function codes using one of the following:

This method allows you to modify the selectable functions of a status easily at runtime.

Example

DATA: itab TYPE TABLE OF sy-ucomm.
APPEND 'DELE' TO itab.
APPEND 'PICK' TO itab.
SET PF-STATUS 'STA3' EXCLUDING itab.

Sets the status STA3 which renders the functions with the function codes DELE and PICK inactive.

Addition 2

... IMMEDIATELY

Effect

List processing: The status becomes effective for the last list displayed and is not flagged for the next secondary list. In screen processing, this addition has no effect because every status becomes immediately effective anyway.

Example

Event in program:

START-OF-SELECTION.
  SET PF-STATUS 'MAIN'.
  WRITE SY-PFKEY.

AT USER-COMMAND.
  CASE SY-UCOMM.
    WHEN 'F002'.
      SET PF-STATUS '0002' IMMEDIATELY.
      EXIT.
    ...
  ENDCASE.

Selecting the function F002 in the basic list (contents MAIN, status MAIN) redisplays the basic list, but this time with the status 0002.

Note

Without the addition ... IMMEDIATELY, the old status MAIN becomes active again.

Addition 3

... OF PROGRAM progname

Effect

The system does not look for the status pfstat in the GUI of the main program of the current program group, but in the program whose name is specified in the field progname.

Note

Only use this addition if the status contains no dynamic texts.
Since the system searches for the texts in the program to which the status belongs (that is, in program progname) the calling program will not be able to fill the dynamic texts. External statuses containing dynamic texts should be assigned to a function group, and activated by a function module that both fills the dynamic text fields and sets the status.

Example

DATA PROGR LIKE SY-REPID.

...

MOVE 'TESTPROG' TO PROG.

...

SET PF-STATUS 'ABCD' OF PROGRAM PROG.

The system activates the status ABCD of program TESTPROG.

Note

You can use the OF PROGRAM addition in conjunction with the EXCLUDING itab and IMMEDIATLEY additions.

Additional help

Using GUI Statuses