ABAP Platform 1809 Optimizations for SAP HANA and SAP S/4HANA
by Karl Kessler, Vice President of Product Management ABAP Platform, SAP SE
ABAP platform 1809, the latest release of the on-premise ABAP platform — is a thorough foundation for SAP S/4HANA and SAP S/4HANA Cloud. In addition to delivering improvements to the Eclipse-based ABAP development tools that enable the efficient development and enhancement of business applications, ABAP platform 1809 includes optimizations that help SAP customers take full advantage of the underlying capabilities of SAP HANA and the features of SAP S/4HANA.
Here we look at three key optimizations for SAP HANA and SAP S/4HANA that are delivered with ABAP platform 1809: the ability to use SAP HANA hierarchy and abstract entities in core data services, support for adapting custom code for SAP S/4HANA, and enabling machine-to-machine (M2M) communication.
Using SAP HANA Hierarchy and Abstract Entities in Core Data Services
With ABAP platform 1809, for the first time, the ABAP stack can focus exclusively on SAP HANA without having to ensure that corresponding features are available on other database platforms as well. One key feature that is supported only by SAP HANA is hierarchies, which are not well handled on the SQL level since you need to model them as tables. In principle, you could define a two-column table in SQL, with a column for parent and a column for child, but this approach becomes unwieldy if you need to compute the descendants (such as grandchildren) — in this case, you would have to define join operations of the table with itself, known as self-joins, which are not easy to handle.
In traditional ABAP, these types of hierarchies were typically handled on the application server level using internal tables. With ABAP platform 1809, you can use the SAP HANA hierarchy functions in-memory on the database level using the new keyword DEFINE HIERARCHY (see Figure 1). Supported by core data services, you can easily navigate to subordinate levels and access nodes and branches of a given hierarchy without the need to introduce internal tables on the ABAP language level. The new hierarchy functions can also be used in ABAP SQL, which is the name for Open SQL as of ABAP platform 1809, because SQL no longer focuses on supporting any database, but instead on full optimization of the ABAP layer on top of SAP HANA.
define hierarchy DEMO_CDS_PARENT_CHILD
with parameters
p_id : abap.char(2)
as parent child hierarchy(
source
DEMO_CDS_PARENT_CHILD_SOURCE
child to parent association _relat
start where
id = :p_id
siblings order by
parent
multiple parents allowed
)
{
id,
parent,
$node.hierarchy_rank as h_rank,
$node.hierarchy_tree_size as h_tree_size,
$node.hierarchy_parent_rank as h_parent_rank,
$node.hierarchy_level as h_level,
$node.hierarchy_is_cycle as h_is_cycle,
$node.hierarchy_is_orphan as h_is_orphan,
$node.node_id as h_node_id,
$node.parent_id as h_parent_id
}