https://raw.githubusercontent.com/ajmaradiaga/feeds/main/scmt/topics/BW-Analytic-Engine-(OLAP)-blog-posts.xml SAP Community - BW Analytic Engine (OLAP) 2026-02-25T12:10:07.426552+00:00 python-feedgen BW Analytic Engine (OLAP) blog posts in SAP Community https://community.sap.com/t5/technology-blog-posts-by-sap/smart-queries-for-sap-analytics-cloud-with-bw-live-connection/ba-p/13443234 Smart Queries for SAP Analytics Cloud with BW Live Connection 2019-11-13T21:10:52+01:00 IngoH https://community.sap.com/t5/user/viewprofilepage/user-id/150260 One important aspect of the integration of SAP Analytics Cloud and SAP BW / BW4HANA is always the topic performance. With wave 19 we released a new feature especially for the BW Live connectivity. Officially the feature is called "Query Merging", but I thought "Smart Query" sounds far better...<BR /> <BR /> Lets assume a very simple case:<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/11/BW_TWO_STRUCTURE_007.jpg" /><BR /> <BR /> In our example, we have three charts displaying:<BR /> <UL><BR /> <LI>Net Value by Product (Top 10)</LI><BR /> <LI>Costs by Product (Top 10)</LI><BR /> <LI>Net Value by Region (Top 10)</LI><BR /> </UL><BR /> Without doing anything, this would result in three queries towards the SAP BW system.<BR /> <BR /> Now with the new option of query merging, we can reduce the amount of queries.<BR /> <BR /> First I open the Query Settings as part of my story...<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/11/BW_TWO_STRUCTURE_008.jpg" /><BR /> <BR /> .. and I then enable both options:<BR /> <UL><BR /> <LI>Enable Query Merge</LI><BR /> <LI>Visualize Query Merge</LI><BR /> </UL><BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/11/BW_TWO_STRUCTURE_009.jpg" /><BR /> <BR /> .. and then i refresh my story.<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/11/BW_TWO_STRUCTURE_010.jpg" /><BR /> <BR /> All three charts are shown with a different color and there is a small comment in the bottom right corner for each chart, showing with with data request the data was retrieved. In my given example we still have three data requests - so we didn't improve.<BR /> <BR /> Why ?<BR /> <BR /> So lets look at the pre-requisites:<BR /> <UL id="loio697b09ba2a984ab6997eac94efe8d043__ul_cm3_tbt_53b" class="ul"><BR /> <LI class="li"><BR /> <P class="p">Queries contain the same dimensions with the same hierarchies and drill.</P><BR /> </LI><BR /> <LI class="li"><BR /> <P class="p">Queries use the same sorting and ranking.</P><BR /> </LI><BR /> <LI class="li"><BR /> <P class="p">Queries do not have an active threshold with threshold filters.</P><BR /> </LI><BR /> <LI class="li"><BR /> <P class="p">The widget does not have a local filter on a dimension that is also used in a restriction in SAP BW.</P><BR /> </LI><BR /> <LI class="li"><BR /> <P class="p">Queries are part of the same receiver group if they use linked analysis.</P><BR /> </LI><BR /> <LI class="li"><BR /> <P class="p">There is no widget filter on a secondary structure query.</P><BR /> </LI><BR /> <LI class="li"><BR /> <P class="p">The widget filter is not defined as complex tuple or range filter.</P><BR /> </LI><BR /> <LI class="li"><BR /> <P class="p">Presentation types are the same.</P><BR /> </LI><BR /> </UL><BR /> So in our example the second rule is why our three charts are not being merged, because we are using three different sets of ranking rules.<BR /> <BR /> &nbsp;<BR /> <BR /> So lets remove the ranking from all our three charts.....<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/11/BW_TWO_STRUCTURE_011.jpg" /><BR /> <BR /> .... and we can see that the two charts that share the dimension are now part of the same data request, so instead of 3 requests we now are only using 2 requests.<BR /> <BR /> When looking at this simple example the impact might not be so obvious, so lets put this into a perspective.<BR /> <BR /> Lets assume we have a SAP Analytics Cloud Story with a total of 6 widgets and instead of running 6 data requests, we would be running 2 data requests with the Query Merging capability enabled.<BR /> <BR /> Lets also assume that the SAP Analytics Cloud Story is being viewed by 100 people each morning.<BR /> <BR /> &nbsp;<BR /> <BR /> Our old scenario:<BR /> <P style="padding-left: 40px">100 Users x 6 requests = 600 requests</P><BR /> &nbsp;<BR /> <BR /> New scenario with Query Merging:<BR /> <P style="padding-left: 40px">100 Users x 2 requests = 200 requests</P><BR /> &nbsp;<BR /> <BR /> I am sure your BW Administrator would appreciate this and your end users will as well ...<BR /> <BR /> &nbsp;<BR /> <BR /> &nbsp;<BR /> <BR /> <A href="https://help.sap.com/doc/00f68c2e08b941f081002fd3691d86a7/2019.20/en-US/697b09ba2a984ab6997eac94efe8d043.html" target="_blank" rel="noopener noreferrer">Merging SAP BW Queries Documentation</A> 2019-11-13T21:10:52+01:00 https://community.sap.com/t5/technology-blog-posts-by-members/configuration-of-fiori-analytical-app-using-sap-smart-business-kpi-modeller/ba-p/13453803 Configuration of FIORI Analytical App using SAP Smart Business KPI Modeller 2019-12-13T06:08:12+01:00 rpatra https://community.sap.com/t5/user/viewprofilepage/user-id/340759 Hi Readers,<BR /> <BR /> First of all, thank you very much for reading this blog. I hope it will be helpful for you.<BR /> <BR /> In this blog, I am going to discuss the steps to create your first FIORI analytical app using SAP Smart Business KPI Modeller.<BR /> <BR /> Before going to start let's understand what is FIORI Analytical App.<BR /> <BR /> <SPAN style="color: #0000ff"><STRONG>What is FIORI Analytical App?</STRONG></SPAN><BR /> <BR /> Analytical apps are used to provide role-based real-time information about business operations. Analytical apps integrate the power of SAP HANA with SAP business suite. It provides real-time information from a large volume of data in the front-end web browsers.<BR /> <BR /> Using Analytical apps, you can closely monitor Key Performance Indicators KPIs. You can perform complex aggregations and calculations of your business operations and react immediately as per the changes in the market condition.<BR /> <BR /> SAP Fiori Analytical apps run on SAP HANA database and use Virtual data models.<BR /> <BR /> There are two types of Analytical Apps −<BR /> <UL class="list"><BR /> <LI>SMART Business</LI><BR /> <LI>Virtual Data Models</LI><BR /> </UL><BR /> <SPAN style="color: #000000"><STRONG>SMART Business</STRONG></SPAN><BR /> <BR /> SAP Fiori smart business apps are used to monitor your most important KPIs in real-time and to make changes as per market conditions immediately.<BR /> <BR /> <STRONG>Note</STRONG> − There are around 84 Analytical apps under this umbrella and out of these, you have 69 apps are smart business apps and rest 15 are Analytical Apps.<BR /> <BR /> <SPAN style="color: #0000ff"><STRONG>What is a KPI Modeler?</STRONG></SPAN><BR /> <BR /> It is a tool used to model KPI and report tiles for monitoring the business data using Fiori Launchpad. You can define KPIs and reports to which you can apply different calculations and it enables you to make adjustments according to changing market conditions.&nbsp;You can configure drill-down views.<BR /> <BR /> SAP HANA Live provides exceptional capability analytics for all business suite by enabling industry-standard access to SAP data through data models.<BR /> <BR /> The data models are used for analytical purposes using views in the HANA database. The views from a virtual data model that a customer and partner can reuse.<BR /> <BR /> Now, let's see the steps to follow to create a new KPI Report for any of your business processes.<BR /> <BR /> <STRONG>1</STRONG>. Open your Fiori Launchpad, you will see <STRONG>KPI Modeller Tiles</STRONG><BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/1-45.png" /><BR /> <BR /> <STRONG>2</STRONG>. Click on the <STRONG>Create KPI Tile</STRONG><BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/2-61.png" /><BR /> <BR /> <STRONG>3. </STRONG>You should enter <STRONG>Title</STRONG>, <STRONG>Description</STRONG>, Choose<STRONG> Goal Type</STRONG> from options Maximizing, Minimizing or Range<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/3-29.png" /><BR /> <BR /> <STRONG>4</STRONG>: You should select <STRONG>SAP HANA View</STRONG> from the Value Help<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/4-18.png" /><BR /> <BR /> <STRONG>5</STRONG>. Select the <STRONG>HANA View</STRONG> and then search for <STRONG>OData Service</STRONG> from OData Service Value help.<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/5-18.png" /><BR /> <BR /> <STRONG>6</STRONG>. Now, select the respective <STRONG>OData Service</STRONG> and respective <STRONG>Entity Set</STRONG>.<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/6-30.png" /><BR /> <BR /> 7: Now, Search for <STRONG>Value</STRONG> <STRONG>Measure</STRONG> from Measure Value help.<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/7-16.png" /><BR /> <BR /> <STRONG>8</STRONG>. Click on <STRONG>Activate</STRONG> <STRONG>and</STRONG> <STRONG>Add Evaluation</STRONG><BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/8-18.png" /><BR /> <BR /> 9. Once clicked on <STRONG>Activate and Add Evaluation</STRONG>, the Add Evaluation page opens up. On this page some of the fields are prefilled. This data is fetched from KPI.<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/9-11.png" /><BR /> <BR /> <STRONG>10</STRONG>. Select a few<STRONG> Additional Measures</STRONG><BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/10-17.png" /><BR /> <BR /> <STRONG>11: </STRONG>Now, Select <STRONG>optional Filters</STRONG><BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/11-10.png" /><BR /> <BR /> <STRONG>12:&nbsp;</STRONG>Select <STRONG>Value Type</STRONG><BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/12-9.png" /><BR /> <BR /> <STRONG>13: </STRONG>You can also Enter <STRONG>Target</STRONG>, <STRONG>Threshold,</STRONG> and <STRONG>Trend </STRONG>if required<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/13-10.png" /><BR /> <BR /> <STRONG>14: </STRONG>Now, click on <STRONG>Activate and Configure Tile</STRONG><BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/14-6.png" /><BR /> <BR /> <STRONG>15:&nbsp;</STRONG>Once you clicked on <STRONG>Add Tile</STRONG>, <STRONG>Add Tile page</STRONG> opens up, you can choose any tile type as per your requirement.<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/15-4.png" /><BR /> <BR /> <STRONG>16:&nbsp;</STRONG>After clicking on <STRONG>Save</STRONG> <STRONG>and&nbsp;Configure Drill Down</STRONG>, the Drill-Down Configuration Details page will come up.<BR /> <BR /> Now, you have to select an Evaluation and click on Configure Button.<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/16-7.png" /><BR /> <BR /> <STRONG>17:</STRONG> Now, select <STRONG>Measures</STRONG> and <STRONG>Dimensions</STRONG>.<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/17-5.png" /><BR /> <BR /> <STRONG>18</STRONG>: You can select the <STRONG>Visualization Type </STRONG>and <STRONG>Save View</STRONG><BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/18-3.png" /><BR /> <BR /> <STRONG>19:&nbsp;</STRONG>Save the new Configuration<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/19-4.png" /><BR /> <BR /> <STRONG>&nbsp;20:</STRONG> Now, you can go to <STRONG>Tile Catalog</STRONG> in <STRONG>Fiori Launchpad</STRONG> and search for the KPI Tile that was created and Add Tile to Group by Clicking on ‘+’ icon<BR /> <BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2019/12/20-4.png" /><BR /> <BR /> That's it!!! Your new KPI report will be available on your Fiori Launchpad.<BR /> <BR /> &nbsp;<BR /> <BR /> Thanks &amp; Regards,<BR /> <BR /> Rahul Patra 2019-12-13T06:08:12+01:00 https://community.sap.com/t5/technology-blog-posts-by-sap/asug-bi-and-dw-upcoming-influence-councils/ba-p/13428562 ASUG BI and DW Upcoming Influence Councils 2020-01-20T18:26:09+01:00 IngoH https://community.sap.com/t5/user/viewprofilepage/user-id/150260 Some of you might already be aware what ASUG Influence Councils are and some of you might be new to the topic.<BR /> <BR /> An ASUG Influence Council is basically your opportunity to "make your voice heard" and present any requirements and suggestions to the product team from SAP. In addition, you are not doing this just by yourself, but instead you are combining your voice with several other customers together, which then provides it an even stronger voice.<BR /> <BR /> &nbsp;<BR /> <BR /> In case you are interested to join some of these Influence Council, I highly recommend that you join these public calls to hear more about the scope and what type of profile the product team is looking for.<BR /> <BR /> &nbsp;<BR /> <BR /> <A href="https://www.asug.com/events/data-warehouse-cloud-influence-council" target="_blank" rel="nofollow noopener noreferrer">February 03 - Data Warehouse Cloud Influence Council 2020 Launch</A><BR /> <BR /> <A href="https://www.asug.com/events/enterprise-data-warehouse-influence-council" target="_blank" rel="nofollow noopener noreferrer">February 11 - Enterprise Data Warehouse Influence Council 2020 Launch</A><BR /> <BR /> <A href="https://www.asug.com/events/business-intelligence-platform-influence-council" target="_blank" rel="nofollow noopener noreferrer">February 20 - SAP BusinessObjects BI Platform Influence Council 2020 Launch</A><BR /> <BR /> <A href="https://www.asug.com/events/sap-businessobjects-web-intelligence-2020-launch" target="_blank" rel="nofollow noopener noreferrer">February 24 - SAP BusinessObjects Web Intelligence 2020 Launch</A><BR /> <BR /> <A href="https://www.asug.com/events/sap-analytics-cloud-integration-with-bw-influence-council-2020-launch-1" target="_blank" rel="nofollow noopener noreferrer">February 24 - SAP Analytics Cloud Integration with BW Influence Council 2020 Launch</A><BR /> <BR /> <A href="https://www.asug.com/events/sap-analysis-for-microsoft-office-influence-council" target="_blank" rel="nofollow noopener noreferrer">March 12 - SAP Analysis for Microsoft Office Influence Council 2020 Launch</A><BR /> <BR /> <A href="https://www.asug.com/events/mobile-analytics-influence-council" target="_blank" rel="nofollow noopener noreferrer">March 16 - Mobile Analytics Influence Council 2020 Launch</A> 2020-01-20T18:26:09+01:00 https://community.sap.com/t5/enterprise-resource-planning-blog-posts-by-members/s-4hana-analytics-bw-queries-with-or-without-bw-modeling-comparison/ba-p/13438412 S/4HANA Analytics: BW queries with or without BW modeling (comparison) 2020-05-06T15:42:03+02:00 DmitryKuznetsov https://community.sap.com/t5/user/viewprofilepage/user-id/183443 Since I am a proponent of using BW queries even directly in S/4HANA Embedded Analytics, I have done some research whether stirring BW objects into the picture has any major down-sides.<BR /> <BR /> There are two major scenarios of virtual data consumption in BW:<BR /> <UL><BR /> <LI>A BW Query directly on a CDS view with <a href="https://community.sap.com/t5/user/viewprofilepage/user-id/15206">@analytics</a>.dataCategory: #CUBE. I will call it CDS scenario further in the text.</LI><BR /> <LI>A BW Query on a Composite Provider that has an OpenODS that is based on DataSource that is based on CDS (mentioned above). I will call it HCPR scenario.</LI><BR /> </UL><BR /> We all realize that CDS-scenario is much simpler, robust, extendable, easier to support and so on. But... we have some BW fans amongst us that would maybe like to union the live data with something else like benchmarks, external system data, etc., so we have certainly valid reasons for HCPR scenario.<BR /> <BR /> Before we start doing any modeling, let us just measure if there is a penalty of using the triple-sandwich of BW objects. For the sake of real head-to-head comparison let us eliminate various factors that may influence performance like network time (if we have separate instances), additional data union operations, etc. I take just a plain and simple example of standard BW technical content consumed in two different ways. (Don't blame me for using BW technical content here, it is written in the same ABAP CDS nowadays and works in exact same fashion as S/4HANA CDS views).<BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/overview.png" /></P><BR /> So, here we go, 2 queries with exact same set of fields built on top of CDS-view directly on one end and HCPR on the other.<BR /> <BR /> I execute (yes, in RSRT) three very basic tests:<BR /> <UL><BR /> <LI>Very aggregaed, i.e. just Key Figures and nothing in drill-down</LI><BR /> <LI>Slightly aggregated, i.e. just an Object is in drill-down</LI><BR /> <LI>Full details, i.e. all 10 characteristics are in rows</LI><BR /> </UL><BR /> In addition, I execute it on two very different data-sets, 1 being 20k records, the other – 1,6 mil (filtered to 0,4 mil in Query), so we see if there is growth related to data-volume.<BR /> <BR /> &nbsp;<BR /> <TABLE style="height: 782px" width="937"><BR /> <TBODY><BR /> <TR style="height: 42px"><BR /> <TD style="width: 127px;height: 42px" width="127">Scenario</TD><BR /> <TD style="width: 334px;height: 42px" width="348">Small data-set</TD><BR /> <TD style="width: 176px;height: 42px" width="184">Observation</TD><BR /> <TD style="width: 233px;height: 42px" width="184">Big data-set</TD><BR /> <TD style="width: 53px;height: 42px" width="95">Observation</TD><BR /> </TR><BR /> <TR style="height: 257px"><BR /> <TD style="width: 127px;height: 257px" width="127">Very aggregated</TD><BR /> <TD style="width: 334px;height: 257px" width="348"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/01.png" /></TD><BR /> <TD style="width: 176px;height: 257px" width="184"><BR /> <BR /> Nothing major, but Data Manager seems taking +45% more time in HCPR case<BR /> <BR /> &nbsp;<BR /> <BR /> HCPR also implies query regeneration even though I generated it before execution (1/10<SUP>th</SUP> of a second)</TD><BR /> <TD style="width: 233px;height: 257px" width="184"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/04.png" /></TD><BR /> <TD style="width: 53px;height: 257px" width="95">No major impact</TD><BR /> </TR><BR /> <TR style="height: 246px"><BR /> <TD style="width: 127px;height: 246px" width="127">Slightly aggregated</TD><BR /> <TD style="width: 334px;height: 246px" width="348"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/02.png" /></TD><BR /> <TD style="width: 176px;height: 246px" width="184"><BR /> <BR /> Nothing major, but Data Manager seems taking +25% more time and<BR /> <BR /> OLAP Data Transfer +70% more time in HCPR case<BR /> <BR /> &nbsp;<BR /> <BR /> HCPR also implies query regeneration even though I generated it before execution (1/10<SUP>th</SUP> of a second)</TD><BR /> <TD style="width: 233px;height: 246px" width="184"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/05.png" /></TD><BR /> <TD style="width: 53px;height: 246px" width="95">No major impact</TD><BR /> </TR><BR /> <TR style="height: 237px"><BR /> <TD style="width: 127px;height: 237px" width="127">Full details</TD><BR /> <TD style="width: 334px;height: 237px" width="348"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/03.png" /></TD><BR /> <TD style="width: 176px;height: 237px" width="184"><BR /> <BR /> OLAP Data Transfer +8%<BR /> <BR /> Data Manager +6%</TD><BR /> <TD style="width: 233px;height: 237px" width="184"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/06.png" /></TD><BR /> <TD style="width: 53px;height: 237px" width="95">The cumulative effect of DM and OLAP in HCPR case is +20 seconds (15% increase), which is a significant penalty</TD><BR /> </TR><BR /> </TBODY><BR /> </TABLE><BR /> &nbsp;<BR /> <BR /> * a small remark that I am doing it on a system where there are 1,6 mil records<BR /> <BR /> So, to draw a conclusion – I’ve never noticed HCPR-based solution taking over the CDS<BR /> <BR /> There seems to be insignificant penalty for using HCPR in aggregated data-sets, so it is a viable way forward from performance point of view. For bigger, more detailed queries I would do the exact measurement and see if user-expectations will be met.<BR /> <BR /> If you would like to reproduce the same scenario, you may grab a BW system and work with Technical Content, e.g. OLAP statistics CDS views. I used RV_C_OlapStatACube 2020-05-06T15:42:03+02:00 https://community.sap.com/t5/technology-blog-posts-by-members/getting-bex-query-id-in-customer-exit-for-authorization-variables/ba-p/13439125 Getting BEx query ID in customer exit for authorization variables 2020-05-29T17:30:36+02:00 Gourab_Dey https://community.sap.com/t5/user/viewprofilepage/user-id/13422 <H2 id="toc-hId-931778780">Introduction:</H2><BR /> The importing parameter "I_S_RKB1D"(query attribute) is not getting filled for authorization variable(I_STEP=0) in the FM "<STRONG>EXIT_SAPLRRS0_001"(FM for customer exit variable). </STRONG>Recently I have faced this issue in our system and came up with a workaround and thought to share it so that it will be helpful for someone who is having the same issues.<BR /> <H2 id="toc-hId-735265275"><STRONG>Problem Statement:</STRONG></H2><BR /> In customer exit/BAdI for BEx Variable, we often have requirements to get the query related attributes (e.g., ID of the query) so that we can mold our code accordingly. We already have an importing parameter(I_S_RKB1D in case of customer exit) for the query attributes in the FM/Class of the Customer exit/BAdI respectively.<STRONG> The importing parameter works fine for customer exit variables for I_STEP=1 and 2(work fine in the sense, the query id is filled in the imparting parameter). However, for authorization variables(that is when the value of I_STEP is 0), the values are not filled in the query attributes and remain blank.&nbsp;</STRONG><BR /> <BR /> Below screenshot for reference. We can see the variable "I_VNAM" which have the value for authorization variable name, "I_STEP" which have the value "0" which is for authorization check. We can see the value of the variable "I_S_RKB1D-COMPID" is empty, which should have the value of the query being run.<IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/FM-3.png" /><BR /> <BR /> <STRONG>(The above screenshot is from the function module "EXIT_SAPLRRS0_001" which belongs to the customer exit "RSR00001"-BI: Enhancements for Global Variables in Reporting).</STRONG><BR /> <BR /> We can see in the below screenshot, the value of I_STEP is "2" and the query id is populated successfully in the variable "I_S_RKB1D-COMPID".<IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/FM2-1.png" /><BR /> <BR /> So, to summarize the issue, the query ID is not getting populated for Authorization Variable (I_STEP=0) but, it is working fine for the customer exit variable(I_STEP =1 or 2).<BR /> <H2 id="toc-hId-538751770">Proposed Solution:</H2><BR /> There is a standard class "CL_RSBOLAP_SELECTION_OBJECT" which is responsible for calling the customer exit/BAdI for authorization/customer exit variable of BEx. The class has an attribute "IF_RSBOLAP_MD_SELECTOR~N_S_COMPKEY" which stores the query attributes of the query which is being run.<IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/FM3.png" /><BR /> <BR /> So, we can take the help of the "static attribute" of Object-Oriented Programing. We will create a custom class and create a static attribute in the class for the query id. We set the value of query attribute from this class using a "Pre-exit" in the method. Then inside the customer exit/BAdI, we can use our custom class to get the query Id.<BR /> <BR /> Those who are new to Object-Oriented programming, static attributes are the attributes of the class which are not associated with the object of the class directly and exists on per class basis. Which means, there will be only one instance of the attribute for one class and these attribute can be accessed without creating the object of the class. For more information, please refer to the below link.<BR /> <BR /> <A href="https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapclass-data.htm" target="_blank" rel="noopener noreferrer">https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapclass-data.htm</A><BR /> <BR /> As mentioned already, we will be creating a pre-exit in the class of the method. Pre-exit is nothing but the enhancement technique, where we can associate our code to the class which will be called automatically by the system whenever that particular method is called anywhere. As this is the pre-exit, so our code will be called followed by the code of the standard method. For more information, please refer to the below link<BR /> <BR /> <A href="https://wiki.scn.sap.com/wiki/display/ABAP/Enhancement+Framework+-+Class+Enhancements+-+Pre-exit,+Post-exit+and+Overwrite-exit+methods+-+Concept+and+Simple+Scenarios" target="_blank" rel="noopener noreferrer">https://wiki.scn.sap.com/wiki/display/ABAP/Enhancement+Framework+-+Class+Enhancements+-+Pre-exit,+Post-exit+and+Overwrite-exit+methods+-+Concept+and+Simple+Scenarios</A><BR /> <BR /> So, let's start.<BR /> <H2 id="toc-hId-342238265"><STRONG>Step 1: Creation of custom class</STRONG></H2><BR /> Let's create a custom class "ZCL_BW_QUERY_NAME". This class will be used to get the Query Id. This class will have below component:<IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/Class-2.png" /><STRONG>Attribute:</STRONG><BR /> <UL><BR /> <LI>MV_QUERY_ID -&nbsp; To store the query Id</LI><BR /> </UL><BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/Class-2-1.png" /><BR /> <BR /> <STRONG>Methods:</STRONG><BR /> <UL><BR /> <LI><STRONG>SET_QUERY_ID</STRONG> - Sets the query ID - This will be used in the Pre-exit of the method of class "CL_RSBOLAP_SELECTION_OBJECT" to set the value</LI><BR /> <LI><STRONG>GET_QUERY_ID</STRONG> - Gets the query ID - This will be used in customer exit/BAdI to get the query id</LI><BR /> </UL><BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/Class-3.png" /><BR /> <BR /> <STRONG>Method: SET_QUERY_ID</STRONG><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/Class-4.png" /><BR /> <PRE class="language-abap"><CODE> METHOD set_query_id.<BR /> "Set the query id<BR /> mv_query_id = im_v_query_id.<BR /> ENDMETHOD.</CODE></PRE><BR /> <STRONG>Method: GET_QUERY_ID</STRONG><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/Class-5.png" /><BR /> <PRE class="language-abap"><CODE> METHOD get_query_id.<BR /> "Return the query id<BR /> rt_v_query_id = mv_query_id.<BR /> ENDMETHOD.</CODE></PRE><BR /> <H2 id="toc-hId-145724760"><STRONG>Step 2: Creation of pre-exit for setting the value of Query in the custom class</STRONG></H2><BR /> To create the Pre-exit go to the class "CL_RSBOLAP_SELECTION_OBJECT" in class builder(t-code: SE24) and click on "Class--&gt; Enhance" in the menubar.<BR /> <BR /> If you have already an enhancement implementation, then the created enhancement implementation will be shown in the pop-up. Select the implementation to proceed. In my case, there is no existing implementation, so I will go ahead and create one.<IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/Class-7-1.png" /><BR /> <BR /> Once the Enhancement Implementation is created, place the cursor on the method "CREATE_OLAP_OBJECT". Then create a pre-exit method.<IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/Class-8.png" /><BR /> <BR /> Please click on "Yes" in the pop-up if the pop-up is displayed.<BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/Class-9-1.png" /></P><BR /> Now click on the button shown in "Pre-exit" column of the method "CREATE_OLAP_OBJECT".<IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/Class-10.png" /><BR /> <BR /> Please add below code inside the pre-exit of the method method<IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/Class-11.png" /><BR /> <PRE class="language-abap"><CODE>METHOD IPR_ZEHN_QUERY_DETAILS~CREATE_OLAP_OBJECT.<BR /> *"------------------------------------------------------------------------*<BR /> *" Declaration of PRE-method, do not insert any comments here please!<BR /> *"<BR /> *"methods CREATE_OLAP_OBJECT<BR /> *" importing<BR /> *" !I_AUTHCHECK type RS_BOOL<BR /> *" raising<BR /> *" CX_RSBOLAP_UNKNOWN_DATA_PROV .<BR /> *"------------------------------------------------------------------------*<BR /> "Set the query ID <BR /> zcl_bw_query_name=&gt;set_query_id( im_v_query_id = core_object-&gt;if_rsbolap_md_selector~n_s_compkey-compid ).<BR /> ENDMETHOD.</CODE></PRE><BR /> So, we have created the custom class and set the query Id. We are all done. No kidding. Now we can use our method "GET_QUERY_ID" of our class "ZCL_BW_QUERY_NAME" inside customer exit to fetch the query id.<BR /> <H2 id="toc-hId--50788745"><STRONG>Step 3: Get the query id in customer exit&nbsp;</STRONG></H2><BR /> Now, let's go our customer exit for BEx Variable to use our class to get the query id. Let's<IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2020/05/Class-12-3.png" /><BR /> <PRE class="language-abap"><CODE>IF i_s_rkb1d-compid IS INITIAL.<BR /> "Get the query id<BR /> i_s_rkb1d-compid = zcl_bw_query_name=&gt;get_query_id( ).<BR /> ENDIF.</CODE></PRE><BR /> We can call the method "GET_QUERY_ID" of the class "ZCL_BW_QUERY_NAME". We can see we get the name of the query in the which is being run. Please note the value of "I_STEP" is "0", which confirms we are dealing with the authorization variable.<BR /> <H2 id="toc-hId--247302250"><STRONG>Conclusion:</STRONG></H2><BR /> As we saw, we had an issue to get the Query Name for the authorization variable(I_STEP=0). The I_S_RKB1D-COMPID was blank. However, for I_STEP=1 or 2, there is no issues and the variable "I_S_RKB1D-COMPID" is filled correctly. To overcome the issue, we have created a pre-exit in the method "CREATE_OLAP_OBJECT" in the class to set the query id in the custom class "ZCL_BW_QUERY_NAME". Then, we used the class "ZCL_BW_QUERY_NAME" in the customer exit(for BAdI also it will work fine) to get the name of the query. Cheers! 2020-05-29T17:30:36+02:00 https://community.sap.com/t5/technology-blog-posts-by-members/how-to-recover-objects-not-visible-within-infoarea/ba-p/13541917 How to Recover Objects not visible within InfoArea 2021-12-31T09:20:53+01:00 siddhesh_kadam https://community.sap.com/t5/user/viewprofilepage/user-id/775176 In this Blog Post we will understand how to handle a situation when Objects are not visible within InfoArea.<BR /> <BR /> &nbsp;<BR /> <BR /> <SPAN style="text-decoration: underline"><STRONG>Problem Statement :</STRONG></SPAN><BR /> <BR /> Often when there are Role level and authorization related Changes from Basis or Security Team on User ID, User's might not be able to see the Modelling Objects and Query related Elements within the InfoArea and it creates a kind of confusion when no object is visible to work upon which used to exists before.<BR /> <BR /> This issue often occurs due to Shared Buffer that exists on Application Server.<BR /> <BR /> &nbsp;<BR /> <BR /> Lets try to Understand how we can resolve this Issue.<BR /> <BR /> <SPAN style="text-decoration: underline"><STRONG>Solution</STRONG></SPAN> :<BR /> <OL><BR /> <LI>Go to T-Code : <STRONG>RSOSM</STRONG>, which is often used for BW Search for SAP HANA Maintenance.</LI><BR /> </OL><BR /> <P style="overflow: hidden;margin-bottom: 0px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2021/12/RSOSM.png" height="344" width="461" /></P><BR /> &nbsp;<BR /> <BR /> 2.&nbsp; You will get the above Screen , Scroll to the bottom of the screen and click on "<STRONG>Configure BW Search</STRONG>" , You will be presented with the below Screen.<BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2021/12/configure_bw_search.png" height="321" width="505" /></P><BR /> &nbsp;<BR /> <BR /> 3. Once you are within "<STRONG>Configure BW Search</STRONG>" Section, You can see the status of your Shared Buffer as "<STRONG>Shared Buffer is Filled</STRONG>" and a Delete Icon besides that Status.<BR /> <BR /> &nbsp;<BR /> <BR /> 4. Click on that Delete Icon , it will delete your Shared Buffer and the Status will be changed to "<STRONG>Shared Buffer is not filled</STRONG>" as below.<BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2021/12/Pic3.png" height="113" width="508" /></P><BR /> &nbsp;<BR /> <BR /> 5. Now , go back to your InfoArea and hit Refresh , You will be able to see all your Modelling Objects and Query related Elements back within InfoArea.<BR /> <BR /> &nbsp;<BR /> <BR /> &nbsp;<BR /> <BR /> <SPAN style="text-decoration: underline"><STRONG>Conclusion</STRONG></SPAN>:<BR /> <BR /> &nbsp;<BR /> <BR /> By Following the above steps you will be able to clear up your shared buffer and able to see the missing Objects back within your InfoArea.<BR /> <BR /> &nbsp;<BR /> <BR /> — Sources of the pictures are screenshots I have taken from SAP system and no image is taken from the internet.<BR /> <BR /> &nbsp;<BR /> <BR /> Hope the above Information added a bit of value to your time and knowledge .<BR /> <BR /> If you enjoyed reading it do give it a Like and would be happy to read your feedback in the comments section.<BR /> <BR /> &nbsp;<BR /> <BR /> &nbsp;<BR /> <BR /> &nbsp;<BR /> <BR /> &nbsp;<BR /> <BR /> &nbsp; 2021-12-31T09:20:53+01:00 https://community.sap.com/t5/technology-blog-posts-by-members/obtaining-mdx-data-in-sapui5-via-xmla/ba-p/13524695 Obtaining MDX data in SAPUI5 via XMLA 2022-02-12T15:06:04+01:00 ThorstenHoefer https://community.sap.com/t5/user/viewprofilepage/user-id/343 <H2 id="toc-hId-959340477">1. Introduction</H2><BR /> SAP UI5 developers often struggle with obtaining data from the backend. The common way to access backend data is the OData protocol.<BR /> <BR /> The OData interface provides such advantages as selecting. binding, filtering and sorting data.<BR /> On the other hand, there are some flaws in OData protocol as to handling OLAP Data for analysis.<BR /> <BR /> MDX (Multidimensional Expressions) has established itself as a common query language for OLAP data. XMLA (XML for analysis) is an open standard for requesting OLAP Data with MDX.<BR /> <BR /> Below find my description of&nbsp; how MDX Data can be obtained using XMLA in javascript for SAP UI5.<BR /> <BR /> SAP offers the ISCF node /sap/bw/xml/soap/xmla/ as a web service data provider interface.<BR /> <BR /> This web service offers two methods: <STRONG>Execute</STRONG> and <STRONG>Discover</STRONG>. In the following article is the focus on the <STRONG>Execute </STRONG>Method.<BR /> <BR /> A JQuery post request will send the MDX query envelop in a XML structure as a web service request.<BR /> <BR /> &nbsp;<BR /> <H2 id="toc-hId-762826972">2. Create and test the MDX Query</H2><BR /> Transaction MDXTEST allows us to create, test and execute a MDX Query.<BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2022/02/TA_MDX.png" /></P><BR /> The MDX query can be directly executed.<BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2022/02/mdx_result.png" /></P><BR /> <P class="image_caption" style="text-align: center;font-style: italic">Execution of MDX Query</P><BR /> &nbsp;<BR /> <BR /> In this example, I used a Query which is provided in the trial SAP 7.52 Developer Edition.<BR /> <BR /> <A href="https://developers.sap.com/trials-downloads.html?search=7.52" target="_blank" rel="noopener noreferrer">https://developers.sap.com/trials-downloads.html?search=7.52</A><BR /> <BR /> MDX example<BR /> <PRE class="language-markup"><CODE>SELECT<BR /> NON EMPTY<BR /> { [48CSWO6CA6TXXHDU2Q35OLJW0].Members }<BR /> ON COLUMNS,<BR /> NON EMPTY<BR /> { [0D_FC_COUN 0D_FC_COUN_H001].Members }<BR /> DIMENSION PROPERTIES<BR /> LEVEL_NUMBER<BR /> ON ROWS<BR /> FROM<BR /> [0D_FC_C02/0D_FC_AE_EOIBV_Q001]</CODE></PRE><BR /> Key Figures are selected in the columns, the Country hierarchy is selected in the rows.<BR /> Additionally the property of the hierarchy level is included in the row dimension.<BR /> <BR /> &nbsp;<BR /> <H2 id="toc-hId-566313467">3. Preparing the MDX Statement for the XMLA call</H2><BR /> The MDX statement needs to be embedded in a xml structure for the web service post request.<BR /> <PRE class="language-javascript"><CODE> var _sRequest = `<BR /> &lt;Execute&gt;<BR /> &lt;Command&gt;<BR /> &lt;Statement&gt;<BR /> ${_sMdx}<BR /> &lt;/Statement&gt;<BR /> &lt;Properties&gt;<BR /> &lt;PropertyList&gt;<BR /> &lt;Format&gt;&lt;/Format&gt;<BR /> &lt;/PropertyList&gt;<BR /> &lt;/Properties&gt;<BR /> &lt;/Command&gt;<BR /> &lt;/Execute&gt;`;</CODE></PRE><BR /> The webservice request will be initialized by the JQuery post request to the endpoint.<BR /> <PRE class="language-javascript"><CODE> $.post("/sap/bw/xml/soap/xmla/Execute",_sRequest , _fProcessData); </CODE></PRE><BR /> <H2 id="toc-hId-369799962">4. Processing the XMLA response</H2><BR /> _fProcessData is the callback Method for processing the response of the request.<BR /> <BR /> The response can be analysed in the debugger.<BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2022/02/soap_response.png" /></P><BR /> From the response, the output in Axis0, Axis1 and CellData is relevant to obtain the MDX data..<BR /> <BR /> Axis0 delivers the columns Information about the key figure.<BR /> The element Caption contains the key figure name in the text node.<BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2022/02/Axis0.png" /></P><BR /> Axis1 contains the rows with the requested attribute of the hierarchy level of the row dimension.<BR /> The first attribute of the member, here "Hierarchy" contains the technical name of the row column.<BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2022/02/axis1-1.png" /></P><BR /> <P class="image_caption" style="text-align: center;font-style: italic">Axis 1</P><BR /> &nbsp;<BR /> <BR /> At first the response for the root element needs to be checked. If this element is not present, it indicates an error present. The error message will be passed in the rejection of the promise.<BR /> <PRE class="language-javascript"><CODE> var _oRoot = oData.querySelector("ExecuteResponse&gt;return&gt;root")<BR /> if(!_oRoot){<BR /> debugger;<BR /> var _sError =<BR /> oData.querySelector("Error")?.getAttribute("Description") || <BR /> "undefined Error";<BR /> <BR /> _fReject(_sError)<BR /> return;<BR /> }</CODE></PRE><BR /> Column nodes will be extracted from the Axis0 and the row nodes from Axis1<BR /> <PRE class="language-javascript"><CODE>_ColumnNodes = _oRoot.querySelectorAll("Axes&gt;[name='Axis0']&gt;Tuples&gt;Tuple");<BR /> _RowNodes = _oRoot.querySelectorAll("Axes&gt;[name='Axis1']&gt;Tuples&gt;Tuple");</CODE></PRE><BR /> Data nodes are extracted from CellData<BR /> <PRE class="language-javascript"><CODE>_DataNodes = _oRoot.querySelectorAll("CellData&gt;Cell");</CODE></PRE><BR /> The rows of the output table will be determined from the row nodes, including the requested properties like "hierarchy level". We assume that the properties always occur starting from position 6 from the child nodes. If the technical name (remember 1. attribute of Member) contains blanks, replace them with one underscore.<BR /> <PRE class="language-javascript"><CODE> _RowNodes.forEach(pRow=&gt;{<BR /> let _oMemberNodes = pRow.querySelectorAll("Member")<BR /> let _aRow = [];<BR /> _oMemberNodes.forEach(pMember=&gt;{<BR /> let _sName = pMember.attributes[0].value.replace(/\s+/g,"_");<BR /> _aRow[_sName] = pMember.querySelector("Caption").textContent;<BR /> pMember.querySelectorAll(":nth-child(n+6)")<BR /> .forEach(pProperty=&gt;_aRow[_sName+pProperty.nodeName] = pProperty.textContent); <BR /> })<BR /> _aRowName.push(_aRow);<BR /> });</CODE></PRE><BR /> Keyfigures will be determine by text node of the caption element.<BR /> <PRE class="language-javascript"><CODE> _ColumnNodes.forEach(pRow=&gt;{<BR /> let _oMemberNodes = pRow.querySelectorAll("Member")<BR /> _oMemberNodes.forEach(pMember=&gt;{<BR /> _aColName.push(pMember.querySelector("Caption").textContent);<BR /> })<BR /> });</CODE></PRE><BR /> <SPAN style="font-size: 1rem">Finally the data has to be divided between the rows and columns</SPAN><BR /> <PRE class="language-javascript"><CODE> _iCntRow = _aRowName.length; <BR /> _iCntCol = _aColName.length;<BR /> <BR /> _DataNodes.forEach((pData,pIndex)=&gt;{<BR /> let _sValue = pData.querySelector("Cell&gt;Value").textContent;<BR /> let _iRow = Math.trunc(pIndex / _iCntCol)<BR /> let _iCol = pIndex % _iCntCol;<BR /> _aRowName[_iRow][_aColName[_iCol]] = _sValue<BR /> }); </CODE></PRE><BR /> <H2 id="toc-hId-173286457"></H2><BR /> <H2 id="toc-hId--23227048">5. Binding the OLAP output to the Datamodel</H2><BR /> As a result a promise is returned. Data from this promise can be bound to the model.<BR /> <PRE class="language-abap"><CODE> this.getMdxData(this.getMdx())<BR /> .then(aData=&gt;{<BR /> this.getView().getModel("viewModel").setProperty("/mdxData",aData);<BR /> })<BR /> .catch((oError)=&gt;{<BR /> debugger<BR /> })</CODE></PRE><BR /> &nbsp;<BR /> <H3 id="toc-hId--90657834">5.1 Result of the MDX Query in SAP UI5</H3><BR /> After obtaining data from the XMLA web service, it can be bound directly to a table.<BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2022/02/result.png" /></P><BR /> <P class="image_caption" style="text-align: center;font-style: italic">Final result</P><BR /> <BR /> <H2 id="toc-hId--416254058">6. Conclusion</H2><BR /> XMLA enables SAP UI5 developers to benefit from the dynamics of<BR /> Multidimensional Expressions (MDX).<BR /> <BR /> Multidimensional Expressions (MDX) is the query language you use to work with and retrieve multidimensional data. This includes the definition of calculated members, named sets, scoped assignments and key performance indicators (KPIs).<BR /> <BR /> MDX offers the flexibility to fetch data, pivot data in dynamic structures based on your needs,<BR /> without restriction of structured data types in the backend.<BR /> <BR /> With MDX you use the flexibility of your multidimensional OLAP queries.<BR /> <BR /> Thank you for reading this blog post. I want to encourage you to share your knowlege about SAPUI5 using this tag link <A href="https://answers.sap.com/tags/500983881501772639608291559920477" target="_blank" rel="noopener noreferrer">https://answers.sap.com/tags/500983881501772639608291559920477</A><BR /> <BR /> &nbsp;<BR /> <H3 id="toc-hId--483684844">Appendix: Project Code</H3><BR /> Three files are required to test the project_<BR /> <BR /> zxmla/index.html<BR /> zxmla/Test.view.xml<BR /> zxmla/Test.controller.xml<BR /> <PRE class="language-markup"><CODE>File: zxmla/index.html<BR /> <BR /> &lt;!DOCTYPE html&gt;<BR /> &lt;html&gt;<BR /> &lt;head&gt;<BR /> &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;<BR /> &lt;meta charset="utf-8"&gt;<BR /> &lt;title&gt;XMLA-Test&lt;/title&gt;<BR /> &lt;script<BR /> <BR /> id="sap-ui-bootstrap"<BR /> src="resources/sap-ui-core.js" <BR /> data-sap-ui-theme="sap_bluecrystal"<BR /> data-sap-ui-libs="sap.m"<BR /> data-sap-ui-compatVersion="edge"<BR /> data-sap-ui-preload="async" <BR /> data-sap-ui-resourceroots='{<BR /> "zxmla": "./"<BR /> }' &gt;<BR /> &lt;/script&gt;<BR /> &lt;script&gt;<BR /> sap.ui.getCore().attachInit(function () {<BR /> sap.ui.xmlview({<BR /> viewName : "zxmla.Test"<BR /> }).placeAt("content");<BR /> });<BR /> &lt;/script&gt;<BR /> &lt;/head&gt;<BR /> &lt;body class="sapUiBody" id="content"&gt;<BR /> &lt;/body&gt;<BR /> &lt;/html&gt;</CODE></PRE><BR /> <PRE class="language-markup"><CODE>File: zxmla/Test.view.xml<BR /> <BR /> &lt;core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" <BR /> xmlns="sap.m"<BR /> controllerName="zxmla.Test"&gt;<BR /> <BR /> &lt;Table id="idProductsTable" items="{viewModel&gt;/mdxData}"&gt;<BR /> &lt;headerToolbar&gt;<BR /> &lt;Toolbar&gt;<BR /> &lt;content&gt;<BR /> &lt;Title text="Products" level="H2"/&gt;<BR /> &lt;ToolbarSpacer /&gt;<BR /> &lt;Button text="Go" press=".onPress"/&gt;<BR /> &lt;/content&gt;<BR /> &lt;/Toolbar&gt;<BR /> &lt;/headerToolbar&gt;<BR /> &lt;columns&gt;<BR /> &lt;Column&gt;&lt;Text text="Level" /&gt;&lt;/Column&gt;<BR /> &lt;Column&gt;&lt;Text text="Land" /&gt;&lt;/Column&gt;<BR /> &lt;Column&gt;&lt;Text text="konsolidiertes Netto" /&gt;&lt;/Column&gt;<BR /> &lt;Column&gt;&lt;Text text="netto Umsatz" /&gt;&lt;/Column&gt;<BR /> &lt;/columns&gt;<BR /> &lt;items&gt;<BR /> &lt;ColumnListItem&gt;<BR /> &lt;cells&gt;<BR /> &lt;Text text="{viewModel&gt;0D_FC_COUN_0D_FC_COUN_H001LEVEL_NUMBER}" /&gt;<BR /> &lt;Text text="{viewModel&gt;0D_FC_COUN_0D_FC_COUN_H001}" /&gt;<BR /> &lt;Text text="{viewModel&gt;Konsolidierter Netto}" /&gt;<BR /> &lt;Text text="{viewModel&gt;Nettoumsatz}" /&gt;<BR /> &lt;/cells&gt;<BR /> &lt;/ColumnListItem&gt;<BR /> &lt;/items&gt;<BR /> &lt;/Table&gt;<BR /> &lt;/core:View&gt;</CODE></PRE><BR /> <PRE class="language-abap"><CODE>File: zxmla/Test.controller.js<BR /> <BR /> sap.ui.define([<BR /> "sap/ui/core/mvc/Controller",<BR /> "sap/ui/model/json/JSONModel"<BR /> ], function(Controller, JSONModel) {<BR /> "use strict";<BR /> <BR /> return Controller.extend("zxmla.Test", {<BR /> <BR /> <BR /> onInit: function() { <BR /> var _oModel = new JSONModel({mdxData: []});<BR /> this.getView().setModel(_oModel, "viewModel");<BR /> },<BR /> <BR /> onPress: function(oEvent){<BR /> this.getMdxData(this.getMdx())<BR /> .then(aData=&gt;{<BR /> debugger<BR /> this.getView().getModel("viewModel").setProperty("/mdxData",aData);<BR /> <BR /> })<BR /> .catch((oError)=&gt;{<BR /> debugger<BR /> })<BR /> },<BR /> getMdxData: function(sMdx){<BR /> var _fResolve, _fReject, <BR /> _oPromise = new Promise((resolve,reject)=&gt;{<BR /> _fResolve = resolve;<BR /> _fReject = reject;<BR /> });<BR /> var _sMdx = this.getMdx();<BR /> var _sRequest = `<BR /> &lt;Execute&gt;<BR /> &lt;Command&gt;<BR /> &lt;Statement&gt;<BR /> ${_sMdx}<BR /> &lt;/Statement&gt;<BR /> &lt;Properties&gt;<BR /> &lt;PropertyList&gt;<BR /> &lt;Format&gt;&lt;/Format&gt;<BR /> &lt;/PropertyList&gt;<BR /> &lt;/Properties&gt;<BR /> &lt;/Command&gt;<BR /> &lt;/Execute&gt;`;<BR /> <BR /> var _fProcessData = function(oData, sStatus){<BR /> <BR /> var _oRoot = oData.querySelector("ExecuteResponse&gt;return&gt;root")<BR /> if(!_oRoot){<BR /> debugger;<BR /> var _sError =<BR /> oData.querySelector("Error")?.getAttribute("Description") || <BR /> "undefined Error";<BR /> <BR /> _fReject(_sError)<BR /> return;<BR /> }<BR /> <BR /> var _aColName = [], _iCntRow = 0, _iCntCol = 0;<BR /> var _aRowName = []<BR /> var _ColumnNodes =<BR /> _oRoot.querySelectorAll("Axes&gt;[name='Axis0']&gt;Tuples&gt;Tuple")<BR /> var _RowNodes = <BR /> _oRoot.querySelectorAll("Axes&gt;[name='Axis1']&gt;Tuples&gt;Tuple")<BR /> var _DataNodes = _oRoot.querySelectorAll("CellData&gt;Cell")<BR /> <BR /> _RowNodes.forEach(pRow=&gt;{<BR /> let _oMemberNodes = pRow.querySelectorAll("Member")<BR /> let _aRow = [];<BR /> _oMemberNodes.forEach(pMember=&gt;{<BR /> let _sName = pMember.attributes[0].value.replace(/\s+/g,"_");<BR /> _aRow[_sName] = pMember.querySelector("Caption").textContent;<BR /> pMember.querySelectorAll(":nth-child(n+6)")<BR /> .forEach(pProperty=&gt;_aRow[_sName+pProperty.nodeName] = pProperty.textContent); <BR /> })<BR /> _aRowName.push(_aRow);<BR /> });<BR /> <BR /> _ColumnNodes.forEach(pRow=&gt;{<BR /> let _oMemberNodes = pRow.querySelectorAll("Member")<BR /> _oMemberNodes.forEach(pMember=&gt;{<BR /> _aColName.push(pMember.querySelector("Caption").textContent);<BR /> })<BR /> });<BR /> <BR /> _iCntRow = _aRowName.length; <BR /> _iCntCol = _aColName.length;<BR /> <BR /> _DataNodes.forEach((pData,pIndex)=&gt;{<BR /> let _sValue = pData.querySelector("Cell&gt;Value").textContent;<BR /> let _iRow = Math.trunc(pIndex / _iCntCol)<BR /> let _iCol = pIndex % _iCntCol;<BR /> _aRowName[_iRow][_aColName[_iCol]] = _sValue<BR /> }); <BR /> debugger<BR /> _fResolve(_aRowName)<BR /> // check _aRowName<BR /> };<BR /> <BR /> $.post("/sap/bw/xml/soap/xmla/Execute",_sRequest , _fProcessData); <BR /> return _oPromise <BR /> },<BR /> <BR /> getMdx: function(){<BR /> var _sMdx =<BR /> `SELECT<BR /> NON EMPTY<BR /> { [48CSWO6CA6TXXHDU2Q35OLJW0].Members }<BR /> ON COLUMNS,<BR /> NON EMPTY<BR /> { [0D_FC_COUN 0D_FC_COUN_H001].Members }<BR /> DIMENSION PROPERTIES<BR /> LEVEL_NUMBER<BR /> ON ROWS<BR /> FROM<BR /> [0D_FC_C02/0D_FC_AE_EOIBV_Q001]`<BR /> return _sMdx;<BR /> }<BR /> <BR /> });<BR /> });</CODE></PRE> 2022-02-12T15:06:04+01:00 https://community.sap.com/t5/technology-blog-posts-by-sap/embedded-analytics-with-abap-cloud-the-multidimensional-cube-part-2/ba-p/13554045 Embedded Analytics with ABAP Cloud – The Multidimensional Cube (Part 2) 2023-03-31T03:23:36+02:00 fabianfellhauer https://community.sap.com/t5/user/viewprofilepage/user-id/354017 <SPAN data-contrast="auto">Cheers ABAP folks!</SPAN><SPAN data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <BR /> <SPAN data-contrast="auto">The multidimensional cube view is the heart of the analytical model in ABAP CDS. In this blog post, I want to give you an insight into the modeling patterns of analytical cube views and their role within the ABAP Application Server.</SPAN><SPAN data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <BR /> <SPAN data-contrast="auto">New to analytics? Then I urgently recommend that you read the previous part of this blog post series:</SPAN> <A style="font-size: 1rem" href="https://blogs.sap.com/2022/11/30/embedded-analytics-with-abap-cloud-a-brief-overview-part-1/" target="_blank" rel="noopener noreferrer">Embedded Analytics with ABAP Cloud – A Brief Overview (Part 1)</A><BR /> <BR /> &nbsp;<BR /> <H1 id="toc-hId-833022400">What Is a Multidimensional Cube?</H1><BR /> <SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)">A multidimensional cube </SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)">view</SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)"> spans up all the dimensions</SPAN>&nbsp;<SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)">that </SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)">exist for a specific data set </SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)">to</SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)"> which an analytical reporting is applied. A sales order, for example, may contain dimensional attributes </SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)">such as</SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)"> an order date, an associated product, as well as a business partner reference. Querying the multidimensional cube with </SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)">parameterization of specific</SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)"> dimensions returns an aggregated result for the matching cells </SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)">that</SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)"> represent a measure, </SPAN><SPAN class="NormalTextRun ContextualSpellingAndGrammarErrorV2Themed SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)">e.g.</SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)"> the turnover, in the multi</SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)">-</SPAN><SPAN class="NormalTextRun SCXW180760360 BCX0" data-ccp-parastyle="Normal (Web)">dimensional model:</SPAN><BR /> <PRE><CODE>f(Dimension 1, Dimension 2, Dimension 3) -&gt; Measure<BR /> <BR /> Example: f('Targot Corp.', '2023-02-25', 'Lemonade') -&gt; turnover of this particular company</CODE></PRE><BR /> <IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2023/03/Cube-Pruning.png" /><BR /> <BR /> <SPAN class="TextRun SCXW127570977 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW127570977 BCX0" data-ccp-parastyle="Normal (Web)">Pruning single dimensions </SPAN><SPAN class="NormalTextRun SCXW127570977 BCX0" data-ccp-parastyle="Normal (Web)">whe</SPAN><SPAN class="NormalTextRun SCXW127570977 BCX0" data-ccp-parastyle="Normal (Web)">n</SPAN><SPAN class="NormalTextRun SCXW127570977 BCX0" data-ccp-parastyle="Normal (Web)"> querying a multidimensional data set leads to the aggregation of the pruned dimension:</SPAN></SPAN><SPAN class="EOP SCXW127570977 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <PRE><CODE>f(Dimension 2, Dimension 3) -&gt; Aggregation of Measure over Dimension 1<BR /> <BR /> Example: f('2023-02-25', 'Lemonade') -&gt; sum of turnovers of all companies</CODE></PRE><BR /> <SPAN class="TextRun SCXW142908008 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)">Based on </SPAN><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)">th</SPAN><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)">is</SPAN><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)">, a multidimensional cube always provides the overall data basis for your analytical reporting</SPAN><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)">.</SPAN><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)"> This </SPAN><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)">can</SPAN><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)"> include </SPAN><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)">defini</SPAN><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)">ng</SPAN><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)"> foreign key relationships to dimensions based on dimensional attributes for further data exploration, defaulting for aggregations, </SPAN><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)">and defining</SPAN><SPAN class="NormalTextRun SCXW142908008 BCX0" data-ccp-parastyle="Normal (Web)"> text relationships for labeling your attributes.</SPAN></SPAN><SPAN class="EOP SCXW142908008 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <H1 id="toc-hId-636508895">Multidimensional Reporting on Transactional Data</H1><BR /> <SPAN class="TextRun SCXW147682123 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">Ok, enough theor</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">y</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">. Let’s get concrete: Imagine </SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">you run</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> a company</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> that</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> ships soft drinks to </SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">retailers,</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> and </SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">you have</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> the following given transactional data model: A sales order is defined </SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">at the</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> header level with references to the paying business partner, the business partner to </SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">whom</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> the products </SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">are</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> to be shipped</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">,</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">&nbsp;</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">and an order date. </SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">In addition</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">, each sales order </SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">can</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> consist of multiple sales order items</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> that</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> have priced products, as well as a quantity assigned. Additionally, each sales order </SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">must</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> be paid</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> for</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">. All</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> these</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> details are represented by different CDS </SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">e</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)">ntities</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> that are</SPAN><SPAN class="NormalTextRun SCXW147682123 BCX0" data-ccp-parastyle="Normal (Web)"> linked by a relational data model.</SPAN></SPAN><SPAN class="EOP SCXW147682123 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2023/03/Transactional-Model.png" /></P><BR /> <P class="image_caption" style="text-align: center;font-style: italic">The Transactional Model - Represented as Relational Data Model</P><BR /> <SPAN class="TextRun SCXW30825004 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)">In the corresponding transactional UI service, all </SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)">this </SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)">relational data is properly </SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)">joined</SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)"> so the transactional business user can </SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)">quickly act</SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)"> on specific sales orders. However, </SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)">it</SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)"> seems </SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)">a bit</SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)"> challenging </SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)">to get a summary of last quarter’s </SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)">sales </SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)">with this data representation, </SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)">doesn’t</SPAN><SPAN class="NormalTextRun SCXW30825004 BCX0" data-ccp-parastyle="Normal (Web)"> it?</SPAN></SPAN><SPAN class="EOP SCXW30825004 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2023/03/Transactional-UI.png" /></P><BR /> <P class="image_caption" style="text-align: center;font-style: italic">The Transactional Model - User Interface</P><BR /> <BR /> <H1 id="toc-hId-439995390">Preparing your Data Model Is Key</H1><BR /> <SPAN class="TextRun SCXW220625224 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW220625224 BCX0" data-ccp-parastyle="Normal (Web)">Therefore, </SPAN><SPAN class="NormalTextRun SCXW220625224 BCX0" data-ccp-parastyle="Normal (Web)">it is recommended that you </SPAN><SPAN class="NormalTextRun SCXW220625224 BCX0" data-ccp-parastyle="Normal (Web)">prepare</SPAN><SPAN class="NormalTextRun SCXW220625224 BCX0" data-ccp-parastyle="Normal (Web)"> your transactional data model before building an analytical model on top of it. I’ll show you how to do </SPAN><SPAN class="NormalTextRun SCXW220625224 BCX0" data-ccp-parastyle="Normal (Web)">this</SPAN><SPAN class="NormalTextRun SCXW220625224 BCX0" data-ccp-parastyle="Normal (Web)">.</SPAN></SPAN><SPAN class="EOP SCXW220625224 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <H2 id="toc-hId-372564604">Identify Relevant Data Sources</H2><BR /> <SPAN class="TextRun SCXW225269429 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)">First, ask yourself: What are the relevant </SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)">metrics</SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)"> that I want to report </SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)">on to best run</SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)"> my business? In our current transactional sales order model</SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)">, there are several possible</SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)"> analytical use cases. Let’s focus on reporting </SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)">on </SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)">the </SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)">revenue</SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)"> of sales order items</SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)"> sold</SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)"> and</SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)"> the payment </SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)">history</SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)">. The following relational CDS </SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)">e</SPAN><SPAN class="NormalTextRun SCXW225269429 BCX0" data-ccp-parastyle="Normal (Web)">ntities are involved in this reporting:</SPAN></SPAN><SPAN class="EOP SCXW225269429 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <UL><BR /> <LI>Sales Order Item(s)</LI><BR /> <LI>Payment(s)</LI><BR /> </UL><BR /> <H2 id="toc-hId-176051099">Identify Relevant Relationships</H2><BR /> <SPAN class="TextRun SCXW260562778 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">Isolated reporting on th</SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">e</SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">se CDS </SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">e</SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">ntities would be easy to </SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">implement but</SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)"> wouldn’t provide </SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">much value to</SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)"> our business. Therefore, it's essential to identify the relevant relationships between th</SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">e</SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">se CDS </SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">e</SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">ntities and to take CDS </SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">e</SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">ntities in between into the reporting scope. The following CDS </SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">e</SPAN><SPAN class="NormalTextRun SCXW260562778 BCX0" data-ccp-parastyle="Normal (Web)">ntity is added to our reporting scope:</SPAN></SPAN><SPAN class="EOP SCXW260562778 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <UL><BR /> <LI>Sales Order(s)</LI><BR /> </UL><BR /> <H2 id="toc-hId--20462406">Span up Multidimensional Data Basis</H2><BR /> <SPAN class="TextRun SCXW204985564 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">Working </SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">at</SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)"> a conceptual level is </SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">certainly</SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)"> fun for all </SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">the </SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">theorists out there. However, at this point we need to hit the keys and span up our multidimensional data model&nbsp;</SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">directly on</SPAN> <SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">to</SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">p of</SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">&nbsp;</SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">our relational data model. </SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">To do </SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">this</SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">, it's important to</SPAN><SPAN class="NormalTextRun SCXW204985564 BCX0" data-ccp-parastyle="Normal (Web)">:</SPAN></SPAN><SPAN class="EOP SCXW204985564 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <OL><BR /> <LI>Preserve the unique keys across all involved CDS entities</LI><BR /> <LI>Unite your measure-based data sets by using UNIONs in CDS entities</LI><BR /> <LI>Resolve to-many-relationships by denormalization via dimension-based relations</LI><BR /> </OL><BR /> <SPAN class="TextRun SCXW12841610 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW12841610 BCX0" data-ccp-parastyle="Normal (Web)">In our example, the plain multidimensional data basis could be achieved with the following implementation of a CDS </SPAN><SPAN class="NormalTextRun SCXW12841610 BCX0" data-ccp-parastyle="Normal (Web)">e</SPAN><SPAN class="NormalTextRun SCXW12841610 BCX0" data-ccp-parastyle="Normal (Web)">ntity:</SPAN></SPAN><SPAN class="EOP SCXW12841610 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <PRE class="language-sql"><CODE>@EndUserText.label: 'Sales Order Cube Basis'<BR /> define view entity P_DD_TSM_ANA_SALESORDER<BR /> as select from sdd_tsm_ana_soi as SalesOrderItem<BR /> left outer join SDD_TSM_ANA_SO as SalesOrder<BR /> on SalesOrder.sales_order_id = SalesOrderItem.sales_order_id<BR /> <BR /> {<BR /> key SalesOrder.sales_order_id as SalesOrder,<BR /> key SalesOrderItem.sales_order_item_id as SalesOrderItem,<BR /> key abap.raw'00000000000000000000000000000000' as Payment<BR /> }<BR /> <BR /> union all select from SDD_TSM_ANA_PAYM as Payment<BR /> left outer join SDD_TSM_ANA_SO as SalesOrder<BR /> on SalesOrder.sales_order_id = Payment.sales_order<BR /> <BR /> {<BR /> key SalesOrder.sales_order_id as SalesOrder,<BR /> key abap.raw'00000000000000000000000000000000' as SalesOrderItem,<BR /> key Payment.payment_id as Payment<BR /> }</CODE></PRE><BR /> &nbsp;<BR /> <BR /> <SPAN class="TextRun SCXW255917638 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)">This CDS </SPAN><SPAN class="NormalTextRun CommentStart SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)">v</SPAN><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)">iew </SPAN><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)">helps to span up the data basis for our multidimensional reporting. </SPAN><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)">Proper key</SPAN><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)"> handling is essential here. Further attributes </SPAN><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)">can</SPAN><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)"> be added later in the cube again. Key elements </SPAN><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)">that do </SPAN><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)">not </SPAN><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)">bel</SPAN><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)">o</SPAN><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)">ng</SPAN><SPAN class="NormalTextRun SCXW255917638 BCX0" data-ccp-parastyle="Normal (Web)"> to the reported data set are initialized with corresponding default values. The result of a data preview should then look like the following picture:</SPAN></SPAN><SPAN class="EOP SCXW255917638 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2023/03/Data-Preview.png" /></P><BR /> <P class="image_caption" style="text-align: center;font-style: italic">Data preview of the cubes data basis</P><BR /> <SPAN class="TextRun SCXW101775143 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW101775143 BCX0" data-ccp-parastyle="Normal (Web)">Each data record contains a reference to </SPAN><SPAN class="NormalTextRun SCXW101775143 BCX0" data-ccp-parastyle="Normal (Web)">either</SPAN><SPAN class="NormalTextRun SCXW101775143 BCX0" data-ccp-parastyle="Normal (Web)"> a concrete sales order item or to a concrete payment. </SPAN><SPAN class="NormalTextRun SCXW101775143 BCX0" data-ccp-parastyle="Normal (Web)">Each record also contains a reference to a specific </SPAN><SPAN class="NormalTextRun SCXW101775143 BCX0" data-ccp-parastyle="Normal (Web)">sales order header.</SPAN></SPAN><SPAN class="EOP SCXW101775143 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <BR /> &nbsp;<BR /> <H1 id="toc-hId--346058630">Slice and Dice Your Cube</H1><BR /> <SPAN class="TextRun SCXW154017958 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">After </SPAN><SPAN class="NormalTextRun SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">preparing</SPAN><SPAN class="NormalTextRun SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)"> our data basis, we now have a fine</SPAN><SPAN class="NormalTextRun SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">-</SPAN><SPAN class="NormalTextRun SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">granular reporting of all available data records</SPAN><SPAN class="NormalTextRun SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)"> that</SPAN><SPAN class="NormalTextRun SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)"> can be aggregated </SPAN><SPAN class="NormalTextRun SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">safely</SPAN> <SPAN class="NormalTextRun SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">by the HANA engine without counting any measure twice. </SPAN></SPAN><SPAN class="TextRun SCXW154017958 BCX0" lang="DE-DE" lang="DE-DE" data-contrast="auto"><SPAN class="NormalTextRun SpellingErrorV2Themed SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">To</SPAN><SPAN class="NormalTextRun SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)"> design a multidimensional </SPAN><SPAN class="NormalTextRun SpellingErrorV2Themed SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">cube</SPAN><SPAN class="NormalTextRun SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">, </SPAN><SPAN class="NormalTextRun SpellingErrorV2Themed SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">we</SPAN> <SPAN class="NormalTextRun SpellingErrorV2Themed SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">now</SPAN> <SPAN class="NormalTextRun SpellingErrorV2Themed SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">need</SPAN> <SPAN class="NormalTextRun SpellingErrorV2Themed SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">to</SPAN><SPAN class="NormalTextRun SCXW154017958 BCX0" data-ccp-parastyle="Normal (Web)">:</SPAN></SPAN><SPAN class="EOP SCXW154017958 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <OL><BR /> <LI>Classify the cube view as such</LI><BR /> <LI>Introduce measures, which are used for aggregations</LI><BR /> <LI>Introduce dimensions, which are used for grouping based on drilldowns</LI><BR /> </OL><BR /> &nbsp;<BR /> <H2 id="toc-hId--413489416">Definition of a Cube</H2><BR /> <SPAN class="TextRun SCXW117564020 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)">The cube simply selects from our prepared data model and creates joins</SPAN><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)"> to</SPAN><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)"> the </SPAN><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)">original</SPAN><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)"> data sources </SPAN><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)">to access</SPAN><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)"> further attributes. Don’t worry about performance: </SPAN><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)">Th</SPAN><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)">e</SPAN><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)">se</SPAN><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)"> additional joins are optimized by the HANA engine anyway. Just </SPAN><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)">be</SPAN><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)"> sure to flag your cube with the annotation </SPAN></SPAN><SPAN class="TextRun SCXW117564020 BCX0" lang="EN-US" style="color: #3366ff" lang="EN-US" data-contrast="none"><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)"><a href="https://community.sap.com/t5/user/viewprofilepage/user-id/15206">@analytics</a>.dataCategory: #CUBE</SPAN></SPAN><SPAN class="TextRun SCXW117564020 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW117564020 BCX0" data-ccp-parastyle="Normal (Web)">.</SPAN></SPAN><SPAN class="EOP SCXW117564020 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <BR /> &nbsp;<BR /> <H2 id="toc-hId--610002921">Measures</H2><BR /> <SPAN class="TextRun SCXW263236811 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW263236811 BCX0" data-ccp-parastyle="Normal (Web)">Next, add all measure-like fields to your cube</SPAN><SPAN class="NormalTextRun SCXW263236811 BCX0" data-ccp-parastyle="Normal (Web)"> that</SPAN><SPAN class="NormalTextRun SCXW263236811 BCX0" data-ccp-parastyle="Normal (Web)"> you're interested in for your analytical reporting. Measures are identified by their numeric data type, as well as by their capability to be </SPAN><SPAN class="NormalTextRun SCXW263236811 BCX0" data-ccp-parastyle="Normal (Web)">aggregated by</SPAN><SPAN class="NormalTextRun SCXW263236811 BCX0" data-ccp-parastyle="Normal (Web)"> default, also called standard aggregation. This property can be set with </SPAN><SPAN class="NormalTextRun SCXW263236811 BCX0" data-ccp-parastyle="Normal (Web)">the</SPAN><SPAN class="NormalTextRun SCXW263236811 BCX0" data-ccp-parastyle="Normal (Web)"> annotation </SPAN></SPAN><SPAN class="TextRun SCXW263236811 BCX0" lang="EN-US" style="color: #3366ff" lang="EN-US" data-contrast="none"><SPAN class="NormalTextRun SCXW263236811 BCX0" data-ccp-parastyle="Normal (Web)">@Aggregation.default</SPAN></SPAN><SPAN class="TextRun SCXW263236811 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW263236811 BCX0" data-ccp-parastyle="Normal (Web)">.</SPAN></SPAN><SPAN class="EOP SCXW263236811 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <BR /> Please consider the following recommendations for measures:<BR /> <TABLE style="border-collapse: collapse;width: 100%" border="1"><BR /> <TBODY><BR /> <TR style="height: 14px"><BR /> <TD style="width: 6.48%;height: 14px"><SPAN style="color: #339966"><STRONG>Do</STRONG></SPAN></TD><BR /> <TD style="width: 93.52%;height: 14px">Measures should be added to the cube if aggregated reporting is required for them.</TD><BR /> </TR><BR /> <TR style="height: 14px"><BR /> <TD style="width: 6.48%;height: 14px"><SPAN style="color: #339966"><STRONG>Do</STRONG></SPAN></TD><BR /> <TD style="width: 93.52%;height: 14px">Aggregations are defined on element level for measures only.</TD><BR /> </TR><BR /> <TR style="height: 14px"><BR /> <TD style="width: 6.48%;height: 14px"><SPAN style="color: #339966"><STRONG>Do</STRONG></SPAN></TD><BR /> <TD style="width: 93.52%;height: 14px">Aggregations are defined with annotation <SPAN style="color: #3366ff">@Aggregation.default</SPAN>.</TD><BR /> </TR><BR /> <TR style="height: 14px"><BR /> <TD style="width: 6.48%;height: 14px"><SPAN style="color: #339966"><STRONG>Do</STRONG></SPAN></TD><BR /> <TD style="width: 93.52%;height: 14px">Supported default aggregations on cube level are #SUM, #MIN, #MAX. Other aggregations need to be defined in concrete analytical queries.</TD><BR /> </TR><BR /> <TR style="height: 14px"><BR /> <TD style="width: 6.48%;height: 14px"><SPAN style="color: #800000"><STRONG>Don't</STRONG></SPAN></TD><BR /> <TD style="width: 93.52%;height: 14px">Calculated measures based on formulas shouldn't be introduced in the cube, but in the analytical query on top.</TD><BR /> </TR><BR /> </TBODY><BR /> </TABLE><BR /> &nbsp;<BR /> <H2 id="toc-hId--806516426">Dimensions</H2><BR /> <SPAN data-contrast="auto">To fine-tune your reporting, it is mandatory to define dimensions in your cube, for example, to group aggregated measures based on the characteristics of a data record. Dimensions are modeled either as foreign key fields, such as a business partner ID, or as pure attribute, such as an order date. Foreign key fields should also be linked via an association to the corresponding dimension view to span up the analytical star schema around your cube. This gives you further possibilities to deep dive into your analytical model at the query level.</SPAN><SPAN data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <BR /> <SPAN data-contrast="auto">Please consider the following recommendations for dimensions:</SPAN><SPAN data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <TABLE style="border-collapse: collapse;width: 100%" border="1"><BR /> <TBODY><BR /> <TR style="height: 28px"><BR /> <TD style="width: 5.68%;height: 28px"><SPAN style="color: #339966"><STRONG>Do</STRONG></SPAN></TD><BR /> <TD style="width: 94.32%;height: 28px"><SPAN class="TextRun SCXW251117459 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW251117459 BCX0">Dimensions should be added to the cube if drill downs </SPAN><SPAN class="NormalTextRun SCXW251117459 BCX0">are to</SPAN><SPAN class="NormalTextRun SCXW251117459 BCX0"> be applied</SPAN><SPAN class="NormalTextRun SCXW251117459 BCX0">.</SPAN></SPAN><SPAN class="EOP SCXW251117459 BCX0" data-ccp-props="{&quot;201341983&quot;:0,&quot;335559740&quot;:259}">&nbsp;</SPAN></TD><BR /> </TR><BR /> <TR style="height: 14px"><BR /> <TD style="width: 5.68%;height: 14px"><SPAN style="color: #339966"><STRONG>Do</STRONG></SPAN></TD><BR /> <TD style="width: 94.32%;height: 14px">Dimensions may be represented by a dedicated dimension view associated with your cube.</TD><BR /> </TR><BR /> <TR style="height: 14px"><BR /> <TD style="width: 5.68%;height: 14px"><SPAN style="color: #339966"><STRONG>Do</STRONG></SPAN></TD><BR /> <TD style="width: 94.32%;height: 14px">Be sure to link such an association with annotation <SPAN style="color: #3366ff">@ObjectModel.foreignKey.association</SPAN>.</TD><BR /> </TR><BR /> </TBODY><BR /> </TABLE><BR /> <H2 id="toc-hId--655775574"></H2><BR /> <H2 id="toc-hId--852289079">Special Case: Dimeasures</H2><BR /> <SPAN class="TextRun SCXW25633379 BCX0" lang="EN-US" lang="EN-US" data-contrast="auto"><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">There </SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">may </SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">be use cases</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)"> where</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)"> some attributes need to represent a measure in one analytical reporting, but </SPAN> <SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">also</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)"> a dimension in another one. Ok – I’</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">ll be</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)"> honest – </SPAN><SPAN class="NormalTextRun SpellingErrorV2Themed SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">Dimeasure</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)"> is</SPAN> <SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">n</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">o</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">t an official term, but I think you know what I mean, right?</SPAN> <SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">Like </SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">calculating the average response time of incident processing based on a timestamp field, as well as using the same timestamp field for grouping the results </SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">by</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)"> month. In such a case, make sure to simply introduce the field</SPAN> <SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">twice in</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)"> your cube view</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">. One with a measure-like flavor, the other one with a dimension</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">-</SPAN><SPAN class="NormalTextRun SCXW25633379 BCX0" data-ccp-parastyle="Normal (Web)">like flavor.</SPAN></SPAN><SPAN class="EOP SCXW25633379 BCX0" data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <BR /> &nbsp;<BR /> <H2 id="toc-hId--1048802584">TL;DR – Just Give Me Some Coding</H2><BR /> The result of an analytical cube could look like the following:<BR /> <PRE class="language-sql"><CODE>@Analytics.dataCategory: #CUBE<BR /> define view entity I_DD_TSM_ANA_SALESORDERCUBE<BR /> as select from P_DD_TSM_ANA_SALESORDER as SalesOrder<BR /> <BR /> left outer join I_DD_TSM_ANA_SALESORDERITEM as SalesOrderItem<BR /> on SalesOrder.SalesOrderItem = SalesOrderItem.SalesOrderItemId<BR /> <BR /> left outer join I_DD_TSM_ANA_PAYMENT as Payment <BR /> on SalesOrder.Payment = Payment.PaymentId<BR /> <BR /> association [0..1] to I_DD_TSM_ANA_BUPA as _Buyer <BR /> on $projection.Buyer = _Buyer.BupaId<BR /> <BR /> {<BR /> <BR /> key SalesOrder.SalesOrder,<BR /> key SalesOrder.SalesOrderItem,<BR /> key SalesOrder.Payment,<BR /> SalesOrder.OrderDate,<BR /> <BR /> @Aggregation.default: #SUM<BR /> @Semantics.amount.currencyCode: 'ItemCurrency'<BR /> SalesOrderItem.amount as ItemAmount,<BR /> SalesOrderItem.currency as ItemCurrency,<BR /> <BR /> @Aggregation.default: #MAX<BR /> Payment.PaymentDueDate as PaymentDueDate,<BR /> @Aggregation.default: #MAX<BR /> Payment.PaymentDate as PaymentDate,<BR /> <BR /> Payment.PaymentMethod as PaymentMethod,<BR /> <BR /> @Aggregation.default: #SUM<BR /> @Semantics.amount.currencyCode: 'PaymentCurrency'<BR /> Payment.PaymentAmount as PaymentAmount,<BR /> Payment.PaymentCurrency as PaymentCurrency,<BR /> <BR /> @ObjectModel.foreignKey.association: '_Buyer'<BR /> SalesOrder.Buyer,<BR /> <BR /> _Buyer<BR /> }</CODE></PRE><BR /> &nbsp;<BR /> <H1 id="toc-hId--951913082">Great – But Where’s My Fancy Analytical Reporting?</H1><BR /> <SPAN data-contrast="auto">I love your excitement! Building a dedicated CDS Analytical Query on top of our cube will be the next step – in the next part of this series. So, stay tuned!</SPAN><SPAN data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <BR /> <SPAN data-contrast="auto">Ok – I just can’t leave you behind with such a spoiler. Here's a preview of what an analytical reporting could look like when accessed via SAP Analytics Cloud.</SPAN><SPAN data-ccp-props="{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}">&nbsp;</SPAN><BR /> <P class="image_caption" style="text-align: center;font-style: italic;overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2023/03/Analytical-Preview-SAC-2.png" /></P><BR /> <P class="image_caption" style="text-align: center;font-style: italic">Analytical Story in SAP Analytics Cloud (SAC)</P><BR /> &nbsp;<BR /> <BR /> Don't forget to checkout further material:<BR /> <BR /> Developer Guide: <A href="https://help.sap.com/docs/btp/sap-business-technology-platform/analytical-data-modeling" target="_blank" rel="noopener noreferrer">Analytical Data Modeling</A><BR /> <BR /> &nbsp;<BR /> <BR /> Cheerio ABAP folks! 2023-03-31T03:23:36+02:00 https://community.sap.com/t5/technology-blog-posts-by-members/sap-native-hana-procedure-to-create-and-populate-a-transpose-table/ba-p/13574828 SAP Native HANA Procedure to Create and Populate a Transpose Table 2023-08-08T18:16:56+02:00 pavani_sappati6 https://community.sap.com/t5/user/viewprofilepage/user-id/870399 <H2 id="toc-hId-963959790">Scenario:</H2><BR /> The scenario is to transpose a table by a single transpose column and populate the new table with the data.<BR /> <BR /> <STRONG>PRODUCT_DATA:</STRONG><BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2023/08/Product_data.png" /></P><BR /> <STRONG>PRODUCT_TRANSPOSE:</STRONG><BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2023/08/Product_transpose.png" /></P><BR /> &nbsp;<BR /> <H2 id="toc-hId-767446285"><STRONG>Solution Approach:</STRONG></H2><BR /> The solution is to create the dynamic SQL statement as below which combines both creation and population of data into one step, where the bolded parts of the statement are dynamically created.<BR /> <PRE class="language-sql"><CODE>Create table Product_transpose as ( <BR /> <BR /> SELECT Product, Large,Small,Medium FROM ( <BR /> <BR /> SELECT Product,<BR /> <BR /> MAX(CASE WHEN Product_Type = 'Large' THEN Unit_Price END) AS Large,<BR /> <BR /> MAX(CASE WHEN Product_Type = 'Small' THEN Unit_Price END) AS Small,<BR /> <BR /> MAX(CASE WHEN Product_Type = 'Medium' THEN Unit_Price END) AS Medium<BR /> <BR /> From Product_data<BR /> <BR /> Group By Product ))</CODE></PRE><BR /> &nbsp;<BR /> <BR /> First two statements are to create the table Product_transpose with the desired columns.<BR /> <BR /> The inner select statement reads the data from product_data by transposing it as below.<BR /> <H2 id="toc-hId-570932780"><STRONG><U>Solution:</U></STRONG></H2><BR /> <H3 id="toc-hId-503501994"><STRONG>Step1:</STRONG></H3><BR /> First, we will use the SQL function “STRING_AGG”, to get the distinct values in the transpose column.<BR /> <BR /> In our case “Product_Type”. This is the dynamic column list for the transpose table.<BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2023/08/String_Agg.png" /></P><BR /> We will store this list it in &nbsp;'ProductTypeList' variable.<BR /> <PRE class="language-sql"><CODE>SELECT string_agg(PRODUCT_TYPE, ', ')<BR /> INTO ProductTypeList<BR /> FROM (SELECT DISTINCT PRODUCT_TYPE from PRODUCT_DATA as b);</CODE></PRE><BR /> <H3 id="toc-hId-306988489"><STRONG>Step2:</STRONG></H3><BR /> Create the first part of the dynamic SQL statement as below.<BR /> <PRE class="language-sql"><CODE>DynamicSQL := 'Create table Product_transpose as (<BR /> <BR /> SELECT PRODUCT, ' || ProductTypeList || ' FROM (<BR /> <BR /> SELECT PRODUCT,<BR /> <BR /> ';</CODE></PRE><BR /> <H3 id="toc-hId-110474984"><STRONG>Step3:</STRONG></H3><BR /> Dynamically create the statement for populating the data as below.<BR /> <PRE class="language-sql"><CODE>SELECT <BR /> STRING_AGG('MAX(CASE WHEN PRODUCT_TYPE = ''' || PRODUCT_TYPE || ''' THEN <BR /> Unit_Price END) AS ' || PRODUCT_TYPE, ', ')<BR /> <BR /> INTO ColumnExpressions<BR /> <BR /> FROM (SELECT DISTINCT PRODUCT_TYPE FROM Product_data);</CODE></PRE><BR /> <H3 id="toc-hId--86038521"><STRONG>Step4:</STRONG></H3><BR /> Combine all the 3 steps and create the complete dynamic SQL.<BR /> <PRE class="language-sql"><CODE>DynamicSQL := DynamicSQL || ColumnExpressions || <BR /> ' FROM Product_data GROUP BY PRODUCT))';</CODE></PRE><BR /> <H3 id="toc-hId--282552026"><STRONG>Step5:</STRONG></H3><BR /> Execute the dynamic SQL.<BR /> <PRE class="language-sql"><CODE>EXEC DynamicSQL;</CODE></PRE><BR /> <H3 id="toc-hId--479065531"><STRONG>Step6: </STRONG></H3><BR /> Call the procedure from the SQL console as below.<BR /> <PRE class="language-abap"><CODE>CALL "MYSCHEMA"."MYPACKAGE::product_transpose" ( ) ;</CODE></PRE><BR /> <H3 id="toc-hId--675579036">Complete Code:</H3><BR /> <PRE class="language-sql"><CODE>PROCEDURE "MYSCHEMA"."MYPACKAGE::product_transpose" ( )<BR /> <BR /> LANGUAGE SQLSCRIPT<BR /> <BR /> SQL SECURITY INVOKER<BR /> <BR /> --DEFAULT SCHEMA &lt;default_schema_name&gt;<BR /> <BR /> --READS SQL DATA<BR /> <BR /> AS<BR /> <BR /> BEGIN<BR /> <BR /> DECLARE ProductTypeList NVARCHAR(10000);<BR /> <BR /> DECLARE DynamicSQL NVARCHAR(60000);<BR /> <BR /> DECLARE ColumnExpressions NVARCHAR(50000);<BR /> <BR /> <BR /> SELECT string_agg(PRODUCT_TYPE, ', ')<BR /> <BR /> INTO ProductTypeList<BR /> <BR /> FROM (SELECT DISTINCT PRODUCT_TYPE from PRODUCT_DATA as b);<BR /> <BR /> <BR /> DynamicSQL := 'Create table Product_Transpose as (<BR /> <BR /> SELECT PRODUCT, ' || ProductTypeList || '<BR /> <BR /> FROM (<BR /> <BR /> SELECT PRODUCT,<BR /> <BR /> ';<BR /> <BR /> SELECT STRING_AGG('MAX(CASE WHEN PRODUCT_TYPE = ''' || PRODUCT_TYPE || ''' <BR /> <BR /> THEN UNIT_PRICE END) AS ' || PRODUCT_TYPE, ', ')<BR /> <BR /> INTO ColumnExpressions<BR /> <BR /> FROM (SELECT DISTINCT PRODUCT_TYPE FROM PRODUCT_DATA);<BR /> <BR /> <BR /> DynamicSQL := DynamicSQL || ColumnExpressions || ' FROM PRODUCT_DATA<BR /> <BR /> GROUP BY PRODUCT))';<BR /> <BR /> EXEC DynamicSQL;<BR /> <BR /> <BR /> END;</CODE></PRE><BR /> &nbsp;<BR /> <H3 id="toc-hId--947323910">In Conclusion,</H3><BR /> SAP Native HANA procedures are a powerful feature to execute complex data transformations, which can significantly enhance data manipulation and processing efficiency.<BR /> <BR /> Embrace the advantages of streamlined data processing, optimized performance, and simplified code maintenance that these procedures offer.<BR /> <BR /> Feel free to like, comment and share your thoughts! Your insights, questions, and feedback are invaluable in developing a collaborative learning environment.<BR /> <BR /> &nbsp;<BR /> <BR /> <EM><STRONG>&nbsp;</STRONG></EM> 2023-08-08T18:16:56+02:00 https://community.sap.com/t5/technology-blog-posts-by-sap/cds-hierarchy-directory-how-to-use-notassignednode-annotation-to-suppress/ba-p/13576317 CDS Hierarchy Directory: How to use NOTASSIGNEDNODE Annotation to suppress or to filter the Not Assigned(REST_H) nodes 2023-12-19T23:56:31+01:00 LinaRaut https://community.sap.com/t5/user/viewprofilepage/user-id/179963 This blog is about how to handle Not Assigned(REST_H) nodes in CDS Hierarchy Directory of Analytical query, to get the result set either without Not Assigned node or filtered Not Assigned node. Let’s start with some basic information about CDS Hierarchy Directory.<BR /> <H2 id="toc-hId-964014535"><STRONG>Introduction to CDS Hierarchy Directory</STRONG></H2><BR /> There are two types of Hierarchy views. First where we use annotation <STRONG>‘</STRONG><STRONG>@Hierarchy</STRONG><STRONG>’</STRONG> and new one where we use <STRONG>‘define hierarchy &lt;NAME&gt;’</STRONG> (from 2023 on Prem and 2308 Cloud). In both the ways we can define association to a view which is then used as Hierarchy Directory.<BR /> <BR /> Hierarchy Directory is CDS view.<BR /> <UL><BR /> <LI>It contains the List of all hierarchies available in the hierarchy view.</LI><BR /> <LI>It can have Text for the hierarchies (language independent case) Or it can have an association to a text view (language dependent case)</LI><BR /> <LI>It can contain a field which determine whether the Not Assigned node will be displayed or not.</LI><BR /> <LI>It can contain a field which describes a filter which should be applied to the Not Assigned node.</LI><BR /> <LI>It can contain a field which describes when a hierarchy was changed last time and which has annotation as ‘@Semantics.systemDate.lastChangedAt : true (for date)’ or ‘@Semantics.systemDateTime.lastChangedAt: true (for timestamp)’</LI><BR /> </UL><BR /> When this field exist, then analytical engine will buffer the hierarchy and will renew the buffer when hierarchy is changed. Without this field hierarchy will always be rebuild and it can be performance overhead.<BR /> <H2 id="toc-hId-767501030"><STRONG>Use of </STRONG><STRONG>NOTASSIGNEDNODE</STRONG> <STRONG>Annotations in CDS Hierarchy Directory</STRONG></H2><BR /> <UL><BR /> <LI><STRONG>@HIERARCHY.NOTASSIGNEDNODE.SUPPRESSINDICATOR</STRONG> can be used to suppress the display of Not Assigned nodes.</LI><BR /> </UL><BR /> It can be used for one field in a Hierarchy Directory view. The data type of the field must be Boolean (CHAR field with length 1 and with values '' or 'X'). If the flag is set for an entry in the directory, then the analytical engine doesn't create a 'Not Assigned' node. In this case the hierarchy itself acts as a filter and data which is not a leaf in the hierarchy is not part of the resultset.<BR /> <UL><BR /> <LI><STRONG>@HIERARCHY.NOTASSIGNEDNODE.</STRONG><STRONG>FILTER</STRONG> can be used to restrict the display of Not Assigned nodes.</LI><BR /> </UL><BR /> It can be used for a field in the Hierarchy Directory view. The field needs in addition, a foreign-key association to a dimension view. This dimension view has also to be target of a foreign-key association defined in the dimension view which holds the hierarchy. The field with that foreign-key association must be a non representative key field. When the analytical engine resolves the 'Not Assigned' node, it derives a filter from the hierarchy’s name and applies this filter to the dimension values which have to be added to the 'Not Assigned' node. The other dimension values, which don't fulfil the filter criteria are ignored. In this case the hierarchy itself acts as a filter. The annotation can be used for key and for non-key fields in the Hierarchy Directory. Only constraint is that the field needs a foreign-key association.<BR /> With this feature you can improve the performance. It is only useful for hierarchies on dimensions with more than one key field and if one hierarchy should only contain leaves belonging to one value of a key field. A typical example is a cost center hierarchy. All cost centers of one hierarchy should belong to the same controlling area. Without this feature the analytical engine would also add cost centers of other controlling areas to the 'Not-Assigned' node. Notice that this happens independent of the filters used in a query. Therefore, in a query result there is no difference if the query contains a filter on the same controlling area. But the performance will be much better if the filter is also defined in the Hierarchy Directory.<BR /> <H2 id="toc-hId-570987525"><STRONG>Examples</STRONG></H2><BR /> <H3 id="toc-hId-503556739"><STRONG>Example 1: Without @HIERARCHY.NOTASSIGNEDNODE </STRONG></H3><BR /> <DIV><BR /> <DIV><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@EndUserText.label:</SPAN> <SPAN style="color: #335ca2">'Connection Hierarchy Directory View'</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2"><a href="https://community.sap.com/t5/user/viewprofilepage/user-id/15206">@analytics</a></SPAN> <SPAN style="color: #335ca2">:</SPAN> <SPAN style="color: #335ca2">{</SPAN> <SPAN style="color: #335ca2">dataCategory:</SPAN> <SPAN style="color: #335ca2">#DIMENSION,</SPAN> <SPAN style="color: #335ca2">dataExtraction.</SPAN><SPAN style="color: #335ca2;text-decoration: underline">enabled:</SPAN> <SPAN style="color: #335ca2;text-decoration: underline">true</SPAN> <SPAN style="color: #335ca2">}</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@ObjectModel.representativeKey:</SPAN> <SPAN style="color: #335ca2">'hieid'</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">define</SPAN> <SPAN style="color: #7f0074;font-weight: bold">view entity</SPAN> <SPAN style="color: #000000;text-decoration: underline">ZOQ_CONNECTION_HIERARCHY_DIR</SPAN> <SPAN style="color: #7f0074;font-weight: bold">as</SPAN> <SPAN style="color: #7f0074;font-weight: bold">select</SPAN> <SPAN style="color: #7f0074;font-weight: bold">from</SPAN> <SPAN style="color: #000000">ZOQ_CONNID_HD</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">{</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@ObjectModel.text.element:</SPAN> <SPAN style="color: #335ca2">'hiertxt'</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">key</SPAN> <SPAN style="color: #000000">hieid</SPAN><SPAN style="color: #7f0074;font-weight: bold">,</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@Semantics.text:</SPAN> <SPAN style="color: #335ca2">true</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #000000">hiertxt</SPAN><SPAN style="color: #7f0074;font-weight: bold">,</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@Semantics.systemDate.</SPAN><SPAN style="color: #335ca2;text-decoration: underline">lastChangedAt:</SPAN> <SPAN style="color: #335ca2;text-decoration: underline">true</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #000000">last_changed</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">}</SPAN></P><BR /> Resultset will display Not assigned (REST_H) nodes<BR /> <BR /> </DIV><BR /> <P style="margin: 0px;overflow: hidden"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2023/12/all-4.jpg" /></P><BR /> &nbsp;<BR /> <BR /> </DIV><BR /> <H3 id="toc-hId-307043234"><STRONG>Example 2: With&nbsp;@HIERARCHY.NOTASSIGNEDNODE.SUPPRESSINDICATOR</STRONG></H3><BR /> <DIV><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@EndUserText.label:</SPAN> <SPAN style="color: #335ca2">'Connection Hierarchy Directory View'</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2"><a href="https://community.sap.com/t5/user/viewprofilepage/user-id/15206">@analytics</a></SPAN> <SPAN style="color: #335ca2">:</SPAN> <SPAN style="color: #335ca2">{</SPAN> <SPAN style="color: #335ca2">dataCategory:</SPAN> <SPAN style="color: #335ca2">#DIMENSION,</SPAN> <SPAN style="color: #335ca2">dataExtraction.</SPAN><SPAN style="color: #335ca2;text-decoration: underline">enabled:</SPAN> <SPAN style="color: #335ca2;text-decoration: underline">true</SPAN> <SPAN style="color: #335ca2">}</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@ObjectModel.representativeKey:</SPAN> <SPAN style="color: #335ca2">'hieid'</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">define</SPAN> <SPAN style="color: #7f0074;font-weight: bold">view entity</SPAN> <SPAN style="color: #000000;text-decoration: underline">ZLR_CONNECTION_HIERARCHY_DIR</SPAN> <SPAN style="color: #7f0074;font-weight: bold">as</SPAN> <SPAN style="color: #7f0074;font-weight: bold">select</SPAN> <SPAN style="color: #7f0074;font-weight: bold">from</SPAN> <SPAN style="color: #000000">zoq_connid_hd</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">{</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@ObjectModel.text.element:</SPAN> <SPAN style="color: #335ca2">'hiertxt'</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">key</SPAN> <SPAN style="color: #000000">hieid</SPAN><SPAN style="color: #7f0074;font-weight: bold">,</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@Semantics.text:</SPAN> <SPAN style="color: #335ca2">true</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #000000">hiertxt</SPAN><SPAN style="color: #7f0074;font-weight: bold">,</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@Semantics.systemDate.</SPAN><SPAN style="color: #335ca2;text-decoration: underline">lastChangedAt:</SPAN> <SPAN style="color: #335ca2;text-decoration: underline">true</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #000000">last_changed</SPAN><SPAN style="color: #7f0074;font-weight: bold">,</SPAN></P><BR /> <P style="margin: 0"><STRONG><SPAN style="color: #335ca2">@Hierarchy.notAssignedNode.suppressIndicator:</SPAN> <SPAN style="color: #335ca2">true</SPAN></STRONG></P><BR /> <P style="margin: 0"><STRONG><SPAN style="color: #008000">'X'</SPAN> <SPAN style="color: #7f0074">as</SPAN> <SPAN style="color: #000000">suppressNotAssigned</SPAN></STRONG></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">}</SPAN></P><BR /> Resultset will not display Not Assigned (REST_H) nodes<BR /> <BR /> </DIV><BR /> <P style="overflow: hidden;margin-bottom: 0px"><IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2023/12/supress_rest1.jpg" /></P><BR /> &nbsp;<BR /> <H3 id="toc-hId-110529729"><STRONG>Example 3: With&nbsp;@HIERARCHY.NOTASSIGNEDNODE.FILTER</STRONG></H3><BR /> <DIV><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@EndUserText.label:</SPAN> <SPAN style="color: #335ca2">'Connection Hierarchy Directory View'</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2"><a href="https://community.sap.com/t5/user/viewprofilepage/user-id/15206">@analytics</a></SPAN> <SPAN style="color: #335ca2">:</SPAN> <SPAN style="color: #335ca2">{</SPAN> <SPAN style="color: #335ca2">dataCategory:</SPAN> <SPAN style="color: #335ca2">#DIMENSION,</SPAN> <SPAN style="color: #335ca2">dataExtraction.</SPAN><SPAN style="color: #335ca2;text-decoration: underline">enabled:</SPAN> <SPAN style="color: #335ca2;text-decoration: underline">true</SPAN> <SPAN style="color: #335ca2">}</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@ObjectModel.representativeKey:</SPAN> <SPAN style="color: #335ca2">'hieid'</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">define</SPAN> <SPAN style="color: #7f0074;font-weight: bold">view entity</SPAN> <SPAN style="color: #000000;text-decoration: underline">ZLR_CONNECTION_HIERARCHY_DIR</SPAN> <SPAN style="color: #7f0074;font-weight: bold">as</SPAN> <SPAN style="color: #7f0074;font-weight: bold">select</SPAN> <SPAN style="color: #7f0074;font-weight: bold">from</SPAN> <SPAN style="color: #000000">zoq_connid_hd</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">association</SPAN> <SPAN style="color: #7f0074;font-weight: bold">to</SPAN> <SPAN style="color: #000000">ZOQ_AIRLINE</SPAN> <SPAN style="color: #7f0074;font-weight: bold">as</SPAN> <SPAN style="color: #000000">_carrid</SPAN> <SPAN style="color: #7f0074;font-weight: bold">on</SPAN> <SPAN style="color: #000000">_carrid</SPAN><SPAN style="color: #7f0074;font-weight: bold">.</SPAN><SPAN style="color: #000000">carrid</SPAN> <SPAN style="color: #7f0074;font-weight: bold">=</SPAN> <SPAN style="color: #7f0074;font-weight: bold">$projection.</SPAN><SPAN style="color: #000000">carrid</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">{</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@ObjectModel.text.element:</SPAN> <SPAN style="color: #335ca2">'hiertxt'</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">key</SPAN> <SPAN style="color: #000000">hieid</SPAN><SPAN style="color: #7f0074;font-weight: bold">,</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@Semantics.text:</SPAN> <SPAN style="color: #335ca2">true</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #000000">hiertxt</SPAN><SPAN style="color: #7f0074;font-weight: bold">,</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@Semantics.systemDate.</SPAN><SPAN style="color: #335ca2;text-decoration: underline">lastChangedAt:</SPAN> <SPAN style="color: #335ca2;text-decoration: underline">true</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #000000">last_changed</SPAN><SPAN style="color: #7f0074;font-weight: bold">,</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@ObjectModel.foreignKey.association:</SPAN> <SPAN style="color: #335ca2">'_carrid'</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #335ca2">@Hierarchy.notAssignedNode.filter:</SPAN> <SPAN style="color: #335ca2">true</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">cast(</SPAN> <SPAN style="color: #008000">'LH'</SPAN> <SPAN style="color: #7f0074;font-weight: bold">as</SPAN> <SPAN style="color: #000000;font-style: italic;text-decoration: underline">s_carr_id</SPAN> <SPAN style="color: #7f0074;font-weight: bold">)</SPAN> <SPAN style="color: #7f0074;font-weight: bold">as</SPAN> <SPAN style="color: #000000">carrid</SPAN><SPAN style="color: #7f0074;font-weight: bold">,</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #000000">_carrid</SPAN></P><BR /> <P style="margin: 0"><SPAN style="color: #7f0074;font-weight: bold">}</SPAN></P><BR /> Resultset will display Not Assigned(REST_H) node but only with LH as we have provided filter on carrid LH<IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/blog_attachments/2023/12/filter-2.jpg" /><BR /> <BR /> &nbsp;<BR /> <BR /> Following are some of correction which are done for this feature:<BR /> <BR /> 3348310 - Problem with Hierarchy.notAssignedNode.filter<BR /> 3377570 - Dump: GETWA_NOT_ASSIGNED in class CL_RSR_RRK0_HIERARCHY<BR /> <BR /> </DIV><BR /> &nbsp;<BR /> <BR /> &nbsp; 2023-12-19T23:56:31+01:00 https://community.sap.com/t5/technology-blog-posts-by-sap/cds-view-time-comparison/ba-p/13620651 CDS View: Time comparison 2024-02-28T22:27:29.400000+01:00 LinaRaut https://community.sap.com/t5/user/viewprofilepage/user-id/179963 <P><FONT color="#000000">This blog is about CDS scalar functions - CALENDER_SHIFT and CALENDER_OPERATIONS and how to use it in analytical queries for time comparison. Similarly FISCAL_CALENDAR_SHIFT and FISCAL_CALENDAR_OPERATION can be used.</FONT></P><P><FONT color="#000000">These CDS scalar functions are used to compare the measure value of current time period with previous time period. Further it can be used to calculate measure value for year to date (YTD), month to date (MTD) or quarter to date (QTD). Current member can only be used when time dimensions are in drilldown else restricted measure is used. The usage of current member is not as fast as restricted measure. Detail specification of the mentioned scalar functions can be found in Help.</FONT></P><H2 id="toc-hId-987850336">&nbsp;</H2><H2 id="toc-hId-791336831"><FONT color="#000000"><STRONG>Usage of Current Member</STRONG></FONT></H2><P><FONT color="#000000">This function can be used by modeling an association with the cube. In the ON-condition, the scalar functions are specified on the right side.</FONT></P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>association to ZOQ_FLIGHT as _previousMonth on _previousMonth.fyearMonth = calendar_shift( base =&gt; $projection.fyearMonth, base_level =&gt; calendar_date_level.#MONTH, shift =&gt; abap.int2'-1', shift_level =&gt; calendar_date_level.#MONTH )</code></pre><P>&nbsp;</P><P>&nbsp;</P><P><FONT color="#000000"><STRONG>Constraints:</STRONG></FONT></P><UL><LI><FONT color="#000000">Current member to work properly, we have to mark all the time fields which are related with annotation - @ObjectModel.value.derivedFrom. We should also specify semantics. </FONT><FONT color="#000000">for example,</FONT></LI></UL><P><FONT color="#000000">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<STRONG>key</STRONG> fldate,<BR />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<STRONG>@ObjectModel.value.derivedFrom: 'fldate'</STRONG><BR />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;@Semantics.calendar.yearMonth: true<BR />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;@ EndUserText.label: 'FL Month'<BR />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;_calday.calmonth <STRONG>as</STRONG> fyearMonth,&nbsp;</FONT><FONT color="#000000">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</FONT></P><UL><LI><FONT color="#000000">The base parameter must be filled with the same field name as it appears on the left: for example, the field name __previousMonth<STRONG>.</STRONG><SPAN><STRONG>fyearMonth</STRONG> &nbsp;&nbsp;should be same as base </SPAN><STRONG>=&gt;</STRONG> $projection<STRONG>.fyearMonth</STRONG></FONT></LI></UL><UL><LI><FONT color="#000000">The Semantics of field $projection.fyearMonth must match the base_level parameter. As In the cube view example, the fyearMonth field has the annotation &nbsp;@Semantics.calendar.yearMonth: true, &nbsp;base_level is specified as calendar_date_level<STRONG>.</STRONG>#MONTH.</FONT></LI><LI><FONT color="#000000">In the example to restrict the measure to the previous month, shift is set to -1 and shift_level is set to #MONTH. There is a constraint in using shift_level with base_level : for example for base level #MONTH, shift _level can be #MONTH,#QUARTER or #YEAR But can’t be #DAY.</FONT></LI></UL><P><FONT color="#000000">&nbsp;&nbsp;<STRONG>Example 1:&nbsp;</STRONG> Time comparison with time in drill-down (Current Member Variables)</FONT></P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #NOT_ALLOWED @EndUserText.label: 'Query: Current Memeber on Month' define transient view entity ZLR_PC_CM_1 provider contract analytical_query as projection on ZOQ_FLIGHT association to ZOQ_FLIGHT as _previousMonth on _previousMonth.fyearMonth = calendar_shift( base =&gt; $projection.fyearMonth, base_level =&gt; calendar_date_level.#month, shift =&gt; abap.int2'-1', shift_level =&gt; calendar_date_level.#month ) association to ZOQ_FLIGHT as _firstMonthOfQuarter on _firstMonthOfQuarter.fyearMonth between calendar_operation( base =&gt; $projection.fyearMonth, base_level =&gt; calendar_date_level.#month, operation =&gt; calendar_date_operation.#first, operation_level =&gt; calendar_date_level.#quarter ) and $projection.fyearMonth association to ZOQ_FLIGHT as _CMM1_CMP1 on _CMM1_CMP1.fyearMonth between calendar_shift( base =&gt; $projection.fyearMonth, base_level =&gt; calendar_date_level.#month, shift =&gt; abap.int2'-1', shift_level =&gt; calendar_date_level.#month ) and calendar_shift( base =&gt; $projection.fyearMonth, base_level =&gt; calendar_date_level.#month, shift =&gt; abap.int2'1', shift_level =&gt; calendar_date_level.#month ) { @AnalyticsDetails.query: { axis: #ROWS, totals: #SHOW } @EndUserText.label: 'Year Quarter' flquarter, @AnalyticsDetails.query: { axis: #ROWS, totals: #SHOW } @EndUserText.label: 'Year Month' fyearMonth, @AnalyticsDetails.query.axis: #FREE .hidden: true currency, @Semantics.amount.currencyCode: 'currency' paymentsum, _previousMonth.currency as PrevMonthCurrency, @Semantics.amount.currencyCode : 'PrevMonthCurrency' @EndUserText.label: 'Previous Month' _previousMonth.paymentsum as PrevMonthPayment, _firstMonthOfQuarter.currency as firstMonthOfQuartCurrency, @Semantics.amount.currencyCode : 'firstMonthOfQuartCurrency' @EndUserText.label: 'Quarter to today' _firstMonthOfQuarter.paymentsum as firstMonthOfQuartPayment, _CMM1_CMP1.currency as last3MonthCurrency, @Semantics.amount.currencyCode : 'last3MonthCurrency' @EndUserText.label: 'Previous month To next month' _CMM1_CMP1.paymentsum as CMM1_CMP1Payment } where flyear = '2019' and currency = 'EUR'</code></pre><P>&nbsp;</P><P>&nbsp;</P><P><FONT color="#000000"><STRONG>Result:</STRONG></FONT></P><P><FONT color="#000000"><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_2-1709031740486.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/71830iDE9646596608699E/image-size/large?v=v2&amp;px=999" role="button" title="LinaRaut_2-1709031740486.png" alt="LinaRaut_2-1709031740486.png" /></span></FONT></P><P><FONT color="#000000">In this Result</FONT></P><UL><LI><FONT color="#000000"><FONT color="#FF0000"><STRONG>Red</STRONG></FONT>- column Previous Month -shows value from previous month.</FONT></LI><LI><FONT color="#000000"><FONT color="#FFCC00"><STRONG>Yellow</STRONG></FONT>- column Quarter to Today- shows the aggregate values of previous months in this quarter.</FONT></LI><LI><FONT color="#000000"><FONT color="#339966"><STRONG>Green</STRONG></FONT>- column Gliding window of 3 month- shows aggregate value of previous month + current month + next month.</FONT></LI></UL><P>&nbsp;</P><H2 id="toc-hId-594823326"><FONT color="#000000"><STRONG>Usage of Restricted Measure</STRONG></FONT></H2><P><FONT color="#000000">This can be done using the CASE statement, where one of the scalar function is used.&nbsp;</FONT></P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code> case when fyearMonth = calendar_shift( base =&gt; $parameters.p_month, base_level =&gt; calendar_date_level.#MONTH, shift =&gt; abap.int2'-1', shift_level =&gt; calendar_date_level.#MONTH ) then paymentsum end as paymentPrev</code></pre><P>&nbsp;</P><P>&nbsp;</P><P><FONT color="#000000"><STRONG>Constraints:</STRONG></FONT></P><UL><LI><FONT color="#000000">The base parameter must be a parameter or a literal.</FONT></LI><LI><FONT color="#000000">The type of parameter or literal must match to &nbsp;base_level. In the example for base_level &nbsp;calendar_date_level.#MONTH, the type of parameter p_month must be NUMC6.</FONT></LI><LI><FONT color="#000000">In the example to restrict the measure to the previous month, shift is set to -1 and shift_level is set to #MONTH.</FONT></LI></UL><P><FONT color="#000000"><STRONG>Example 2:</STRONG> Time comparison (Restricted key figure)</FONT></P><P>&nbsp;</P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #NOT_ALLOWED @EndUserText.label: 'Query: Current Memeber on Month' define transient view entity ZLR_PC_RSRT_SHIFT1 provider contract analytical_query with parameters p_month : /bi0/oicalmonth as projection on ZOQ_FLIGHT { @AnalyticsDetails.query: { axis: #ROWS, totals: #SHOW } carrid, currency, virtual currCur : abap.cuky, @Semantics.amount.currencyCode : 'currCur' @Consumption.dynamicLabel: { label: 'Bookings &amp;1', binding: [{ index : 1 , element : 'fyearMonth' }] } case when fyearMonth = $parameters.p_month then paymentsum end as paymentCur, virtual currPrev : abap.cuky, @Semantics.amount.currencyCode : 'currPrev' @Consumption.dynamicLabel: { label: 'Previous Bookings &amp;1', binding: [{ index : 1 , element : 'fyearMonth' }] } case when fyearMonth = calendar_shift( base =&gt; $parameters.p_month, base_level =&gt; calendar_date_level.#month, shift =&gt; abap.int2'-1', shift_level =&gt; calendar_date_level.#month ) then paymentsum end as paymentPrev, virtual currLastInYear : abap.cuky, @Semantics.amount.currencyCode : 'currLastInYear' @Consumption.dynamicLabel: { label: 'Bookings from &amp;1 To &amp;2', binding: [{ index : 1 , element : 'fyearMonth', replaceWith: #LOW }, { index : 2 , element : 'fyearMonth', replaceWith: #HIGH }] } case when fyearMonth between calendar_operation( base =&gt; $parameters.p_month, base_level =&gt; calendar_date_level.#month, operation =&gt; calendar_date_operation.#first, operation_level =&gt; calendar_date_level.#year ) and $parameters.p_month then paymentsum end as paymentToDate } where currency = 'EUR'</code></pre><P>&nbsp;</P><P>&nbsp;</P><P><FONT color="#000000"><STRONG>Result:</STRONG></FONT></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_3-1709031740488.png" style="width: 800px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/71829i4C6A60C9C4189EE8/image-dimensions/800x159?v=v2" width="800" height="159" role="button" title="LinaRaut_3-1709031740488.png" alt="LinaRaut_3-1709031740488.png" /></span></P><P><FONT color="#000000">In this example I have used @Consumption.dynamicLabel to dynamically set the column label with values calculated from parameter.</FONT></P><H2 id="toc-hId-398309821">&nbsp;</H2><H2 id="toc-hId-201796316"><FONT color="#000000">Release Info:</FONT></H2><P><FONT color="#000000">On-Prem SAP_BW from 7.58 and Cloud from 2308</FONT></P><H2 id="toc-hId-5282811"><FONT color="#000000">Related Notes:</FONT></H2><P><FONT color="#000000">3270090-CurrentMember + FemsN</FONT></P><P><FONT color="#000000">3359468-Current Member on reference characteristic and selection for Partial Time Characteristic</FONT></P> 2024-02-28T22:27:29.400000+01:00 https://community.sap.com/t5/technology-blog-posts-by-sap/cds-view-hierarchy-node-sign-reversal/ba-p/13599337 CDS View: Hierarchy node sign reversal 2024-04-15T13:30:04.285000+02:00 LinaRaut https://community.sap.com/t5/user/viewprofilepage/user-id/179963 <P><SPAN>This blog is about how to use @Semantics.signReversal in CDS Views</SPAN> <SPAN>to revert the sign of a measure in</SPAN> <SPAN>dependence of the settings of a hierarchy node. Analytic query offers the functionality to reverse a sign after aggregation based on a hierarchy node attribute.&nbsp;</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>This functionality shall be made accessible from a CDS Query,</SPAN> <SPAN>for this it is necessary to determine the hierarchy node attribute which stores the sign reverse indicator.</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>To make use of the sign reversal feature in an analytical query, the following field needs to be added to the related hierarchy view:</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>@Semantics.signReversalIndicator</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; signref </SPAN><STRONG><SPAN>as</SPAN></STRONG><SPAN> signReversalFlag</SPAN><STRONG><SPAN>,</SPAN></STRONG><SPAN>&nbsp;</SPAN></P><P><FONT color="#0000FF"><STRONG><SPAN class=""><SPAN class="">Example</SPAN><SPAN class="">:</SPAN> <SPAN class="">Hierarchy </SPAN><SPAN class="">v</SPAN><SPAN class="">iew</SPAN></SPAN><SPAN class="">&nbsp;</SPAN></STRONG></FONT></P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AbapCatalog.sqlViewName: 'ZOQ_CONNIDHIER' @EndUserText.label: 'Connection Hierarchy View' @ObjectModel.dataCategory: #HIERARCHY @Hierarchy.parentChild : { name : 'ConnectionHierarchy', label : 'Connection', siblingsOrder: [{ by: 'seqno' , direction: 'ASC' }] , recurseBy : '_parent', directory: '_dir' } define view ZOQ_CONNECTION_HIERARCHY as select from zoq_connid_h association [0..1] to ZOQ_CONNECTION_HIERARCHY as _parent on $projection.parentid = _parent.nodeid association [1] to ZOQ_CONNECTION_HIERARCHY_DIR as _dir on $projection.hieid = _dir.hieid association [1] to ZOQ_CONNECTION_NODENAME as _node on $projection.hieid = _node.hieid and $projection.nodename = _node.nodeName and $projection.carrid = '' and $projection.connid = '0000' association [1] to ZOQ_AIRLINE as _airline on $projection.carrid = _airline.carrid and $projection.connid = '0000' association [1] to ZOQ_CONNECTION as _connection on $projection.carrid = _connection.carrid and $projection.connid = _connection.connid { @Consumption.filter: { mandatory : true, selectionType : #SINGLE, multipleSelections : false } @ObjectModel.foreignKey.association: '_dir' key hieid, key nodeid, parentid, seqno, @ObjectModel.foreignKey.association: '_airline' carrid, @ObjectModel.foreignKey.association: '_connection' connid, @ObjectModel.foreignKey.association: '_node' nodename, @Semantics.signReversalIndicator signref as signReversalFlag, _parent, _dir, _node, _airline, _connection } </code></pre><P>&nbsp;</P><P><FONT color="#0000FF"><SPAN><STRONG><SPAN class=""><SPAN class="">Preview:</SPAN></SPAN><SPAN class="">&nbsp;</SPAN></STRONG></SPAN></FONT></P><P><FONT color="#0000FF"><SPAN><STRONG><SPAN class=""><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="preview.png" style="width: 791px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/95121i6179BCE8DA569035/image-size/large?v=v2&amp;px=999" role="button" title="preview.png" alt="preview.png" /></span></SPAN></STRONG></SPAN></FONT></P><P><SPAN>In CDS views with "Analytics.query : true"</SPAN><SPAN> or define as "transient view entity",</SPAN><SPAN> function "HRY_NODE_SIGN_VALUE(elemRef)" </SPAN><SPAN>is </SPAN><SPAN>used in a formula (AnalyticsDetails.query.formula). This function works in the following way</SPAN><SPAN>, </SPAN><SPAN>At first the path from the element to its hierarchy view is evaluated. In the hierarchy view there should exist exactly one field with semantics signReversal. For each hierarchy node for which the value of the sign reversal element returns space, the function HRY_NODE_SIGN_VALUE will return +1. If the value is not initial, the function returns -1. With this,</SPAN></P><P><SPAN>for example- </SPAN><SPAN>the formula</SPAN> <STRONG><SPAN>$projection.</SPAN></STRONG><SPAN>paymentsum </SPAN><STRONG><SPAN>*</SPAN></STRONG><SPAN> hry_node_sign_value</SPAN><STRONG><SPAN>(</SPAN></STRONG><SPAN> dimension </SPAN><STRONG><SPAN>=&gt;</SPAN></STRONG> <STRONG><SPAN>$projection.</SPAN></STRONG><SPAN>connid</SPAN><STRONG><SPAN>)</SPAN></STRONG> <STRONG><SPAN>as</SPAN></STRONG><SPAN> paymentsumSignRef</SPAN></P><P><SPAN>will return the key figure </SPAN><SPAN>paymentsum</SPAN><SPAN> for all nodes/leaves in the hierarchy with initial sign reversal indicator</SPAN><SPAN> and </SPAN><SPAN>It will return "- </SPAN><SPAN>paymentsum</SPAN><SPAN>" for all nodes/leaves with not initial sign reversal indicator.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>If there is no field with semantics signReversal in the hierarchy view, the function HRY_NODE_SIGN_VALUE always returns +1.</SPAN><SPAN>&nbsp;</SPAN></P><P><FONT color="#0000FF"><STRONG><SPAN class=""><SPAN class="">Example:</SPAN></SPAN><SPAN class=""> <SPAN class="">Analytical query</SPAN></SPAN><SPAN class="">&nbsp;</SPAN></STRONG></FONT></P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #NOT_ALLOWED @EndUserText.label: 'SIGN REVERSAL' @Metadata.ignorePropagatedAnnotations: true define transient view entity ZLR_SIGN_REV_FLIGHT_1 provider contract analytical_query with parameters @EndUserText.label: 'Hierarchy' @Consumption.defaultValue: 'CNTRY' p_hienm : char5 as projection on ZOQ_FLIGHT { @AnalyticsDetails.query.axis: #ROWS @AnalyticsDetails.query: { displayHierarchy: #ON, hierarchyBinding: [{ type : #PARAMETER , value : 'p_hienm' }] } connid, @AnalyticsDetails.query.axis: #FREE currency, @Semantics.amount.currencyCode: 'CURRENCY' @Aggregation.default: #SUM @AnalyticsDetails.query.axis: #COLUMNS curr_to_decfloat_amount( paymentsum ) as paymentsum, @AnalyticsDetails.query.axis: #COLUMNS @EndUserText.label: 'HierSignRev' @Aggregation.default: #FORMULA $projection.paymentsum * hry_node_sign_value( dimension =&gt; $projection.connid) as paymentsumSignRef }</code></pre><P>&nbsp;</P><P><FONT color="#0000FF"><STRONG>Result:</STRONG></FONT></P><P><FONT color="#0000FF"><STRONG><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="result.png" style="width: 761px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/95125iE96DEC39C036AD90/image-size/large?v=v2&amp;px=999" role="button" title="result.png" alt="result.png" /></span></STRONG></FONT></P><P><SPAN>In this example for Hierarchy ZOQ_CONNECTION_HIERARCHY (which is defined in the </SPAN><SPAN>ZOQ_FLIGHT)</SPAN><SPAN>, </SPAN><SPAN>signReversalFlag is set for Carried id 'A', 'JL', 'UA'. Therefore, in result of analytical query HierSignRev field is showing the –ve result of the booking total.</SPAN><SPAN>&nbsp;</SPAN></P><P><FONT color="#0000FF"><STRONG><SPAN>SAP Delivered Hierarchies:</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><P><SPAN>There are few SAP delivered hierarchies which have this feature.</SPAN></P><P><SPAN>Following fields name:&nbsp;</SPAN><SPAN>FinancialStatementItem, </SPAN><SPAN>CnsldtnFinancialStatementItem, FinancialStatementLeafItem, GLAccount, etc.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>Can have this feature because they have foreign key association with dimension view which has hierarchy association to hierarchy view supporting this feature.</SPAN><SPAN>&nbsp;</SPAN></P><P><SPAN>For example:</SPAN><SPAN>&nbsp;</SPAN><SPAN>Field with name ‘</SPAN><SPAN>FinancialStatementItem</SPAN><SPAN>’ typically have a foreign key association to dimension view </SPAN><SPAN>I_CnsldtnFinStmntItem and corresponding hierarchy view </SPAN><SPAN>I_FinStmntItmHier will support this feature.</SPAN><SPAN>&nbsp;</SPAN></P><P><FONT color="#0000FF"><STRONG><SPAN>Constraints:</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><P><SPAN>Only one element in a view of data category HIERARCHY can be marked with semantics signReversal. The data type of the element should be CHAR of length 1.</SPAN><SPAN>&nbsp;<SPAN class=""><SPAN class="">Allowed values are X or space.</SPAN></SPAN><SPAN class="">&nbsp;</SPAN></SPAN></P><P><FONT color="#0000FF"><STRONG><SPAN>Related Note:</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><P><SPAN>1385580 - How does a formula variable with a replacement path work?</SPAN><SPAN>&nbsp;</SPAN></P><P><FONT color="#0000FF"><STRONG><SPAN>Availability:</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><P><SPAN>This feature is available from </SPAN><SPAN>S/4HANA 1909 (ABAP Platform 7.54).</SPAN><SPAN>&nbsp;</SPAN></P> 2024-04-15T13:30:04.285000+02:00 https://community.sap.com/t5/technology-blog-posts-by-sap/cds-how-to-define-hierarchy-view/ba-p/13758059 CDS : How to define Hierarchy View 2024-07-17T14:18:20.286000+02:00 LinaRaut https://community.sap.com/t5/user/viewprofilepage/user-id/179963 <P><FONT size="4"><SPAN>This blog is about how to define Hierarchy View</SPAN><SPAN> in CDS</SPAN><SPAN>.</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>There are two types of </SPAN><SPAN>hierarch</SPAN><SPAN>ies – '</SPAN><SPAN>Leveled</SPAN><SPAN> Hierarchy' and '</SPAN><SPAN>Parent-Chil</SPAN><SPAN>d Hierarchy'</SPAN><SPAN>&nbsp;</SPAN><SPAN>In Analytics, only a Parent-Child hierarchy is supported.</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>In CDS, Hierarchy can be defined in two ways:</SPAN><SPAN>&nbsp;</SPAN></FONT></P><UL><LI><FONT size="4"><SPAN>Inline Hierarchy: where the hierarchy definition is modelled in the dimension view.</SPAN><SPAN>&nbsp;</SPAN></FONT></LI></UL><UL><LI><FONT size="4"><SPAN>External Hierarchy: where there is a separate CDS view to model the definition of the hierarchy.</SPAN><SPAN>&nbsp;</SPAN></FONT></LI></UL><P><FONT size="4"><SPAN>In the past, External hierarchy was defined using the annotation '</SPAN><SPAN>@ObjectModel.dataCategory:</SPAN> <SPAN>#HIERARCHY'.</SPAN><SPAN>&nbsp;</SPAN><SPAN>Now, in CDS it is allowed to define new type of CDS view called as Hierarchy CDS, which is defined using</SPAN> <SPAN>syntax </SPAN><SPAN>define hierarchy</SPAN><STRONG><SPAN>, </SPAN></STRONG><SPAN>which create a hierarchical view.</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>A CDS hierarchy represents a HANA hierarchy, created when the CDS hierarchy is activated.</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>Normally the hierarchy contains headers and nodes. The header data of the hierarchy is coming from the directory view and the nodes data is coming from the hierarchy view itself.&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4" color="#0000FF"><SPAN>&nbsp;</SPAN><STRONG><SPAN>Hierarchy Directory</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>The directory of the </SPAN><SPAN>h</SPAN><SPAN>ierarchy provides the header information of the </SPAN><SPAN>h</SPAN><SPAN>ierarchy</SPAN><SPAN>.</SPAN> <SPAN>A hierarchy view might </SPAN><SPAN>contain</SPAN><SPAN> more than one hierarchy. Information about each hierarchy (</SPAN><SPAN>e.g.</SPAN><SPAN> text</SPAN><SPAN>)</SPAN> <SPAN>is</SPAN><SPAN> provided by a hierarchy directory</SPAN><SPAN>. More</SPAN><SPAN> information can be found in </SPAN><A href="https://community.sap.com/t5/technology-blogs-by-sap/cds-hierarchy-directory-how-to-use-notassignednode-annotation-to-suppress/ba-p/13576317" target="_blank"><SPAN>blog</SPAN></A><SPAN>.</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>Typically, the directory view is defined as follows:</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@EndUserText.label: 'Connection Hierarchy Directory View' @Analytics : { dataCategory: #DIMENSION, dataExtraction.enabled: true } @ObjectModel.representativeKey: 'hieid' define view entity ZLR_CONNECTION_HIERARCHY_DIR as select from zoq_connid_hd { @ObjectModel.text.element: [ 'hiertxt' ] key hieid, @Semantics.text: true hiertxt, @Semantics.systemDate.lastChangedAt: true last_changed, }</code></pre><P>&nbsp;</P><P><FONT size="4" color="#0000FF"><STRONG><SPAN class=""><SPAN class="">Output</SPAN></SPAN></STRONG></FONT></P><P><FONT size="4"><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_0-1720985264075.png" style="width: 457px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/136485i2087A99928F26B22/image-dimensions/457x361?v=v2" width="457" height="361" role="button" title="LinaRaut_0-1720985264075.png" alt="LinaRaut_0-1720985264075.png" /></span></FONT></P><P>&nbsp;</P><P><FONT size="5" color="#0000FF"><STRONG><SPAN class=""><SPAN class="">Hierarchy View </SPAN><SPAN class="">using&nbsp;</SPAN></SPAN><SPAN class=""><SPAN class="">d</SPAN></SPAN><SPAN class=""><SPAN class="">efine</SPAN><SPAN class=""> hierarchy &lt;NAME&gt;</SPAN></SPAN></STRONG></FONT></P><P><FONT size="4"><SPAN>This is the new way of defining hierarchy and it is available </SPAN><SPAN>from 2023 on Prem and 2308 Cloud</SPAN><SPAN>. </SPAN><SPAN>For defining hierarchy, prerequisite is having a source view, which is mentioned in the definition as parent child hierarchy source.</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4" color="#0000FF"><STRONG><SPAN>Source View</SPAN></STRONG></FONT></P><P><FONT size="4"><SPAN>In view definition parent child association is define along with that following associations:</SPAN><SPAN>&nbsp;</SPAN></FONT></P><UL><LI><FONT size="4"><SPAN>Association to hierarchy view itself- It defines parent child relationship</SPAN></FONT></LI><LI><FONT size="4"><SPAN>Association to hierarchy directory - It contains all the header information- hierarchy ids.</SPAN><SPAN>&nbsp;</SPAN></FONT></LI><LI><FONT size="4"><SPAN>A</SPAN><SPAN>ssociation to different dimension/text views –</SPAN><SPAN> I</SPAN><SPAN>t is a relation from the nodes and leaves to dimension and text views</SPAN><SPAN>.</SPAN><SPAN> Via this </SPAN><SPAN>association the</SPAN><SPAN> text of a node/leaf is derived. In the foll</SPAN><SPAN>owing e</SPAN><SPAN>xample '_</SPAN><SPAN>node' is</SPAN><SPAN> first level node. '_airline' acts as se</SPAN><SPAN>cond </SPAN><SPAN>level node </SPAN><SPAN>and '</SPAN><SPAN>_connection' is leaf and pointing to dimension</SPAN><SPAN>.</SPAN><SPAN>&nbsp;</SPAN></FONT></LI><LI><FONT size="4">Extra conditions like 'carrid = "" '&nbsp; are not necessary and the order of the associations is not relevant. Instead in this case a separate field is needed, which returns the fieldname of the records, which should be used. In the example it is field 'nodetype'</FONT></LI></UL><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: 'Base for : New Way of defining Hierarchy' define view entity ZLR_CONN_HIERARCHY_BASE as select from zoq_connid_h //association to itself. association [0..1] to ZLR_CONN_HIERARCHY_BASE as _parent on $projection.hieid = _parent.hieid and $projection.parentid = _parent.nodeid // association with hierarchy directory association [1] to ZLR_CONNECTION_HIERARCHY_DIR as _dir on $projection.hieid = _dir.hieid // associations to the different node types // evalulated at runtime for each record in the order given here // first hit of ON-condition is followed // Differnce to old way of Hierarchy ZLR_CONNECTION_HIERARCHY - here no $projection.carrid = '' and $projection.connid = '0000' association [1] to ZOQ_CONNECTION_NODENAME as _node on $projection.hieid = _node.hieid and $projection.nodename = _node.nodeName // "nodatetype" Airline // Differnce to old way of Hierarchy ZLR_CONNECTION_HIERARCHY - here no and $projection.connid = '0000' association [1] to ZOQ_AIRLINE as _airline on $projection.carrid = _airline.carrid // association to dimension view association [1] to ZLR_CONN as _connection on $projection.carrid = _connection.carrid and $projection.connid = _connection.connid { @Consumption.filter: { mandatory : true, selectionType : #SINGLE, multipleSelections : false } @ObjectModel.foreignKey.association: '_dir' key hieid, key nodeid, parentid, seqno, // three different node types possible in this example // here CONNID is leaf (can not be derived from this view) @ObjectModel.foreignKey.association: '_airline' carrid, @ObjectModel.foreignKey.association: '_connection' connid, @ObjectModel.foreignKey.association: '_node' nodename, cast( case when carrid is initial and connid is initial then 'NODENAME' when connid is initial then 'CARRID' else 'CONNID' end as fieldname ) as nodetype, // associations defined above have to be exposed here // otherwise they will not be available _parent, _dir, _node, _airline, _connection }</code></pre><P>&nbsp;</P><P><FONT size="4" color="#0000FF"><STRONG><SPAN>Hierarchy View&nbsp;</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>Hierarchy view can be defined using the following syntax.</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><STRONG><SPAN>Syntax:</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><OL><LI><FONT size="4"><SPAN>... </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>[DEFINE] HIERARCHY hierarchy </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>         [parameter_list] </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>         AS PARENT CHILD HIERARCHY( </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           SOURCE cds_view&nbsp; </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           CHILD TO PARENT ASSOCIATION _hierarchy_assoc </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           [PERIOD FROM field1 TO field2 VALID FROM from TO to] </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           [DIRECTORY _directory_assoc FILTER BY cds_cond] </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           [START WHERE cds_cond] </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           SIBLINGS ORDER BY field1 [ASCENDING|DESCENDING][, </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>                             field2 [ASCENDING|DESCENDING], ...] </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           [DEPTH depth] </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           [NODETYPE node_type] </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           [LOAD BULK|INCREMENTAL|load_option] </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           [MULTIPLE PARENTS {NOT ALLOWED}|LEAVES|ALLOWED] </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           [ORPHANS IGNORE|ERROR|ROOT] </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           [CYCLES ERROR|BREAKUP] </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           [GENERATE SPANTREE] </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>           [CACHE ON|OFF|FORCE]) </SPAN><SPAN>&nbsp;<BR /></SPAN><SPAN>     { element_list }</SPAN><SPAN>&nbsp;</SPAN></FONT></LI></OL><P><FONT size="4"><STRONG><SPAN>In Syntax</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><UL><LI><FONT size="4"><STRONG><SPAN>SOURCE</SPAN></STRONG><SPAN> – Name of Source view. The mandatory addition SOURCE specifies a CDS view entity. This source must expose the hierarchy association specified after CHILD TO PARENT ASSOCIATION in its SELECT list.</SPAN><SPAN>&nbsp;</SPAN></FONT></LI></UL><P><FONT size="4"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN>&nbsp; </SPAN><STRONG><SPAN>source</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN>ZLR_CONN_HIERARCHY_BASE</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><UL><LI><FONT size="4"><STRONG><SPAN>CHILD TO PARENT ASSOCIATION</SPAN></STRONG><SPAN>: The mandatory addition CHILD TO PARENT ASSOCIATION specifies the hierarchy association who’s ON condition selects the descendant nodes of the root node set.</SPAN><SPAN>&nbsp;</SPAN></FONT></LI></UL><P><FONT size="4"><STRONG><SPAN>&nbsp;&nbsp; </SPAN></STRONG><SPAN>&nbsp; &nbsp; &nbsp;&nbsp;</SPAN><STRONG><SPAN>child</SPAN></STRONG> <STRONG><SPAN>to</SPAN></STRONG> <STRONG><SPAN>parent</SPAN></STRONG> <STRONG><SPAN>association</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>&nbsp;&nbsp;&nbsp; </SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN> _parent</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><UL><LI><FONT size="4"><STRONG><SPAN>PERIOD FROM</SPAN></STRONG><SPAN> field1 </SPAN><STRONG><SPAN>TO</SPAN></STRONG><SPAN> field2 </SPAN><STRONG><SPAN>VALID FROM</SPAN></STRONG><SPAN> from </SPAN><STRONG><SPAN>TO</SPAN></STRONG><SPAN> to: The optional addition PERIOD defines the hierarchy as a temporal SQL hierarchy in which the hierarchy nodes are limited by an adjustment of time intervals.</SPAN><SPAN> In case</SPAN><SPAN> of </SPAN><SPAN>parameter, they </SPAN><SPAN>can be </SPAN><SPAN>different but value must be same when used in a query.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</SPAN></FONT><FONT size="4"><SPAN>&nbsp; </SPAN><STRONG><SPAN>period</SPAN></STRONG> <STRONG><SPAN>from</SPAN></STRONG><SPAN> datefrom </SPAN><STRONG><SPAN>to</SPAN></STRONG><SPAN> dateto </SPAN><STRONG><SPAN>valid</SPAN></STRONG> <STRONG><SPAN>from</SPAN></STRONG> <STRONG><SPAN>$parameters.</SPAN></STRONG><SPAN>p_date </SPAN><STRONG><SPAN>to</SPAN></STRONG> <STRONG><SPAN>$parameters.</SPAN></STRONG><SPAN>p_date&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></LI></UL><P><FONT size="4"><SPAN>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OR</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><STRONG><SPAN>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;period</SPAN></STRONG> <STRONG><SPAN>from</SPAN></STRONG><SPAN> datefrom </SPAN><STRONG><SPAN>to</SPAN></STRONG><SPAN> dateto </SPAN><STRONG><SPAN>valid</SPAN></STRONG> <STRONG><SPAN>from</SPAN></STRONG> <SPAN>'20230425'</SPAN> <STRONG><SPAN>to</SPAN></STRONG> <SPAN>'20230425'</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><UL><LI><FONT size="4"><STRONG><SPAN>DIRECTORY</SPAN></STRONG><SPAN>: Hierarchy directory name. The optional addition DIRECTORY defines a filter condition cds_cond for the rows of the source of the hierarchy specified after SOURCE. It defines association to the header/ directory view. Filter can be defined on hierarchy directory, based on parameter. In case of time dependent hierarchy date parameters can be used to filter out the hierarchy.</SPAN><SPAN>&nbsp;</SPAN></FONT></LI></UL><P><FONT size="4"><SPAN>&nbsp;</SPAN><STRONG><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></STRONG><SPAN>_dir </SPAN><STRONG><SPAN>filter</SPAN></STRONG> <STRONG><SPAN>by</SPAN></STRONG><SPAN>&nbsp; hienm </SPAN><STRONG><SPAN>=</SPAN></STRONG> <STRONG><SPAN>$parameters.</SPAN></STRONG><SPAN>p_hienm1</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><STRONG><SPAN>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</SPAN></STRONG><STRONG><SPAN>and</SPAN></STRONG><SPAN> keydate </SPAN><STRONG><SPAN>=</SPAN></STRONG> <STRONG><SPAN>$parameters.</SPAN></STRONG><SPAN>p_keydate</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><UL><LI><FONT size="4"><STRONG><SPAN>START WHERE</SPAN></STRONG><SPAN>: The optional addition START WHERE specifies the start condition for creating the hierarchy. START WHERE can be followed by a logical expression cds_cond that selects rows from the source cds_view.</SPAN><SPAN>&nbsp;</SPAN></FONT></LI></UL><P><FONT size="4"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN>&nbsp;</SPAN><STRONG><SPAN>start</SPAN></STRONG> <STRONG><SPAN>where</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>&nbsp;&nbsp;</SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN>&nbsp;parentid </SPAN><STRONG><SPAN>is</SPAN></STRONG> <STRONG><SPAN>initial</SPAN></STRONG><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><UL><LI><FONT size="4"><STRONG><SPAN>SIBLINGS ORDER BY</SPAN></STRONG><SPAN> field1 [ASCENDING|DESCENDING]: The mandatory addition SIBLINGS ORDER BY sorts sibling nodes in the hierarchy. Default is Ascending.</SPAN><SPAN>&nbsp;</SPAN>&nbsp;</FONT></LI></UL><P><FONT size="4"><SPAN>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</SPAN><STRONG><SPAN>siblings</SPAN></STRONG> <STRONG><SPAN>order</SPAN></STRONG> <STRONG><SPAN>by</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;seqno</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><UL><LI><FONT size="4"><STRONG><SPAN>NODETYPE </SPAN></STRONG><SPAN>node_type: The&nbsp; NODETYPE identifies an element of the CDS hierarchy that can be used to determine the type of the hierarchy node. The values of this element must be element names, which must </SPAN><SPAN>also</SPAN><SPAN> be contained in the element list of the CDS hierarchy.</SPAN><SPAN>&nbsp;</SPAN></FONT></LI></UL><P><FONT size="4"><SPAN>In context of Analytics, it is mandatory to define the nodetype field in the source view of the hierarchy and also in the hierarchy view using key word '</SPAN><SPAN>nodetype'</SPAN></FONT></P><P><FONT size="4"><SPAN>For example, in the Source view&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>&nbsp;&nbsp;&nbsp; </SPAN><SPAN>&nbsp; </SPAN><STRONG><SPAN>cast(</SPAN></STRONG><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>&nbsp;</SPAN> <SPAN>&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><STRONG><SPAN>case</SPAN></STRONG> <STRONG><SPAN>when</SPAN></STRONG> <SPAN>carrid</SPAN> <STRONG><SPAN>is</SPAN></STRONG> <STRONG><SPAN>initial</SPAN></STRONG> <STRONG><SPAN>and</SPAN></STRONG><SPAN> connid </SPAN><STRONG><SPAN>is</SPAN></STRONG> <STRONG><SPAN>initial</SPAN></STRONG> <STRONG><SPAN>then</SPAN></STRONG> <SPAN>'NODENAME'</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><STRONG><SPAN>when</SPAN></STRONG><SPAN> connid </SPAN><STRONG><SPAN>is</SPAN></STRONG> <STRONG><SPAN>initial</SPAN></STRONG><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><STRONG><SPAN>then</SPAN></STRONG> <SPAN>'CARRID'</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>&nbsp;&nbsp;&nbsp; </SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><STRONG><SPAN>else</SPAN></STRONG> <SPAN>'CONNID'</SPAN> <STRONG><SPAN>end</SPAN></STRONG> <STRONG><SPAN>as</SPAN></STRONG> <I><SPAN>fieldname</SPAN></I> <STRONG><SPAN>)</SPAN></STRONG> <STRONG><SPAN>as</SPAN></STRONG><SPAN> nodetype</SPAN><STRONG><SPAN>,</SPAN></STRONG><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>In the Hierarchy view&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>&nbsp; &nbsp; &nbsp; &nbsp;</SPAN><STRONG><SPAN>nodetype</SPAN></STRONG><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>&nbsp; </SPAN><SPAN>&nbsp; &nbsp; &nbsp;nodetype</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>&nbsp;</SPAN><SPAN>More detailed information can be found here </SPAN><A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abencds_f1_define_hierarchy.htm" target="_blank" rel="noopener noreferrer"><SPAN>ABAP Keyword Documentation (sap.com)</SPAN></A><SPAN>.</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4" color="#0000FF"><STRONG><SPAN><SPAN class="">Example of </SPAN><SPAN class="">Hierarchy View</SPAN></SPAN></STRONG></FONT></P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>define hierarchy ZLR_CONN_HIERARCHY with parameters @Consumption.defaultValue: 'CNTRY' p_hieid : zoq_conhieid as parent child hierarchy( source ZLR_CONN_HIERARCHY_BASE child to parent association _parent directory _dir filter by hieid = $parameters.p_hieid start where parentid is initial siblings order by seqno nodetype nodetype ) { @ObjectModel.foreignKey.association: '_dir' key hieid, key nodeid, parentid, seqno, @ObjectModel.foreignKey.association: '_airline' carrid, @ObjectModel.foreignKey.association: '_connection' connid, @ObjectModel.foreignKey.association: '_node' nodename, nodetype, // associations defined above have to be exposed here // otherwise they will not be available _parent, _dir, _node, _airline, _connection }</code></pre><P>&nbsp;</P><P><FONT size="4" color="#0000FF"><STRONG><SPAN><SPAN class="">Out</SPAN><SPAN class="">put</SPAN></SPAN></STRONG></FONT></P><P><FONT size="4"><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_0-1720989908770.png" style="width: 607px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/136487iB83682D5BB21AF35/image-dimensions/607x432?v=v2" width="607" height="432" role="button" title="LinaRaut_0-1720989908770.png" alt="LinaRaut_0-1720989908770.png" /></span></FONT></P><P><FONT size="4"><FONT color="#FF0000"><SPAN>Red:</SPAN></FONT><SPAN> association _node&nbsp;</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><FONT color="#339966"><SPAN>Green</SPAN></FONT><SPAN><FONT color="#339966">:</FONT> association _airline</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><FONT color="#0000FF"><SPAN>Blue</SPAN></FONT><SPAN><FONT color="#0000FF">:</FONT> association _connection,</SPAN> <SPAN>the blue marked records are leaves</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><STRONG><FONT color="#0000FF"><SPAN class=""><SPAN class=""><SPAN class="">Example o</SPAN></SPAN></SPAN><SPAN class=""><SPAN class=""><SPAN class="">f Query using Hierarchy</SPAN></SPAN></SPAN></FONT></STRONG></FONT></P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #NOT_ALLOWED @EndUserText.label: 'ZLR_CONN - query' @Metadata.ignorePropagatedAnnotations: true define transient view entity ZLR_CONN_QUERY provider contract analytical_query as projection on ZLR_CONN { @AnalyticsDetails.query:{ axis:#ROWS, displayHierarchy: #ON , hierarchyBinding: [{ type: #CONSTANT, value: 'CNTRY' }] } connid }</code></pre><P>&nbsp;</P><P><FONT size="4" color="#0000FF"><STRONG><SPAN><SPAN class=""><SPAN class="">Output</SPAN></SPAN></SPAN></STRONG></FONT></P><P><FONT size="4"><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_1-1720990617543.png" style="width: 462px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/136488iDCC79DDE37ADBC00/image-dimensions/462x488?v=v2" width="462" height="488" role="button" title="LinaRaut_1-1720990617543.png" alt="LinaRaut_1-1720990617543.png" /></span></FONT></P><P><FONT size="5" color="#0000FF"><STRONG><SPAN>Hierarchy View Using @ObjectModel.dataCategory: #HIERARCHY Annotation </SPAN></STRONG><SPAN>(OLD way)</SPAN></FONT></P><P><FONT size="4"><SPAN>In View </SPAN><SPAN>definition the annotation&nbsp;</SPAN><A href="mailto:%E2%80%98@Hierarchy.parentChild%E2%80%99" target="_blank" rel="noopener nofollow noreferrer"><SPAN>@Hierarchy.parentChild </SPAN></A><SPAN>provides the information about the parent child hierarchy. It has hierarchy name, </SPAN><SPAN>multiple parents, recursion by, ordering of siblings, root node visibility, orphaned node handling, etc. along with </SPAN><SPAN>that, following association</SPAN><SPAN>s need to be defined.&nbsp; </SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><UL><LI><FONT size="4"><SPAN>Association to hierarchy view itself</SPAN> <SPAN>- </SPAN><SPAN>I</SPAN><SPAN>t defines parent child relationship.</SPAN><SPAN>&nbsp;</SPAN>&nbsp;</FONT></LI><LI><FONT size="4"><SPAN>Association to hierarchy directory</SPAN><SPAN> view</SPAN> <SPAN>-</SPAN><SPAN> I</SPAN><SPAN>t </SPAN><SPAN>contains</SPAN><SPAN> all the header information</SPAN><SPAN>, </SPAN><SPAN>hierarchy</SPAN><SPAN> Ids and the </SPAN><SPAN>descriptions</SPAN><SPAN>.</SPAN><SPAN>&nbsp;</SPAN></FONT></LI><LI><FONT size="4"><SPAN>Association to different</SPAN><SPAN> dimension/text views</SPAN> <SPAN>–</SPAN> <SPAN>I</SPAN><SPAN>t is a relation from the nodes and leaves to dimension and text views</SPAN><SPAN>.</SPAN><SPAN> Via this association </SPAN><SPAN>the text of a node/leaf is derived.</SPAN><SPAN> In the following example '</SPAN><SPAN>_</SPAN><SPAN>node'</SPAN>&nbsp;<SPAN>is</SPAN> <SPAN>first</SPAN><SPAN> level node</SPAN><SPAN>,</SPAN><SPAN>&nbsp;'_airline' acts as </SPAN><SPAN>second</SPAN><SPAN> level node </SPAN><SPAN>and '</SPAN><SPAN>_connection'</SPAN><SPAN>&nbsp;is leaf and pointing to dimension.&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></LI></UL><P><FONT size="4">Important is the order of the associations listed in the element-list and the '<SPAN>extra-condition'</SPAN><SPAN> in the ON-clause. For each record of the hierarchy the ON condition of the associations is checked - the first association which meets the ON condition is used to get text and attributes for the hierarchy node/leaf</SPAN><SPAN>.</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><SPAN>One association is mandatory - its target must be the dimension view which has a </SPAN><SPAN>ObjectModel.hierarchy.association</SPAN><SPAN> to the hierarchy view. These objects in the hierarchy represent the </SPAN><SPAN>leave</SPAN><SPAN>s</SPAN><SPAN>.</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4" color="#0000FF"><STRONG><SPAN>Example</SPAN></STRONG></FONT></P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@EndUserText.label: 'Connection Hierarchy View' @ObjectModel.dataCategory: #HIERARCHY @Hierarchy.parentChild: [{ name : 'ConnectionHierarchy', label : 'Connection', siblingsOrder: [{ by: 'seqno' }] , recurseBy : '_parent', directory: '_dir' }] define view entity ZLR_CONNECTION_HIERARCHY as select from zoq_connid_h // basic parent child relation inside one hierarchy // hierarchy uniquely selected (see @Filter for field HIEID association [0..1] to ZLR_CONNECTION_HIERARCHY as _parent on $projection.parentid = _parent.nodeid // necessary if view represents several hierarchies // association to the hierarchy directory association [1] to ZLR_CONNECTION_HIERARCHY_DIR as _dir on $projection.hieid = _dir.hieid // associations to the different node types // evalulated at runtime for each record in the order given here // first hit of ON-condition is followed association [1] to ZOQ_CONNECTION_NODENAME as _node on $projection.hieid = _node.hieid and $projection.nodename = _node.nodeName and $projection.carrid = '' and $projection.connid = '0000' // "nodatetype" Airline association [1] to ZOQ_AIRLINE as _airline on $projection.carrid = _airline.carrid and $projection.connid = '0000' // For which dimension this hierarchy belongs association [1] to ZLR_CONNECTION as _connection on $projection.carrid = _connection.carrid and $projection.connid = _connection.connid { @Consumption.filter: { mandatory : true, selectionType : #SINGLE, multipleSelections : false } @ObjectModel.foreignKey.association: '_dir' key hieid, key nodeid, parentid, seqno, // three different node types possible in this example // here CONNID is leaf (can not be derived from this view) @ObjectModel.foreignKey.association: '_airline' carrid, @ObjectModel.foreignKey.association: '_connection' connid, @ObjectModel.foreignKey.association: '_node' nodename, // associations defined above have to be exposed here // otherwise they will not be available _parent, _dir, _node, _airline, _connection } </code></pre><P>&nbsp;</P><P>&nbsp;</P><P><FONT size="4" color="#0000FF"><STRONG><SPAN class=""><SPAN class="">Output</SPAN></SPAN></STRONG></FONT></P><P><FONT size="4"><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_1-1720985929330.png" style="width: 613px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/136486iE4D5634C7709FE25/image-dimensions/613x544?v=v2" width="613" height="544" role="button" title="LinaRaut_1-1720985929330.png" alt="LinaRaut_1-1720985929330.png" /></span></FONT></P><P><FONT size="4"><FONT color="#FF0000"><SPAN>Red:</SPAN></FONT><SPAN> association _node&nbsp;</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><FONT color="#008080"><SPAN>Green</SPAN></FONT><SPAN><FONT color="#008080">: </FONT>association _airline</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4"><FONT color="#0000FF"><SPAN>Blue</SPAN></FONT><SPAN><FONT color="#0000FF">:</FONT> association _connection, the blue marked records are leaves</SPAN><SPAN>&nbsp;</SPAN></FONT></P><P>&nbsp;</P><P><FONT size="4"><FONT color="#0000FF"><STRONG><SPAN>Reference</SPAN></STRONG></FONT><SPAN>&nbsp;</SPAN></FONT></P><P><FONT size="4">More information on @Semantics.signReversalIndicator&nbsp;can be found in the <A href="https://community.sap.com/t5/technology-blogs-by-sap/cds-view-hierarchy-node-sign-reversal/ba-p/13599337" target="_blank">blog.</A>&nbsp;</FONT></P><P><FONT size="4"><SPAN>&nbsp;</SPAN></FONT></P><P>&nbsp;</P><P>&nbsp;</P> 2024-07-17T14:18:20.286000+02:00 https://community.sap.com/t5/technology-blog-posts-by-members/query-hierarchy-f4-help-not-customizeable-not-possible-for-a-multi-level/ba-p/13925205 Query Hierarchy F4 Help not customizeable ? Not possible for a multi level Hierarchy ? 2024-10-31T16:19:34.903000+01:00 Martin_4 https://community.sap.com/t5/user/viewprofilepage/user-id/172054 <P><STRONG>newly updated !&nbsp;newly updated !&nbsp;newly updated !newly updated !newly updated !<BR /><BR />Hierarchy input Parameter f4 selection user customized solution searched<BR />===========================================================<BR />Summary:<BR /></STRONG>Desired result is, that a SAP User with defined access rights can see and choose in the&nbsp; query input only those hierachie trees and leaves which he is authorized for.</P><P>The authorization rights&nbsp; for each single SAP User are available in a flat view consisting of&nbsp; (SAP User- Country -Region -- Company Code).</P><P><STRONG>Current design Hierarchy Tree:<BR /></STRONG>+-0HIER_NODE (Root=Betriebe Gesamt = &nbsp;All Plants)<BR />+-- ZMO_CNTRY (Country Node = DE, AT)<BR />+---ZMO REGION (Region Node: BER, FRO)<BR />+----ZMO_CCODE (Company Code Leave=5070, 8000):</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Martin_4_0-1730903050530.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/187531i95E9914226161B37/image-size/medium?v=v2&amp;px=400" role="button" title="Martin_4_0-1730903050530.png" alt="Martin_4_0-1730903050530.png" /></span></P><P>&nbsp;</P><P><STRONG>Current Query Design:</STRONG></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Martin_4_1-1730903050532.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/187532i7D96979C0BDC5718/image-size/medium?v=v2&amp;px=400" role="button" title="Martin_4_1-1730903050532.png" alt="Martin_4_1-1730903050532.png" /></span></P><P>Hierachy node, Mulit entry, input ready &nbsp;variable of the filter which allows the multibed entry</P><P><STRONG>Current– Customer Exit F4 Input Variable Design:</STRONG></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Martin_4_2-1730903050534.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/187533iC80B7CCE0ED45B33/image-size/medium?v=v2&amp;px=400" role="button" title="Martin_4_2-1730903050534.png" alt="Martin_4_2-1730903050534.png" /></span></P><P>&nbsp;</P><P><STRONG>Current F4 Customers Exit Parameter Result:</STRONG></P><P>&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Martin_4_3-1730903050540.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/187536i0B6FE41879A4DE72/image-size/medium?v=v2&amp;px=400" role="button" title="Martin_4_3-1730903050540.png" alt="Martin_4_3-1730903050540.png" /></span><BR /><STRONG>Sample Desired Result:</STRONG><BR />A User with &nbsp;these Values &nbsp;Country = DE, Region=BER, Company Codes 5070, 5150, 5160 should result in this F4:</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Martin_4_4-1730903050544.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/187535i56F59883C2D46F18/image-size/medium?v=v2&amp;px=400" role="button" title="Martin_4_4-1730903050544.png" alt="Martin_4_4-1730903050544.png" /></span><BR /><STRONG>Suggested Solution&nbsp;With Badi RSR_VARIABLE_F4_RESTRICT</STRONG></P><P>Filtervalues:</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Martin_4_5-1730903050547.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/187534i803CAE20C07A5A63/image-size/medium?v=v2&amp;px=400" role="button" title="Martin_4_5-1730903050547.png" alt="Martin_4_5-1730903050547.png" /></span></P><P>Using Class Method IF_RSR_VARIABLE_F4_RESTRICT~GET_RESTRICTION_NODE</P><P>With a Custome Class with the Method &nbsp;IF_RSR_VARIABLE_F4_RESTRICT~<STRONG>GET_RESTRICTION_NODE</STRONG></P><P>???????Right Method ???????<BR />???????But how to fill the Structures &nbsp;properly ??????<BR />???????This wont do it</P><P><FONT size="2">method&nbsp;IF_RSR_VARIABLE_F4_RESTRICT~GET_RESTRICTION_NODE.</FONT></P><P><FONT size="2">DATA:&nbsp;l_s_node&nbsp;LIKE&nbsp;LINE&nbsp;OF&nbsp;c_t_node,</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l_s_hier&nbsp;LIKE&nbsp;LINE&nbsp;OF&nbsp;c_t_hierarchy.</FONT><BR /><FONT size="2">*</FONT><BR /><FONT size="2">#CASE&nbsp;i_vnam.</FONT><BR /><FONT size="2">**</FONT><BR /><FONT size="2">&nbsp;WHEN&nbsp;'ZCOMPCODE_HIERNODE_CUST_MULTI'.</FONT></P><P><FONT size="2">&nbsp;</FONT></P><P><FONT size="2">* ZMO_COMPANY_HIERARCHIE_SAC is the flat view containing the </FONT><BR /><FONT size="2">* Assigments Country Region – BUKR and via an Autorization CDS</FONT><BR /><FONT size="2">* the right BUKrs</FONT><BR /><FONT size="2">* GROUP By is only used to have only 1 BUKRS in the SELECT result set. </FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;SELECT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BUKRS</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;FROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZMO_COMPANY_HIERARCHIE_SAC</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;GROUP&nbsp;BY&nbsp;&nbsp;&nbsp;BUKRS</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;INTO&nbsp;<a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1407137">@DATA</a>(BUKRS).</FONT></P><P><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;clear&nbsp;l_s_node.</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l_s_node-niobjnm&nbsp;&nbsp;=&nbsp;'ZMO_CCODE'.&nbsp;l_s_node-nodename&nbsp;=&nbsp;BUKRS.</FONT><BR /><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;APPEND&nbsp;l_s_node&nbsp;&nbsp;TO&nbsp;c_t_node.</FONT><BR /><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;ENDSELECT.</FONT><BR /><BR /></P><P><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;SELECT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;country</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;FROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZMO_COMPANY_HIERARCHIE_SAC</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;GROUP&nbsp;BY&nbsp;&nbsp;&nbsp;country</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;INTO&nbsp;<a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1407137">@DATA</a>(country).</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;clear&nbsp;l_s_node.</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l_s_node-niobjnm&nbsp;&nbsp;=&nbsp;'ZMO_CNTRY'.</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l_s_node-nodename&nbsp;=&nbsp;country.</FONT><BR /><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;APPEND&nbsp;l_s_node&nbsp;&nbsp;TO&nbsp;c_t_node.</FONT><BR /><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;ENDSELECT.</FONT></P><P><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;SELECT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;region</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;FROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZMO_COMPANY_HIERARCHIE_SAC</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;GROUP&nbsp;BY&nbsp;&nbsp;&nbsp;region</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;INTO&nbsp;<a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1407137">@DATA</a>(region).</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;clear&nbsp;l_s_node.</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l_s_node-niobjnm&nbsp;&nbsp;=&nbsp;'ZMO_REGIO'.</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l_s_node-nodename&nbsp;=&nbsp;region.</FONT><BR /><FONT size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;APPEND&nbsp;l_s_node&nbsp;&nbsp;TO&nbsp;c_t_node.</FONT></P><P><BR /><BR /></P><P><FONT size="2">ENDCASE.</FONT><BR /><BR /><FONT size="2">endmethod.</FONT></P> 2024-10-31T16:19:34.903000+01:00 https://community.sap.com/t5/technology-blog-posts-by-sap/cds-view-how-to-provide-the-default-value-for-hierarchy-node-variable-in/ba-p/13930165 CDS View: How to provide the default value for hierarchy node variable in analytical queries 2024-11-08T15:57:12.182000+01:00 LinaRaut https://community.sap.com/t5/user/viewprofilepage/user-id/179963 <P>This blog is about – how to provide static or dynamic default value for hierarchy node variable in&nbsp;analytical queries.</P><P><FONT size="5"><STRONG>Static Default values</STRONG></FONT></P><P>Hierar<FONT size="3">chy node variable is defined using <STRONG>@AnalyticsDetails.variable</STRONG> annotation. Static default value for this variable can be provided using @AnalyticsDetails.variable.defaultHierarchyNode annotation.</FONT></P><P>In <STRONG>@AnalyticsDetails.variable</STRONG> annotation, selectionType need to set as #HIERRARCHY_NODE, also hierarchyBinding is specified along with referenceElement, MultipleSelections.</P><P><FONT size="4"><STRONG><SPAN>Example</SPAN></STRONG></FONT></P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AbapCatalog.viewEnhancementCategory: [#NONE] @AccessControl.authorizationCheck: #NOT_ALLOWED @EndUserText.label: 'Example of static default value' @Metadata.ignorePropagatedAnnotations: true @ObjectModel.usageType:{ serviceQuality: #X, sizeCategory: #S, dataClass: #MIXED } define transient view entity ZLR_RES_HIERNODE2 provider contract analytical_query with parameters @EndUserText.label: 'Connection Hierarchy' p_hienm : char5, @AnalyticsDetails.variable: { selectionType: #HIERARCHY_NODE, referenceElement: 'connid', hierarchyBinding: [{ type:#PARAMETER, value: 'p_hienm'}], multipleSelections: true, defaultHierarchyNode: { nodeType: 'carrid', node: [{element: 'carrid', value:'AZ' }] } } @Consumption.hidden: true p_hier_node : s_conn_id as projection on ZOQ_FLIGHT { @AnalyticsDetails.query.displayHierarchy: #FILTER @AnalyticsDetails.query.axis: #ROWS @AnalyticsDetails.query.totals: #SHOW connid, currency, @Semantics.amount.currencyCode: 'CURRENCY' @AnalyticsDetails.query.axis: #COLUMNS paymentsum } where currency = 'EUR' and connid = $parameters.p_hier_node</code></pre><P>&nbsp;</P><P class=""><FONT size="4"><STRONG><SPAN>Output</SPAN></STRONG></FONT></P><P><FONT size="5"><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_0-1730897022732.png" style="width: 572px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/187472i18351CAEEC9588EF/image-dimensions/572x506?v=v2" width="572" height="506" role="button" title="LinaRaut_0-1730897022732.png" alt="LinaRaut_0-1730897022732.png" /></span></FONT></P><H1 id="toc-hId-945573821"><FONT size="5"><STRONG>Dynamic Default Values</STRONG></FONT><SPAN>&nbsp;</SPAN></H1><P>Dynamic default values for hierarchy node variables should be derived from another CDS view (lookup view) at runtime.</P><P>@Consumption.derivation annotation enables derivation of the value for a parameter or a filter automatically at runtime by selecting a row from a given entity.</P><P>At first, a separate hierarchy node lookup view is defined.</P><P>Then hierarchy node variable is defined using @AnalyticsDetails.variable annotation.</P><P>To specify a default value for the previously defined node variable @Consumption.derivation.resultHierarchyNode is used.</P><P><STRONG>@Consumption.derivation</STRONG> annotation contains,</P><P>lookupEntity, which provide the name of hierarchy node lookup view to get the hierarchy node.</P><P>resultHierachyNode annotation is used to provide hierarchy node value to a parameter.</P><P>resultHierarchyNode.nodeTypeElement must point to a field in the lookup entity and this field must return a fieldname. This fieldname (in the data of the lookup view) must be an existing fieldname in the lookup view. &nbsp;If the value of field NodeTypeElement in the result of the lookup is initial, the row represents a leaf.</P><P>resultHierarchyNode.Mapping describes the mapping of the elements in the hierarchy view and the elements in the lookup entity.</P><P>Consumption.derivation.binding is possible to add filters to the lookup. This is generic and not specific to hierarchy nodes.</P><H1 id="toc-hId-749060316"><FONT size="4"><STRONG><SPAN>Example</SPAN></STRONG></FONT></H1><P><STRONG>Step 1: </STRONG>Defining Hierarchy node lookup view</P><P>Hierarchy node look up view is use as a lookup entity in the @Consumption.derivation annotation.</P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AbapCatalog.viewEnhancementCategory: [#NONE] @AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: 'Derivation for node parameter-resultHierarchyNode' @Metadata.ignorePropagatedAnnotations: true @ObjectModel.usageType:{ serviceQuality: #X, sizeCategory: #S, dataClass: #MIXED } define view entity ZLR_RES_DERIVE_BASE as select from t000 { cast( 'carrid1' as fieldname ) as nodeType, cast( 'LH' as s_carr_id ) as carrid1, cast( ' ' as s_conn_id ) as connid1, cast( ' ' as rsshnodename ) as nodename1, $session.user as userName } where mandt = '000'</code></pre><P>&nbsp;</P><P><STRONG>Step 2: </STRONG>Defining hierarchy node variable and use Consumption.derivation annotation in analytical query</P><P>In this example, ZLR_RES_DERIVE_BASE view is used as lookupEntity- which provides default value to the parameter</P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AbapCatalog.viewEnhancementCategory: [#NONE] @AccessControl.authorizationCheck: #NOT_ALLOWED @EndUserText.label: 'Example of dynamic default value' @Metadata.ignorePropagatedAnnotations: true @ObjectModel.usageType:{ serviceQuality: #X, sizeCategory: #S, dataClass: #MIXED } define transient view entity ZLR_RES_HIERNODE1 provider contract analytical_query with parameters @EndUserText.label: 'Connection Hierarchy' p_hienm : char5, @AnalyticsDetails.variable: { selectionType: #HIERARCHY_NODE, referenceElement: 'connid', hierarchyBinding: [{ type:#PARAMETER, value: 'p_hienm'}], multipleSelections: true } @Consumption.derivation: { lookupEntity: 'ZLR_RES_DERIVE_BASE', resultHierarchyNode: { nodeTypeElement: 'nodetype', mapping: [ { hierarchyElement: 'carrid', lookupElement: 'carrid1' }, { hierarchyElement: 'connid', lookupElement: 'connid1' }, { hierarchyElement: 'nodename', lookupElement: 'nodename1' } ] } } @Consumption.hidden: true p_hier_node : s_conn_id as projection on ZOQ_FLIGHT { @AnalyticsDetails.query.displayHierarchy: #FILTER @AnalyticsDetails.query.axis: #ROWS @AnalyticsDetails.query.totals: #SHOW connid, currency, @Semantics.amount.currencyCode: 'CURRENCY' @AnalyticsDetails.query.axis: #COLUMNS paymentsum } where currency = 'EUR' and connid = $parameters.p_hier_node</code></pre><P>&nbsp;</P><P class=""><FONT size="4"><STRONG><SPAN>Output</SPAN></STRONG></FONT></P><P class=""><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_1-1730897281623.png" style="width: 562px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/187473i542CB42B4BC03B70/image-dimensions/562x514?v=v2" width="562" height="514" role="button" title="LinaRaut_1-1730897281623.png" alt="LinaRaut_1-1730897281623.png" /></span></P><P>Please note that in the older release instead of using @AnalyticsDetails.variable annotation, @Consumption.hierarchyNodeSelection is used.</P><P>@Consumption.hierarchyNodeSelection: {&nbsp;</P><P>&nbsp; hierarchyElement: 'connid',</P><P>&nbsp; hierarchyBinding: [{ type:#PARAMETER, value: 'p_hienm'}],</P><P>&nbsp; multipleSelections: true</P><P>}</P> 2024-11-08T15:57:12.182000+01:00 https://community.sap.com/t5/technology-blog-posts-by-sap/cds-how-to-define-analytical-query-using-two-structures/ba-p/13960195 CDS : How to define analytical query using two structures 2024-12-20T14:44:22.867000+01:00 LinaRaut https://community.sap.com/t5/user/viewprofilepage/user-id/179963 <P>This blog is about how to use two structures in CDS analytical query as in BW query.</P><P>The structure forms the foundational layout of the axes (rows or columns) in a data table, determining how information is organized and presented.<BR />Structural components of key figure structures are always based on the key figure selections (basic key figures, restricted key figures, and calculated key figures). Characteristic structural components cannot contain key figure selections.</P><P><SPAN>The arrangement of the structure affects the order and quantity of key figures or characteristics displayed in the rows and columns of a query or report.</SPAN></P><P><STRONG>Example:</STRONG> BW Query with Characteristic structure and Key Figure structure</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_0-1733840825806.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/200347i1F98FC24B75D30C2/image-size/large?v=v2&amp;px=999" role="button" title="LinaRaut_0-1733840825806.png" alt="LinaRaut_0-1733840825806.png" /></span></P><P>In Analytical query, elements can be assigned to characteristics structure using @AnalyticsDetails.query.onCharacteristicStructure: true. Element with measures get automatically assigned to measure structure.</P><P>Formulas can be defined for both characteristic structure and measure structure. The operands of a formula must be elements of the same structure to which the formula belongs. Operands of the other structure are not allowed.</P><P>If an analytical query has two structures (a measure and a characteristic structure), then the query result is a grid. Each cell in this grid is defined by an element of the measure structure and one of the characteristic structures. Restrictions are combined with AND. If both elements are formulas, the formula of the measure structure is calculated by default. Also, other properties like scaling, decimals are taken from the element of the measure structure by default. If this should be different, @AnalyticsDetails.query.collisionHandling annotation is used.</P><P>&nbsp; collisionHandling<STRONG>:</STRONG></P><P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <STRONG>{</STRONG> formula&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <STRONG>:</STRONG> String<STRONG>(</STRONG> 20<STRONG>)</STRONG> <STRONG>enum</STRONG> <STRONG>{</STRONG> DEFAULT<STRONG>;</STRONG> THIS<STRONG>;</STRONG> CONCURRENT<STRONG>;</STRONG> <STRONG>};</STRONG></P><P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; decimals&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <STRONG>:</STRONG> String<STRONG>(</STRONG> 20<STRONG>)</STRONG> <STRONG>enum</STRONG> <STRONG>{</STRONG> DEFAULT<STRONG>;</STRONG> THIS<STRONG>;</STRONG> CONCURRENT<STRONG>;</STRONG> <STRONG>};</STRONG></P><P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scaling&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <STRONG>:</STRONG> String<STRONG>(</STRONG> 20<STRONG>)</STRONG> <STRONG>enum</STRONG> <STRONG>{</STRONG> DEFAULT<STRONG>;</STRONG> THIS<STRONG>;</STRONG> CONCURRENT<STRONG>;</STRONG> <STRONG>};</STRONG></P><P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; semanticObject <STRONG>:</STRONG> String<STRONG>(</STRONG> 20<STRONG>)</STRONG> <STRONG>enum</STRONG> <STRONG>{</STRONG> DEFAULT<STRONG>;</STRONG> THIS<STRONG>;</STRONG> CONCURRENT<STRONG>;</STRONG> <STRONG>};</STRONG></P><P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <STRONG>};</STRONG></P><P><STRONG>Example:</STRONG></P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #NOT_ALLOWED @EndUserText.label: 'CDS Query with 2 Structures' @ObjectModel.modelingPattern: #ANALYTICAL_QUERY @ObjectModel.supportedCapabilities: [ #ANALYTICAL_QUERY ] define transient view entity ZLR_2STRUCT_CELL_REF_SIMPLE provider contract analytical_query as projection on ZOQ_FLIGHT { //----Elements of Key Figure structure @AnalyticsDetails.query.axis: #ROWS @EndUserText.label: 'Max Capacity Economy' seatsmax, @AnalyticsDetails.query.axis: #ROWS @EndUserText.label: 'Occupied Economy' seatsocc, @AnalyticsDetails.query.axis: #ROWS @Aggregation.default: #FORMULA @EndUserText.label: 'Percentage' @AnalyticsDetails.query.decimals: 5 seatsocc / seatsmax * 100 as percentage, //---Elements of Characteristics Structure @AnalyticsDetails.query.axis: #COLUMNS @EndUserText.label: 'Calender Year 2019' @AnalyticsDetails.query.onCharacteristicStructure: true case when flyear = '2019' then 1 else null end as year2019, @AnalyticsDetails.query.axis: #COLUMNS @EndUserText.label: 'Calender Year 2020' @AnalyticsDetails.query.onCharacteristicStructure: true case when flyear = '2020' then 1 else null end as year2020, @AnalyticsDetails.query.axis: #COLUMNS @Aggregation.default: #FORMULA @EndUserText.label: 'Diffenece 2019-2020' @AnalyticsDetails.query.onCharacteristicStructure: true @AnalyticsDetails.query.decimals: 2 @AnalyticsDetails.query.collisionHandling: {decimals: #THIS} $projection.year2019 - $projection.year2020 as difference }</code></pre><P>&nbsp;</P><P><STRONG>Output:</STRONG><STRONG>&nbsp;</STRONG></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_0-1733840939495.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/200349i4B1D71B8375BDAD2/image-size/large?v=v2&amp;px=999" role="button" title="LinaRaut_0-1733840939495.png" alt="LinaRaut_0-1733840939495.png" /></span></P><P>To display structure element in a hierarchy, AnalyticsDetials.query.elementHierarchy.parent and @AnalyticsDetails.query.elementHierarchy.initiallyCollapsed annotations are used in CDS.</P><P><STRONG>Example:</STRONG></P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #NOT_ALLOWED @EndUserText.label: 'CDS Query with 2 Structures' @ObjectModel.modelingPattern: #ANALYTICAL_QUERY @ObjectModel.supportedCapabilities: [ #ANALYTICAL_QUERY ] define transient view entity ZLR_2STRUCT_CELL_REF_HIER provider contract analytical_query as projection on ZOQ_FLIGHT { //----Elements of Key Figure structure @AnalyticsDetails.query.axis: #ROWS @EndUserText.label: 'Max Capacity Economy' seatsmax, @AnalyticsDetails.query.axis: #ROWS @EndUserText.label: 'Occupied Economy' seatsocc, @AnalyticsDetails.query.axis: #ROWS @Aggregation.default: #FORMULA @EndUserText.label: 'Percentage' @AnalyticsDetails.query.decimals: 5 seatsocc / seatsmax * 100 as percentage, //---Elements of Characteristics Structure @AnalyticsDetails.query.axis: #COLUMNS @EndUserText.label: 'Calender Year 2019' @AnalyticsDetails.query.onCharacteristicStructure: true @AnalyticsDetails.query.elementHierarchy.parent: 'difference' case when flyear = '2019' then 1 else null end as year2019, @AnalyticsDetails.query.axis: #COLUMNS @EndUserText.label: 'Calender Year 2020' @AnalyticsDetails.query.onCharacteristicStructure: true @AnalyticsDetails.query.elementHierarchy.parent: 'difference' case when flyear = '2020' then 1 else null end as year2020, @AnalyticsDetails.query.axis: #COLUMNS @Aggregation.default: #FORMULA @EndUserText.label: 'Diffenece 2019-2020' @AnalyticsDetails.query.onCharacteristicStructure: true @AnalyticsDetails.query.decimals: 2 @AnalyticsDetails.query.collisionHandling: {decimals: #THIS} @AnalyticsDetails.query.elementHierarchy.initiallyCollapsed: true $projection.year2019 - $projection.year2020 as difference }</code></pre><P>&nbsp;</P><P><STRONG>Output:</STRONG><STRONG>&nbsp;</STRONG></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_0-1733841400499.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/200350iEACEA12DD6E36CDA/image-size/large?v=v2&amp;px=999" role="button" title="LinaRaut_0-1733841400499.png" alt="LinaRaut_0-1733841400499.png" /></span></P><P>&nbsp;</P><P>After Expanding Hierarchy</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_1-1733841400500.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/200351i346EDC9E54E35CC4/image-size/large?v=v2&amp;px=999" role="button" title="LinaRaut_1-1733841400500.png" alt="LinaRaut_1-1733841400500.png" /></span></P><P><STRONG>Reference:</STRONG></P><P><A href="https://help.sap.com/doc/saphelp_nw73ehp1/7.31.19/en-US/46/81fc706a23468ce10000000a114a6b/content.htm?no_cache=true" target="_blank" rel="noopener noreferrer">Working with Structures</A></P> 2024-12-20T14:44:22.867000+01:00 https://community.sap.com/t5/technology-blog-posts-by-sap/cds-how-to-define-analytical-query-using-cell-definition/ba-p/13992131 CDS : How to define analytical query using cell definition 2025-02-19T15:53:49.446000+01:00 LinaRaut https://community.sap.com/t5/user/viewprofilepage/user-id/179963 <P>This blog is about how to use cell definition in CDS analytical query as like in BW query. Lets start with brief overview about two structures.</P><P>&nbsp;</P><H1 id="toc-hId-951174432"><STRONG><FONT size="4">Two Structures</FONT></STRONG></H1><P>The structure forms the foundational layout of the axes (rows or columns) in a data table, determining how information is organized and presented. The arrangement of the structure affects the order and quantity of key figures or characteristics displayed in the rows and columns of a query or report. More information can be found in&nbsp; <A href="https://community.sap.com/t5/technology-blogs-by-sap/cds-how-to-define-analytical-query-using-two-structures/ba-p/13960195" target="_blank">CDS : How to define analytical query using two str... - SAP Community</A></P><H2 id="toc-hId-883743646"><FONT size="4">Cell Definition</FONT></H2><P>A cell is the intersection between two structural components. Each cell in grid is defined by an element of the measures-structure and one of the characteristic-structure.&nbsp;</P><P><STRONG>Exception cell</STRONG>: When implicit cell definition overwritten by an explicit definition, cell is called as exception cell. It can be defined using formula or selection.&nbsp;<SPAN>Formulas for a cell must only use operands which are cells.&nbsp;</SPAN></P><P><SPAN><STRONG>Help cell</STRONG>: It does not have any direct connection with the corresponding structural elements. It is not embedded in the grid and not displayed, but can be used in formulas of an exception cell.&nbsp;</SPAN></P><P>In BW modelling tool query designer, In 'Cell' tab we can specify the cell definition.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_0-1738656173738.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/221558i1FAFA2D624F36AB7/image-size/large?v=v2&amp;px=999" role="button" title="LinaRaut_0-1738656173738.png" alt="LinaRaut_0-1738656173738.png" /></span></P><P>In the above screenshot marked,</P><P><FONT color="#FF0000">Red&nbsp; &nbsp; </FONT>: Exception cell&nbsp;</P><P><FONT color="#008000">Green&nbsp;</FONT>: Formula to calculate the value for the exception cell</P><P><FONT color="#3366FF">Blue&nbsp; &nbsp;</FONT>: Help cell</P><P>In analytical query to define the Exception cell, following annotation is used.</P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AnalyticsDetails.query: { isCell: true, cellReference: { measureStructureElement: 'seatsocc', characteristicStructureElement: 'yearPlaceholder' } }</code></pre><P>&nbsp;</P><P>A cell is specified with “@AnalyticsDetails.query.isCell: true”,</P><UL><LI><SPAN>If it should overwrite a cell of the grid, then the coordinates can be specified with @AnalyticsDetails.query.cellReference</SPAN><SPAN>&nbsp;(Exception Cell)</SPAN></LI></UL><UL><LI><SPAN>Otherwise, the element is invisible and must be hidden Consumption.hidden:true.</SPAN><SPAN>&nbsp;(Help Cell)</SPAN></LI></UL><P>A value of a cell in the grid can be obtained with CDS function - GET_CELL_REFERENCE_VALUE, which can be used in formula of an exception or help cell.&nbsp;</P><P><STRONG><FONT size="4">Example</FONT></STRONG></P><P><FONT size="3">In the following example, '<EM>exceptionCellRatioPercent'</EM>&nbsp;is Exception cell, cellReference defines exact coordinate of this cell. '</FONT><FONT size="3"><SPAN><EM>helpCellratio'</EM> is a helper cell, it does not have cellReference, it is not part of grid and has Consumption.hidden:true. It is used in formula of an exception cell '<EM>exceptionCellRatioPercent'&nbsp;</EM>to calculate percentage of occupied seats.</SPAN></FONT></P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #NOT_ALLOWED @EndUserText.label: 'Query with structure and cell definition' @ObjectModel.modelingPattern: #ANALYTICAL_QUERY @ObjectModel.supportedCapabilities: [#ANALYTICAL_QUERY] // CDS Query like the normal query ZLR_2STRUCT_CELL_CAL define transient view entity ZLR_2STRUCT_CELL_REF provider contract analytical_query as projection on ZOQ_FLIGHT { //Elements of the Key Figure Structure @AnalyticsDetails.query.axis: #ROWS @EndUserText.label: 'Max Seats' seatsmax, @AnalyticsDetails.query.axis: #ROWS @EndUserText.label: 'Occupied Seats' seatsocc, //Elements of the Characteristic Structure @AnalyticsDetails.query.axis: #COLUMNS @EndUserText.label: '2020' @AnalyticsDetails.query.onCharacteristicStructure: true case when flyear = '2020' then 1 else null end as year2020, @AnalyticsDetails.query.axis: #COLUMNS @EndUserText.label: 'Occupied %' @AnalyticsDetails.query.onCharacteristicStructure: true case when flyear = '0000' then 1 else null end as yearPlaceholder, abap.unit'%' as unitPercent, //Help cell - used in formula of exception cell @Aggregation.default: #FORMULA @AnalyticsDetails.query: { isCell: true } @Consumption.hidden: true // scalar function with use of cell refernce ratio_of( portion =&gt; GET_CELL_REFERENCE_VALUE(measure_struc_element =&gt; $projection.seatsocc, characteristic_struc_element =&gt; $projection.year2020 ), total =&gt; GET_CELL_REFERENCE_VALUE(measure_struc_element =&gt; $projection.seatsmax, characteristic_struc_element =&gt; $projection.year2020) ) as helpCellratio, // Exception cell @Aggregation.default: #FORMULA @AnalyticsDetails.query: { isCell: true, cellReference: { measureStructureElement: 'seatsocc', characteristicStructureElement: 'yearPlaceholder' } } @AnalyticsDetails.query.decimals: 2 @Semantics.quantity.unitOfMeasure: 'unitPercent' $projection.helpCellratio * 100 as exceptionCellRatioPercent }</code></pre><P>&nbsp;</P><P><STRONG><FONT size="4">Output</FONT></STRONG></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_0-1737717251178.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/216508i1FA44E82494C69AB/image-size/large?v=v2&amp;px=999" role="button" title="LinaRaut_0-1737717251178.png" alt="LinaRaut_0-1737717251178.png" /></span></P><P>More information can be found <A href="https://help.sap.com/docs/SAP_NETWEAVER_AS_ABAP_FOR_SOH_740/04030263a0d041309a039fa3ea586720/9735e7691dbd47b1a7f29f26bfc2f70e.html?version=7.40.25" target="_blank" rel="noopener noreferrer">Cell, Exception Cell and Help Cell | SAP Help Portal</A></P> 2025-02-19T15:53:49.446000+01:00 https://community.sap.com/t5/technology-blog-posts-by-sap/cds-how-to-use-analyticsdetails-query-ignorefurtherfilter-in-analytical/ba-p/14032597 CDS: How to use AnalyticsDetails.query.ignoreFurtherFilter in Analytical query (Constant Selection) 2025-03-04T13:26:32.355000+01:00 LinaRaut https://community.sap.com/t5/user/viewprofilepage/user-id/179963 <P>This blog is about how to use @ AnalyticsDetails.query.ignoreFurtherFilter in Analytical query to define a constant selection as like in BW query (see Note &nbsp;944815).</P><P>‘Ignore filter’ is a property that influences the effect of filters on cells, in classic BW it is called as ‘Constant selection’. It is used to define a selection in query definition as fixed value. Navigation and filters then have no effect on this selection at runtime.</P><P>This feature is useful to calculate e.g., Market Index.&nbsp; More information about constant selection can be found <SPAN><A href="https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/0ecf5244825c4742a7b062a89d11c2ac/4f03364885212f98e10000000a42189d.html?version=1709.latest" target="_blank" rel="noopener noreferrer">Constant Selection | SAP Help Portal</A></SPAN></P><P>&nbsp;</P><H2 id="toc-hId-1704561383"><STRONG>@ AnalyticsDetails.query.ignoreFurtherFilter </STRONG></H2><P>annotation is used to model 'constant selection' in the Analytical Engine.</P><P>The value of each cell in a query result set is determined by different filters acting on this cell. These filters are from the structure element or key figures itself or global filters and drill down. &nbsp;</P><P>Sometimes there is a need that not all filters should be applied, therefore with this annotation filters on certain dimensions or on all dimensions can be excluded.</P><P><STRONG>@AnalyticsDetails.query.ignoreFurtherFilter.forElement</STRONG>: Global filters and filters from drill down will not be applied on the structure element for the elements listed in the array.</P><P><STRONG>@AnalyticsDetails.query.ignoreFurtherFilter.forAllElements</STRONG>: No global filters and no filter from drill down will be applied on the structure element.</P><P>&nbsp;</P><H3 id="toc-hId-1637130597"><SPAN><STRONG>Example</STRONG></SPAN></H3><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #NOT_ALLOWED @EndUserText.label: 'IGNOREFILTER- constant selection' @ObjectModel.modelingPattern: #ANALYTICAL_QUERY @ObjectModel.supportedCapabilities: [#ANALYTICAL_QUERY] define transient view entity ZLR_PC_IGNOREFILTER1 provider contract analytical_query as projection on ZDMO_I_FLIGHTCUBE { @AnalyticsDetails.query.axis: #ROWS AirlineID, @AnalyticsDetails.query.axis: #ROWS @AnalyticsDetails.query.totals: #SHOW ConnectionID, CurrencyCode, @EndUserText.label: 'Price in 2024 ' @Semantics.amount.currencyCode: 'CurrencyCode' case when FlightYear = '2024' then Price else null end as priceIn2024_without, @EndUserText.label: 'Price in 2024 for Airline' @Semantics.amount.currencyCode: 'CurrencyCode' @AnalyticsDetails.query.ignoreFurtherFilter.forElement: ['ConnectionID' ] case when FlightYear = '2024' then Price else null end as priceIn2024 } where AirlineID = 'AA' or AirlineID = 'AZ'</code></pre><P>&nbsp;</P><H3 id="toc-hId-1440617092"><SPAN><STRONG>Output </STRONG></SPAN></H3><P>In the above example column 'Price in 2024 for Airline' shows the total price for airline, as 'ConnectionID' filter is ignored with annotation @AnalyticsDetails.query.ignoreFurtherFilter.forElement: ['ConnectionID' ]</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_0-1741090803682.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/232841i0FEF5347EC3A6674/image-size/large?v=v2&amp;px=999" role="button" title="LinaRaut_0-1741090803682.png" alt="LinaRaut_0-1741090803682.png" /></span></P><H3 id="toc-hId-1244103587"><SPAN><STRONG>Constraint</STRONG></SPAN></H3><P>This feature is only available in Analytical query</P> 2025-03-04T13:26:32.355000+01:00 https://community.sap.com/t5/technology-blog-posts-by-sap/cds-how-to-use-analyticsdetails-elimination-annotation-to-eliminate-the/ba-p/14106626 CDS: How to use @AnalyticsDetails.elimination annotation to eliminate the internal business volume 2025-05-26T21:35:47.915000+02:00 LinaRaut https://community.sap.com/t5/user/viewprofilepage/user-id/179963 <P>This blog is about how to use @AnalyticsDetails.elimination to eliminate the internal business volume when executing an analytical query.</P><H3 id="toc-hId-1859622597"><STRONG>Internal business volume</STRONG></H3><P><FONT size="3">When revenues made between two subsidiaries of company, for company’s total revenue, these revenues should not be considered, as transaction is happening within the company.&nbsp;</FONT><FONT size="3">For example, a company is divided into several subsidiaries. These subsidiaries are divided into further subsidiaries. This means there exists a hierarchy of subsidiaries. Subsidiaries are selling products to each other. For each subsidiary this is external sales. But for a parent subsidiary this is just internal sales, as both subsidiaries are descendants. By using this annotation, revenues made between two subsidiaries in an organization are no longer displayed.</FONT></P><P><FONT size="3">More information about the concept can be found <A href="https://help.sap.com/docs/SAP_NETWEAVER_AS_ABAP_FOR_SOH_740/0ecf5244825c4742a7b062a89d11c2ac/4a245d75b1160456e10000000a421937.html?version=7.40.26&amp;q=analytical+manager" target="_blank" rel="noopener noreferrer">Elimination of Internal Business Volume | SAP Help Portal</A></FONT></P><H3 id="toc-hId-1663109092"><STRONG>Syntax</STRONG></H3><P>elimination: {</P><P>&nbsp;&nbsp;&nbsp;&nbsp; pair : array of {</P><P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dimension1: String(30);</P><P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dimension2: String(30);</P><P>&nbsp;&nbsp;&nbsp;&nbsp; }</P><P>&nbsp;&nbsp;&nbsp;&nbsp; rule : String(20) enum { ELIMINATE_IF_ALL; ELIMINATE_IF_ONE; };</P><P>&nbsp;&nbsp; }</P><P>The annotation can be used in cube-views (Analytics.dataCategory: #CUBE) or in analytical queries (define transient view entity with provider contract analytical query).</P><UL><LI><STRONG>pair</STRONG>: this list defines the pairs (dimension1 and dimension2) which are checked for elimination. Both dimensions have needed a foreign key association to the same target view. If the annotation is used on cube level, both dimensions must be elements of the cube. If the annotation is used in an analytical query, both dimensions must be part of the source cube view.</LI><LI><STRONG>rule</STRONG>: if set to #ELIMINATE_IF_ALL, then the volume is eliminated if all pairs are internal. If set to #ELIMINATE_IF_ONE the volume is eliminated if at least one pair is internal. If "rule" is not set, the AND-logic (ELIMINATE_IF_ALL) is applied.</LI></UL><P><FONT size="5"><STRONG>Example&nbsp;</STRONG></FONT></P><P>Following example displays the number of seat booked in flight according to the elimination rule specified on destination&nbsp;airport, departure&nbsp;airport, destination&nbsp;country, departure country.</P><P>&nbsp;</P><pre class="lia-code-sample language-abap"><code>@AccessControl.authorizationCheck: #NOT_ALLOWED @EndUserText.label: 'Elimination of Internal Busniess volumn' @ObjectModel.modelingPattern: #ANALYTICAL_QUERY @ObjectModel.supportedCapabilities: [#ANALYTICAL_QUERY] define transient view entity ZLR_PC_FLIGHTICE_SIMPLE provider contract analytical_query as projection on ZOQ_FLIGHT_ICE { _airportfrom._hier( p_HierarchyID : 'GEO' ) as _airportFromHier, @Consumption.hidden: true _airportfrom.AirportID as dummyAirportFrom, _airportto._hier( p_HierarchyID : 'GEO' ) as _airportToHier, @Consumption.hidden: true _airportto.AirportID as dummyAirportTo, @AnalyticsDetails.query: { axis: #ROWS, displayHierarchy: #ON, hierarchyAssociation: '_airportFromHier' } airportfrom, @AnalyticsDetails.query: { axis: #ROWS, displayHierarchy: #ON, hierarchyAssociation: '_airportToHier' } airportto, @Consumption.filter.defaultValue: 'DE' @AnalyticsDetails.query.axis: #ROWS countryfrom, @AnalyticsDetails.query.axis: #ROWS countryto, seatsmax, @AnalyticsDetails.elimination: { pair: [{ dimension1 : 'countryfrom' , dimension2: 'countryto' }] } @EndUserText.label: 'SeatsMax Q-ICE country' seatsmax as seatsmaxICEQ_C, @AnalyticsDetails.elimination:{ pair: [ { dimension1 : 'airportfrom' , dimension2: 'airportto' }, { dimension1 : 'countryfrom' , dimension2: 'countryto' } ], rule: #ELIMINATE_IF_ALL } @EndUserText.label: 'SeatsMax Q-ICE airport and country' seatsmax as seatsmaxICEQ_AC, @AnalyticsDetails.elimination:{ pair: [ { dimension1 : 'airportfrom' , dimension2: 'airportto' }, { dimension1 : 'countryfrom' , dimension2: 'countryto' } ], rule: #ELIMINATE_IF_ONE } @EndUserText.label: 'SeatsMax Q-ICE airport or country' seatsmax as seatsmaxICEQ_A_C }</code></pre><P>&nbsp;</P><H3 id="toc-hId-1466595587"><STRONG><SPAN>Output </SPAN></STRONG></H3><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LinaRaut_0-1747740751661.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/263737iB4743F1656B2A571/image-size/large?v=v2&amp;px=999" role="button" title="LinaRaut_0-1747740751661.png" alt="LinaRaut_0-1747740751661.png" /></span></P><P>&nbsp;</P><P>In this example for columns (cells marked with colour):&nbsp;</P><P><FONT color="#339966">SeatsMax Q-ICE country</FONT> – elimination pair mentioned as 'countryfrom' and 'countryto'. Therefore, there is no entry where departure country and destination country&nbsp;are same.</P><P><FONT color="#3366FF">SeatsMax Q-ICE airport and country-</FONT> elimination pairs are 'airportfrom' and 'airportto', 'countryfrom' and 'countryto' And rule as #ELIMINATE_IF_ALL, Therefore, there is no entry where destination airport and departure airport are same AND destination country and departure country are same.</P><P><FONT color="#FFCC00">SeatsMax Q-ICE airport or country</FONT> - elimination pairs are 'airportfrom' and 'airportto', 'countryfrom' and 'countryto' And rule as #ELIMINATE_IF_ONE, Therefore, there is no entry where destination airport and departure airport are same OR destination country and departure country are same.</P><P>&nbsp;</P><H3 id="toc-hId-1270082082"><STRONG>Constraints</STRONG></H3><P>The annotation can be used in cubes or in queries.</P><UL><LI>The dimension names in one pair (AnalyticsDetails.elimination.pair) must have a foreign key association to the same dimension view and this dimension view must have an hierarchy association.</LI><LI>In the query definition:</LI><UL><LI>It is not necessary that any of the dimensions in the list of pairs is part of the query</LI><LI>If a hierarchy is assigned to a dimension, then the pair dimension must be assigned to the same hierarchy or must be without hierarchy</LI><LI>If a dimension is not in drill down, then the condition of the one pair is always true (independent of the value of the other dimension of the pair). The same is true on totals/subtotal lines.</LI></UL></UL><P>&nbsp;</P> 2025-05-26T21:35:47.915000+02:00 https://community.sap.com/t5/technology-blog-posts-by-sap/exploring-cds-based-analytical-models-with-the-relation-explorer-analytical/ba-p/14229070 Exploring CDS based Analytical Models with the Relation Explorer - analytical view/perspective 2025-10-01T16:39:40.313000+02:00 martin_mayer https://community.sap.com/t5/user/viewprofilepage/user-id/191669 <P>Relation explorer <STRONG>analytical view / analytical perspective</STRONG> makes it easy to get an&nbsp;overview of the analytical model with very less clicks.&nbsp;No need to open all the views to understands details.</P><P>We start small , looking to a branch of a star schema , <STRONG>dimension</STRONG> Connection (&nbsp;/DMO/ANA_I_Connection ) which is part of the flight data model.&nbsp; After calling the relation explorer we see the Relation Explorer Tab in the below section of the screenshot.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="martin_mayer_1-1759323592595.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/322013iB6966D0C878BC05F/image-size/large?v=v2&amp;px=999" role="button" title="martin_mayer_1-1759323592595.png" alt="martin_mayer_1-1759323592595.png" /></span></P><P>Relation Explorer tab shows:</P><UL><LI>in the left pane the associations from the dimension to other CDS views <U>over all levels</U> are&nbsp;visualizes . It starts fully expanded!<BR />next to the CDS view name we see the view type. E.g. /DMO/ANA_I_CARRIER is of type [Dimension]</LI><LI>in the right pane one can see all the elements of current view. As&nbsp;/DMO/ANA_I_Connection is selected all elements of this dimension are displayed.<UL><LI>One can select (single click) any other view e.g. /DMO/ANA_I_CARRIER and the right pane get updated with the elements of that view.</LI><LI>double clicking the view will directly open the view&nbsp;</LI></UL></LI><LI>the right pane displays all elements grouped by roles.<UL><LI>In this example we have 2 keys and e.g. expanding AirlineID show label and additional details about association and InfoObject. In case of compounded parent we would have seen the Parent element.</LI><LI>double clicking AirlineID highlight the element in the source ( see line 21 )</LI><LI>[Text] gives a hint that AirlineID has text,&nbsp;this is missing for ConnetionID -&gt; no Text supported</LI><LI>Attributes list all dimension attributes. Last one, DistanceUnit is a Unit element.</LI><LI>the Unit group show all unit related elements.</LI><LI>other group are shown if relevant.</LI></UL></LI></UL><P>One can also start the analytical Relation Explorer based on query or cube view.<BR />In both cases the cube view is opened and visualizes the cube with all associations .</P><P>We change focus and look to the example of a <STRONG>query</STRONG>&nbsp;- starting relation explorer shows the cube definition including dimension Connection from above.</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="martin_mayer_0-1759325206609.png" style="width: 999px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/322016i9D9521200352EC39/image-size/large?v=v2&amp;px=999" role="button" title="martin_mayer_0-1759325206609.png" alt="martin_mayer_0-1759325206609.png" /></span></P><P>with one view</P><UL><LI>in the left pane we get all associations visualizes. View names are shown with the view types</LI><LI>in the right pane we can see all 13 dimensions of the cube and get if dimension support Text, have Attributes or Hierarchies<UL><LI>from 1st screenshot we already know that Text, Attributes and Hierarchies are available for AirlineID</LI><LI>expanding ConnectionID show that it is compounded to AirlineID</LI></UL></LI><LI>we see all 5 measures with additional details like aggregation method and unit</LI><LI>with " Units (2) " we see the unit related dimensions. This section only list those dimension that are unit relevant.&nbsp; Expanding the dimension like CurrencyCode lists all related measures.&nbsp;<BR />( Both dimension are also listed in dimension section. )</LI><LI>for time based dimension one can directly understand the base dimension and wherefrom it is derived without looking into the source ( see below snippet with FiscalYearMonth )</LI></UL><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="martin_mayer_0-1759322874979.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/322010i53240695CD5E5697/image-size/medium?v=v2&amp;px=400" role="button" title="martin_mayer_0-1759322874979.png" alt="martin_mayer_0-1759322874979.png" /></span></P><P>&nbsp;</P><P>How to start the <A href="https://help.sap.com/docs/abap-cloud/abap-development-tools-user-guide/relation-explorer" target="_self" rel="noopener noreferrer"><STRONG>Relation Explorer</STRONG></A></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="martin_mayer_1-1758891540834.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/320499i4A0D737B505A0062/image-size/medium?v=v2&amp;px=400" role="button" title="martin_mayer_1-1758891540834.png" alt="martin_mayer_1-1758891540834.png" /></span>call relation explorer to see the view</P><P>right click somewhere in the CDS view&nbsp;</P><P>(&nbsp;in case of CDS view type cube, dimension or query the analytical view is the default view )</P><UL><LI><SPAN>If the view is not shown, choose <STRONG>Configure Context</STRONG> and activate it.</SPAN></LI><LI><SPAN>one can switch any time to different perspective / context if needed</SPAN></LI></UL><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="martin_mayer_1-1759325661029.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/322021i11B35C6E5358E291/image-size/medium?v=v2&amp;px=400" role="button" title="martin_mayer_1-1759325661029.png" alt="martin_mayer_1-1759325661029.png" /></span></P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P><STRONG>Release Info:</STRONG>&nbsp; analytical view / analytical perspective started with</P><UL><LI>BW/4HANA 2023 FP 04&nbsp;</LI><LI>S/4HANA Public Cloud and Privat Cloud OP2023&nbsp;</LI></UL><P>&nbsp;</P> 2025-10-01T16:39:40.313000+02:00