This is a test message to test the length of the message box.
Login
|
ABAP CL_ABAP_CONTEXT_INFO explained
Created by Software-Heroes

ABAP - CL_ABAP_CONTEXT_INFO

7972

Collected information about the user and the system was previously only obtained from the SYST structure. There is now a class that provides much of this informations.

Advertising


In many current applications on an On-Premise system, the SYST (or SY) structure of the system is used to determine the user, the date or the time, and this has also been standard from the start. SAP now wants to try something new with the cloud and the new version of ABAP.

 

CL_ABAP_CONTEXT_INFO

The new class offers various methods for determining environmental data for the current application. The various methods should replace the corresponding fields from the SYST.

 

To make things easier, a comparison of the methods for the individual fields from the SYST structure and an assignment to the fields used on the SAP Cloud Platform:

New Method Old environment
GET_SYSTEM_DATE SYST-DATUM
GET_SYSTEM_TIME SYST-UZEIT
GET_USER_TECHNICAL_NAME SYST-UNAME
GET_USER_LANGUAGE_ABAP_FORMAT SYST-LANGU
GET_USER_LANGUAGE_ISO_FORMAT ISO format for language
GET_USER_TIME_ZONE SYST-TZONE
GET_USER_ALIAS Alias of user master data (Cloud)
GET_SYSTEM_URL URL of the system (Cloud)
GET_USER_FORMATTED_NAME BAPI_USER_GET_DETAIL
GET_USER_DESCRIPTION BAPI_USER_GET_DETAIL
GET_USER_BUSINESS_PARTNER_ID Business-Partner-ID of the user (Cloud)

 

You will most likely not need some of the fields that only affect the cloud on your On-Premise system. The date and time are determined using the TIMESTAMP function, which you can also use normally in the cloud.

Hint: There are still many fields of the SYST structure available that you also need for your daily work (SUBRC, INDEX, TABIX, DBCNT).

 

On-Premise

Even if the class is not yet a must in the on-premise landscape, we recommend that you use the new fields. Especially if your company wants to be “Cloud Ready” or is migrating its own developments to the cloud via side-by-side extension in the near future. If you get used to the new auxiliary class today, it will be very easy for you to adjust later because you are already doing everything as described.

 

Cloud

On the SAP Cloud Platform, up to release 2008 (August 2020), many of the fields were not released for use and you could only use the class to access the other information. Since this release the remaining fields have been released again, but probably temporarily for the time being.

When using the new fields, you will receive a warning in Eclipse that the field should no longer be used with this language version.

 

It is therefore possible that in the future the fields will be removed again by SAP and can no longer be used. As already described above, some fields are still relevant and can only be accessed via the SYST structure.

 

Conclusion

The new class CL_ABAP_CONTEXT_INFO already offers some nice features for determining the full user name. However, we recommend that you include them in your daily development so that you are prepared for the future and the cloud.


Included topics:
New ABAPCL_ABAP_CONTEXT_INFOContext information
Comments (2)



And further ...

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


ABAP - XCO Logging

Category - ABAP

The XCO classes are part of the ABAP Cloud APIs and offer numerous functions that aren't always easy to understand. In this article, we'll take a detailed look at the logging object.

12/16/2025

ABAP - The right Key

Category - ABAP

What about the use of internal tables? Is it still just TYPE TABLE in ABAP, and the table is fully defined?

11/14/2025

ABAP - XCO Regular Expressions

Category - ABAP

Let's take a look at the XCO classes for regular expressions and how you can easily use them to execute REGEX against text and input in ABAP Cloud. We'll also compare them with classic ABAP.

11/07/2025

ABAP - Escape

Category - ABAP

In this article, let's take a closer look at different escape variants that you need for ABAP development and system security.

10/07/2025

ABAP - Date and Time

Category - ABAP

In this article, let's take a closer look at the data types for dates and times in ABAP. Have any changes been made between the various releases, and what should you still use today?

10/03/2025