Entering content frame

Screen Fields Locate the document in its SAP Library structure

Screen fields are fields in the working memory of a screen. Their contents are passed to identically-named fields in the ABAP program in the PAI event, and filled from the same identically-named fields in the program in the PBO event. The screen fields are linked with the input/output fields on the screen and with the OK field. Input and output fields must have a unique name (element attribute Name). This assigns them to a screen field with the same name, which allows you to work with their values in an ABAP program.

The technical attributes length and data type of a screen field are defined by the element attributes DefLg and Format. For the data type, you can Structure linkselect one of the predefined data types in the ABAP Dictionary. These are converted appropriately when data is passed between the screen and the ABAP program. When you Structure linkuse fields from the ABAP Dictionary or the ABAP program, the name, length, and data type of the screen fields are defined automatically (see Linking ABAP Strings to Screen Fields). Otherwise, you have to set these attributes in Screen Painter. Note that you need to specify the name of the OK field for each screen, so that a corresponding screen field can be defined. This makes it possible to use more than one OK field in an ABAP program.

Display elements such as text fields or boxes are not linked to screen fields, and do not necessarily need a unique field name. When you create input and output fields by Structure linkusing fields from the ABAP Dictionary, the system usually also creates field labels using texts from the Dictionary. The default name for these text fields is the same name as the screen fields of the input and output fields.

As well as the screen fields defined in Screen Painter, screens also recognize the same predefined system fields as the ABAP program. In contrast to the ABAP program, however, the system fields are administered in the structure SYST, and not in SY. You therefore need to address them using syst-name.

 

Example

Suppose we have the following program extract:

DATA: text(10) TYPE c,
      number TYPE i.

CALL SCREEN 100.

Screen 100, created in Screen Painter, contains two fields SPFLI-CARRID and SPFLI-CONNID from the ABAP Dictionary and two fields, text and number, from the ABAP program. It also contains three text fields and a box. Overall, the screen looks like this:

This graphic is explained in the accompanying text

The columns of the element list that are relevant for the screen fields are as follows:

Name

Type

defLg

Format

Text/ I/O Template

Group boxes

Frame

62

 

Test frame

%#AUTOTEXT001

Text

14

 

Screen fields

SPFLI-CARRID

Text

16

 

Airline

SPFLI-CARRID

I/O

3

CHAR

___

SPFLI-CONNID

Text

15

 

Flight number

SPFLI-CONNID

I/O

4

NUMC

____

%#AUTOTEXT002

Text

10

 

ABAP field1

TEXT

I/O

10

CHAR

__________

%#AUTOTEXT003

Text

10

 

ABAP field2

NUMBER

I/O

11

INT4

___________

 

OK

20

OK

________________

The screen has four input/output fields. Each of these fields is linked to an identically-named screen field. The data types and lengths of the screen fields are copied from the ABAP Dictionary or the ABAP program. In our example, the OK_CODE field still needs a name - for example, OK_CODE - to assign it to a screen field.

You can either assign a name to display fields with the type frame and text, or the system can automatically create field names for them. The texts that come from the ABAP Dictionary have the same names as the input/output fields. The texts created in the Screen Painter have generated names.

The last column shows the contents of the screen elements on the screen. Input/output fields only contain the template for the field, since the contents will not be known until runtime. The content of the output fields, on the other hand, are statically defined in Screen Painter and cannot be affected by screen fields.

 

 

 

Leaving content frame