Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A



What is the difference between data & parameter?

Where can we use Data & parameter.




The statement DATA dobj either declares an arbitrary variable dobj or a structure struc. The naming conventions apply to the names dobj and struc. The declared data object is visible within the current context as of this position. Within the declaration part of a class or an interface, DATA declares an instance attribute. Its validity is bound to an instance of a class.

The data type of an arbitrary variable dobj is defined either using the TYPE addition and a type specification or using the LIKE addition and the specification of a data object. The syntax allows the definition of elemenary data objects, reference variables, structures, and internal table types. If neither TYPE nor LIKE is specified, a data object with the bound data type c of length 1 is created.

For the definition of a structure struc, arbitrary data declarations are included by two DATA statements with the additions BEGIN OF and END OF. Here a struc structure is declared that contains the enclosed data objects dobj as a struc-dobj component. Structure definitions can be nested.

The syntax of the DATA statement corresponds to the syntax of the TYPES statement, with the exception of two additions. In this way, a new data type can be defined during the declaraion of a data object. The most important difference compared with the statement TYPES is that a data type defined using DATA - not derived from an existing type - is available only as a property of the declared data object and is not independent. This kind of data type is bound to its data object.

Data objects that are declared in a program, but are not accessed there statically, cause a warning message in the enhanced program check.


Declaration of a para parameter of length len. Parameters are components of a selection screen that are assigned a global elementary data object in the ABAP program and an input field on the selection screen.

The name of the para parameter may contain a maximum of eight characters. This statement is permitted in the global declaration part of executable programs, function groups and module pools. In function groups and module pools it is only permitted within the definition of a independent selection screen. In executable programs, it is otherwise automatically assigned to the standard selection screen.

The length len can only be specified if the data type specified in type_options is generic in terms of the length ( c, n, p and x). The length len must be specified as a numeric literal or as numeric constants. If len is not specified, the length is set to 1 for a generic data type, or else it is set to the length of the data type. From Release 6.10, it is possible to specify the length using the LENGTH addition.

In detail, the PARAMETERS statement has the following effect:

The statement declares a global variable para of the specified length in the program. The type of the data object is specified in type_options.

On the current selection screen, an input field with the same name and a suitable external data type is created in a new line at position 35. The length of the input field is aligned with the length of the parameter. The maximum length of the input field is 132. The maximum visible length of the input field is between 39 and 45, depending on the nesting depth in blocks with frames. If the len length is greater than the maximum visible length, the content is displayed as movable.

In front of the input field, in the first possible position, an automatically generated output field is displayed as a description, whose length is between 23 and 30 depending on the nesting depth in blocks with frames. The output field contains either the name of the para parameter or the selection text to which the parameter is assigned in the text elements of the program. If the user requests field or input help on the output field using the F1 or F4 function keys, the same output is displayed as when the input field itself is selected.

The attributes of the elements on the selection screen can be influenced in screen_options and with the SELECTION-SCREEN statement.

Before the selection screen is sent, the content of the para data object is transported to the input field on the selection screen. If the length of the parameter is greater than 132, the content is truncated from the right. After a user action on the selection screen, the content of the input field is transported to the data object, where various events are triggered. The content of character-type fields is converted into uppercase by default. Settings with regarding the content of the input field can be made in value_options.

If parameters are defined in the selection include in the logical database, additional ldb_options additions are necessary or possible.

If a parameter with a length greater than 132 is populated by SUBMIT when an executable program is called, the value is similarly truncated from the right at position 132. It is not truncated only if the parameter is declared with the NO-DISPLAY addition.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question