Some of the methods in cl_abap_context_info
can only be used in a cloud environment.
cl_abap_context_info=>
New Method |
Old Environemnt |
ET_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) |
(see here)
Thus means if you run On-Premise those methods will not return any value as far as I know.
But I just saw that you are using the BTP abap cloud example. I've also tested it here it seems that there no alias is set for the users.
You can verify your user with the get_user_business_partner_id
-method which is only valid in cloud.
METHOD if_oo_adt_classrun~main.
TRY.
out->write( |Hello World { cl_abap_context_info=>get_user_business_partner_id( ) }| ).
CATCH cx_abap_context_info_error.
ENDTRY.
ENDMETHOD.
I'm not sure weather you can set a user alias with transaction SU1
due there is no SAP Gui support I guess.