SAP WITH ASSOCS REDIR SELF ABEXA



Get Example source ABAP code based on a different SAP table
  



WITH, Exposing Associations with a Recursive Redirect
This example demonstrates the addition REDIRECTED of WITH ASSOCIATIONS where the redirect is made to the current CTE.

ABAP_SOURCE_CODE
DEMO CL_DEMO_WITH_ASSOCS_REDIR_SELF

ABAP_DESCRIPTION
As in the example Exposing Association with a Redirect, a common table expression +cte accesses the CDS view entity DEMO_CDS_EXPOSE_ASSOC_1 and exposes its CDS association _demo_join2. Here, however, the redirect is made to the current common table expression and not to a preceding common table expression. This expression specifies the association target demo_join2 of the exposed CDS association twice as an additional data source under the names src1 and src2.
In the first WITH statement, the data source is specified using src1.
In the second WITH statement, the data source is specified using src2.
The results of the two reads are different from each other. The following reads again demonstrate which join instances are created. The different results come from the different ON conditions, where the column of src1 and the column of src2 are both evaluated once.