Price per unit is getting round off to two decimal places.
Hi Gurus,
In the Billing output, the Price per unit is getting round off to two decimal places.
How can we avoid this or allow 4 decimal places for such cases.
In the same pricing procedure, we have two pricing condition types PR02 and ZR01.
When PR02 is being used,it doesnt rounds off Price per unit.e.g .578888 = .578888
But when ZR01 is being used the system rounds off price per unit.e.g.578888 = .58
Please suggest where is the setting for it.
Thanks
Montee
Hi,
Which currency you are using? If its INR, then it will do only for 2 decimal places.
The solution for ur problem can be ractified by changing the scales :
Also check OSS 80183
Thanks,
Raja
Similar Messages
-
Round off to two decimal places
hi
i have a filed in it values are there i want to round off to two decimal places
which is the function module for it please suggest
regards
AroraHi Nishant Arora,
Please check this code.
DATA: N1 TYPE P DECIMALS 4 VALUE '0.0565',
N2 TYPE P DECIMALS 2.
MOVE N1 TO N2.
WRITE: N2.
Here the value is get rounded to 0.06.
Rather than function modules you go with this. I think it is easier.
Reward points if useful.
Cheers,
Swamy Kunche -
Rounding off to two decimal places
Hello,
For simplicity, is there a method which will round off
a double variable to two decimal places.
Excample: if I have a result which equals 2.1999998
and I want to display this as 2.20 in a TexTField.
Any help would be much appreciated.
ThanksIf you are trying to do dollars and cents, I further recommend you use:NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance();
String currencyOut = currencyFormatter.format(yourNumber);to format your numbers as they will give the correct precision for international currencies simply by setting the locale, and they will also automatically handle the currency symbols ($, DM FR, etc.)
Doug -
How do I round calculations to two decimal places (form-wide)
Hi,
I've created an order form where customers input the quantity of product they want to order and the form outputs the total due (including shipping and sales tax). Depending on user input, the resulting total sometimes contains more than two decimal places. How do I round calculations to two decimal places? Is there a way to do this form-wide?
I'm new at using Acrobat for calculations. Any help would be greatly appreciated! Thanks...The above will affect the displayed value not the actual value of the field nor its value when accessed in another computation. This behavior may cause an error of 1 cent or more in the grand total or sales tax computation. If you want the the value and displayed value to be the same value you can use the following Validation script:
event.value = util.scand("%,1 0.2f", event.value); -
Rounding off to 2 decimal places
Hi,
I use "Double" for my calculations and since I am working with $$ ;-) I need to round it off at 2 decimal places. Any quick way to do this? or do I have to write some major code for that?
ThanksThis works for all the test cases. Try this
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat;
class RoundOff {
public static void main(String args[]) {
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("173449.8"));
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("173449.98"));
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("-1.0"));
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("-1.0"));
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("-141.036"));
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("-00.1"));
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("-0.0"));
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("173449.98"));
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("173449.0.54"));
//RARE EXCEPTIONS BUT WONT OCCUR
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("0125."));
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("0125.979.79E"));
//RARE EXCEPTIONS BUT WONT OCCUR
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("173449.2354"));
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("173449.9874"));
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("173449.999"));
System.err.println(" FINAL OUT PUT >>> " + formatPrecision("173449.999"));
private static String formatPrecision(String s) {
if (s == null || s.trim().length() == 0) {
return "0.00";
try {
if (Double.parseDouble(s) == 0) {
return "0.00";
catch (java.lang.NumberFormatException nfe) {
return s;
double d = 0.00;
int ind = s.indexOf('.');
String dec = "";
if (ind > 0) {
dec = s.substring(ind);
if (dec.length() == 1) {
s = s.concat("00");
return s;
if (dec.length() == 2) {
s = s.concat("0");
return s;
if (dec.length() == 3) {
return s;
if (ind == -1) {
return s.concat(".00");
try {
d = Double.parseDouble(s);
BigDecimal bd = new BigDecimal(d);
bd = bd.setScale(2, BigDecimal.ROUND_HALF_UP); //2 decimal places
d = bd.doubleValue();
NumberFormat formatter = new DecimalFormat("0.00");
return String.valueOf(formatter.format(d));
catch (java.lang.NumberFormatException nfe) {
return s;
} -
Rounding Doubles to Two Decimal Places
Hi All,
I've searched the archive and found a few different posts regarding restricting the number of decimal places in doubles. However they all suggest different methods, BigDecimal, NumberFormat etc.
Which is the simplest method of rounding a number say 10.023445656 to 10.02?
I tried using the java.text.NumberFormat but this turns the double into a string and I need the end result to be a double.
ThanksHi All,
I've searched the archive and found a few different
posts regarding restricting the number of decimal
places in doubles. However they all suggest different
methods, BigDecimal, NumberFormat etc.
Which is the simplest method of rounding a number say
10.023445656 to 10.02?
I tried using the java.text.NumberFormat but this
turns the double into a string and I need the end
result to be a double.
ThanksI ahve a small code that can do the work for u:
import java.text.*;
double format(double val, int dec){
double multiple=Math.pow(10,dec);
val=Math.round(val*multiple)/multiple;
DecimalFormat df=new DecimalFormat("0.00");
String format=df.format(val);
double dval=Double.parseDouble(format);
return dval;
}//end of functionHope that helps! -
Convert rounded number into two decimal places
Hi All,
I have a Number 156 stired in a column having number(10,2);
but i want to update it into 156.00......
May be simple,,,,but how?
Edited by: 887268 on May 29, 2012 10:04 AMHi,
156
156.00
156.0000000000000 and
00000156.0000 are all the same NUMBER. There's nothing to convert.
If you want to display a NUMBER in a certain way (e.g., with 2 digits after the decimal point) then use TO_CHAR, or have your front end format the column. In SQL*Plus, for example, you can use the COLUMN command:
COLUMN sal FORMAT 99999.99
SELECT ename
, sal
FROM scott.emp
;Output:
ENAME SAL
SMITH 800.00
ALLEN 1600.00
WARD 1250.00
JONES 2975.00
... -
Rounding to two decimal places
In Java, how do I round a number off to two decimal places?
Thank Youjava.text.DecimalFormat
Or use java.math.BigDecimal and specify rounding rules, apparently. -
Rounding to two decimal places in BPC/NW
Hello,
I am dealing with the task to round values to two decimal places. I have found some discussions in BPC-MS where the statement ROUND should work in logic. Unfortunately I am not able to make it work in the NW version.
Isn't there also a parameter in the appset or application administration which would cut the numbers only to two decimal places (this task would be also a possible solution for us).
Thanks for any help
JanHello Pravin,
the second import worked fine. I realized that the class has changed to ZCL_BPC_SL_ROUND.
I debugged the class and noticed that the parameter it_cv is not filled at all. Therefore the program ends before starting the rounding procedure. Here is the part of the code:
Take CV into account
clear l_success.
loop at it_cv into ls_cv.
clear l_val_string.
loop at ls_cv-member into l_member.
if sy-tabix eq 1.
l_val_string = l_member.
else.
concatenate l_val_string l_member into l_val_string separated by ','.
endif.
endloop.
if l_val_string ne space.
l_success = add_dim_restriction( i_param = l_val_string i_dimension = ls_cv-dimension i_clear = abap_true ).
if l_success eq abap_false.
concatenate 'Failed to successfully add Dimension' ls_cv-dimension into l_log_msg
separated by space.
cl_ujk_logger=>log( l_log_msg ).
cl_ujk_logger=>log( 'Exiting Round Method' ).
cl_ujk_logger=>empty_line( ).
raise exception type cx_uj_custom_logic
exporting messages = et_message.
exit.
endif.
endif.
endloop.
if l_success eq abap_false. exit. endif. - here the program exits and therefore doesn't do any rounding.
If I comment this part the system rounds correctly but runs on all records in the cube which degrades performance a lot.
Could you please advice further if it is possible to restrict the data region only to the submitted data?
Best regards
Jan -
Quantity getting rounded off in Sales Order
Hello All,
The problem is related to Sales Order raising in SD which is as follows -
While punching a sales order for example :- Quantity (Kg) Per Kg Price (Rs.) Net Value (Rs.)
Material A 3036.800 3052 9268313.60
Material A 3037.000 3052 9268924.00
Difference in Net Value 610.40
As mentioned above the difference in net value is occurring due to the rounding of quantity of material A while the sales order is generated, which is actually totally not recommendable as we know that in standard SAP system we have the provision of rounding up of net value whereas here the quantity of the material is getting rounded up.
Please suggest how to stop this commercial rounding up of material quantity & kindly provide the configuration steps if any to stop this.
Thanks & regards
Priyanka MitraHello All,
In addition to the above mentioned problem please find below a little more explanation related to it -
In the material master Sales Org 1 View we have maintained the rounded off profile ZRON for example as " No Round Off " and conversion factor for unit of measurement is maintained as 1Ton = 1000 Kg & 1kg=1Kg. Still while punching the sale order for 3036.8Kg of material A when we enter the rate as 35732 INR/Ton the entire net value is getting rounded off to 108518.08 INR instead of 108510.93 INR, when we are checking the pricing condtions it has been observed that the condition based value is getting rounded off to 3.037 instead of 3.0368 which is actually the exact value.
Please suggest how to stop this rounding off calculation of the condition based value.
Looking forward to some valuable suggestions.
Thanks & Regards
Priyanka Mitra -
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.
endif.
endif.
clear : lv_kbetr,
lv_kpein,
lv_KMEIN.
Reward Points if it is useful
Thanks
Seshu -
IN Po quantity is getting round off - when we create PO through BAPI?
Hi all,
In PO quantity is getting round off instead of 5711.210 it is taking 5711 only. Here we are creating the PO's through BAPI automatically.
and in excel sheet we have maintained 5711.210, Kindly let me know what may be the possible causes for this..
regards,
archanafyi
change decimal places in PO quantity -
PO: Condition type maintained in header level affect the price per unit
Hi,
When I create a PO (Tcode ME21N) with 2 line items:
Line Item 1: $5.00 per unit, order 1 unit
Line Item 2: $10.00 per unit, order 1 unit
Then I put a condition type: Transportation Charges of $10.00 at header level.
The system will auto calculate and proportionate the transportation charges into that 2 line items. So now, the price per unit of the 2 line items has been change:
Based on the formula [ (original price per unit * Transportation Charges / total order value) + original price per unit ]:
Line Item 1: $8.33 per unit [ ($5.00 * $10.00 / $15.00) + $5.00 ]
Line Item 2: $16.67 per unit [ ($10.00 * $10.00 / $15.00) + $10.00 ]
There are 2 things here that we want to do:
1. We donu2019t want the transportation charges affect the price per unit. Means we do not want the price per unit to be changed. We want the transportation charges stand alone on it owns.
2. Also, sometimes the transportation charges is paid to a different supplier, meaning the original order value paid to supplier A, and the transportation charges paid to the supplier B (which is a transportation company).
Can anyone advise how can I do this?
Thank you.hai;
give the transportation charges in item level
go to 'item details' tab and select individual item ,go to condition ,maintain the 'frb1' value seperatly for the two items in the PO.You can also assign seperate transportation vendor for items sepertly.
For selecting the transportation vendor ;you just select the line where you maintained the frieght value and click on the 'condition detail' button shown in the bottom of the screen then on next screen there is an option for giving the transportation vendor acccount no.
try
hope this will help you
by fasal -
UOM is getting rounded-off while converting the PR into PO
Dear all,
We have created a PR with the UOM - EA for the qty 2.256 but the same was changed as 2 while converting the PR into Purchase order (If the PR qty is 2.564, then PO qty is changed to 3).
I have checked in "CUNI". In this, for "EA", decimal pl rounding is maintained as 3.
(If we create the PO directly for decimal qty w/o referring the PR, qty is getting rounded-off in print format. We have already posted this print script issue alone and we were advised to change the print script.)
What we have to do to get the actual PR qty in PO.
Pl give your valuable suggestions.
Warm regards,
M.Selvaganesh,Friends,
What is the application of decimal places under display and decimal pl. rounding under conversion in CUNI?
(If i maintained decimal pl. rounding as 2, system is taking the PR qty of 2.256 as 2.25 in PO. and i've maintained decimal places as 3. But where can i see this in PO?)
Pl clarify.
Cool regards,
M.Selvaganesh, -
Rounding off a float to two decimal places
I want to make a function where I shall pass a float and and integer.
The float shall have to be rounded off to a value in the integer.
Can anyone please suggest how to round off a float.
E.g.: if the float is 12.56890 and I want to round it off to 2 decimal places, then it should be 12.57.
Regards
HawkerI didn't mention any datatypes like float, double.True, but that is what the question is about, so you weren't answering the question. For a change.
As I mentioned, that was just a mathematical steps to round of the floating point value. (Not in any programming languages point of view).False. You didn't mention that at all.
This is the code for that in java.So here you are mentioning datatypes and floats for the same piece of mathematics that you have already been told, with reasons, doesn't work in floating point.
which seems to be working fine
Seems to. What evidence do you have that the float actually got rounded? As opposed to got displayed as rounded? Which is not what the OP asked for.
And of course all that code seems to do is round 0.01 to two decimal places, which again is not what the OP asked for.
For any remaining fans of this 'technique', please explain the behaviour of the following code:
public static void main(String[] args)
int count = 0, errors = 0;
for (double x = 0.0; x < 1; x += 0.0001)
count++;
double d = x;
int scale = 2;
double factor = Math.pow(10, scale);
d = Math.round(d*factor)/factor;
if ((d % 0.01) != 0.0) // if 'd' really has been rounded this should be zero
System.out.println(d % 0.01);
errors++;
System.out.println(count+" trials "+errors+" errors");
}
Maybe you are looking for
-
I would just like my blog to return to its original format with no line down the middle of the page and the top border going across the entire page not just halfway. This happened immediately after I upgraded to Firefox 6. My blog's format is normal
-
while trying to close a kindle app on my iphone I changed to background in that app to black with white letters and cannot get it to change back. Invert colors is off
-
Item category limit (B) in frame work order
Is it that item category B (limit) is mandetory in frame work order ? In that case it should appear by default. Can we use any other item category with frame work order logically?
-
I was just reading another forum where people asked "what type of backup do you do" , and interestingly, none of the responders was using Outlook, Outlook Express or Lotus whatever. Mainly they replied they were using Linux. Yet, Nokia still denies a
-
My left click on macbook pro is hard to press
Recently my brother open up a can of pop and it went everywhere. Nothing splashed on the the computer but a little drop went near the track pad...not sure if anything seeped in but is there anything that can be done??