The framework offers a facade which lets you determine the current context. For this
class
/IWBEP/CL_DIAGNOSTICS_FACADE is available
with several methods:
You can use this as follows:
Option 1 only returns a flag indicating that you are in the context of an OData
service.
Example DATA: lv_is_gateway_service TYPE abap_bool.
lv_is_gateway_service = /iwbep/cl_diagnostics_facade=>is_gateway_service( ).
Option 2 returns the name of the OData service in whose context you are currently
in.
Example DATA: lv_service_name TYPE string. lv_service_name =
/iwbep/cl_diagnostics_facade=>get_current_gateway_service( ).
This works similar to the ABAP language element
SY-TDOCE:
SY-TDOCE returns the ABAP transaction code
which has called the current coding.