A wizard helps you to define the ON conditions in the
JOIN clauses and ASSOCIATION definitions of your CDS
view definition.
Prerequisites
This function affects the CDS view in the currently opened editor.
Context
You can use the
ON conditions wizard when defining:
- Joins between two data sources (JOIN condition) in a CDS
view.
- Conditions for association in a SELECT statement.
The wizard considers the used data sources and their elements and provides proposals
(strategies) for joining the data sources. As developer you can also specify the
elements for a JOIN manually using drag and drop (User
Defined strategy).
To launch the wizard, proceed as follows:
Procedure
- Open the relevant CDS view in the DDL editor.
- In the CDS source code, position the cursor on the ON keyword where you
want to define an ON condition for a join or association.
- Press CTRL + 1 key shortcut.
Figure 1:
Starting the ON conditions wizard from the quick fix view
A quick fix view appears.
- On the quick fix view, double-click the Define ON
conditions entry to start the wizard.
Note
If the ON condition already exists, the mapping between
elements of data sources will be displayed on the wizard page, where you
can then modify them.
- To specify the condition expression, define the mapping between the source and the target
data source.
The wizard offers you automatic proposals for mapping elements of the data
sources:
- Strategy > By Name: Elements with identical names are mapped to
each other.
- Strategy > By Foreign Key: Based on the foreign key
relationship, that has been defined for a table in the ABAP
Dictionary, mappings are suggested for each key definition.
When using the User Defined option, you can map the elements in a
straightforward manner using drag & drop.
In addition, the wizard provides you with additional functionality, so that you can:
- Filter the data sources and their elements by
- Name
- Dictionary type
- Built-in type
- Expand or collapse all elements of the
- $parameter
- $projection
- data source
- Access context menu functions to...
- Delete a selected condition
- Delete all conditions
- Restore the initial mapping
Tip
To open the context menu on the wizard page, select the relevant element from the
Source or Target
area.
Figure 2:
For defining mapping drag and drop relevant elements from source to target
- Choose Finish.
Results
The wizard inserts the corresponding condition expression after the ON
keyword into the DDL source code.
Note
The wizard does not check the syntax or semantic correctness of a CDS view. So,
the modified coding might contain syntax or semantic errors.