ABAP Obsolete - DESCRIBE
Again we have for you a most used ABAP term for which there is already a new alternative, this time not just one alternative.
Table of contents
In today's article we want to give you a closer look at the changes to DESCRIBE. The peculiarity of this command is that it depicts several functions and is not just for one thing. For example, you can specify the type of table or the number of rows in a table. We'll show you how the latest features can be used.
Turn one into three
Basically, an existing command is replaced by several new techniques and commands, so why so many innovations? In order to clearly distinguish the functions from each other, Describe is officially not yet marked as obsolete. These features include:
- Properties of a field
- Properties of a table
- Properties between two fields
Number of table rows
To derive the number of lines, an inline function can now be used which directly returns a number and can be called in a concatenation. Here's a little example from everyday life for you:
" with describe
DESCRIBE TABLE lt_t001 LINES DATA(ld_lines).
WRITE: / |Number of company codes: { ld_lines }|.
" new variant
WRITE: / |Number of company codes: { lines( lt_t001 ) }|.
As you can see, you can now concatenate the calls as known in Modern ABAP. The inline declaration works as well as with the Describe command.
Derive properties
For the derivation of the data types and properties, there are the RTTS services in the system. This is a bundle of classes to which you can pass a variable and it return an object that holds more information about the properties of this variable.
We will prepare more about the RTTS services in a separate article and give you a closer look at several examples.
Conclusion
Although DESCRIBE is not quite obsolete yet, you can already use many new features that save time and are much more intuitive to use. We definitely recommend the uses of the more advanced features.
Source:
ABAP Documentation - Describe
ABAP Documentation - Lines