Skip to content

ABAP Keyword Documentation →  ABAP Programming Guidelines →  Architecture →  Data Storage 

Client Handling

Other versions: 7.31 | 7.40 | 7.54

Background

A client indicates a data area in an AS ABAP database that contains independent application data. The application data of different clients use the same database tables, but are flagged with a three-figure client ID within these tables.

When logging on to AS ABAP, this client ID must be entered. This selects the client whose data is processed by the user session. Open SQL statements support automatic client handling by default, where the data of the current client is always accessed. This is specified by passing an implicit condition for the current client to WHERE conditions, and ignoring clients specified in modifying statements in work areas.

The current client is entered in the system field sy-mandt. You can override automatic client handling in Open SQL by using the addition CLIENT SPECIFIED. Native SQL and ADBC do not implement automatic client handling.

Rule

Do not access the data of other clients

In the persistency services of business applications, access the data of the current client only.

Details

Each client within the application server is to be viewed as a self-contained unit. The addition CLIENT SPECIFIED should not be used in Open SQL statements of business applications, not even to access the current client. This is because it does not use SAP buffering.

The system field sy-mandt does not generally need to be evaluated, unless Native SQL or ADBC need to be used to access database tables in an emergency. The client ID is then needed to select the data of the currrent client explictly.


Note

Cross-client database tables (tables without client ID) are usually system tables. This means that cross-client access to these tables is also reserved for system programs.

Bad example

The following source code shows an Open SQL access to a database table where the current client is specified explicitly. This causes a drop in performance in buffered tables and requires another explicit WHERE condition.

SELECT SINGLE ...
       FROM dbtab CLIENT SPECIFIED
       INTO ...
       WHERE mandt = sy-mandt AND
             ...

Good example

The following source code shows the typical use of Open SQL to perform automatic client handling explicitly and implement SAP buffering.

SELECT SINGLE ...
       FROM dbtab
       INTO ...
       WHERE ...