Dynpro Fields
Use
Dynpro fields are fields in the working memory of a dynpro. 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 dynpro fields are associated with the input/output fields on the dynpro and with the OK field. Input and output fields must have a unique name (element attribute Name). This assigns them to a dynpro field with the same name, which makes it possible to edit their content in an ABAP program.
The technical attributes length and data type of a dynpro field are defined by the element attributes DefLg and Format. For the data type, one of the predefined data types in ABAP Dictionary can be selected. These are converted appropriately when data is passed between the dynpro and the ABAP program. When fields are applied from ABAP Dictionary or the ABAP program, the name, length, and data type of the dynpro fields are defined automatically (see Docking ABAP Strings to Dynpro Fields). Otherwise, these attributes must be set in Screen Painter. The name of the OK field must be specified for each dynpro, to enable a corresponding dynpro field to 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 associated with dynpro fields, and do not necessarily need a unique field name. When input and output fields are created by applying fields from 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 dynpro fields of the input and output fields.
As well as the dynpro fields defined in Screen Painter, dynpros also recognize the same system fields as the ABAP program. In contrast to the ABAP program, however, the system fields are managed in the structure SYST, and not in sy. This means they must be addressed using syst-name.
Take the following program extract:
DATA: text(10) TYPE c,
number TYPE i.
CALL SCREEN 100.
Dynpro 100, created in Screen Painter, contains two fields, SPFLI-CARRID and SPFLI-CONNID, from ABAP Dictionary and two fields, text and number, from the ABAP program. It also contains three text fields and a box. The layout is as follows:
The columns of the element list that are relevant for the dynpro fields are as follows:
|
Name |
Type |
defLg |
Format |
Text or I/O template |
|
Box |
Frame |
62 |
Test Box |
|
|
%#AUTOTEXT001 |
Text |
14 |
Dynpro 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 dynpro has four input/output fields. Each of these fields is associated with an identically named dynpro field. The data types and lengths of the dynpro fields are applied from ABAP Dictionary or the ABAP program. In this example, the OK_CODE field still needs a name, for example OK_CODE, to assign a dynpro field to it.
Either a name can be assigned to display fields with the type Frame or Text, or the system can automatically create field names for them. The texts that come from ABAP Dictionary have the same names as the input/output fields. The texts created in Screen Painter have generated names with sequential numbers.
The last column shows the contents of the screen elements on the screen. Input/output fields only contain the template for the content of the dynpro fields, since the contents will not be known until runtime. The content of the output fields, on the other hand, are defined statically in Screen Painter and cannot be modified by dynpro fields.