This is a test message to test the length of the message box.
Login
New escape characters
Created by Software-Heroes

ABAP - New escape characters

If you should have the new symbols @ and # somewhere in the code, you do not have to despair immediately, we will help you understand the new logic.

With the extension of the SELECT statement and the inclusion of new language elements, some new symbols have also been adopted in the modern ABAP. These are also very often used depending on the use of the new commands and constructs.

So that you can easily learn them, here just two examples where we want to explain the effects.


" Select statement
SELECT * FROM adrc INTO TABLE @DATA(lt_adrc).

" Create a structure
DATA ls_t001 TYPE t001.
ls_t001 = VALUE #( bukrs = '1234' butxt = 'Test input' ).

 

The @ within the SELECT

The @ symbol not only stands for the delimiter in an e-mail address, but is used in the Select to say where a statement or variable belongs. Everything marked with @ in Select belongs to the program and is not part of the database statement.

This can be used to perform various actions in selects:

  • Definition of a table for the result (example above)
  • Transfer of parameters and select options
  • Usage of inline functions within a select

 

Hint: Once you use the new logic, it must be applied in the full select statement. The fields are then separated by a comma. More in a separate article how it works.

 

The # in a function

Whether hash tag, rhombus or picket fence, the # is also used as a new symbol in ABAP and describes the context-dependent data types, especially in the inline functions.

In the example above, it refers to a data type of the variable to which the structure is assigned via VALUE. The value statement knows that it should refer to the data type of the variable ls_t001 when generating the data type.

Often you will find this:

  • Handover to methods
  • New inline functions

 

Conclusion

The new escape symbols are relatively easy to understand, given what they are meant for. The usage is mandatory for all new commands, so there is no way around it.


Included topics:
New ABAPEscape characters
Comments (0)

ABAP Deep Dive - VALUE

Category - ABAP

In this article we want to look at the value statement again in all its forms and how you can use it in your daily work.

11/11/2022

ABAP - Common Table Expression (CTE)

Category - ABAP

In this article we want to take a look at the general table expression WITH and how you can use it in everyday life.

10/28/2022

ABAP Deep Dive - CORRESPONDING

Category - ABAP

In this article, a little more about the new Corresponding Statement and how to use it in detail. Let's take a look at the additional features.

09/16/2022

ABAP - Step

Category - ABAP

Today a new addition for the loops and how you can use it. With Step you have the possibility to skip steps in a loop.

09/02/2022

ABAP - Text, String, Template

Category - ABAP

How do I use character strings in modern ABAP development and how do they behave together with inline declarations. We also look at errors that can happen with it.

01/14/2022