# SAP S/4 HANA and Data Science

Predictive Analysis is one of the most important and budding topic in today’s ICT world. The analytical demand of management is getting into new dimension in every part of the world. This is depended not only on current data but also historical data which can provide in-depth insights to companies with the help of various statistical prediction and algorithm.

According to SAP predictive analysis was out of reach to Organizations mainly due to

1. Lack of Quality data
2. Not enough powerful processing resources
3. Algorithms that were too generic and was not capable to handle huge volume of data.
4. Lack of skills in developing predictive analysis and understanding the result.

The shift of SAP database from traditional row store to column store is one of the key developments which will cater to this future demand of Business to provide them with data which is not only descriptive but also predictive and prescriptive.

I have tried to bring out some very basic use of predictive analysis in different filed as mentioned below

 Simple Problem Solution Calculation What is the probability that a customer will buy New Socks if he buys Shoes? At a very simple level not considering market basket analysis P is Probability p(Shoes) Customer buying Shoes 0.55 p(Socks) Customer also buying Socks 0.25 =p(Shoes)*p(Socks) 0.1375 What is the probability that a candidate will join the company even though he has rejected the offer last time during a Giant Recruitment Session Number of Candidate did not join last recruitment 80 Number of Candidate joined during this recruitment 20 Conditional Probability (Joining Candidiate|Not Joining Candidate) =20/80=.25 What is the probability if we provide a discount to 100 customers 25 will accept my offer. If I have a probability of history data to be 17% Binomial Distribution formula in Excel. 0.0119351

Considering this is my first blog of Data Science I have tried to keep it simple and with time I shall come up with some more test cases and case studies on complex scenarios in near future.

However, some other key areas can be

1. Healthcare: Clinical trials to meet any pandemic
2. Retail: Identification of location for opening a retail store.
3. Telecom: What will be the future of customer demand and how it is changing with generation of 5G.
4. Energy and Resource: Analysis on the demand of customer for Rooftop Solar Energy.
5. Banking: Fraudulent customer avoidance.

I shall try to briefly explain how we, SAP HANA Consultants can cater to this demand of Data Mining.

SAP HANA has a large library of built in Algorithms ready to use. It is also possible to import more algorithms from the public R library and to develop our custom algorithms.

We can utilize these algorithms in various analysis which can be in different areas like

• Regression — Relationship between variables. (y=mx+c). e.g. If temperature increases sell of ice-cream will increase.

• Time series — Analysing data based on time. Example: Sell of stylish apparel increases during X-mas.

• Associations — relationship between activities or behaviour. Example If I buy new shoes I can buy a pair of socks too.

• Classification — Prediction of target class. Example: Bank might use this to find fraudulent customer before accepting credit card application

• Cluster — Grouping of set of similar behaviour or type. Example: Intelligence dept might use clustering to find out the similar crimes happening in areas to find further reports.

How to perform Data Mining to provide analytics and predictive analysis to Business in SAP HANA?

I shall try to simplify and keep my blog limited to SAP HANA studio. The SAP HANA studio is a multipurpose interface used by variety of SAP HANA experts. The SAP HANA studio provides different screen layout for different audience. The screen is organized with different screen content and tool for different type of SAP HANA Persona. We call them Perspective.

In this case we shall use Modeler Perspective.

In Modeler perspective we can access two types of content.

• Catalogue Objects: tables, views, synonyms etc.
• Content Objects: Calculation Views, Procedure, Decision tables etc.

Soure: SAP AG Image

Application Function Library (AFL): Although AFL is not part of the HANA Appliance, but it can be installed by the administrator. It is mandatory requirement for predictive data modelling.

Inside AFL we have Predictive Analysis Library and Business Function Library.

The SAP HANA Application Function Modeler (AFM) in SAP HANA Studio supports function from BFL in flowgraph model. We can add BFL function to the flowgraph by using AFM. We can generate the procedure without writing any SQL Script.

Once this is done we can create a view and consume the view with CDS to provide a tile in Fiori to the user. This will enable the user to execute Data Analytics as per their choice of data on the specified filed they are working.

I shall try to bring some more detail step by step procedure in my next blog on how we can implement a statistical model on our data set and provide it to user through a Fiori tile

### Assigned Tags

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

Very interesting topic

Santanu Ray
Blog Post Author

Thanks a lot. Your knowledge and learning is  motivation for me

Nice one. Hope to see more use cases covered.

Santanu Ray
Blog Post Author

We shall work together and ensure to work hard to meet you expectation

very nice and simple explanation on the topic. i will now following your blogs to know more real time problem scenarios and solutions.

Santanu Ray
Blog Post Author

You are SAP Guru Pallab. Your comment is very important for me. Thanks a lot.

Hi Santanu,

Is it possible to access or leverage the AFL in SAP Analytics Cloud (SAC)? Or are you aware if SAC offers similar function libraries for predictive analysis?

Application functions enable us to execute database procedures written in C++ safely inside the SAP HANA database as-if they were written in SQL. The AFL or application function library bundles these functions. PAL and APL are examples of AFLs.

Does SAP Analytics Cloud offers similar functionality? Yes, it is called Smart Predict

Thanks. this helps.

Santanu Ray
Blog Post Author

Dear Abhinav,

i shall try to send you some insights on that. Collecting my knowledge base. Thanks for your kind reply. Will get back.

Santanu Ray
Blog Post Author

Dear Abhinav Sinha

I checked SAC today.

In addition to Smart Predict . You may also use R predictive libraries. Unfortunately I was not able to do any practical experiement as my authorization are limited.

If you have some imported data in SAC. Then you may run some R functionality into the data set.

At this point this is all I know. Once I try my hand on it I shall send you a mail with further investigation.

Your question helped me to learn something new. Thanks a lot

With Respect

Santanu

Hi Santanu,

Yes, I recently learnt we can use both R and Python with SAC although I too don't know how that works.

Hope that you can cover it in another blog when you get your hands on it because for most parts Smart Predict seems very basic for a predictive modelling tool. Thanks for sharing.

Regards

Abhinav

Difficult topic nicely explained.

.

Thanks for sharing your insights, Santanu.

A few remarks

• in the title you mention SAP S/4HANA but do not reference this product in your blog. Maybe change to SAP HANA?
• As tags you use another product: SAP Predictive Analytics, yet do not reference this product in your blog. Maybe change to SAP HANA?
• You propose to use SAP HANA studio. This tool was deprecated with the SAP HANA 2.0 SPS 02  release in 2018.
Although still supported for the SAP HANA 2.0 release (at least until 2025 with SPS 05), we can no longer use SAP HANA studio when working with SAP HANA Cloud, for example.
The successor of the SAP HANA studio for modeling and development, SAP Web IDE, was released already five years ago (2015)
More recently, the next generation of SAP Web IDE was announced: SAP Business Application Studio (GA 2020). Why not cover how to make friends with BAS and PAL?Â

Food for thought. Looking forward to your next blog.

For those who need a refresher about SAP on-premises analytics products, see

Should you find all the combinations of HANA’s, Cloud, Platforms, and Services confusing (you are not alone), see

Santanu Ray
Blog Post Author

Thanks Denys. Good to hear from You. Stay Well.

Very well done and easy to understand. Thanks Santanu. Looking forward for the next blogs. Keep writing and keep sharing pls.

Santanu Ray
Blog Post Author

Thanks a lot. I shall try my best to work hard and provide the insights as much as possible. Grateful for your kind advice.

Good article Santanu.. Will wait for the next on detail step by step approach..

Santanu Ray
Blog Post Author

Thanks Sukanta kumar . My induction to S4 HANA is because of you. It is always refreshing to work with Leaders who has thoughts for tomorrow. You are one of those Leaders.

Very well explained and knowledge enriching. Looking forward for more such blog

Santanu Ray
Blog Post Author

Thanks Rishikesh I shall try my best to come up with more blogs