SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software SAP ABAP Programming and HANA Database Tutorials
Development resources, articles, tutorials, code samples and tools and downloads for ASP.Net, SQL Server, R Script, Windows, Windows Phone, AWS, SAP HANA and ABAP, like SAP UI5, Screen Personas, etc.

Install SAP Free

Error with SQLScript Hierarchy Function on SAP HANA Database

SAP enables HANA database developers to query parent-child or hierarchy data structures using SQL Hierarchy function
When I execute SQLScript sample about SAP HANA Hierarchy function shared at SAP HANA SQL and System Views Reference document, I got following error

Could not execute 'SELECT hierarchy_rank AS "rank", hierarchy_tree_size AS "tree_size", hierarchy_parent_rank AS ...'
SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "SELECT":

Although it is not stated at reference documentation, SQLScript Hierarchy function is not supported on HANA database versions prior to 2.00.022

Here is the sample SQL code taken from Hierarchy function reference documentation published by SAP

 hierarchy_rank AS "rank",
 hierarchy_tree_size AS "tree_size",
 hierarchy_parent_rank AS "parent_rank",
 hierarchy_level AS "level",
 hierarchy_is_cycle AS "is_cycle",
 hierarchy_is_orphan AS "is_orphan",
   id AS node_id,
   parent AS parent_id,
  FROM Hierarchy
  ORDER BY ord
ORDER BY hierarchy_rank;

If you are not running your SAP S/4HANA system on a HANA database 2.0, SQL programmers will experience SQL syntax error.

On the other hand, if you are running your SAP HANA system on a HANA database version for example, you will get following output successfully querying the parent-child relation also known as hierarchy data.

error during query hierarchy data aka parent-child on SAP HANA database

If you have installed a HANA database version which is supporting Hierarchy function usage on hierarchical data, you can refer to tutorial Query Hierarcy Data in SAP HANA Database using SQLScript for samples.

SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table

Meetup Sunumu 1 meetup

Copyright © 2004 - 2020 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems