Show TOC

Dialog Status for ListsLocate this document in the navigation structure

Use

To allow the user to communicate with the system when a list is displayed, the lists must be able to direct user actions to the ABAP program. As described in User Actions on Dynpros, function codes are used to do this. Function codes are maintained in the GUI status of the list screen. You define a GUI status using the Menu Painter tool in the ABAP Workbench. The system assigns function codes to list-specific user actions.

The most important of these functions is for selecting list lines by double-clicking. As described in the chapter Using the GUI Status, the double-click function is always linked to the F2 key. If a function code is assigned to the F2 key in the GUI status, it will be triggered when you double-click.

The Standard List Status

As on regular dynpros, you can define your own GUI status for lists and attach it to a list level using the SET PF-STATUS command. If you do not set a particular GUI status, the system sets a default list status for the list screen in an executable program. In other programs, for example, when you call a list from screen processing, you must set this status explicitly using the statement

SET PF-STATUS space.

This default interface always contains at least the functions described in the Standard List section.

Unlike normal dialog statuses, the default list status is affected by the ABAP program.

If you define event blocks in your program using the event keywords AT LINE-SELECTION or AT PFnn, the system automatically assigns extra functions to other function keys that provide the user with additional action options on the standard interface.

  • AT PFnn (obsolete)

    All function keys of the keyboard Fnn that are not used for predefined system functions are set to the function codes PFnn, where nn is a number between 01 and 24. During list processing, the function codes PFnn are linked to the events AT PFnn. Selecting PFnn always raisesAT PFnn. Event blocks for PFnn should no longer be defined.

  • AT LINE-SELECTION

    For this event, the F2 key (double-click) is assigned the function code PICK and function text Choose. The function also always appears in the application toolbar. In list processing, the function code PICK is fixed to the event AT LINE-SELECTION: Selecting PICK always raisesAT LINE-SELECTION.

All other function codes are either intercepted by the runtime environment or trigger the event AT USER-COMMAND. Function codes that trigger AT USER-COMMAND must be defined in your own GUI status. The easiest way to do this is to use the standard list status and add extra functions of your own to it.

Dialog Status for Lists

A dialog status for lists can be created using Menu Painter in ABAP Workbench. As soon as you create the status, you should choose Start of the navigation path Extras Next navigation step Adjust Template End of the navigation path and select List Status for your template. This status already contains standard function codes for list processing. They are distributed as follows on the menus, standard toolbar, and application toolbar:

Code

Menu

Standard Toolbar

Function Key

Description

%PC

List

Save list to file

%SL

List

Save list in SAPoffice

%ST

List

Save list in report tree

PRI

List

Ctrl P

Print displayed list

%EX

List

Shift-F3

Exit processing

PICK

Edit

F2

Event AT LINE-SELECTION

RW

Edit

F12, ESC

Cancel processing

%SC

Edit

Ctrl F

Find

%SC+

Edit

CTRL-G

Find next

BACK

Goto

F3

Back one level

P--

CTRL-PgUp

Scroll to first window page

P-

PgUp

Scroll to previous window page

P+

PgDn

Scroll to next window page

P++

Ctrl-PgDn

Scroll to last window page

%CTX

Shift-F10

Context menu on list

In addition, the following function codes are predefined, but not set as status functions. You can assign them freely to any empty status element.

Code

Description

PFnn

Event AT PFnn

PPn

Scroll to top of list page n

PP-[n]

Scroll back one list page or n pages

PP+[n]

Scroll forward one list page or n pages

PSn

Scroll to column n

PS--

Scroll to first column of the list

PS-[n]

Scroll left by one or n columns

PS+[n]

Scroll right by one or n columns

PS++

Scroll to last column of the list

PZn

Scroll to line n

PL-[n]

Scroll back to first line of the page or by n lines

PL+[n]

Scroll to last line of the page or by n lines

/....

For other system commands

The runtime environment directly queries and processes all function codes of the above tables, except PICK and PFnn. These function codes do not trigger events, and you cannot use them for the AT USER-COMMAND event.

The function code PICK always triggers the AT LINE-SELECTION event, whenever the cursor is positioned on a list line. The function codes PFnn always trigger the AT PFnn event. Therefore, you cannot use them for the AT USER-COMMAND event either.

To trigger the AT USER-COMMAND event, you can define any number of function codes yourself that do not have a function code listed in the above table. Note the following special function key assignments:

  • Function key F2:

    A double-click is always equivalent to pressing function key F2. Each function code you assign to F2 is therefore activated by double-clicking. Double-clicking triggers the AT LINE-SELECTION event only if the function code PICK is assigned to function key F2. If you assign your own function code to F2, double-clicking triggers the AT USER-COMMAND event. If a predefined function code is assigned to F2, double-clicking triggers the corresponding action from the runtime environment.

  • Function key SHIFT-F10:

    The SHIFT-F10 key is always the equivalent of right-clicking. When you use context menus in lists, it is assigned the function code %CTX.

You can change the list-specific template if you have other requirements. You can

  • replace function code PICK with your own function code to prevent the AT LINE-SELECTION event from being triggered in the report. You can then program all reactions to user actions in a single processing block (AT USER-COMMAND).

  • delete predefined function codes whose functionality you do not want to support. For example, this allows you to prevent the user from printing the list or saving it in a file on the presentation server.

  • modify the standard key settings. For example, you can assign your own function code to F3 to navigate within the lists according to your requirements, instead of returning one list level (Back). This may be important if you keep several lists on the same logical level and therefore do not want to delete the displayed list as would the standard F3 setting. Or you may want to display a warning before leaving a list level.

Setting a Dialog Status

You set the dialog status for lists in the same way as on regular dynpros, using the statement

SET PF-STATUS stat [EXCLUDING f|itab]
                   [OF PROGRAM prog]
                   [IMMEDIATELY].

            

This statement sets the status stat for the current output list. The dialog status stat must be defined for the current program, unless you have used the addition OF PROGRAM to set a status from another program prog. The set status is active for all subsequent list levels up until the next SET PF-STATUS statement. The sy-pfkey system field always contains the status of the current list.

Using SET PF-STATUS, you can display different user interfaces for different list levels to provide the user with different functions according to the individual requirements. Use SET PF-STATUS SPACE to set the standard list status. This depends on the event blocks in the program, as described above.

The EXCLUDING option allows you to change the appearance and available functions of a status from within the program. This is useful if the individual user interfaces for a range of list levels are very similar. A single global status can be defined and those functions not needed deactivated using EXCLUDING. f can be specified to deactivate the function code stored in field f. itab can be specified to deactivate all function codes stored in the internal table itab. Field f and the lines of table itab should be defined with reference to the system field sy-ucomm.

The addition IMMEDIATELY is intended specially for list processing. You use it while creating a detail list within an event block to change the status of the list currently displayed (index sy-listi). Without this option, the system changes the status of the current secondary list (sy-lsind) that is displayed only at the end of the processing block.

Setting a Title for a List

As on regular dynpros, you can set a title for a list as follows:

SET TITLEBAR tit [WITH g1 ... g9]


                 [OF PROGRAM prog].
            

During list processing, this statement sets the title of the user interface for the output list. It remains active for all screens until you specify another using SET TITLEBAR. The title tit must be a component of the current ABAP program, unless you use the title of another program prog with the addition OF PROGRAM.

If the title contains placeholders &1 .... &9, you can use the addition WITH of the statement SET TITLEBAR to replace these placeholders with the contents of the corresponding fields g1 .... g9. The system also replaces '&' placeholders in succession by the contents of the corresponding g1 .... g9 parameters. The '&' character is displayed by repeating it in the title: '&&'.

Example

Example for dialog status in a list.


REPORT demo_list_menu_painter.
START-OF-SELECTION.
  SET PF-STATUS 'TEST'.
  WRITE:  'Basic list, sy-lsind =', sy-lsind.
AT LINE-SELECTION.
  WRITE:  'LINE-SELECTION, sy-lsind =', sy-lsind.
AT USER-COMMAND.
  CASE sy-ucomm.
    WHEN 'TEST'.
      WRITE:  'TEST, sy-lsind =', sy-lsind.
  ENDCASE.





         

This program uses a status TEST, defined in the Menu Painter.

  • Function key F5 has the function code TEST and the text Test for demo.

  • Function code TEST is entered in the List menu.

  • The function codes PICK and TEST are assigned to pushbuttons.

    The user can trigger the AT USER-COMMAND event either by pressing F5, Start of the navigation path List Next navigation step  Test for demo End of the navigation path, or by choosing the pushbutton Test for demo. He or she can trigger the AT USER-COMMAND event by selecting a line (F2).

Example of setting a dialog status for the current list


REPORT demo_list_set_pf_status_1.
DATA: fcode TYPE TABLE OF sy-ucomm,
      wa_fcode TYPE sy-ucomm.
START-OF-SELECTION.
  wa_fcode = 'FC1 '. APPEND wa_fcode TO fcode.
  wa_fcode = 'FC2 '. APPEND wa_fcode TO fcode.
  wa_fcode = 'FC3 '. APPEND wa_fcode TO fcode.
  wa_fcode = 'FC4 '. APPEND wa_fcode TO fcode.
  wa_fcode = 'FC5 '. APPEND wa_fcode TO fcode.
  wa_fcode = 'PICK'. APPEND wa_fcode TO fcode.
  SET PF-STATUS 'TEST'.
  WRITE: 'PF-Status:', sy-pfkey.
AT LINE-SELECTION.
  IF sy-lsind = 20.
    SET PF-STATUS 'TEST' EXCLUDING fcode.
  ENDIF.
  WRITE: 'Line-Selection, sy-lsind:', sy-lsind,
       / '                sy-pfkey:', sy-pfkey.
AT USER-COMMAND.
  IF sy-lsind = 20.
      SET PF-STATUS 'TEST' EXCLUDING fcode.
    ENDIF.
    WRITE: 'User-Command, sy-lsind:', sy-lsind,
         / '              sy-ucomm:', sy-ucomm,
         / '              sy-pfkey:', sy-pfkey.
         

Suppose that the function codes FC1 to FC5 are defined in the status TEST and assigned to pushbuttons: The function code PICK is assigned to function key F2.

When the program starts, the user can create detail lists by selecting a line or choosing one of the function codes FC1 to FC5. For all details lists up to level 20, the user interface TEST is the same as for the basic list:

On list level 20, EXCLUDING itab deactivates all function codes that create details lists. This prevents the user from triggering program termination by trying to create details list number 21.

Example of setting a dialog status for the current list



REPORT demo_list_set_pf_status_2.
START-OF-SELECTION.
  WRITE: 'sy-lsind:', sy-lsind.
AT LINE-SELECTION.
  SET PF-STATUS 'TEST' IMMEDIATELY.


         

After executing the program, the output screen shows the basic list and the user interface predefined for line selection (with function code PICK).

When you choose Choose, the user interface changes. No details list is created since no output statement is executed during the AT LINE-SELECTION event: The status TEST is defined as in the previous example.

Titles of detail lists.



REPORT demo_list_title .
START-OF-SELECTION.
  WRITE 'Click me!' HOTSPOT COLOR 5 INVERSE ON.
AT LINE-SELECTION.
  SET TITLEBAR 'TIT' WITH sy-lsind.
  WRITE 'Click again!' HOTSPOT COLOR 5 INVERSE ON.

         

In this program, a new title is set for each details list. The title TIT is thus defined as the 'Title for Details List &1'.