Selective Build in HANA Development
Build Selected Files (aka Selective Build)
SAP HANA Development in SAP Web IDE
When developing SAP HANA database modules in SAP Web IDE (both on-premise and in the cloud) you need to “build” the HDB module to deploy the HDI artifacts in the designated SAP HANA database schema.
When you build an HDB module for the first time, SAP Web IDE creates a dedicated, isolated HDI container that includes the database schema.
To build the HDB module, right-click the module name and select Build.
Sometimes, a full HDB build can take a long time to complete, depending on the size of the module and the number of HDB artifacts it includes.
To improve the experience, SAP Web IDE provides the Selective Build option which lets you select individual files and folders and build (aka deploy) only the selected artifacts, thus saving precious time.
Select the files you wish to deploy, right-click, and select Build Selected Files. This triggers the selective build option.
The selective build is also useful when the HDB module is in a non-consistent state which means that a full HDB module build will not succeed. In this case, you can use the selective build to get your project into a consistent state.
To understand this better, let’s imagine that you are working on a calculation view and need to connect to a remote schema. You therefore add a synonym to your project and use it in your calculation view. Sounds easy, right?
The problem is that although the calc view is already active (deployed to your HDI container), the synonym is not which will cause the build to partially fail.
Using the selective build to activate the synonym alone solves this issue and allows you to continue working on the calculation view.
However, it is important to understand the limitations of the selective build.
As a general rule, the selective build will only work if the selected files don’t have dependencies to other artifacts that are inactive or are not included in the selected files.
Keep in. mind that when triggering a selective build, only files that are physically selected are included in the build. Hidden files, for example, will not be included. If you wish to include hidden files, first choose the option to Show Hidden Files in SAP Web IDE, and then select the hidden files as part of your selective build.
SAP Web IDE uses SAP HANA’s HDI Deployer (aka hdi-deploy module) to deploy the HDB artifacts on the SAP HANA server. By default, SAP Web IDE configures the deployer with standard options (e.g. auto-undeploy, include-filter, etc.).
Nevertheless, there are also other options available, for example, Force Deploy and Simulate build.
The HDI Deployer is smart enough to deploy only the changed artifacts (Delta Deployment). If it does not identify a change in the artifact, it will not deploy it. However, in some cases you might want to “force” the HDI Deployer to deploy an artifact even if it was not changed. This is what we call “Force Deploy”.
You can archive this by selecting the artifact you wish to deploy, right-clicking on it, and choosing Build Selected Files.
Note: This only works on a single file. If multiple files are selected, a standard selective build is activated.
In some cases, you might want to test the integrity of your HDB module without deploying all the artifacts on the SAP HANA server. You can do this by “simulating” a build (using the simulate-make flag on the hdi-deploy).
You do this by opening the Problems View bottom pane in SAP Web IDE, selecting the HDB module, and clicking the Analyze and Display Problems button. This will run the simulate build command and display the errors found.