6 Replies Latest reply: May 14, 2007 2:18 PM by Mindaugas Kazlauskas RSS

how to retrieve price per unit in SAP?

Mindaugas Kazlauskas
Currently Being Moderated

Hi all!


does anyone know what are the steps to retrieve from SAP price per unit value that customer was invoiced?


I am writing Z program for retrieving price per unit (for example per kilogram) in order to calculate debit/credit memo invoice for the customer.


To achieve this I have the following information:

customer nr

material nr

amount of units (for example amount of kilograms)

invoice nr

pricelist nr


so price per unit value is missing here... if I have it I could multiply it with amount of units and get the result I need...


Award points are waiting!


BR, M.

  • Re: how to retrieve price per unit in SAP?
    Anji Reddy Vangala
    Currently Being Moderated


    All price related data will be stored in KONV table

    Take the VBRK-KNUMV table field and pass it to KONV-KNUMV and take the KBETR field which gives the rate Amount.


    If you won't get.

    Take the billing Qty and the Net amount fields for that billing document

    and divide the amount with qty to get the Unit rate .


    Reward points if useful



    • Re: how to retrieve price per unit in SAP?
      Mindaugas Kazlauskas
      Currently Being Moderated

      Hello Anji!


      thanks for your input!


      ... but where pricelists are used here? I guess I have to use pricelists as they contain different values.


      I will try to be more precise. Here is what I have:


      KNA1-KUNNR     Customer Number 1

      • by the way, would be great if you know what are other tables using with KUNNR

      T189-PLTYP              Price list type          

      A006-PLTYP     Table for sales area, pricelist and material connection

      MARA-MATNR          Material nr

      BSEG-BELNR           Invoice nr

      KONH-KNUMH          Number of suplier


      Having this information I have to find out what is the current rate for each MARA-MATNR to the KNA1-KUNNR and I guess A006-PLTYP has to be used here as well...


      I need to have the current rate of materials in order to calculate the difference from the invoiced value (I need to prepare creadit or debit memo invoice).


      If something is not explained good - please let me know.

      BR, M.

      • Re: how to retrieve price per unit in SAP?
        Seshu reddy Maramreddy
        Currently Being Moderated

        Get the data from A004 and A005 tables...


        See below example code material price per unit :




        • Get the data from A004 table to get KNUMH

        • Added new field Sales Unit - Seshu 01/09/2006

          refresh : i_a004.

          clear :   i_a004.

          data : lv_kbetr like konp-kbetr," Condition value

                 lv_KPEIN like konp-kpein , "per

                 lv_KMEIN like konp-KMEIN. " Sales Unit

          select * from a004 into table i_a004

                                  where matnr = i_join-matnr

                                  and   vkorg = '0001'

                                  and   vtweg = '01'.


          if sy-subrc eq 0.

            sort i_a004 by DATAB descending.

        • Get the Latetest Date

            read table i_a004 with key matnr = i_join-matnr

                                       vkorg = '0001'

                                       vtweg = '01'

                                       binary search.


        • Get the Sales Value

            select single kbetr KPEIN KMEIN from konp

                     into (lv_kbetr,lv_KPEIN, lv_KMEIN)

                                     where knumh = i_a004-knumh

                                     and   kappl = i_a004-kappl

                                     and   kschl = i_a004-kschl.

            if sy-subrc eq 0.


              i_output-kbetr = lv_kbetr / lv_KPEIN.

              i_output-KMEIN = lv_KMEIN.




          clear : lv_kbetr,





        Reward Points if it is useful