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. The current client is entered in the system field sy-mandt
.
- ABAP SQL statements work
with implicit client handling, where the data of the current client is accessed by default. 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. Implicit client handling in ABAP SQL can be switched to one more different clients by using the additionUSING
in queries or the additions USING orCLIENT SPECIFIED
in write statements.
- Native SQL and ADBC do not apply implicit client handling. The client in question does not need to be selected explicitly when Native SQL or AMDP is used to access client-specific database tables or views.
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 AS ABAP is to be viewed as a self-contained unit. The additions USING
CLIENT and CLIENT SPECIFIED
should not be used in ABAP SQL statements of business applications. When Native SQL or AMDP is used, only the current client should be selected.
The system field sy-mandt
does not generally need to be evaluated, unless
Native SQL or AMDP 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.
Notes
- 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 demonstrates ABAP SQL access on application data where implicit client handling is switched to a different client.
FROM scarr USING '...'
WHERE ... ...
INTO ...
Good Example
The following source code demonstrates the recommended use of ABAP SQL where implicit client handling accesses the current client by default.
SELECT SINGLE ...
FROM scarr
WHERE ...
INTO ...