SET

Basic form 2

SET TITLEBAR f.

Extras:

1. ... OF PROGRAM prog

2. ... WITH g1 g2 ... gn

Effect

Sets the title of a window.
You create these program-specific titles using the Menu Painter. If there is a text for title ID f, this is displayed in the title bar of the window, starting from the next time the screen changes.
The return value SY-SUBRC shows whether the system found an entry.

SY-SUBRC = 0:
Entry found
SY-SUBRC = 4:
Entry not found

If the statement occurs in an external subroutine, the system sets a title for the main program that called it. However, in a function module, the system sets a title for the fucntion group (but see also the addition OF PROGRAM ...).
Once you have set a title, it remains active within the transaction until the next SET TITLEBAR statement.
After SET TITLEBAR, the field SY-TITLE contains the current title.
SY-TITLE is 70 characters long. Longer titles are not permitted.

Notes

Addition 1

... OF PROGRAM prog

Effect

The system does not search in the GUI of the main program of the current program group for f, but in the program specified in the field prog.

Example

DATA PROG LIKE SY-REPID.

PROG = 'TESTPROG'.

SET TITLEBAR 'ABC' OF PROGRAM PROG.

This example sets the title 'ABC'for program 'TESTPROG'.

Addition 2

... WITH g1 g2 ... gn

Effect

The WITH addition allows you to use up to 9 parameters in the title. You address these in the title as variables &1 to &9. Additionally, any single & characters are replaced from left to right with the contents of the corresponding parameter (the first ampersand with the first parameter following WITH, and so on). If you want to put an ampersand as a character in your title, you must double it (&& is output as &).
If a parameter is missing, its corresponding variable is replaced by a space.
Given the maximum length of 70 characters (length of SY-TITLE), it is possible that your title can be truncated if you use WITH.

Example

DATA: PAR1(4) VALUE 'par1',
      PAR2(4) VALUE 'par2'.

SET TITLEBAR 'ABC' WITH PAR1 PAR2 'par3'.

Given a title "ABC" as follows:
"Title & &1&3 some_text & &2 && & &4",
the example would produce a title bar like this:
"Title par1 par1par3 some_text par2 par2 & par3  ".

Note

You can combine both of these additions. Note, then, that the ... OF PROGRAM addition must come before WITH.

Additional help

Use GUI Status