Use of Round function

Hi,
   I have a requirement to round off the values. The round offed values should store in another variable.
Can u give function module or any operator to achieve this one.
   Ex v1 = 12.567.
  round of v1  = v2  = 13.
Rewards as per answer.

Hi,
J_1I6_ROUND_TO_NEAREST_AMT
This FM rounds the number.
but the input shud b in ','.
for eg: input = 12,5   instead of 12.5
output= 13
Also, try this method:
data : a type p decimals 2,
b type i.
a = '10.20'.
b = abs( a ).
write : / b.
a = '10.50'.
b = abs( a ).
write : / b.

Similar Messages

  • Using sum function and round function in single text form field

    Hi all,
    I have a column Name - A . In the rtf template i have summed up the column A and showing it. But the output is coming as 99.9999997. I want to round it to 100.
    I tried using <?round(sum(A),2)?> but dint workout.
    I also tried using variables. It is also not working.. I used <?xdoxslt:set_variable($_XDOCTX,’ABS',sum(A)?> and then i used get variable to get it.... But it throwing error while using sum in the set variable step.
    Can anyone please help me..
    Thanks
    Sunil

    Hi Sunil,
    Calculate the sum into a Variable. and apply round function on the variable to get the desired value.
    Calculating sum:
    <?xdoxslt:set_variable($_XDOCTX,'v',xdoxslt:get_variable($_XDOCTX,'v')+DOLLARS)?> (its running sum formula,should be placed inside the table to get sum of all rows of particular column)
    here Variable 'v' holds the sum value
    apply round function:
    <?round(xdoxslt:get_variable($_XDOCTX,'v'))?>
    Thanks and Regards,
    Aravind

  • Rounding down using the floor function

    I need some help rounding down to the nearest 5 using the floor function.
    My code appears to be correct but I'm not getting the wrong result.
    create or replace
    TRIGGER "SALE_CALC" BEFORE
    INSERT OR
    UPDATE ON Prs FOR EACH Row
    BEGIN
    :New.Prsvf9c := (floor((:New.Prsprsc - :new.prsvf1c)/5)*5);
    END;
    *:New.Prsprsc = 100.00 and :new.prsvf1c = 46.00*
    After the trigger executes I get a result of *54.00*, which is the result before the rounding should take place. The result should be *50.00!*
    What am I doing wrong?

    The code you posted appears to produce the results you expect if the data is what you say it is
    SQL> create table prs(
      2    Prsvf9c number,
      3    Prsprsc number,
      4    prsvf1c number
      5  );
    Table created.
    SQL> create or replace
      2  TRIGGER "SALE_CALC" BEFORE
      3  INSERT OR
      4  UPDATE ON Prs FOR EACH Row
      5  BEGIN
      6
      7  :New.Prsvf9c := (floor((:New.Prsprsc - :new.prsvf1c)/5)*5);
      8
      9  END;
    10  /
    Trigger created.
    SQL> insert into prs( Prsprsc , prsvf1c )
      2    values( 100, 46 );
    1 row created.
    SQL> select * from prs;
       PRSVF9C    PRSPRSC    PRSVF1C
            50        100         46If you're seeing something different, it would be very helpful if you did something like I did here and post a reproducible test case.
    Incidentally, I'm not sure why you would have columns named prsvf1c and Prsvf9c but if that implies that you've denormalized your table to store 9 values rather than creating a child table with up to 9 rows, that's unlikely to be a reasonable solution.
    Justin

  • How to return whole number using round function

    hi
    can i get sql query using round function how to return whole number value

    Hi welcome to the forum. if you want whole number value what does it mean
    1. whether you want the whole number greator than or eqaul to that number example for 12.6 you want 12 or 13
    see below example
    1.  SQL> select round(12.5) from dual;
    ROUND(12.5)
             13
    2.  SQL> select round(12.4) from dual;
    ROUND(12.4)
             12
    3.  SQL> select floor(12.5) from dual;
    FLOOR(12.5)
             12
    4. SQL> select floor(12.4) from dual;
    FLOOR(12.4)
             12
    floor will always give you a round value which is a integer or whole number less than or equal to but output of rond will differ if the value is greator than 12.5 it will give 13 but if it is less than 12.5 it will give 12, so depending on your requirement you can choose which function to use. similarly if you always want to get the whole number greator than the number you can use ceil as below
    SQL>  select ceil(12.3) from dual;
    CEIL(12.3)
            13
    SQL>  select ceil(12.8) from dual;
    CEIL(12.8)
            13

  • Problem with the round function using Date

    Hi,
    I have a problem with round function for Date. The input is the four digit year which was picked out from say SYSDATE.
    In these scenarios the original value should be rounded up and should get the output as shown under rounded column.
    Scenario1
    Original Rounded
    2020 ---> 2020
    2021 ---> 2020
    2022 ---> 2020
    2023 ---> 2020
    2024 ---> 2020
    2025 ---> 2025
    2026 ---> 2025
    Scenario2
    Original Rounded
    2020 ---> 2020
    2021 ---> 2025
    2022 ---> 2025
    2023 ---> 2025
    2024 ---> 2025
    2025 ---> 2030
    2026 ---> 2030
    Scenario3
    Original Rounded
    2020 ---> 2020
    2021 ---> 2020
    2022 ---> 2020
    2023 ---> 2025
    2024 ---> 2025
    2025 ---> 2025
    2026 ---> 2025
    Can anyone help with this....Urgent Please
    Thanx for your time

    1.
    SQL> select n,n-mod(n,5) rnd from test;
             N        RND
          2020       2020
          2021       2020
          2022       2020
          2023       2020
          2024       2020
          2025       2025
          2026       2025
    2.
    SQL> select n,n+(case when mod(n,10) = 0 then 0
      2                   when mod(n,10) < 5 then 5-mod(n,5)
      3                   else 10-mod(n,10)
      4              end) rnd
      5  from test;
             N        RND
          2020       2020
          2021       2025
          2022       2025
          2023       2025
          2024       2025
          2025       2030
          2026       2030
    7 rows selected.
    3.
    SQL> select n,n+(case when mod(n,10) < 3 then mod(n,10)*-1
      2                   when mod(n,10) < 8 then 5-mod(n,10)
      3                   else 10-mod(n,10)
      4              end) rnd
      5  from test;
             N        RND
          2020       2020
          2021       2020
          2022       2020
          2023       2025
          2024       2025
          2025       2025
          2026       2025
          2027       2025
          2028       2030
          2029       2030
          2030       2030
    11 rows selected.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Issue with ROUND function in RTF template

    Hi All,
    Can anyone please help me in implementing the ROUND function at the RTF template.
    Need to handle rounding of amounts at the RTF template level itself.
    The ROUND function should be implemented to the following tags:
    <?sum(current-group()/TAXABLE_AMOUNT)?> (Record level)
    <?sum(TAXABLE_AMOUNT)?> (Report level total)
    Eg. If the Sum(current-group()/TAXABLE_AMOUNT) for a particular record is 401.65 then it should round of to 402
    we try to do this using following syntax ..
    1) by declaring variable "value"
    <?xdoxslt:set_variable($_XDOCTX, value, sum(current-group()/TAXABLE_AMOUNT))?>
    2) <?xdofx:round(sum(current-group()/TAXABLE_AMOUNT))?>
    3)<?xdofx:round(xdoxslt:sum(current-group()/TAXABLE_AMOUNT))?>
    but we ding get the solution.
    A quick response on this is highly appreciable.
    Thanks,
    Praveen

    Re: Summing derived values within xdofx:
    Re: Rounding not working

  • Issues with 'Rounding' function (Word 2007 issue? Works in Word 2003...)

    My colleague (using Word 2003) and I (using Word 2007) are working on a change to a template where we include a formula that has the function called rounding.
    She (2003) is able to preview the pdf but I (2007) am getting error message: : oracle.xdo.parser.v2.XPathException: Extension function error: Method not found 'round'
    All other settings that we have appear to be the same (same config file, same java version, etc)
    Does anyone know if there are some changes to Word 2007 that are causing this? And, any ideas on how to resolve?
    Thanks for the help!
    Background:
    -The function is designed provide a total weight value: each individual weight value, multiply by a factor of .80, round up, and then added together to get a total amount.
    -Because we also show the individual weight values on the output, (also multiplied by the factor of .80 and then rounded up), we need the factor and rounding to happen before the sum).
    The entire set of functions for the total weight value is:
    <?xdoxslt:set_variable($_XDOCTX,'sum',0)?>
    <?for-each:LIST_G_CONTAINER_NAME1?><?for-each:G_CONTAINER_NAME1?>
    <?xdoxslt:set_variable($_XDOCTX,'sum', xdoxslt:get_variable($_XDOCTX,'sum')+ xdoxslt:round((GROSS_WT*0.8),2))?><?end for-each?><?end for-each?>
    <?format-number: xdoxslt:get_variable($_XDOCTX,'sum');'9G990D00'?>
    space
    <?WEIGHT_UOM_CODE?>
    Error when attempting to preview the pdf after uploading an xml file:
    : oracle.xdo.parser.v2.XPathException: Extension function error: Method not found 'round

    Hi,
    I took my original file (didn't have the round functionality) and Word 2007 and did the following:
    1) Tested with xml to ensure that there are no other issues - was able to preview successfully
    2) Added the function you suggested: <?xdoxslt:round(1000.98978,2)?> and saved the change
    3) Tried to preview using the same xml and got the same error message about rounding
    I can't test on 2003 because my colleague is not working right now (she is the one with that version installed). I will try on 2003 later today (but I am guessing it will work for her because the other rounding function works for her).
    Thanks for any other ideas about this.
    Here is the entire extract of error message:
    Font Dir: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\fonts
    Run XDO Start
    RTFProcessor setLocale: en-us
    RTFProcessor setConfig: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\config\xdo.cfg
    FOProcessor setData: C:\Data\BI Publisher\2010_CR-102626_PL-CML_Net Weight\Net Weight Template Changes\Testing\OTST_SC-06_PL_SGS-2903194_Direct_ENG_Jul-09.xml
    FOProcessor setLocale: en-us
    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLT10gR1.invokeProcessXSL(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLT10gR1.transform(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLT10gR1.transform(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLTWrapper.transform(Unknown Source)
         at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(Unknown Source)
         at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(Unknown Source)
         at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(Unknown Source)
         at oracle.apps.xdo.template.FOProcessor.createFO(Unknown Source)
         at oracle.apps.xdo.template.FOProcessor.generate(Unknown Source)
         at RTF2PDF.runRTFto(RTF2PDF.java:632)
         at RTF2PDF.runXDO(RTF2PDF.java:466)
         at RTF2PDF.main(RTF2PDF.java:254)
    Caused by: oracle.xdo.parser.v2.XPathException: Extension function error: Method not found 'round'
         at oracle.xdo.parser.v2.XSLStylesheet.flushErrors(XSLStylesheet.java:1526)
         at oracle.xdo.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:517)
         at oracle.xdo.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:485)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:264)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:150)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:187)
         ... 16 more

  • How to use case when function to calculate time ?

    Dear All,
    May i know how to use case when function to calculate the time ?
    for the example , if the First_EP_scan_time is 12.30,  then must minus 30 min.  
    CASE WHEN FIRSTSCAN.EP_SHIFT <> 'R1' AND FIRSTSCAN.EP_SHIFT <> 'R2'
    THEN ROUND(CAST((DATEDIFF(MINUTE,CAST(STUFF(STUFF((CASE WHEN SHIFTCAL.EP_SHIFT = 'N1'
    THEN CONVERT(VARCHAR(8),DATEADD(DAY,+1,LEFT(FIRSTSCAN.EP_SCAN_DATE ,8)),112) + ' ' + REPLACE(CONVERT(VARCHAR(8),DATEADD(HOUR,+0,SHIFTDESC.EP_SHIFT_TIMETO + ':00'),108),':','')
    ELSE LEFT(FIRSTSCAN.EP_SCAN_DATE ,8) + ' ' + REPLACE(CONVERT(VARCHAR(8),DATEADD(HOUR,+0,SHIFTDESC.EP_SHIFT_TIMETO + ':00'),108),':','') END),12,0,':'),15,0,':') AS DATETIME),CAST(STUFF(STUFF(LASTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME)) / 60.0 - 0.25) AS FLOAT),2)
    ELSE ROUND(CAST((DATEDIFF(MINUTE,CAST(STUFF(STUFF(FIRSTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME),CAST(STUFF(STUFF(LASTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME)) / 60.0) AS FLOAT),2) END AS OTWORK_HOUR

    Do not use computations in a declarative language.  This is SQL and not COBOL.
    Use a table of time slots set to one more decimal second of precision than your data. You can now use temporal math to add it to a DATE to TIME(1) get a full DATETIME2(0). Here is the basic skeleton. 
    CREATE TABLE Timeslots
    (slot_start_time TIME(1) NOT NULL PRIMARY KEY,
     slot_end_time TIME(1) NOT NULL,
     CHECK (start_time < end_time));
    INSERT INTO Timeslots  --15 min intervals 
    VALUES ('00:00:00.0', '00:14:59.9'),
    ('00:15:00.0', '00:29:59.9'),
    ('00:30:00.0', '00:44:59.9'),
    ('00:45:00.0', '01:00:59.9'), 
    ('23:45:00.0', '23:59:59.9'); 
    Here is the basic query for rounding down to a time slot. 
    SELECT CAST (@in_timestamp AS DATE), T.start_time
      FROM Timeslots AS T
     WHERE CAST (@in_timestamp AS TIME)
           BETWEEN T.slot_start_time 
               AND T.slot_end_time;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Combing rounding functions with other functions

    I am using hyperion reports. Is it possible to combine a rounding function with another function? Specifically, I am taking a variance of actual vs budget where actual and budget are % of total functions. The variance I am getting is off (see ex. below.) I need to keep the actual and budget at 1 decimal point. To correct this problem in excel I am able to round the numbers pulled in by essbase. The ex. below illustrates my problem. Actual .2% Budget .2% Variance .1%

    You may want to make a 'Scenario' for rounding that is rounding the input data. If you make it (variance) 2pass, it will show the difference of the rounded numbers (ie. 0%)Rich [email protected]

  • RBA - use of rounding profile/settings during Interchangebility

    Hi,
    We are using the product-location interchangebility dung RBA ATP check at the time when PR's get converted into PO's.
    Rounding profile/value of predecessor product is different than that of successor product. We want both the values to be considered while system perform ATP check through Rules maintained at location level.
    The illustration of the same is -
    Product A has rounding profile/value = 54, it has stock of 30 at location L1
    Product B has rounding profile/value = 84, it has stock of 100 at location L1.
    PR of quantity 54 is been created at location L1 for product A. We confirm this PR into PO & during this time, ATP check is performed for product A@L1. As it has not sufficient stock, product A is been replaced by product B (the substitution is maintained in RBA). But, in our case, the PR of 54 is getting created for product B wherein it should get created for 84 as rounding profile/value = 84 is maintained for product B@L1.
    Can anyone come across the same problem?
    Your inputs on the same are highly appreciated...
    Thanks for looking into the issue.
    Rgds
    Jay

    Data is always maintained on an article, sales organization and distribution channel basis. It can be made customer-specific through the creation of customer-article information.
    You have the following control options:
    1. <u>Customer master</u>
    You can deactivate rounding at customer level for each distribution chain by deselecting an indicator.
    2. <u>Item category in Customizing</u>
    In Customizing for sales documents, you use an indicator for each item category to switch the rounding function on or off.
    3. <u>Article master / customer-article information</u>
    Minimum quantity (Minimum order quantity or Minimum delivery quantity field)
    Maximum quantity (Max. delivery quantity field)
    Delivery unit (two fields for Delivery unit)
    The delivery unit comprises an increment and a unit of measure. If you define an increment, the system rounds off the delivery quantity so that it can be divided into whole numbers by the increment.
    You only have to enter a unit of measure for the increment if the unit of measure is not the base unit of measure. Otherwise, the increment refers to the base unit of measure.
    Rounding profile (Rounding profile field)
    Unit of measure group (Unit of measure group field)
    Variable sales unit

  • Native compilation and the ROUND function

    Native Compilation Advisor lists the built-in ROUND function as not supported for natively compiled stored procedures.  Is there a suggested workaround?

    oracle by oracle  wrote:
    I am trying to test performance of one package and there is only one procedure wich uses just instr and substr internal functions ( I am working with varchar2).
    I am having the folowing results: native compilation is twice worst than inetrpreted. What may be the reason?
    P.S. I did ALTER SYSTEM FLUSH SHARED_POOL;Yuo should take this into account that the Native compilation is not supposed to make the code always go faster. If I remember correctly, the maximum benefit that Oracle benchmarked for it was about 30% only and taht too, if the code has lots of computational code rather than queries. If your package contains lots of this kind of code. than may be the Native compilation may be faster than the other but it doesn't come with any guarantee like this.
    Have a read about it from here,
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2278
    HTH
    Aman....

  • Round functions in SAP

    Hi Experts,
    Can you help me in finding a suitable round function in SAP? I need to round off to 3 decimal places. I used the function module ROUND but it is not very much helpful.
    I have 3 values ex 0.43444567 , 0.0824495 , 0.48310483. The total is 1. But wen i update in transaction Kp46 for Plan value column it takes only 3 decimal places. So if i reduce the above 3 values to 0.434,0.082,0.483 then i get total as 0.999.
    But if i reduce them ( rounding off ) to 0.435,0.083,0.483 i get 1.001. Please help me get a proper solution for this.
    Thanks and Regards,
    Ramya S

    Hi,
    Thanks for your reply. But I need not calculate the sum to update it anywhere. I just want the total to be 1. I just want to reduce them to 3 decimal places and also retaining the the total as 1.
    Thanks,
    Ramya S

  • How the ROUND function helps to solve balancing accounts?

    As a developer, I'm being assigned to solved a bug in an application. In the application, large number transactions with credit and debit amounts are to be balanced. But before balancing, another calculation takes place. At the end of that calculation, the difference between the credit and debit amounts is not zero. There'll be a difference of about 0.02. Thus an application error is raised.
    Will there be a possibility of making use of the ROUND function and solving it? or are there any other functions provided by Oracle to solve such a situation?
    Thanks

    I guess, you should post here steps of example calculation. It also depends on the organization which rule it is following, I mean something like ignoring few decimal places etc.
    Please post the example.

  • BPEL round function with precision for a decimal value?

    Dear All,
    I need to do a rounding of a higher value to 3 precisioned one.
    As per the round function available in Jdeveloper, I can only round a decimal to its respective integer value.
    But my requirement is to retain the decimal value, but with a limited precision value...
    How can I accomplish this.. Is there any extension of round function in BPEL to do this...?
    Please update..
    Many thanks...

    Use the function format-number(variable,precision_num)+.
    Thanks,
    Sen

  • Help with a ROUND function

    Hi everyone, can someone please help me with a function to use here please. I have a nine digit number e,g (000046650 and 024063870). I would like to convert this to 4 digits before the comma and 5 digits after the comma. So it must be something like this (0000,46650 and 0240,63870). I thought I could easily do this with a ROUND function, but it doesn't work. Could somebody please help by telling me what I'm missing?
    Thank you all for your help.

    Hi,
    I must be missing something, but why don't you just divide by 10000 ?Scott@my11g SQL>with d as (
      2  select 000046650 n from dual
      3  union all
      4  select 024063870 from dual
      5  )
      6  select n/10000 from d ;
       N/10000
         4.665
      2406.387You can then use a to_char with fmt to format it with zero padding :Scott@my11g SQL>with d as (
      2  select 000046650 n from dual
      3  union all
      4  select 024063870 from dual
      5  )
      6  select to_char(n/10000,'0000.00000') nn from d ;
    NN
    0004.66500
    2406.38700

Maybe you are looking for

  • Change in Material Description in Sales Order

    HI, We have a scenario where there's a change in our existing material Description and there's an existing SO of the said material. When we changed the description in MM03, it doesn't reflected/changed in VA03. The material description there, remains

  • [apvlv] mouse scrolling doesn't work anymore

    Hello guys, it occured with some newer version of apvlv that mouse scrolling isn't working anymore. Is there any chance to activate that feature again? Best regards

  • Customer Check Returns

    Hi Team, When Customer checks bounce in Bank statement we see two entries. In Bank statement First, Credit amount, and with the same amount Debit.  and Bank Charges. Now my question, Is there any standard process to track in SAP. Like Example if we w

  • Satellite C850-1KN - Windows 8.1 Freeze

    Hi, I have tried the search function but cannot find the help I require. My Satellite C850-1KN (windows 8.1) has been freezing a lot recently but I am still able to use the mouse pointer, CTRL + ALT + DEL has no effect and the computer won't do anyth

  • RRI target selections same as source query

    Hi BI Experts, As per my requirement the input of the target query should be same as the first query. i.e.., if A ,B,C,docnumber are the variables of two queres and if i fill Variable A in query one and in the result of the first query i right click