Introduction:
In a typical customer situation the HANA based application Customer Engagement Intelligence (CEI) regularly runs in an integrated scenario on replicated ERP and CRM data. In many cases we face the situation that customers have setup different clients in their ERP and CRM source systems feeding CEI.
This could result e.g. in the below situation:
CEI Application Client | Source Client of replicated CRM data | Source Client of replicated ERP Data |
---|---|---|
100 | 200 | 300 |
In the event that one extends e.g. a customer segmentation model in CEI-ADT by implementing customer specific HANA views, certain modeling rules have to be considered in order to enable the CEI application running in a client 100 to consume application tables with containing records <> client 100.
Pls. note: If one deals e.g. with data replicated from non SAP system with no client/ mandant field in the source tables, the following is not relevant!
However if the data contains a client/ mandant column and below rules have not been followed while modeling the custom views this could result in issues
when trying to consume data through the custom view from the CEI application. This is because when the CEI application accesses the views via ADBC the currenty CEI application client is passed to the HANA DB/ views as session parameter used for filtering data.
Rules:
To support different clients per schema in CEI the following rules are recommended to be followed:
- All CEI HANA Views shall be defined as cross client.
- All CEI HANA Views shall handle filtering on the correct client inside of the view. It should be done in a transparent way to the view consumers.
- Client for a particular schema (e.g. SAP_CUAN_CRM) shall be retrieved as a derived Input Parameter from the Client Mapping Table (CUANC_CLNTMAP). Derived Parameters are available in Analytical and graphical Calculation Views. Naming conventions for such parameters shall be $$IP_<SCHEMA>_CLIENT$$ (e.g. $$IP_CRM_CLIENT$$).
- Client for SAP<SID> Schema shall be retrieved from the session context ($$client$$).
- Data Foundations of Attribute Views, Analytical Views and graphical Calculation Views shall be filtered on the corresponding client.
- Analytical Views that are directly consumed via SQL, SQLScript, CE Functions (standalone case) shall join the Client Mapping Table within the view and filter it on the session client. Reason for this is unavailability of derived Parameters in the Attribute views, SQL Script as well as outside of HANA.
- If an Attribute View is consumed both directly via SQL (standalone) and inside of Analytical or graphical Calculation View (embedded) then two versions of the view should be created:
- with filter on the derived client for the embedded scenario. Naming convention for an Attribute View for embedded scenarion is e.g. AT_<VIEWNAME>_CF.
- with join to the client mapping table for the standalone scenario.
- Attribute Views consumed inside of Analytical or graphical Calculation Views should not contain a join to the client mapping table.
- Analytical Views and graphical Calculation Views should not contain a join to the client mapping table for filtering the correct client.
Examples:
You can check how the above rules are implemented in the standard views AT_COUNTRY and AT_COUNTRY_CF to be found in ...sap/hana-app/cuan/common/internal/Attribute Views.