Function Module for Calculation Schema in MM

I am looking for a function module that does the calculation schema for arbitrary material.

When opening ME23N and looking for the position details you have the tab Conditions where the table showing contains the base price and various conditions and below the "endprice". But since the price finding calculates the (baseprice + conditions) * amount as the netto value and divides this by the amount this can lead to rounding issues where the calculated value of 4,738 gets rounded to 4,74 which gets stored as netto price. Now when calculating nettoprice * amount this value can be different to the original value printed on the purchase document.

Since the purchase-document-value is not stored in the EKPO my goal is to re-evaluate this value by simply calling a function module with the material number and the calculation schema and any necessary parameter to give me the actual value that (again) is printed on the document.

Is there any function module that can do this or do I have to code the logic by myself?


  • As I wrote in my comment the solution is the FM BAPI_PO_GETDETAIL1. If you supply the PO number you get several tables containing information that is displayed in the PO create/view transaction. One of them is the iTab POCOND that has all conditions. Then you just have to read this iTab and calculate the values and add them up.

    lv_ebeln = 4711
    lv_ebelp = 10
    " Call FM to get the detail data for one PO and each position
    call function 'BAPI_PO_GETDETAIL1'
        purchaseorder = lv_ebeln
        pocond = gt_pocond
    " Loop over the iTab and only read entries for position 10
    loop at gt_pocond
        into gs_pocond
        where itm_number = lv_ebelp.
        " Get the netto value NAVS
        if ( gs_pocond-cond_type =  'NAVS' ).
            lv_netwr = gs_pocond-conbaseval.