Prerequisite:
Download the definition of HANA Wrapper views files. The downloaded folder contains
Synonym,
Synonym Config and the
HANA Wrapper View definition.
For more details, please refer to the
blog.
To deploy Wrapper Views to the HANA DB, please complete the following steps:
- Open the SAP Web IDE from the SCP account and create a new Multi-Target Application Project.
2. Next, select the
Multi-Target Application.
3. Enter the
Project Name
4. Choose
Finish
5. Next, create a new
HANA Database Module in the project.
6. Enter the
Module Name.
7. Choose Next.
8. Enter the
Namespace (optional) and
Schema Name (optional).
9. Choose
Finish.
Note: If the views are generated from Wrapper View generator, please leave Namespace and Schema as blank.
Result: The following folder structure will be generated.
10. To create a config folder
cfg, right click on
HDI folder and select a new
Folder.
11. Like with the
src folder, create a
grants and
synonyms folder under the
cfg folder.
12. Create a
grants file (.hdbgrants) with the User-Provided service and the required roles.
13. Put it in the
grants folder.
Sample grants file: Here, the role generated for the schema should be entered under the section
roles.
{
"< User-Provided service >": {
"object_owner": {
"roles": [
"< ROLE_WITH_ACCESS_TO_SCHEMA >"
]
},
"application_user": {
"roles": [
"< ROLE_WITH_ACCESS_TO_SCHEMA >"
]
}
}
}
14. Next, create sub folders
CDS and
Synonyms in the
src folder.
15. Position the downloaded files as shown below:
- Synonym Config file in cfg->synonyms folder
- Synonym file in src->Synonyms
- CDS View (hdbcds) file in src->CDS.
Here is an example scenario using I_CUSTOMER:
16. In the synonym config file (with extension .hdbsynonymconfig), provide the
configure as
<< User-Provided Services>> /schema.
17. Open the mta.yaml file using MTA editor and make the following changes.
18.Navigate to
Resources tab, and add the << User-Provided Services >> by using the
icon.
19. Select the type as org.cloudfoundry.existing-service.
20. Navigate to
Modules tab.
21. Under Requires section, add the property TARGET_CONTAINER and value as
~{hdi-container-name} to the HDI resource.
22.
Add the << User-Provided Services >> resource.
23. Copy the .hdiconfig folder from the
src folder and paste it in the
cfg folder.
24. Paste it in the
cfg.
25. Right click on the HANA Database module (HDI) and build the project.
Result: Once the build has successfully completed, the HDI will be created and the HANA CDS view for I_CUSTOMER will be created.
HANA CDS View in Database Explorer:
26. Next, go to database explorer from the SAP WEB IDE by clicking on
icon.
Note: If the Database explorer is not activated, go to settings, search for SAP HANA Database Explorer and set the feature to
ON.
27.
Add the database to the database explorer, by clicking on the button.
28.
After adding the database, double click on the Views and the created HANA CDS View I_CUSTOMER will appear.
29. Click on the
Open Data to view the data of the
I_Customer view.
Note: This is the underlying data of the CDS view I_CUSTOMER.
Result: You now have successfully deployed a HANA CDS View in a HDI container.