Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
AyushKumar
Advisor
Advisor
Authors: ak47_, shreya.sinha01 and vipul.khullar

 

Previous Blog in this series:

This is the first blog in the series End-to-End extensibility in Multi-Tenant CAP-based Application.

Prerequisite:-

Before we deep dive into the sample applications/ data models for an application to be extensible, let’s look at all the necessary conditions that need to be satisfied by your application to be easily extensible that we encountered during the phase of our implementation.

  • Use of Associations and Compositions in the entity should be encouraged rather than using joins.

  • Avoid the use of inner and outer joins of any kind if using any joins, it should be on the projection rather than a direct entity, and open projection (*) should be used in case of any joins.


For Example: -
entity ViewB as projection on A;
define view TestView as
select from ViewA as viewA
inner join ViewB as viewB
on < condition >
{
*
}


  • Stable data model

  • MTX version should be above 2.6.3 or the latest version (For newer projects use MTXs)

  • Allow list should be mentioned for the namespace and the entities

    • Entity




  "cds": {
"mtx": {
"element-prefix": [
"x_"
],
"extension-allowlist": [
{
"for": [
"sap.capire.orders"
],
"kind": "entity",
"new-fields": 2
},
{
"for": [
"OrdersService"
],
"new-entities": 2
}
]
}
}




    • Namespace




  "cds": {
"mtx": {
"element-prefix": [
"x_"
],
"namespace-blacklist": [
"com.sap",
"sap.app "
],
"extension-allowlist": [
{
"for": [
"sap.capire.orders"
],
"kind": "entity",
"new-fields": 2
}
]
}
}


  • Blocklist should be defined if you want to restrict the user to extend those entities or services.

    • Entity

    • namespace



  • In your package.json in the i18n section add the path of the translation files for the extensible packages(apps/microservices).


 "i18n": {
"folders": [
"_i18n",
"i18n",
"../db/_i18n",
"assets/i18n"
]
}


  • In your MTA.yaml add the following property in all the applications that you want to be available for extension


Add the below property in the specific application’s mta.yaml file as a property
properties:
CDS_MULTITENANCY_SIDECAR_URL: "https://${org}-${space}-<add your sidecar module name>.${default-domain}"

 

Note: allowlist or blocklist anyone of them will be sufficient depending upon the use case of your project.

Now Let's create a sample application with a simple schema, you can find a sample Multi-tenant application here.

Let's look at the Book Schema which we will be using throughout this Blog Series
namespace sap.acm.fp.sample;
entity Book {
key bookId: String(20);
bookName : String(20);
}

 

Conclusion:

In this blog post, we saw all the prerequisites that are required for making a multi-tenant application extensible.
In the next blog of this series, we will be looking at some of the most common scenarios for which we create an extension project.

Next Blog in this series: Creating Extension Project for your Tenant

Further Reading Links:

  1. https://cap.cloud.sap/docs/guides/extensibility/customization?q=extension#about-extension-models

  2. https://cap.cloud.sap/docs/guides/multitenancy/?q=old+mt#introduction--overview