how to retrieve price per unit in SAP?

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.


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



0 View this answer in context