Classifying Technical Data Types in ABAP

After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Classify technical data types in ABAP

Data Types in ABAP

Recap - Some Predefined ABAP Types

Let's have a quick recap of the predefined ABAP types that you learned about earlier in your learning journey. We will also look at some additional complete and incomplete data types.

Classification of Data Types

As well as distinguishing between complete and incomplete data types, we can classify the built-in ABAP data types as character-like, numeric, byte-like, and date and time. This distinction is important as certain operations are only allowed for character-like fields, and others only for numeric fields. You cannot mix character and byte fields in a single operation.

When choosing numeric types, you should use type I if you need whole numbers, and type P for numbers with decimal places. You can use type INT8 if the range of type I is too small. Equally, use one of the DECFLOAT types if the range or accuracy of type P is insufficient. A packed number can have up to 14 decimal places. The DECFLOAT data types, in particular DECFLOAT34, support a significantly higher accuracy.

Type F is for binary floating point numbers. Since rounding errors can occur when converting binary numbers back into the decimal system, you should avoid using type F for calculations in your programs. However, floating point numbers figure prominently when you read data from the database using SQL.

For date and time fields, you can use the types D and T. Type D uses the format YYYYMMDD and type T the format HHMMSS. Type T is only accurate to the second - if you need a higher accuracy you can use the type UTCLONG. This is a timestamp comprising both date and time and is accurate to 100 nanoseconds.

Log in to track your progress & complete quizzes