ABAP Keyword Documentation → ABAP Programming Guidelines → Architecture → Data Storage
Other versions: 7.31 | 7.40 | 7.54
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. The current client is entered in the system field
- Open SQL statements support
automatic client handling by default, where the data of the current client is accessed by default. This
is specified by passing an implicit condition for the current client to
WHEREconditions, and ignoring clients specified in modifying statements in work areas. Automatic client handling in Open SQL can be switched to a different client using the addition
USING CLIENTor switched off using the addition
- Native SQL does not implement automatic client handling. The client in question does not need to be selected explicitly when Native SQL is used to access client-specific database tables or views.
Do not access the data of other clients
In the persistency services of business applications, access the data of the current client only.
Each client within the application server is to be viewed as a self-contained unit. The additions
USING CLIENT and
CLIENT SPECIFIED should not be used in Open SQL statements of business applications. When Native SQL is used, only the current client should be selected.
The system field
sy-mandt does not generally need to be evaluated, unless
Native SQL is used to access client-specific database tables or views. The client ID is then needed to select the data of the current client explicitly.
- 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.
- If Open SQL has to be used to access data in a different client,
USING CLIENTshould be used instead of the addition
CLIENT SPECIFIED, since all necessary conditions are set implicitly and accessing client-specific CDS views is more simple.
The following source code shows an Open SQL access to a database table where the current client is specified
explicitly. This makes a further explicit
WHERE condition necessary. The
sy-mandt cannot be specified directly when using the addition
FROM dbtab CLIENT SPECIFIED
WHERE mandt = @sy-mandt AND
The following source code shows how Open SQL is generally used for implicit automatic client handling.
SELECT SINGLE ...