ABAP - CL_ABAP_CONTEXT_INFO
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.
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.
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:
|ISO format for language
|Alias of user master data (Cloud)
|URL of the system (Cloud)
|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).
Auch wenn die Klasse auf der On-Premise Landschaft noch kein muss darstellt, empfehlen wir dir die Nutzung der neuen Felder. Vor allem wenn dein Unternehmen "Cloud Ready" sein möchte oder in naher Zukunft die Eigenentwicklungen per Side-by-Side Extension in die Cloud migriert. Wenn du dich bereits heute an die neue Hilfsklasse gewöhnst, fällt dir eine spätere Umstellung sehr leicht, da du bereits alles wie vorgstellt schon machst.
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.
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.