SAP IDT - Joins In Data Foundation



Joins are used to combine tables in Data Foundation. It defines how data is queried in the tables. Joins are defined when you link one column of a table to other column. It is possible to insert Joins manually or to insert automatically by clicking on Detect Join option.

To insert a new Join, go to Insert → Insert Join.

Inserting Join

Select Table 1 from the dropdown, Table 2 from the dropdown from all the tables in Data Foundation. Select columns from Table 1 and Table 2 to join. Select the type of Join you want to insert → OK.

Type of Join

Editing an Existing Join

To edit an existing Join, double-click on Join and it will open Edit Join editor as above.

Editing Join

Derived Tables

A derived table is a virtual table in the data foundation that combines other tables using calculations and functions.

You can use derived tables for the following purposes −

  • To create a table with columns from other tables. The column definitions can include complex calculations and functions.

  • To create a single table that combines two or more tables.

  • To create a table that contains a selection of columns from different tables.

  • To Insert Derived table, select table header → right click → insert → derived table.

Derive Table

Enter the Unique name and click OK.

New Derive Table

Table Alias

An Alias table is known as reference to a standard table in Data Foundation. The data in Alias table is completely same as the original table.

Alias tables are used to break loops in Join path in Data Foundation layer. An Alias table can also be used to rename a table.

Insert an Alias

To create an Alias table, select the table on which Alias has to be created. Right-click the table header → Insert → Alias table. To create an Alias table on more than one table, use CTRL key to select multiple tables.

New Insert Alias

Alias is used to break any loop and to handle Fan trap and Chasm trap issues.

Detect an Alias

To detect an Alias, go to Detect under Data Foundation layer.

Detect Alias

To detect a table alias, the following condition should be met.

Detect Table Alias

Contexts

Contexts are also used to break the loops in Data Foundation when you are not able to break the loop using an Alias table.

When you have multiple fact tables that are connected to a single dimension table, you create a Context for each fact table in this case.

In a context, there are three states defined for a Join −

Included Joins − In a part of the schema that is ambiguous, the context solves the loop by defining a path with the included joins.

Excluded Joins − In a part of the schema that is ambiguous, the excluded joins define the path that context will never take.

Neutral Joins − They are in a part of the schema that is not ambiguous, and are always included in the query path of the context. Any join that is not explicitly included or excluded is neutral.

A Context can be defined manually or by clicking detect Context option.

To detect Context → Open the data foundation editor by double-clicking the data foundation name in the Local Projects View.

From the Aliases and Contexts pane, select the Detect Contexts icon.

Detect Context Icon

The command analyzes the join paths and proposes contexts to resolve any loops that cannot be resolved by alias tables.

Next, open Detect Contexts dialog box, select the contexts you want to insert.

To see the context highlighted in the data foundation view, click the proposed context name. A join that is included in the context is shown by an included icon Context Icon

A join that is excluded is shown by the excluded icon Excluded Icon. Click OK to insert the selected contexts into the data foundation.

Advertisements