a month ago
Hi everyone,
For one of my developments in S/4HANA Cloud Public Edition, I need to build some logic depending if the current system is Production System or not.
In On-Premise systems I used to use table T000 or class CL_ABAP_SYST to do so, but I cannot use them in Cloud Public since they are not released for Cloud Development (Contract C1).
Does anyone know if there's another way to get such information? I took a look at all classes released for cloud, including the XCO libraries, but couldn't find anything suitable.
Thanks.
Request clarification before answering.
Hi,
Use class : cl_abap_context_info and method : get_system_url( ) to get the system URL.
DATA(lv_system) TYPE string.
DATA(lv_var1) TYPE string.
DATA(lv_var2) TYPE string.
DATA(it_sys) TYPE TABLE OF REF TO cl_com_system.
DATA(lr_sys) TYPE REF TO cl_com_system.
DATA(systemid) TYPE string.
" Get the system URL
lv_system = cl_abap_context_info=>get_system_url( ).
" Split the URL at '.' into lv_var1 and lv_var2
SPLIT lv_system AT '.' INTO lv_var1 lv_var2.
" Read the communication systems
cl_com_system_factory=>create_instance( )->query_cs( IMPORTING et_com_system = it_sys ).
" Loop through the communication systems
LOOP AT it_sys INTO lr_sys.
" System is the own system
IF lr_sys->is_own_system( ) = abap_true.
systemid = to_upper( lr_sys->get_id( ) ).
exit.
ENDIF.
ENDLOOP.
" Alternatively, loop and check the hostname
LOOP AT it_sys INTO lr_sys.
IF lr_sys->get_hostname( ) CS lv_var1.
systemid = to_upper( lr_sys->get_id( ) ).
exit.
ENDIF.
ENDLOOP.
Regrads,
Pradeep.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
10 | |
8 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.