Skip to Content
Business Trends

Architecture and deep-dive into leveraging Predictive Intelligence for S/4HANA

As a continuation from my previous blog, Leveraging Predictive Intelligence with S/4HANA, let us now do a deep-dive into the architecure and the different approaches involved here. In processes where the right information must be provided to the right person, at the right time and right place, Predictive algorithms must be integrated into business processes. However there is also need of unforeseen, exceptional, and irregular usage of these Predictive algorithms to discover hidden insights and relationships in data.

Let us now focus on the different approaches and the architecture behind these approaches.


Use cases like forecasting,key influencer identification, trending, relationship analysis or anomalies can be solved with algorithms like regression, clustering, classification, or time series analysis. Usually these algorithms are not resources intensive in terms of memory usage and CPU time. These can be implemented within the S/4HANA stack or called embedded ML (building into the core) where both the application data for model training and ML consuming business processes are located.

The embedded ML architecture is very simple and powerful at the same time as illustrated in the figure below where embedded ML architecture is based on HANA ML and PAI(Predictive Analytics Integrator). While HANA ML provides the required algorithms with PAL (Predicive Analysis Library) and APL (Automated Predictive Library). PAI is in charge of life cycle management of ML models, integration into ABAP, and training of models at customer side. The embedded ML has very low TCO and TCD.

Use cases like image recognition, sentiment analysis, or language recognition require deep learning algorithms based on neural networks. For model training etc., these algorithms require huge amounts of data and CPU time. Therefore the model training for these kind of scenarios is outsourced from the S/4HANA stack to the Leonardo Foundation platform on SCP (SAP Cloud Platform) or called side-by-side ML (expanding around the core). Anyway the requested data for these scenarios like the images, audio files, video files, text documents, historical data are stored not in S/4HANA but on a big data solution leveraging the SCP. The Leonardo Foundation library complements the overall solution architecture where specific algorithms are not provided on the S/4HANA platform since the classic methods (eg., regression, classificaion) consume too many resources of the transactional system, or huge volumes of external data(eg., twitter, facebook etc.,) are required for model training. Hence the S/4HANA extensions consume the Leonardo Foundation services and HANA ML capabilites as application data and business processes are founded on SCP thus bringing the golden rule of algorithms to the data applies.


Building into the core (Embedded ML):

Now let us dive into the embdded ML approach in S/4HANA, as explained in the figure below, the solution is based on 2 main architecture decisions: using CDS views and making use of the ML techniques provided by SAP HANA. The algorithms for embedded ML can be performance intensive as high volumes of application data must be processed. For peformance optimization, the algorithms should be processed closer to the data – SAP HANA provides the Predictive Analysis Library (PAL) and Automated Predictive Library (APL) application function libraries that offer statistical and data mining algorithms, additional algorithms can be implemented as required. These algorithms require application data as input for model training. The trained models are exposed to business processes by wrapping them with CDS views.These CDS views can be combined with other VDM CDS views and can then be exposed to the consumers. By consuming ML models through CDS views, existing content and concepts are re-used which results in a simple and very powerdul solution architecture. The purpose of Predictive Analytics Integrator (PAI) is to provide a common interface for the consumption of ML models, independent of the underlying predictive engine. PAI contains information regarding the installed SAP HANA libraries.It provides a repository for ML models that includes, for example, information concerning model types (eg., regression, classification or time-series), model data sources (e.g., tables or views), model training data, or model quality figures etc. PAI shall also provide a pluggable infrastructure and adapters for automated (eg., APL) and expert (e.g., PAL, R or EML) libraries. Models created with SAP Predictive Analytics (automated or expert mode) can be imported into the PAI repository and executed.

Embedded ML shall be applied when the following criteria are valid:

  • Business & ML logic reside on the S/4HANA platform
  • Use case is simple like forecasting or trending where the algorithms have low demand for data, RAM and CPU time
  • Data located in S/4HANA is sufficient for model training, no need for huge external training data
  • Required algorithms are provided by HANA ML (e.g. PAL, APL, Text Analysis) and handled by PAi/HEMI in terms of ML model lifecycle management and ABAP integration

Expanding around the core (side-by-side ML):

While embedded ML targets scenarios where the business and ML logic reside in the S/4HANA platform, the term side-by-side ML is used in the following use cases:

  • S/4HANA ML app based on SCP: The S/4HANA application and the according business logic are based on SAP Cloud Platform. Such applications should consume the required ML services directly from Leonardo ML respectively HANA ML following the rule of bringing the algorithms to the data.
  • S4HANA ML app based on ABAP AS: The S/4HANA applications and the according business logic are based on the S/4HANA platform. However, the required ML capabilities are not available on the S/4HANA platform, e.g., image & language recognition or sentiment analysis. These features are consumed from Leonardo ML remotely based on exchange of trained models.

Hences side-by-side ML scenarios are usuallly based on Leonardo ML. The architecture of Leonardo ML is illustrated in the figure below. Leonardo ML is oragnized into 3 different development initiatives – Foundation, Functional services and Business services.

  • Leonardo Machine Learning Foundation (LMLF) defines a framework for creating and executing “intelligent” algorithms in the context of the overall SAP echo system.
  • The ML functional services execute on top of the LMLF and provide ready-to-use implementations of a selected set of standard use cases such as image classification, sentiment analysis etc.
  • Finally the ML business services implement complex use cases that are typically tightly integrated with SAP application business processes in S/4HANA.

Side-by-Side ML shall be applied when the following criteria are valid:

  • ML logic resides on the SCP platform while the business logic can be based on S/4HANA or SCP
  • Use case is complex like image recognition or natural language processing where among others neural networks with high demand for data, RAM and CPU/GPU time
  • Huge volume of external data is required for model training, main focus is on processing unstructured data
  • Required algorithms are not provided by HANA ML, but by other libraries for e.g. TenserFlow, scikit-learn


Extending the core:

Further you should be able to enhance, modify the current predictive models embedded in S/4HANA processes by leveraging the “SAP Analytics Cloud – Smart Predict” from the later part of 2019 since these capabiliteis are still being developed. You should then also be able to create new predictive models using “SAC – smart predict” and push them back into the S/4HANA processes.

The below figure explains the different ways of leveraging end-to-end predictive scenarios:

In the next blog, we discuss a bit more details on the different approaches and process flows involved in leveraging Predictive Intelligence.

Here are some quick links to the blogs in this series to give you a complete understanding of how Predictive Intelligence is infused into SAP S/4HANA.

Happy Predicting the future!!


1 Comment
You must be Logged on to comment or reply to a post.