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

Identify SAP Instance Number or System Number using ABAP Code

In this SAP tutorial, I want to show how ABAP programmers and data professionals can identify SAP system number or SAP instance number of the SAP system that you are trying to establish a connection. Recently, I was requested to establish a connection to a SAP system from Theobald XU Xtract Universal application. One of the connection methods requires host or server information and SAP system no as you will see in following sections in this tutorial.

SAP professionals can guess SAP system number easily in most cases since it is either 00, 01 or 02 in most cases. Unfortunately, recently I came across with a case where the SAP instance number is configured as 40 during setup process. As you will understand, it is nearly impossible for me to guess the number 40 as SAP system number easily.

ABAP programmers can use ABAP function module GET_SYSTEM_NUMBER in order to get two-digit system number, SYSNO or SAP instance number.

ABAP function module GET_SYSTEM_NUMBER for SAP instance number

When you call the ABAP function module GET_SYSTEM_NUMBER, if you don't provide an RFC target system, the result will be for the current active SAP system.

SAP instance number via ABAP function module

Here as seen in below screenshot, the ABAP function module GET_SYSTEM_NUMBER returned 2-digit 40 as the system number or instance number information of the current SAP system.

read SAP system number using ABAP function module

ABAP programmers can use following ABAP code block to get the SAP instance number or the SAP system number in their programs.

DATA systemno LIKE instanz-systemnr.

CALL FUNCTION 'GET_SYSTEM_NUMBER'
 IMPORTING
  instancenumber = systemno.

WRITE systemno.
ABAP Code for Function Module GET_SYSTEM_NUMBER

On SAP Logon GUI tool, it is also possible to see the system number under the column "instance no"
But to my experience, this information is missing for most SAP systems.

SAP system number on SAP Logon

Let's return back to the original requirement for identifying the SAP system number. As I mentioned before, for establishing a connection from Theobald Xtract Universal server to the target SAP system, I need the host or server name, or IP address and the SAP system number.

connect SAP from Theobald Xtract Universal



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


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