cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Why am I able to create special variable which starts with "!" using DATA statement?

Surendra_Karma
Explorer
0 Kudos
848

Hello SAP Community,

I encountered an interesting scenario while working with ABAP where I was able to create a variable that starts with the "!" character using the DATA statement. According to the typical naming conventions for ABAP variables, this should not be possible. Here is a sample example to illustrate this:

surendra_karma_9669_80_1-1722703558816.png

 

surendra_karma_9669_80_2-1722703689247.png

In this example, the variable !_lv_var is created and used without any issues. Also, it can be used without "!" like _lv_var. I am curious to understand why this is allowed and if it is related to any recent changes or enhancements in the ABAP language syntax.

Can someone explain why this behavior is possible and if there are any specific use cases or contexts where this is intended?

Thank you!

Accepted Solutions (1)

Accepted Solutions (1)

Surendra_Karma
Explorer

@Sandra_Rossi : Thanks for the explaination.

 

Answer:

  • "The character ! can be written directly before a name operand of a single operand in order to distinguish it from an ABAP word with the same notation in a statement.

https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abennames_escaping.ht...

Answers (0)