Video Lesson 4.2: Basic Abap Statements

Video Lesson 4.2: Basic Abap Statements

Defining Data Objects

  • Data objects are always defined with the DATA key word.
  • You can use an ABAP standard type, a local type, or a global type to type a data object.
  • You can refer to an already defined data object when defining additional variables (LIKE addition).
  • If the type information is missing in a variable definition, the standard type C is assumed.
  •  

    In contrast, if the length is missing, then the appropriate default length for the (incomplete) standard type is used.

 

 

  • The "DATA myvar." statement without type or length information thus defines a character variable with a length of 1 as the default length of type C is one.
  • Literals and constants belong to the fixed data objects.
  • You can use literals to specify fixed values in your programs.
  • There are numeric literals (specified without quotation marks) and text literals (specified with quotation marks).
  • You define constants using the CONSTANTS statement.

You can use the MOVE statement to transfer the contents of a data object to another data object.

The following two syntax variants have the same effect:

MOVE var1 TO var2.

var2 = var1.

  • If both data objects var1 and var2 are of different types, then there is a type conflict.
  • In this case, a type conversion is carried out automatically, if a conversion rule exists.
  • For detailed information on copying and the conversion rules, refer to the keyword documentation for the MOVE statement.
  • The CLEAR statement resets the contents of a data object to the type-specific initial value.