Sunday, 26 January 2020

Real-Time Open Order Calculation with S/4HANA CDS Views

Real-time open order calculation was always a challenge in R/3 due to slow DB. Developers had no choice but do calculations in ABAP layer with endless loops, if statements and interim tables / variables. With S/4HANA ABAP CDS Views game changing technology it is time to use set based SQL calculations and push calculations to HANA DB where they belong.

In my blog I will explain open order requested not goods issued scenario e.g.  open order = requested – goods issued. All calculations are done in CDS view table function using SQL. Table function is very simple and all complexity is inside implementing ABAP Class.

SAP ABAP Study Material, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Online Exam, SAP ABAP Prep

Let me walk you thought set base calculations inside the table function.

1. Select order requested information at schedule line level
2. Calculate order requested quantity totals and running totals for each order item
3. Calculate goods issued quantity at order item level
4. Calculate open quantity e.g. open = requested – goods issued
5. Calculate open order schedule line value and eliminate order schedule lines that are not open

Select Order Requested Information at Schedule Line Level


SAP ABAP Study Material, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Online Exam, SAP ABAP Prep

SAP ABAP Study Material, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Online Exam, SAP ABAP Prep

Calculate Order Requested Quantity Totals and Running Totals for Each Order Item


SAP ABAP Study Material, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Online Exam, SAP ABAP Prep

SAP ABAP Study Material, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Online Exam, SAP ABAP Prep

Calculate Goods Issued Quantity at Order Item Level


SAP ABAP Study Material, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Online Exam, SAP ABAP Prep

SAP ABAP Study Material, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Online Exam, SAP ABAP Prep

Calculate Open Quantity e.g. Open = Requested – Goods Issued


SAP ABAP Study Material, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Online Exam, SAP ABAP Prep

SAP ABAP Study Material, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Online Exam, SAP ABAP Prep

Note: CASE statement is where open quantity is calculated.

1st when statement is when schedule line is not open e.g. fully goods issued

2nd when statement current schedule line is partially open  e.g. partially goods issued

else statement for schedule lines that are open e.g not goods issued

Calculate Open Order Schedule Line Value and Eliminate Order Schedule Lines That are Not Open


SAP ABAP Study Material, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Online Exam, SAP ABAP Prep

SAP ABAP Study Material, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Online Exam, SAP ABAP Prep

Note: open order schedule line value is calculated prorating order line value. Not open schedule lines are eliminated checking open quantity

No comments:

Post a Comment