AWS Partner Network (APN) Blog

Improve Your Business Strategy Using Syntax CxLink and Amazon Forecast for SAP Workloads

By Mario de Felipe, Executive Director – Syntax
By Soumya Sekhar, Sr. Partner Solutions Architect, SAP – AWS
By Maysara Hamdan, Partner Solutions Architect – AWS

Syntax-AWS-Partners
Syntax
Connect with Syntax-1

Customers have been running their critical SAP workloads on Amazon Web Services (AWS) for more than a decade. Typically, SAP applications are integrated with non-SAP applications for sending or receiving data, and this data is critical for customers to create the right business strategy.

Customers are also looking to leverage machine learning (ML) models for predicting and forecasting to meet business objectives. By integrating SAP S/4HANA systems with forecasting capabilities, customers can improve sales prediction, supply-demand planning, and inventory management.

Solutions that extend SAP applications to leverage AWS services and SAP Business Technology Platform can provide insights to future supply-demand, sales, planning, human resource, or automation requirements. This makes it easier to develop the right strategy and meet revenue goals.

In this post, we will show how Syntax CxLink can connect an SAP system with Amazon Forecast, a fully managed service that uses statistical and ML algorithms to deliver highly accurate time-series forecasts on the SAP data stored in Amazon Simple Storage Service (Amazon S3).

This solution allows SAP customers to reliably predict their weekly and monthly plans, while SAP RISE customers can also leverage Amazon Forecast to build future strategies, and create their own growth roadmap based on predictions.

Syntax, an AWS Premier Tier Services Partner and AWS Marketplace Seller with Competencies in SAP, Migration, and other key areas, has focused on customer needs to develop a cloud-native, SAP-certified solution to meet data and document modernization requirements through its CxLink product portfolio.

Connecting Syntax CxLink with Amazon Forecast

Syntax CxLink integrates SAP with Amazon Forecast to generate and orchestrate demand predictions, and supports the data transfer and evaluates forecast accuracy. By ingesting relevant SAP tables, Syntax CxLink takes only the fields that are necessary to train the Amazon Forecast model, where the Target Time Series (TTS) dataset must always include the target attribute (demand).

Optionally, a second dataset—Related Time Series (RTS)—can be used to include other attributes which contribute to improving the forecast. Syntax CxLink effectively transfers and transforms such data continuously.

SAP stores data related to sales orders, accounting and controlling documents in tables such as VBAP or MATDOC. [BD1] [HM2] [HM3] Those tables contain information about items such as product number, quantity, delivery date, pricing, and other relevant details. The combination of SAP tables provides a complete picture of the sales order from the SAP system. Relevant master data transfer consists of locations, materials, transportation lanes, and other data.

MATDOC is one of the SAP tables that stores data related to material documents, which are used to record goods movements and other inventory transactions in the SAP system. MATDOC includes material number, quantity, posting date, and other details used in Material Requirements Planning (MRP), a planning process that helps organizations ensure they have the necessary materials for production and delivery to customers.

The continuous ingestion of these tables allows SAP users to create TTS and RTS datasets to train the Amazon Forecast model.

Syntax CxLink Configuration Transaction Table

Figure 1 – Syntax CxLink configuration transaction table.

Model Monitoring and Retraining

The performance of the forecast model (the predictor) can change over time due to several factors, such as data quality, model selection, improper model tuning, overfitting, outliers and anomalies, lack of representativeness, and non-stationarity in the data. Monitoring the quality of the predictor and identifying low accuracy over time is crucial to improve forecast accuracy and align with business decisions.

As new data is imported, it’s required to measure deviation from initial quality metrics and systematically evaluate the model’s quality.

The Syntax CxLink SAP transaction provides an overview of the datasets, predictors, and forecasts available and its status. This helps SAP users see all of the available metrics needed to decide which forecast can be used and the status of currently generated forecasts.

Syntax CxLink forecast transaction overview

Figure 2 – Syntax CxLink forecast transaction overview.

Solution Architecture

The architecture diagram below shows the overall workflow used to build the solution leveraging Syntax CxLink and AWS services.

High-level architecture diagram

Figure 3 – High-level architecture diagram.

Primary AWS services used are listed below:

  • Amazon S3: Object storage service offering scalability, data availability, security, and performance.
  • Amazon EventBridge: Serverless event bus that makes it easy to build event-driven applications at scale using events generated from customer applications, integrated software-as-a-service (SaaS) applications, and AWS services.
  • AWS Lambda: Serverless, event-driven compute service allowing users to run code for virtually any type of application or backend service without provisioning or managing servers.
  • Amazon Forecast is a fully managed service that uses statistical and machine learning algorithms to deliver highly accurate time-series forecasts.
  •  Amazon Athena can query and retrieve Amazon Forecast exported results, stored in an Amazon S3 bucket.
  • Amazon Simple Notification Service (Amazon SNS) notifies users when a problem occurs during the forecasting process or when the process completes successfully.
  • Amazon QuickSight dashboards are built by business users that queries the forecast data from Amazon S3 using Athena.

A deeper explanation of how the architecture works is listed in the following walkthrough:

  • SAP applications generate massive data which is used to feed forecast datasets. Depending on the required business process that needs forecast, we will select the appropriate SAP tables to feed Amazon Forecast.
  • Syntax CxLink add-on is installed on top of the SAP application, storing the data in CSV format into Amazon S3.
  • Prepare the training dataset by using AWS Glue and AWS Glue ETL Job, or you can create an AWS Step Function that comprises series of Lambda functions to prepare a clean training data for you.
  • Generate forecast by passing data manually to Amazon Forecast using the Forecast console pointing to the right S3 bucket for data retrieval. You can also automate the overall process by using Amazon EventBridge that calls Lambda to create the forecast. Learn more in the documentation about automated pipelines, which uses an AWS CloudFormation stack to automatically deploy datasets to an S3 bucket and trigger a Forecast pipeline. You can use the same automation stack to generate forecasts with your own datasets.
  • Once the dataset is created in Amazon Forecast, train the predictors and generate the forecast. The forecasted data is saved in an S3 bucket.
  • AWS SDK for SAP ABAP is installed into your SAP system as an external transport request. Leveraging AWS SDK for SAP ABAP, the SAP system calls Amazon Forecast Query Service and retrieves forecast results that are consumed by SAP. Users can see the forecasted results in SAP as a dashboard format for better viewing capability.
  • Optionally, you can let your user community know once the results are exported from Amazon Forecast and stored in S3 through Amazon SNS.
  • Amazon Athena can be used to query the results data further so users can build QuickSight dashboards from the data for better visualization.

Once the forecasted results are back in SAP, users can query the data for a given item and time range. They also gain functionality to simulate different scenarios by leveraging What-If for different inputs or assumptions.

This helps SAP customers assess the potential impact of changes in products or materials in various factors, and make more informed decisions. For example, you can evaluate the effect of a marketing campaign, changes in pricing, or modifications to external factors on the forecasted demand.

Amazon Forecast Configuration Steps

This step-by-step process describes how to import the datasets, train predictors, and forecast by using the AWS Management Console.

  • First, choose View dataset groups on the Amazon Forecast console and Create dataset group.
  • Enter the Dataset group name and forecasting domain (‘Custom’ on below screen, but you can choose based on your requirements), and click Next.

Figure 4 – Continue create dataset group.

  • Create a target time series dataset, provide the relevant dataset name and frequency of your data, and input data schema information.
  • As part of dataset import details, input Dataset import name, import file type, S3 bucket location where the source CSV file stored, and create a relevant AWS Identity and Access Management (IAM) role that Amazon Forecast will create it for you.
  • Choose Start to proceed.

Start importing the dataset

Figure 5 – Start importing the dataset.

  • Progress on the dataset import job can be tracked through dashboard screen.
  • To import the related time series file, on the dashboard choose Import.
  • Once finished, on the dashboard choose Train predictor.

Amazon Forecast dataset dashboard

Figure 6 – Amazon Forecast dataset dashboard.

  • As part of training the predictor, enter a name for your predictor, future duration you want to forecast, set the frequency, and enter the number of quantiles you want to forecast for.
  • Keep AutoPredictor enabled if you need to perform what-if analysis.
  • Choose Create to train new predictor.
  • Next, create a forecast on the dashboard. On the Create a forecast screen, enter a forecast name, choose the predictor you created, and specify the forecast quantiles (optional) and the items to generate a forecast for.
  • Choose Start.

Create new Forecast

Figure 7 – Create new forecast.

  • Next, query forecast on the dashboard. Drop down the correct Forecast type, and select the right value on Forecast key.
  • In the below example, we chose the value of an item from the dataset we provided to the Forecast console while creating the dataset group.
  • Select the time duration, and choose Get Forecast.

Get the Forecast results

Figure 8 – Get the Forecast results.

Finally, ensure you follow security best practices for securing your solution on AWS. Be sure to review and follow the guidelines provided in the security pillar of the AWS Well-Architected Framework to improve the security posture of the solution at the time of design and implementation.

Conclusion

In this post, we explained how to create forecast reports from SAP data leveraging the Syntax CxLink add-on and Amazon Forecast.

Syntax CxLink is offered as a subscription service through AWS Marketplace under the CxLink ABAP Suite Syntax product portfolio, including premium support from Syntax’s engineering team to ensure proper setup, maintenance, and customer installation updates.

Learn more from CxLink documentation to start implementing it in your SAP landscape.
.

Syntax-APN-Blog-Connect-2023.


Syntax – AWS Partner Spotlight

Syntax is an AWS Premier Tier Services Partner that has focused on customer needs to develop a cloud-native, SAP-certified solution to meet application modernization requirements through its CxLink product portfolio.

Contact Syntax | Partner OverviewAWS Marketplace