<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Using hierarchy with SQL View in SAP Datawherehouse Cloud in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/using-hierarchy-with-sql-view-in-sap-datawherehouse-cloud/qaa-p/12631974#M4738424</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Hierarchies must be defined in &lt;STRONG&gt;Dimensions &lt;/STRONG&gt;(Views or Tables with semantic "Dimension") and associate them to &lt;STRONG&gt;Facts (&lt;/STRONG&gt;Views or Tables with semantic "Analytical Dataset").&lt;/P&gt;&lt;P&gt;I try to explain it with an example:&lt;/P&gt;&lt;P&gt;Let's imagine a Parent/Child Product hierarchy, it should have two fields similar to PRODUCT_ID and PRODUCT_ID_PARENT.&lt;/P&gt;&lt;P&gt;You may encounter two cases in the Product master data (Dimension):&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;PRODUCT_ID and PRODUCT_ID_PARENT fields are in the dimension: You can directly create the hierarchy in the dimension itself.&lt;/LI&gt;&lt;LI&gt;You only have the PRODUCT_ID in the dimension and the hierarchy is defined in another table PRODUCT_HIERARCHY (with PRODUCT_ID and PRODUCT_ID_PARENT). In this case, you must define that Table or View with  semantic type "Hierarchy" and define the Parent and Child fields. After that in the Product Dimension associate the PRODUCT_HIERARCHY by PRODUCT_ID. &lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Now you can associate the Product Dimension to an Analytical Dataset and the Hierarchy will be available in Product Dimension in SAC.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jul 2022 07:00:27 GMT</pubDate>
    <dc:creator>XaviPolo</dc:creator>
    <dc:date>2022-07-18T07:00:27Z</dc:date>
    <item>
      <title>Using hierarchy with SQL View in SAP Datawherehouse Cloud</title>
      <link>https://community.sap.com/t5/technology-q-a/using-hierarchy-with-sql-view-in-sap-datawherehouse-cloud/qaq-p/12631973</link>
      <description>&lt;P&gt;What is the best way to define a hierarchy within a SQL View using the semantic of Analytical Dataset?&lt;/P&gt;
  &lt;P&gt;Is it possible to configure the hierarchy within the SQL definition or is it only possible using Associations with other dimensions?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jul 2022 17:13:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/using-hierarchy-with-sql-view-in-sap-datawherehouse-cloud/qaq-p/12631973</guid>
      <dc:creator>diego_oliveira4</dc:creator>
      <dc:date>2022-07-16T17:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using hierarchy with SQL View in SAP Datawherehouse Cloud</title>
      <link>https://community.sap.com/t5/technology-q-a/using-hierarchy-with-sql-view-in-sap-datawherehouse-cloud/qaa-p/12631974#M4738424</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Hierarchies must be defined in &lt;STRONG&gt;Dimensions &lt;/STRONG&gt;(Views or Tables with semantic "Dimension") and associate them to &lt;STRONG&gt;Facts (&lt;/STRONG&gt;Views or Tables with semantic "Analytical Dataset").&lt;/P&gt;&lt;P&gt;I try to explain it with an example:&lt;/P&gt;&lt;P&gt;Let's imagine a Parent/Child Product hierarchy, it should have two fields similar to PRODUCT_ID and PRODUCT_ID_PARENT.&lt;/P&gt;&lt;P&gt;You may encounter two cases in the Product master data (Dimension):&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;PRODUCT_ID and PRODUCT_ID_PARENT fields are in the dimension: You can directly create the hierarchy in the dimension itself.&lt;/LI&gt;&lt;LI&gt;You only have the PRODUCT_ID in the dimension and the hierarchy is defined in another table PRODUCT_HIERARCHY (with PRODUCT_ID and PRODUCT_ID_PARENT). In this case, you must define that Table or View with  semantic type "Hierarchy" and define the Parent and Child fields. After that in the Product Dimension associate the PRODUCT_HIERARCHY by PRODUCT_ID. &lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Now you can associate the Product Dimension to an Analytical Dataset and the Hierarchy will be available in Product Dimension in SAC.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 07:00:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/using-hierarchy-with-sql-view-in-sap-datawherehouse-cloud/qaa-p/12631974#M4738424</guid>
      <dc:creator>XaviPolo</dc:creator>
      <dc:date>2022-07-18T07:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using hierarchy with SQL View in SAP Datawherehouse Cloud</title>
      <link>https://community.sap.com/t5/technology-q-a/using-hierarchy-with-sql-view-in-sap-datawherehouse-cloud/qaa-p/12631975#M4738425</link>
      <description>&lt;P&gt;Hello Diego, &lt;/P&gt;&lt;P&gt;We create a plain view from BW 0MATERIAL HIERARCHY extractor structure with the following script:&lt;/P&gt;&lt;P&gt;CREATE VIEW [dbo].[SAPP_V_JERARQUIA_MATERIALES] AS&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt;select n1.nodename n1, n2.nodename n2, n3.nodename n3, n4.nodename n4, n5.nodename n5,&lt;/P&gt;&lt;P&gt;		n1.txt n1_txt, n2.txt n2_txt, n3.txt n3_txt, n4.txt n4_txt, n5.txt n5_txt,&lt;/P&gt;&lt;P&gt;(case &lt;/P&gt;&lt;P&gt;when n5.IOBJNM='0MATERIAL' then n5.nodename&lt;/P&gt;&lt;P&gt;when n4.IOBJNM='0MATERIAL' then n4.nodename&lt;/P&gt;&lt;P&gt;when n3.IOBJNM='0MATERIAL' then n3.nodename&lt;/P&gt;&lt;P&gt;when n2.IOBJNM='0MATERIAL' then n2.nodename&lt;/P&gt;&lt;P&gt;when n1.IOBJNM='0MATERIAL' then n1.nodename&lt;/P&gt;&lt;P&gt;end) MATERIAL_C&lt;/P&gt;&lt;P&gt;from &lt;/P&gt;&lt;P&gt;[dbo].[SAPP_V_0MATERIAL_HIER_L5] n5&lt;/P&gt;&lt;P&gt;right join [dbo].[SAPP_V_0MATERIAL_HIER_L4] n4 on (n5.parentid=n4.nodeid and n5.hienm=n4.hienm )&lt;/P&gt;&lt;P&gt;right join [dbo].[SAPP_V_0MATERIAL_HIER_L3] n3 on (n4.parentid=n3.nodeid and n4.hienm=n3.hienm )&lt;/P&gt;&lt;P&gt;right join [dbo].[SAPP_V_0MATERIAL_HIER_L2] n2 on (n3.parentid=n2.nodeid and n3.hienm=n2.hienm )&lt;/P&gt;&lt;P&gt;right join [dbo].[SAPP_V_0MATERIAL_HIER_L1] n1 on (n2.parentid=n1.nodeid and n2.hienm=n1.hienm )&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;Previously we´ve created one view per hierarchy level (L1, L2, L3, etc..)&lt;/P&gt;&lt;P&gt;create view [dbo].[SAPP_V_0MATERIAL_HIER_L1] AS (&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;hienm, nodeid, childid, parentid, nodename, iobjnm, txt &lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt; [dbo].[SAPP_V_0MATERIAL_HIER]&lt;/P&gt;&lt;P&gt;WHERE tlevel = 1&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Fernando&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 12:13:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/using-hierarchy-with-sql-view-in-sap-datawherehouse-cloud/qaa-p/12631975#M4738425</guid>
      <dc:creator>fagonzalez5</dc:creator>
      <dc:date>2022-07-18T12:13:57Z</dc:date>
    </item>
  </channel>
</rss>

