ABAP Platform 1809 Optimizations for SAP HANA and SAP S/4HANA

ABAP Platform 1809 Optimizations for SAP HANA and SAP S/4HANA

Reading time: 5 mins

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
}

Figure 1 — Defining a hierarchy with core data services

Another important improvement is the definition of abstract entities in core data services using the new keyword DEFINE ABSTRACT ENTITY. Abstract entities, such as database entities, have a structure consisting of fields, but they are not stored in a table. They correspond to structure definitions in the traditional ABAP Dictionary. They can be used in metadata extensions to define the user interface, similar to how structures are used in Dynpro and Web Dynpro development.

Adapting Custom Code for SAP S/4HANA

Making the transition from SAP Business Suite to SAP S/4HANA means adapting your custom code for SAP S/4HANA, which uses a different data model than SAP Business Suite.1 ABAP Test Cockpit is a central entry point for beginning this transformation and shepherding you through the adaptation. ABAP Test Cockpit has been a strong analysis tool for identifying incompatibilities between your custom SAP Business Suite code and SAP S/4HANA — however, you have to fix the errors manually when making the conversion to SAP S/4HANA.

With ABAP platform 1809, ABAP Test Cockpit offers quick fixes for commonly identified issues that you can apply with a single mouse click. Figure 2 shows an example that often occurs in the SAP HANA context, where a binary search operation in ABAP requires a sorted result, but the SQL standard is not sorted by default. In this case, you need to append the addition ORDER BY PRIMARY KEY, which is supported by the quick fix functionality. This approach saves a significant amount of development time and also increases code quality.

ABAP Test Cockpit screen

Figure 2 — The quick fix functionality for commonly identified issues, such as sorting, included with ABAP platform 1809 saves significant time and effort when adapting custom code for SAP S/4HANA

In addition, ABAP platform 1809 introduces highly graphical SAP Fiori-based reporting applications, such as the one shown in Figure 3, to support you with scoping and analysis capabilities, and to guide you through the transition. Objects that are out of scope won’t be imported to get rid of unused code.

ABAP platform 1809 image

Figure 3 — ABAP platform 1809 provides graphical SAP Fiori-based reporting and analysis applications to support the custom code adaptation process

Enabling M2M Communication

Due to the growing popularity of IoT scenarios, the Message Queuing Telemetry Transport (MQTT) protocol, which was designed to support M2M communication in industrial IoT scenarios, has generated a lot of interest for enabling real-time data updates and the ability to react to events on the fly. MQTT supports this capability by offering a lightweight publish-and-subscribe infrastructure where clients can send and receive messages through a message broker.

With ABAP platform 1809, the ABAP stack can act as an MQTT client that can publish messages and receive events, similar to the ABAP channels infrastructure. Figure 4 shows the implementation of an MQTT client that connects to a public MQTT broker and publishes a message to that broker.

In this way, MQTT can be used to extend SAP S/4HANA and SAP Cloud Platform in an event-driven way, taking advantage of the IoT and machine learning capabilities included with SAP S/4HANA, and enabling real-time analytics and responsiveness with the speed provided by SAP HANA.

METHOD constructor.
TRY.
” create MQTT client
cl_mqtt_client_
manager=>create_by_url(
EXPORTING
i_url            = ‘ws://broker.hivemq.com:8000/mqtt’
i_event_handler  = me
RECEIVING
r_client        = mo_mqtt_client ).

” establish the connection
mo_mqtt_client->connect( ).
CATCH cx_mqtt_error.
” to do: error handling, e.g. write error log!
ENDTRY.
ENDMETHOD.

METHOD publish.
TRY.
” create message with specific quality of service (QoS)
DATA(lo_mqtt_message) = cl_mqtt_message=>create( ).
lo_mqtt_message->set_qos( if_mqtt_types=>qos-at_least_
once ).
lo_mqtt_message->set_text( iv_message  ).
” publish message to topic
mo_mqtt_client->publish(
EXPORTING i_topic_name = iv_topic
i_message    = lo_mqtt_message ).
CATCH cx_mqtt_error.
” to do: error handling, e.g. write error log!
ENDTRY.
ENDMETHOD.

Figure 4 — Implementing an MQTT client that connects to a public MQTT broker and publishes a message to that broker

 

1 For a detailed look at this process, see the SAPinsider article “A Simplified Way to Bring Your Custom Code to SAP S/4HANA” (Issue 2 2018) available at SAPinsiderOnline.com. [back]

More Resources

See All Related Content