Skip to Content
0
Former Member
Jun 11, 2009 at 04:57 PM

Unit price in Invoice form(Rounding up issues)

249 Views

Hi Gurus!

In my smartform I have used a formula to get the unit price of an item line which is giving me rounding up issues as it is calulating upto the 3 decimal places that I require in my output. Is it possible to grab the unit price field (KEBTR) directly into my form for the unit price so that I get the actual amount as in SAP into my invoice output rather than caluclting it in my code so that there is no discripancies.

Like it shows on my form sometimes 98.999 or sometime 99.001 instaed of 99.00 as is in under the condition tab of the invoice, I would like it to show straght as is in SAP 99.000 rather tahn doing caluction and coming to a smallest decimal value.

CLEAR: g_unit_price, g_min_charge_flag, g_item_tot, g_skto_kwert.
* get skto amount (Cash discount)
LOOP AT gt_konv INTO gs_konv WHERE kposn = gs_gen_del-itm_number AND
kschl = 'SKTO'.   "Cash discount
g_skto_kwert = gs_konv-kwert.
EXIT.
ENDLOOP.

* For rental contracts there is no delivery so surcharges must be removed from net.
IF is_bil_invoice-hd_gen-bil_type = 'ZFV'.
CLEAR gs_gen_del-kzwi3.
LOOP AT gt_konv INTO gs_konv WHERE
kposn = gs_gen_del-itm_number AND
stunr BETWEEN 230 AND 289.
gs_gen_del-kzwi3 = gs_gen_del-kzwi3 + gs_konv-kwert.
ENDLOOP.
ENDIF.

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

Edited by: Aarav Agnihotri on Jun 11, 2009 6:58 PM