SAP IUMD CLIENT ABAP Statements Get Example source ABAP code based on a different SAP table
ABAP Statement
VERSION 5 OUT
• CLIENT INSERT dbtab
• CLIENTS INSERT dbtab
• USING CLIENT INSERT dbtab
• USING CLIENTS IN INSERT dbtab
• USING ALL CLIENTS INSERT dbtab
• T000 INSERT dbtab
• CLIENT SPECIFIED INSERT dbtab
• CLIENT UPDATE dbtab
• CLIENTS UPDATE dbtab
• USING CLIENT UPDATE dbtab
• USING CLIENTS IN UPDATE dbtab
• USING ALL CLIENTS UPDATE dbtab
• T000 UPDATE dbtab
• CLIENT SPECIFIED UPDATE dbtab
• CLIENT MODIFY dbtab
• CLIENTS MODIFY dbtab
• USING CLIENT MODIFY dbtab
• USING CLIENTS IN MODIFY dbtab
• USING ALL CLIENTS MODIFY dbtab
• T000 MODIFY dbtab
• CLIENT SPECIFIED MODIFY dbtab
• CLIENT DELETE dbtab
• CLIENTS DELETE dbtab
• USING CLIENT DELETE dbtab
• USING CLIENTS IN DELETE dbtab
• USING ALL CLIENTS DELETE dbtab
• T000 DELETE dbtab
• CLIENT SPECIFIED DELETE dbtab
INSERT>, UPDATE>, MODIFY>, DELETE dbtab>, CLIENT>, CLIENTS> ABAP_SYNTAX ... ${ USING CLIENT clnt $} $| ${ CLIENT SPECIFIED $} $| ${ USING ${ CLIENT clnt $} $| ${ CLIENTS IN @client_range_tab $} $| ${ CLIENTS IN T000 $} $| ${ ALL CLIENTS $} $} ...> ABAP_VARIANTS: 1 ... ${USING CLIENT clnt$}$|${CLIENT SPECIFIED$}> 2 ... ${USING CLIENT clnt$}$|${USING $[ALL$] CLIENTS $[IN$]$}> What does it do? These additions modify client handling > of the AB-SQL write statements INSERT> >, UPDATE>>, MODIFY >>, and DELETE>>. They can be specified optionally after the target target> > in each of these statements. If none of these additions is specified, default client handling applies: If a work area wa>, an internal table itab>, or a subquery subquery_clauses>> is specified as a source source> after FROM>, the ID of the current client is used when client-dependent tables are modified instead of the values of the tables for the client column. In the case of the variants UPDATE SET> or DELETE FROM>, in which a WHERE> can be specified, no explicit condition can be set on the client column. Instead, an implicit condition for the current client is passed to the database system. The two variants of the optional additions are specific for these two cases: Variant 1 modifies client handling when sources are specified after FROM>. Variant 2 modifies client handling in modifying statements with possible WHERE> conditions. Latest notes: Each client represents a self-contained unit, which means that implicit client handling should not be switched off in application programs. See also the related security note > and the programming guideline>. ABAP_HINT_END ABAP_VARIANT_1 ... ${USING CLIENT clnt$}$|${CLIENT SPECIFIED$} > ABAP_ALTERNATIVES: 1 ... USING CLIENT clnt> 2 ... CLIENT SPECIFIED> What does it do? These two additions modify implicit client handling> of a modifying AB-SQL statement in cases where its source is specified as a work area wa>, internal table itab>, or subquery subquery_clauses > after FROM>. The addition USING CLIENT> switches implicit client handling to the specified client. The addition CLIENT SPECIFIED> specifies that the client IDs specified in source> are used. Latest notes: If data is to be processed with exactly one other client ID, USING CLIENT> should be used instead of CLIENT SPECIFIED >, since it specifies the client explicitly. If data of multiple clients is to be processed, CLIENT SPECIFIED> can or must be used. This is particularly the case when an internal table is used as a data source whose client column contains different client IDs or if a subquery is used as a data source to select the data of various clients using USING $[ALL$] CLIENTS $[IN$]>>. The addition USING $[ALL$] CLIENTS $[IN$] >> cannot be used in this variant. In this variant, the addition CLIENT SPECIFIED> is not obsolete> and is even allowed when accessing global temporary tables>. Here, it is used to express the fact that the client IDs of the sources specified after FROM> are used. ABAP_HINT_END Example ABAP Coding The following two INSERT> statements have the same effect. The first statement uses the addition USING CLIENT> and hence shows the recommended variant for specifying the client to be inserted explicitly. The second statement, on the other hand, uses CLIENT SPECIFIED> and must hence fill the client field with the required value in the work area passed. ABEXA 00367 ABAP_EXAMPLE_END Example ABAP Coding Modification of a row in a different client. The first UPDATE> statement shows the recommended method with the addition USING CLIENT>. The second UPDATE> statement, on the other hand, uses CLIENT SPECIFIED> and the client field of the work area must be filled. ABEXA 00368 ABAP_EXAMPLE_END ABAP_EXAMPLE_ABEXA See INSERT>, CLIENT>> ABAP_EXAMPLE_END ABAP Alternative 1 ... USING CLIENT clnt> What does it do? This addition modifies implicit client handling> in AB_SQL so that the client ID from clnt> is used instead of the current client ID. The ABAP runtime framework> replaces the client specified in source> with the client specified in clnt> and passes it to the database system. clnt> expects a data object of the type c> with length 3 and containing a client ID. A literal> or a host variable> can be specified. The following rules apply to the addition USING>: It can be used only when modifying a client-dependent table BEGIN_SECTION VERSION 5 OUT or view of this type END_SECTION VERSION 5 OUT . This addition cannot be used with the addition CLIENT SPECIFIED >. It cannot be used if a subquery is used as a data source of INSERT>> or MODIFY>> in which implicit client handling is switched using USING $[ALL$] CLIENTS $[IN$]>>. If specified, the system field sy-mandt> would be ignored and cannot be specified directly for clnt>. Latest notes: If the addition USING CLIENT> is used, the statement AB-SQL works as if the current user were logged on with the client ID specified in clnt>. If the addition USING CLIENT> is used for a dynamically specified DDIC database table and they are not client-dependent, the addition is ignored. The addition USING CLIENT> is not allowed in the obsolete short forms>. If the addition USING CLIENT> is used, the syntax check is performed in a ABAP_STRICT_740_SP05 strict mode / , which handles the statement more strictly than the regular syntax check. ABAP_HINT_END Example ABAP Coding The following MODIFY> statement uses the addition USING CLIENT >, as recommended, to access a specific client. ABEXA 00369 ABAP_EXAMPLE_END Example ABAP Coding The addition USING CLIENT> after INSERT> fills two columns of a DDIC database table with three rows for the client 100. Afterwards, these rows are copied to the current client in a subquery > by specifying USING CLIENT>. ABEXA 00370 ABAP_EXAMPLE_END ABAP Alternative 2 ... CLIENT SPECIFIED> What does it do? The addition CLIENT SPECIFIED> specifies that the client ID> in the client column in the source source> specified after FROM> is used and not the ID of the current client. The following rules apply to the addition CLIENT SPECIFIED>: It can be used only when accessing client-dependent DDIC database tables BEGIN_SECTION VERSION 5 OUT or views END_SECTION VERSION 5 OUT . It cannot be used together with USING CLIENT>. It cannot be used when a subquery is used as a data source of INSERT>> or MODIFY>> that works with default client handling or in which implicit client handling is switched using USING CLIENT>>. It must be used if a subquery is used as a data source of INSERT>> or MODIFY>> in which implicit client handling is switched using USING $[ALL$] CLIENTS $[IN$]>>. Latest notes: If the addition CLIENT SPECIFIED> is used for a dynamically specified DDIC database table and they are not client-dependent, the addition is ignored. If specified for statically specified client-independent DDIC database tables , the addition CLIENT SPECIFIED> produces a syntax error in the strict modes> of the syntax check from ABAP release ABAP_740_SP05 or else a syntax warning. ABAP_HINT_END Example ABAP Coding This example implements a client copy of all data in a table to multiple clients. The addition CLIENT SPECIFIED> of the statement INSERT>> ensures that the client IDs of the internal table used as a data source are not overwritten by the current client. The internal table is created in a host expression by copying the data of the current client read previously from SCARR> to multiple different client IDs. Duplicate entries are avoided by first using the addition USING CLIENTS IN> to delete all data of the area in question. After the insertion, all data of this area is read and displayed. ABEXA 00371 ABAP_EXAMPLE_END ABAP_VARIANT_2 ... ${USING CLIENT clnt$}$|${USING $[ALL$] CLIENTS $[IN$]$}> ABAP_ALTERNATIVES: 1 ... USING CLIENT clnt> 2 ... USING CLIENTS IN @client_range_tab> 3 ... USING CLIENTS IN T000> 4 ... USING ALL CLIENTS> What does it do? These additions modify implicit client handling> of a modifying AB-SQL statement UPDATE SET>> or DELETE FROM>> in which a WHERE> condition can be specified. The addition USING CLIENT> switches implicit client handling to the specified client. The additions USING $[ALL$] CLIENTS $[IN$]> select the data of any number of clients instead of the current client. Latest notes: Instead of USING>, the addition CLIENT SPECIFIED>> can also be specified outside ABAP_STRICT_777 strict mode from ABAP_RELEASE ABAP_777 / . This is, however, obsolete here. The additions shown here should be used instead. ABAP_HINT_END ABAP Alternative 1 ... USING CLIENT clnt> What does it do? This addition modifies implicit client handling> in AB_SQL so that the client ID from clnt> is used instead of the current client ID. In the implicit WHERE> condition, the ABAP runtime framework > replaces the current client ID by the ID specified in clnt>. clnt> expects a data object of the type c> with length 3 and containing a client ID. A literal> or a host variable> can be specified. The following rules apply to the addition USING>: It can be used only when modifying a client-dependent table BEGIN_SECTION VERSION 5 OUT or view of this type END_SECTION VERSION 5 OUT . If specified, the system field sy-mandt> would be ignored and cannot be specified directly for clnt>. Latest notes: If the addition USING CLIENT> is used, the AB-SQL statement works as if the current user were logged on with the client ID specified in clnt>. If the addition USING CLIENT> is used for a dynamically specified DDIC database table and they are not client-dependent, the addition is ignored. If the addition USING CLIENT> is used, the syntax check is performed in a ABAP_STRICT_740_SP05 strict mode / , which handles the statement more strictly than the regular syntax check. ABAP_HINT_END Example ABAP Coding Statements DELETE FROM> with the addition USING CLIENT>. The first statement deletes rows from the client 100> with a specific ID. The second statement deletes all rows of the client 100>. ABEXA 00372 ABAP_EXAMPLE_END ABAP Alternative 2 ... USING CLIENTS IN @client_range_tab> ABAP Alternative 3 ... USING CLIENTS IN T000> ABAP Alternative 4 ... USING ALL CLIENTS> What does it do? These additions switch implicit AB_SQL client handling> so that the data of all clients specified by the addition is modified and not just the data from the current client. The additions modify the implicit WHERE> condition for the client column passed to the database. The addition USING CLIENTS IN @client_range_tab> selects implicitly the clients whose client IDs meet the conditions in a ranges table> client_range_tab> instead of the current client. If the ranges table is empty, the data of all clients is selected. The addition USING CLIENTS IN T000> selects implicitly the clients whose client IDs are in the column MANDT> of the system table T000>> instead of the current client. The addition USING ALL CLIENTS> selects implicitly all rows regardless of client ID instead of the current client. The same rules apply to the additions as to the identically named additions USING $[ALL$] CLIENTS $[IN$]>> in queries. Latest notes: The additions USING $[ALL$] CLIENTS $[IN$]> replace the obsolete addition CLIENT SPECIFIED >> if this is used to select more than one client. If used, the additions USING $[ALL$] CLIENTS $[IN$]> apply ABAP_STRICT_777 strict mode from ABAP_RELEASE ABAP_777 / . ABAP_HINT_END ABAP_EXAMPLE_ABEXA See UPDATE>, USING> CLIENT>, CLIENTS>> ABAP_EXAMPLE_END Return to menu