Former Member
Jul 16, 2009 at 09:03 PM

# Unit price issues

143 Views

HI!

In m my smartform Im getting the unit price for my invoice from the condition table directly instead of calculating it (Total / Quantity) which creates the rounding up issues. SO this works fine for us but the problem occurs when the condition pricing is like 300/ 1000 L or 4000/ 1000Kgs , what happens is that in the output the unit price and quantity when multiplied contradicts , though the net price per line item shows correctly but suppose qty is 3 L and the unit price is 300/1000L so total os .9 dollars which is correct but in the form out put it shows qty= 3 unit price 300 and total .9 dollrs, which si contracdictory, so what I did I used a calculation gaain and divided by condition price by condition pricing unit so when its 300/1000L it would show .3 /L which is now ok but another problem rose with metric ton, since the selling unit is MT and the unit price now after dividing by condition pricngi unit makes it per KG so output would show like qty =3 unit price 4 and total = 12000 dollars , so heer unit price is wrong as it should have been 4000/ Ton as the total os 12000 dollars.

Is theer a way out to show the correct unit pricing as per the sales unit. I had used the code to just divide the total price of line item divided by the Quantity but then the rounding up issues came up which was not required .

```read table is_bil_invoice-it_kond into gs_kond
with key bil_number = gs_gen_del-bil_number
itm_number = gs_gen_del-itm_number.
if sy-subrc = 0.
g_unit_price = gs_kond-kbetr / gs_kond-kpein.
else.
** Loop around and get the price for it
loop at is_bil_invoice-it_kond into gs_kond
where bil_number = gs_gen_del-bil_number and
itm_number = gs_gen_del-itm_number.
if gs_gen_del-fkimg <> 0.
g_unit_price = gs_kond-kbetr / gs_kond-kpein.
endif.
*  g_unit_price = g_item_tot / gs_gen_del-fkimg.
endif.
endloop.
endif.
* Get unit price and tot price.
g_item_tot = gs_gen_del-netwr - gs_gen_del-kzwi3.
*IF gs_gen_del-fkimg <> 0.
*  g_unit_price = g_item_tot / gs_gen_del-fkimg.
*ENDIF.```

thanks