Show TOC

 Optimization for Purchase Order History


Technical Data

Technical Name of Business Function


Type of Business Function

Enterprise Business Function

Available From

SAP enhancement package 6 for SAP ERP 6.0, version for SAP HANA

SAP enhancement package 7 for SAP ERP 6.0

Technical Usage



Application Component

Purchasing (MM-PUR)

Required Business Function

Not relevant

You can use this business function to activate performance optimizations for the purchase order (PO) history. If there are long-living PO items or scheduling agreement items in your system, the number of PO history records can amount to several thousand. If you activate this business function, the performance is improved for routines where open amounts or open quantities are calculated based on PO history information.

This optimization aggregates quantities and amounts at database level and makes the aggregated records available for subsequent calculation routines.

Note Note

If you have activated this business function and implemented the Business Add-In (BAdI) BADI for LEINRF03 excise_invoice_details (ME_CIN_LEINRF2V), the BAdI implementation may not work correctly. This is because, with the business function activated, aggregated values for the PO history records are transferred using the BAdI interface.

End of the note.

Recommendation Recommendation

SAP recommends that you check whether the implementation is still working correctly after you have activated the business function. To do so, start transactions MIRO and MIGO. If the implementation no longer works as originally designed, deactivate the business function.

End of the recommendation.


You must not activate this business function if you are using an Industry Business Solution.


You have installed the following components as of the version mentioned:

Type of Component


Required for the Following Features Only

Software Component


Software Component



    Features of Transactions MIGO, MIRO, ME2K, ME2L, ME2M, and ME2N

    Performance is improved through the aggregation of the underlying values and quantities of the following grouping criteria in the PO history records, for example:

    • Purchasing Document Number

    • Item Number of Purchasing Document

    • Sequential Number of Account Assignment

    • Transaction/Event Type, Purchase Order History

    • Purchase Order History Category

    • Movement Type (Inventory Management)

    • Currency Key

    • Debit/Credit Indicator


    Not all PO history records can be aggregated with this optimization.

    An optimization is not possible in the following cases:

    • If the material ledger is active

    • For service procurement purchasing documents

    • For the invoice verification based on a goods receipt

    • If the item category in the purchasing document ≠ ‘0’

    • For returns

    • If the price determination date control ≠ ‘ ‘

    • For purchasing documents that are not purchase orders or scheduling agreements

    An optimization is possible only for the following event types:

    • 1 = goods receipt

    • 2 = invoice receipt

    • 6 = goods issue for stock transfer

    • 7 = consumption

    • 8 = delivery (stock transfer)

    An optimization is possible only for the following transactions:

    • MIGO

    • MIRO

    • ME2K

    • ME2L

    • ME2M

    • ME2N

    Features of Transactions MB5S, ME2K, ME2L, ME2M, and ME2N

    The improvement of these transactions is achieved through a high-performance determination of data from the purchase order history. This business function optimizes transactions MB5S, ME2K, ME2L, ME2M and ME2N as follows:

    • A new Business Add-In (BAdI) method (GET_PO_HISTORY_VALUES) is available that moves the logic of function module ME_READ_HISTORY into the database. As a result, the number of database accesses is considerably reduced.

    • Buffering PO history data enables faster data access.

    • The data volume that is transferred is considerably reduced by the aggregation of data originating from function module ME_READ_HISTORY and the aggregation of data that is processed in these transactions.

    • By performing a code push-down, the performance of these transactions is significantly increased.


    Not all PO history records can be aggregated with this optimization. An optimization is not possible in the following cases:

    • For multi-accounting items (for MB5S only)

    • For service items (for MB5S only)

    • For delivery costs (for all transactions, namely MB5S, ME2K, ME2L, ME2M, and ME2N)

    More Information

    For more information about database-specific performance optimizations, see SAP Note 1835008Information published on SAP site.