Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Unit price in Invoice form(Rounding up issues)

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

not sure but u can try this

write v_amount currency is_bil_invoice-hd_gen-bil_waerk

to v_amt1_curr.

where v_amount is ur unit price coming.

and v_amt1_curr conatins this value in doc currency form.

6 REPLIES 6

Former Member
0 Kudos

Any suggestions on this issue please.?

Thanks alot

Former Member
0 Kudos

Hi Aarav,

Check this links

[Rounding|]

[Rounding off value|]

Read Above for a clear idea about Rounding values.

[Rounding of the Values|]

[Quantity & Rounding condition values|]

[Rounding down values|]

For More results Search In SDN...

Thanks & regards,

Dileep .C

Former Member
0 Kudos

not sure but u can try this

write v_amount currency is_bil_invoice-hd_gen-bil_waerk

to v_amt1_curr.

where v_amount is ur unit price coming.

and v_amt1_curr conatins this value in doc currency form.

0 Kudos

No , this didnt work . What I want is to grab the unit price directly from the document rather than calculating it by total/quantity in my code.

Thanks

0 Kudos

Hi Aarav,

Can you tell exactly are you selcting from VBAP or KNOV or .....

& Requirement for what is it for sales or something else... If it is from document, Which document???

if sales then try to search in SCN for VBAK & VBAP & KONV, KONP tables relations that will soleve your problem easily,,,,

Thanks & regards,

Dileep .C

Former Member
0 Kudos

.