Get Example source ABAP code based on a different SAP table
ABAP_CDS - Client Handling in CDS DDIC-Based Views For a ABAP_CDS_V1_VIEW > in ABAP CDS, the CDS annotation> @ClientHandling>> can be used to specify client handling. ITOC
Determining Client Dependency The annotation @ClientHandling.type> determines the client dependency of the view. The following values can be specified for the annotation:
<(>#INHERITED<)> Default value. The client dependency of the view is determined by the data sources> used.
If one of the data sources used in the view is client-dependent>, the view is client-dependent.
If none of the data sources used in the view is client-dependent>, the view is a client-independent view.
<(>#CLIENT_DEPENDENT<)> The view is client-dependent. A prerequisite for this is that at least on of the data sources> used in the view is client-dependent. If not, a syntax error occurs.
<(>#CLIENT_INDEPENDENT<)> The view is a client-independent view. A prerequisite for this is that none of the data sources> used in the view is client-dependent. If not, a syntax error occurs.
Latest notes:
CDS views for application data should usually be client-dependent.
Unlike the annotation @ClientDependent>, the annotation @ClientHandling.type> cannot be used to make a ABAP_CDS_V1_VIEW into a client-independent view if it contains client-dependent data sources.
If the annotation @ClientHandling.type> is not specified, client dependency is derived implicitly from the client dependency of the data sources uses, as when specified with the value #INHERITED>. NON_V5_HINTS
The annotation @ClientHandling.type>> replaces the annotation @ClientDependent>> and should be used instead of this annotation. ABAP_HINT_END
Determining Client Handling The annotation @ClientHandling.algorithm> determines how implicit client handling is performed. The following values can be specified for the annotation:
<(>#AUTOMATED<)> Default value for the values #INHERITED> and #CLIENT_DEPENDENT > of the annotation @ClientHandling.type>. Cannot be used together with its value #CLIENT_INDEPENDENT>. The value #AUTOMATED> expands the joins of the ABAP_CDS_V1_VIEW > implicitly as shown in the following table. In the case of outer joins, client-independent sides are made into client-dependent sides artificially using cross joins, which avoids null values. This applies to joins specified directly using JOIN> and to instances of joins created when using SQL path expressions>. Left Side>Right Side>INNER JOIN> LEFT OUTER JOIN>RIGHT OUTER JOIN>CROSS JOIN> Client-dependentClient-dependentCompares the client columns in the ON> conditionCompares the client columns in the ON> conditionCompares the client columns in the ON> condition Transforms the cross join to an inner join using an ON> condition for the client columns Client-independentClient-dependent->The left side is replaced by a cross join of the client-independent data source with the DDIC database table T000>> and a comparison of the client columns in the ON> condition.->-> Client-dependentClient-independent->->The right side is replaced by a cross join of the client-independent data source with the DDIC database table T000>> and the client columns are compared in the ON> condition.-> Client-independentClient-independent->->-> ->
<(>#SESSION_VARIABLE<)> Cannot be used together with the value #CLIENT_INDEPENDENT> of the annotation @ClientHandling.type>. The value #SESSION_VARIABLE> expands the joins of the ABAP_CDS_V1_VIEW > implicitly as shown in the following table. This applies to joins specified explicitly and directly using JOIN> and to instances of joins created when using SQL path expressions>. Left Side>Right Side>INNER JOIN> LEFT OUTER JOIN>RIGHT OUTER JOIN>CROSS JOIN> Client-dependentClient-dependentCompares the client columns in the ON> conditionCompares the client columns in the ON> conditionCompares the client columns in the ON> condition Transforms the cross join to an inner join using an ON> condition for the client columns Client-independentClient-dependent->Compares the client column with the value of the session variable > $session.client>> in the ON > condition->-> Client-dependentClient-independent->->Compares the client column with the value of the session variable> $session.client>> in the ON > condition-> Client-independentClient-independent->->-> -> In addition, when Client-dependent data tables are accessed, WHERE > clauses with comparisons of the client columns with the session variable> $session.client>> are added to the view implicitly. If only client-dependent CDS entities are accessed, however, no clauses are added. If the session variable $session.client> is evaluated in the view, it is not possible to access the data of different clients in a single read. This applies in the following cases:
When a client-dependent DDIC database table is a data source of the view or is a CDS view used as a data source and hence an implicit WHERE > clause exists for the session variable.
When client-dependent and client-independent sides are joined in an outer join and there is an implicit ON> condition for the session variable. The addition USING>> of the statement SELECT>> for switching implicit client handling> is allowed and the client specified here is used implicitly. BEGIN_SECTION VERSION 5 OUT The obsolete addition CLIENT SPECIFIED>> is then not allowed. END_SECTION VERSION 5 OUT