ABAP SQL - Client Handling
As a term, client handling describes the way application data in a client is handled. Client handling is generally employed to restrict user access to the application data to only the client whose client ID was specified in the logon. ABAP SQL uses implicit client handling. This method of client handling dictates that ABAP SQL statements handle the client column in a special way when client-specific data sources are accessed:
- The client column cannot be evaluated in the
SQL conditions of the
SELECTstatements of queries and of the write statements
- Instead, the SQL statements passed to the database by the ABAP SQL interface contain an additional condition for the client column.
- Furthermore, joins between client-specific data sources insert an
ONcondition that checks the client columns for equality.
- The variants of the write statements
DELETE, which use data from work areas, internal tables, or subqueries specified after
FROM, ignore their client columns and the value is set by ABAP SQL instead.
- The condition passed implicitly in selections checks the content of the client column for equality with the client ID of the current client.
- In write statements, ABAP SQL uses the client ID of the current client for the client column of
the target instead of the values of the client column of the work areas, internal tables, or subqueries specified after
This means that ABAP SQL uses only the data of the current data by default and this does not need to be specified explicitly by the developer. Implicit client handling can, however, also be switched from the default current client to other clients using additions of the ABAP SQL statements. The cases described above must also be distinguished here:
- The implicit condition of queries and the write statements
DELETE FROMcan be switched from the current client to other clients as follows:
- The addition
USING CLIENTof the
SELECTstatement and the addition USING CLIENT of the write statements are used to specify the client ID from the addition instead of the current client ID. Implicit client handling works as if the current user is logged on with the specified client ID.
- The additions
USING [ALL] CLIENTS [IN]of the
USING [ALL] CLIENTS [IN]of the write statements are used to replace the equality condition for a client with different conditions for multiple clients (or remove it completely). The condition is then polyvalent instead of monovalent.
- The value set implicitly for the client column of the work areas, internal tables, or subqueries
FROMin write statements can be switched from the current client to other clients as follows:
- ABAP SQL uses the addition USING CLIENT to specify the client ID from the addition instead of the current ID. Implicit client handling works as if the current user is logged on with the specified client ID.
- If ABAP SQL specifies the addition CLIENT
SPECIFIED, no replacement takes place. The values of the client column of the work areas,
internal tables, or subqueries specified after
FROMare used. In internal tables and subqueries, there may be multiple client IDs.
Alongside the case of write statements with data sources after
above), the addition
CLIENT SPECIFIED can also be used instead of
USING in the other cases. This use is
obsolete in queries and
obsolete in the write statements UPDATE
DELETE FROM. The addition
disables implicit client handling in full in these statements. This means that no implicit WHERE
condition is created for the client column and no ON condition is created
between the client columns in joins. The client column in the SQL conditions of the ABAP SQL statements,
on the other hand, can or must itself be evaluated. Disabling implicit client handling in this way is
prone to errors and hence not recommended. The
USING additions for switching implicit handling should be used instead.
7.31 | 7.40 | 7.54
- The client data from an AS ABAP is depicted in closed units. No cross-client access to databases
should take place in application programs. This is why the additions
CLIENT SPECIFIEDshould never be used here. If ABAP SQL is used, there is generally no need to access
sy-mandtin application programs either.
- For information about accessing client-specific CDS entities, see the following descriptions:
- The database table T000 contains the potential client IDs in AS ABAP. Client columns of application tables should contain only those client IDs specified in T000. This is not, however, checked by ABAP SQL.
- True multitenancy, with which the system ensures that different tenants' application data is isolated from each other, is not supported by the ABAP runtime environment in the current release.