1/5/2016 5:19:48 PM

MM Purchasing Purchase Order History

SAP Business Suite on SAP HANA is gaining more and more exposure in the marketplace and if you are like me you really want to know more detail than some marketing slides show. SAP HANA unlocks many opportunities to improve performance and change the way we look at real-time processing compared to historical expectations in performance. So when we combine SAP HANA and the SAP Business Suite there are numerous functional areas where optimization offers tangible performance improvements for the customer. This blog focuses on optimization techniques used within SAP ERP Materials Management and Purchase Order History.

Purchase Order History

Purchase Order History data is used extensively by over 80+ SAP Materials Management transactions. Many of these transactions have dependencies to key business process such as GR/IR clearing, invoicing and purchasing. If these key business processes are not performing it can lead to frustrating issues such as timeouts and a poor user experience. Significant performance gains have been made as demonstrated by the optimization of transaction MB5S for GR/IR Balances, where execution times were improved by a factor of twenty-five.

Given the shared design of Purchase Order History reports performance improvements across multiple transactions was possible. The following transactions were targeted for optimization:

ME2N – Purchase Orders by PO Number

ME2K – Purchase Orders by Account Assignment

ME2L – Purchase Orders by Vendor

ME2M – Purchase Orders by Material

MIRO – Invoice

MIGO – Goods Receipts

MB5S – List of GR/IR Balances


Across the four ME2* transactions in particular there were three approaches used to improve performance. These optimizations can be classified as either HANA related or generic, meaning improvements will be evident independent of the underlying database. 


Stored procedures created in the HANA repository were called using ADBC (ABAP Database Connectivity)

External views (ABAP) were created to as a proxy to call HANA assets seen below.

Calculation views were created and aggregate Purchase Order history values and call the attribute view listed below. 

Attribute views were created to represent the EKB* tables (Purchase Documents history).


Program sequencing was changed

Buffer usage was improved to retrieve Purchase Order Document Item information early and remove subsequent calls to the database.

Bulk reads of Purchase Oder document information we read compared to individual records being read.

Asynchronous database calls have also been implemented to remove blocks in processing.

Authentication Checks – These were leveraged to determine what Purchase Order data a user is allowed to view and then retrieve the data from the database reducing the amount of information sent to the application layer.

SQL statements were updated to embrace Open SQL improvements and increase performance by a more intelligent filter criteria. E.g SUM.

Patterns Used

To improve performance on the above reports and transactions specific optimization patterns were implemented. These patterns or techniques can be leveraged by all customers with SAP HANA in addition to some optimizations that can be run on any database.

Code Pushdown (HANA Assets)

External Views

Attribute Views


Stored Procedure

Open SQL

Refinement of existing SQL statements to leverage increased capability of Open SQL.

Optimization Activation

As with all other SAP Business Suite for HANA enhancements a non-disruptive methodology is followed to ensure stability for all customers independent of their underlying database. The Open SQL optimizations mentioned above cover all databases and hence no isolation is required. The use of HANA specific optimizations as seen above are activated using the switch framework in conjunction with commonly used BADIs.

If you like this blog, please share (Facebook/LinkedIn/Google+) to click below links so it will reach to others.