SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

ABAP Class to Detect SAP is S4 HANA running on Premise or on Cloud


ABAP programmers can use SAP standard class cl_cos_utilities to detect if current SAP system runs on HANA or to detect if SAP S/4HANA system is on premise or is on cloud. In this ABAP tutorial, I just want to show how developers can use cl_cos_utilities class with a sample case.

SAP standard cl_cos_utilities class has a number of static methods that ABAP programmers can keep in mind to use where a requirement occurs.
Here is the list of class static methods for CL_COS_UTILITIES (Utility routines for content separation/client separation)

IS_BYD: Checks if the system is in SAP Business ByDesign mode IS_SUITE: Checks if the system is in Suite mode IS_ADMIN_CLIENT: Checks if the current client is the administrative client IS_SYSTEM_CLIENT: Checks if the current client is a system client IS_APPLICATION_CLIENT: Checks if the current client is an application client IS_S4H: Checks if this is an S/4HANA system. SEE LONGTEXT IS_S4H_CLOUD_WEBGUI: Checks if session is WebGUI in an S/4HANA-like Cloud system IS_S4H_CLOUD: Checks if this is an S/4HANA-like Cloud system. SEE LONGTEXT IS_S4H_MANAGED_CLOUD: Deprecated (returns ABAP_FALSE), use IS_S4H_CLOUD IS_S4H_ON_PREMISE: Checks if this is a S/4 HANA On-Premise system, SEE LONGTEXT IS_S4H_PUBLIC_CLOUD: Deprecated, use IS_S4H_CLOUD IS_SIMPLIFIED_SUITE: Deprecated, use the correct IS_S4H... method instead ASSERT: Asserts if the function is executed in the specified context DISABLE: Disables the function in the specified context GET_CLIENT: Returns the current client IS: Checks if a function is executable in the specified context LOG_EXCEPTION: Logs the error using log-points VALIDATE_GV_S4H: Makes sure GV_S4H is valid, loads data if needed

ABAP programmers can call IS_S4H static method in their custom code to learn if current system is S/4HANA or not and if response is true then programmers can call method IS_S4H_CLOUD or IS_S4H_ON_PREMISE to identify if SAP system is on cloud or is on premise.

Here is the ABAP code for that check

CALL METHOD cl_cos_utilities=>is_s4h
 RECEIVING
  rv_is_s4h = data(is_s4h).

CALL METHOD cl_cos_utilities=>is_s4h_on_premise
 RECEIVING
  rv_is_s4h_on_premise = data(is_s4h_on_premise).

CALL METHOD cl_cos_utilities=>is_s4h_cloud
 RECEIVING
  rv_is_s4h_cloud = data(is_s4h_cloud).
Code

ABAP class to detect SAP is S4 HANA running on premise or on cloud



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.