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

3445

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)



And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.


ABAP - Type Casting

Category - ABAP

How do you actually get the original type of a class or instance if it is passed in a generic table? In this article we examine the possibilities.

04/16/2024

ABAP - RETURN value

Category - ABAP

After all these years, the “real” return in ABAP has finally arrived. In this article we will show you how it works and what it can do.

02/13/2024

ABAP Deep Dive - FOR (Loops)

Category - ABAP

Let's take a closer look at the FOR loop. How does it work? What do I have to consider and what can I do with it?

04/14/2023

ABAP Deep Dive - Table access (internal)

Category - ABAP

In this article, let's take a look at table access to internal tables and how they replace READ TABLE.

02/03/2023

ABAP Developer still relevant

Category - ABAP

In this article we look at whether ChatGPT can already replace an ABAP developer or whether it can be used as a help in everyday life.

01/06/2023