Exercise Objectives
After completing this exercise, you will be able to:
- Define a join into a DIMENSION calculation view.
- Join several tables to get all needed columns.
Business Example
You are at a customer site where the Enterprise Procurement Model (EPM) is used. Information about business partners, products, sales orders, and purchase orders is located in several tables, and you need to structure this data in a report.
You already created a DIMENSION calculation view for the products and now need to create a DIMENSION calculation views for the Business Partner dimension. This view will be used later on to create the star join calculation views for purchase orders.
The view will join several master data tables related to the business partners, including the contact persons and their e-mails.
Prerequisites
Prerequisites
Your SAP Business Application Studio development environment should have been set up and the HC300 project imported and deployed.
Steps
If needed, launch SAP Business Application Studio and start your HCMOD development space.
In your exercises folder, create a new calculation view with the following properties:
Field Value Name CVD_BP_JOIN Label Business Partners Data Category DIMENSION Type STANDARD In the EXPLORER tree, right-click the folder HC300_A####→db→src→exercises folder and choose New File.
Enter CVD_BP_JOIN.hdbcalculationview as file name and press Enter.
Enter the calculation view label and other properties as specified in the table.
Choose Create.
Result
The calculation view graphical editor opens on the right of your screen.
Add a Join node Join_1 to the Scenario pane, and add the following tables from EPM_MODEL schema as data sources to the new node:
Table SNWD_BP: Business Partners master data
Table SNWD_CONTACT: Contact person details
In the Scenario pane, add a Join node below the top nodes by selecting the Create Join node from the palette (
) and clicking in the scenario pane below the projection node.Select the new Join_1 node and click the + sign on the right of the node.
In the Find Data Sources window, click the search field and enter SNWD_.
In the search results, select the two tables SNWD_BP and SNWD_CONTACT.
Choose Finish.
If needed, expand the Details panel.
Choose the
Expand Details Panel icon.
In the Join Definition tab for Join_1, join the data sources as follows:
The table SNWD_BP is considered as the left table, and the table SNWD_CONTACT as the right table. If needed, move the two tables to make sure you have SNWD_BP on the left and do not define the join incorrectly.
Join the field CLIENT of the left table to the field CLIENT of the right table.
Join the field NODE_KEY of the left table to the field PARTNER_GUID of the right table.
Use a Referential join type and a 1..1 cardinality:
Hint
To check the cardinality, in the Properties pane, you can choose Propose Cardinality.

In the Join Definition tab, if needed, drag and drop the table SNWD_BP so that it appears at the left of the SNWD_CONTACTS table.
Drag the SNWD_BP.CLIENT field to the SNWD_CONTACT.CLIENT field, and drag the SNWD_BP.NODE_KEY field to the SNWD_CONTACT.PARTNER_GUID field.
Caution
For the second connector, make sure that you actually join the PARTNER_GUID of the right table (NOT the NODE_KEY).To edit the join properties, select the new connector.
In the PROPERTIES pane, In the Join Type dropdown list, choose Referential.
In the Cardinality dropdown list, choose 1..1.
Optionally, click the
Propose Cardinality button.Note
The Join Type and Cardinality properties are defined for each join, in this case, the pair of connections between the tables.
In the Mapping tab for the node Join_1, add the following columns to the output:
Source table Columns SNWD_BP
CLIENT
NODE_KEY
BP_ID
BP_COMPANY_NAME
SNWD_CONTACT
FIRST_NAME
LAST_NAME
LANGUAGE
Hint
You can add the columns from the two data sources to the output in a single operation, by selecting them all before clicking the
Add to Output button. Ensure that you do not collapse a data source in the tree because it removes the selection. Moreover, do not select an entire data source from the tree, because in this case all the columns will be added to the output.In the Mapping tab, select the columns as per the table above.
Choose the
Add To Output button.
Add another Join node Join_2 to the Scenario pane, between the nodes Join_1 and Projection, and add the two following data sources to this new node:
Node Join_1
Table SNWD_BP_EM (e-mail address) from EPM_MODEL
Hint
To link a node to another one, select the source node and drag the arrow icon onto the target node. When the target node is reached, it gets a bold border, you can drop the arrow icon.
In the Scenario pane, add a new Join node Join_2 below the top nodes by selecting the Create Join icon from the palette and clicking in the scenario pane between the Join_1 and Projection nodes..
Select the Join_1 node.
Drag the arrow icon to the Join_2 node.
Select the Join_2 node.
Choose the + icon on the right of the Join_2 node.
In the search field, enter SNWD_.
Select the SNWD_BP_EM table.
Choose Finish.
In the Join Definition tab, join the data sources of node Join_2 as follows:
The source Join_1 is considered as the left table, and the table SNWD_BP_EM as the right table.
Join the field CLIENT of the left table to the field CLIENT of the right table.
Join the field NODE_KEY of the left table to the field PARTNER_GUID of the right table.
Use a Referential join type and a 1..1 cardinality:
Note
The join is defined on the same fields and with the same properties as the previous one.
On the Join Definition tab, drag the Join_1.CLIENT field to the SNWD_BP_EM.CLIENT field, and drag the Join1.NODE_KEY field to the SNWD_BP_EM.PARTNER_GUID field.
Caution
For the second join, ensure that you actually join the PARTNER_GUID of the right table (NOT the NODE_KEY).To edit the join properties, select the new connector.
In the PROPERTIES pane, in the Join Type dropdown list, choose Referential.
In the Cardinality dropdown list, choose 1..1.
Choose OK.
On the Mapping tab for node Join_2, add the following columns to the output:
Source Table Columns Join_1
[All the columns]
SNWD_BP_EM
EMAIL_ADDRESS
Hint
To add all the columns from Join_1 in a single step, select the Join_1 item from the Data Sources tree.In the Mapping tab for Join_2, select the Join_1 item and choose
Add to Output.You do not need to select any specific column from this data source, you need all columns.
Select the SNWD_BP_EM→EMAIL_ADDRESS field and choose
Add To Output.
Define the Join_2 node as the data source for the Projection node, and add all the columns of the Projection node to the output.
In the Scenario pane, select the Join_2 node.
Drag the arrow icon to the Projection node.
In the Mapping tab of the Projection node, select the Join_2 data source and choose
Add to Output.
In the Semantics node, define the BP_ID column as a key column.
Hint
If the KEY column is not displayed by default, click the
(Customize Column Display) button.In the Scenario pane, choose the Semantics node.
In the Columns tab, choose
(Customize Column Display), select the Key field and choose OK.Select the Key checkbox of the BP_ID column.
Deploy the CVD_BP_JOIN calculation view.
Check the deployment status.
Choose the Deploy icon for your CVD_BP_JOIN calculation view..
In the Console pane, check that the deployment completes successfully.
Preview the data of the CVD_BP_JOIN calculation view.
Open SAP HANA Database Explorer.
Select Column Views , right-click the HC::CVD_BP_JOIN view and choose Open Data.
Close all the open tabs in Business Application Studio.
Right-click any open tab and choose Close All.
