Greatest value
Hi,
One of my friend has given this problem to me.
I'm using 11g.
Two tables t1, t2. No relation exist between these two tables. Please find the table Scripts below.
-- Table t1
CREATE TABLE t1(col1 NUMBER, col2 NUMBER);
INSERT INTO t1 VALUES (1,2);
INSERT INTO t1 VALUES (NULL,10);
INSERT INTO t1 VALUES (3,4);
INSERT INTO t1 VALUES (89,NULL);
INSERT INTO t1 VALUES (5,6);
-- Table t2
CREATE TABLE t2(col1 NUMBER, col2 NUMBER);
INSERT INTO t2 VALUES (3,2);
INSERT INTO t2 VALUES (9,NULL);
INSERT INTO t2 VALUES (5,4);
INSERT INTO t2 VALUES (7,6);
INSERT INTO t2 VALUES (NULL,87);
COMMIT;
-- Table Data
SELECT *
FROM t1;
COL1 COL2
1 2
10
3 4
89
5 6
SELECT *
FROM t2;
COL1 COL2
3 2
9
5 4
7 6
87I need to retrieve greatest value from t1 and greatest value from t2 in two seperate columns.
Expected output:
RES1 RES2
2 3
10 9
4 5
89 7
6 87I was able to select RES1, RES2 individually using below code. But I dont know how to get the same using single SQl statement.
SELECT greatest(NVL(t1.col1,0),NVL(t1.col2,0)) res1
FROM t1Please help me in getting required result from two tables using one SQl query.
Thanks,
Suri
Edited by: Suri on Jul 4, 2012 1:08 AM
Suri wrote:
Hi,
One of my friend has given this problem to me.
I'm using 11g.
Two tables t1, t2. No relation exist between these two tables. Please find the table Scripts below.
-- Table t1
CREATE TABLE t1(col1 NUMBER, col2 NUMBER);
INSERT INTO t1 VALUES (1,2);
INSERT INTO t1 VALUES (NULL,10);
INSERT INTO t1 VALUES (3,4);
INSERT INTO t1 VALUES (89,NULL);
INSERT INTO t1 VALUES (5,6);
-- Table t2
CREATE TABLE t2(col1 NUMBER, col2 NUMBER);
INSERT INTO t1 VALUES (3,2);
INSERT INTO t1 VALUES (9,NULL);
INSERT INTO t1 VALUES (5,4);
INSERT INTO t1 VALUES (7,6);
INSERT INTO t1 VALUES (NULL,87);
COMMIT;
-- Table Data
SELECT *
FROM t1;
COL1 COL2
1 2
10
3 4
89
5 6
SELECT *
FROM t2;
COL1 COL2
3 2
9
5 4
7 6
87I need to retrieve greatest value from t1 and greatest value from t2 in two seperate columns.
Expected output:
RES1 RES2
2 3
10 9
4 5
89 7
6 87I was able to select RES1, RES2 individually using below code. But I dont know how to get the same using single SQl statement.
SELECT greatest(NVL(t1.col1,0),NVL(t1.col2,0)) res1
FROM t1Please help me in getting required result from two tables using one SQl query.
Thanks,
SuriDoesn't really make any sense seeing as how there is no way to join the results. You can make one up as i did below, but without some logical ordering attribute this goes back to making no sense.
ME_XE?with
2 data1 as
3 (
4 select
5 greatest(nvl(col1, 0), nvl(col2,0) ) as col1,
6 row_number() over (order by 1) as rn
7 from t1
8 ),
9 data2 as
10 (
11 select
12 greatest(nvl(col1, 0), nvl(col2,0) ) as col1,
13 row_number() over (order by 1) as rn
14 from t2
15 )
16 select d1.col1 as col1, d2.col1 as col2
17 from data1 d1 full outer join data2 d2
18 on (d1.rn = d2.rn);
COL1 COL2
2 3
10 9
4 5
89 7
6 87
5 rows selected.
Elapsed: 00:00:00.01
ME_XE?
ME_XE?Cheers,
Similar Messages
-
Array - return greatest value in the array
I am trying to write a program that for the method 'greatest' it will return the greates value in the array between the elements beginning and end.
Below is my code. No errors but I am not getting the desired results.
My output:
2
4
1
5
3
6
My code:
public class Test {
public void printArray(int x[]){
for (int i=0; i < x.length; i++)
System.out.println(x[i] + "");
System.out.println("\n");
public static int greatest(int x[], int beginning, int end){
int i;
int index = 0;
int largest = 0;
for(int z = 0; z < x.length; z++)
if(largest < x[z])
largest = x[z];
index = z;
return index;
public static void main(String[] args){
Test program = new Test();
int a[] = {2,4,1,5,3,6};
int val = greatest(a,0,a.length-1);
program.printArray(a);
}Please, I just would like someone to point out where I need to focus. I do not want anyone to write this. Yes - its for college.
Please and Thank youKayaman - once again you have been helpful. Thank you.
So I went to the paper and thought about the logic and rewrote what I had in the method greatest.
* I am passing to the method, successfully calculating the greatest value, but not returning a varialble so the variable val is still not used. Or if I am returning a value I dont see it. *
So, I need to return the value and then call the printArray method to print the outcome.
What line needs to be addressed - remember anyone else reading this, please do not write it for me :-)
public static int greatest(int x[], int beginning, int end){
int max = x[0];
for (int i = 0; i < x.length; i++)
if (max < x)
max = x[i];
System.out.println("The greatest: " + max);
return max;
Please and Thank you :-) -
Hi ,
I'm having three columns with numbers. I have to find first largest,2nd largest and third largest value
Currently i'm using following logic
ley say col 1 =10 col2=4; col3 = 7
1 greatest = greatest (col1,col2,col3) which is 10
3 greated = least (col1,col2,col3) which is 4
2nd greatst = (10+4+7) - (1st greatest - 3rd greatest) which is 7.
Is there any oracle function like greatest,least to find second largest.
Thanks,
SujeethHi
I thought about the same method, but :
Frank Kulash wrote:
For the special case of finding the 2nd greatest of 3 columns, this will work:
GREATEST ( LEAST (col1, col2)
, LEAST (col2, col3)
This won't be enough. You have to test both three combinations ab, bc, ca.
See :Scott@my10g SQL>ed
Wrote file afiedt.buf
1 with t as
2 (
3 select 1 a, 2 b, 3c from dual
4 union all select 6,3,9 from dual
5 union all select 6,3,1 from dual
6 union all select 6,17,9 from dual
7 union all select 12,13,9 from dual
8 )
9 select t.*,
10 greatest(least(a,b),least(b,c)) frck,
11 greatest(least(a,b),least(b,c),least(c,a)) secnd
12* from t
Scott@my10g SQL>/
A B C FRCK SECND
1 2 3 2 2
6 3 9 3 6
6 3 1 3 3
6 17 9 9 9
12 13 9 12 12on the second line : testing only 2 would bring wrong result.
[edit]
One other way +(more explicit)+ would be to test all combinations in a case :case
when (b>a and a>c) or (c>a and a>b) then a
when (a>b and b>c) or (c>b and b>a) then b
when (a>c and c>b) or (b>c and c>a) then c
end secndc -
Finding greatest value of date in a table
Hi experts,
I have many dates in an internal table.How to find min and max dates of these.
Is there any FM or i have to write logic.
Please help.
KrishanHi Krishan,
Adding to pavan ans....
SORT itab BY date.
DESCRIBE TABLE itab LINES l_lines. "Get total number of lines in itab.
READ TABLE itab INTO wa INDEX 1 TRANSPORTING date. "Read first entry
Here wa-date have Min date value.
READ TABLE itab INTO wa INDEX l_lines TRANSPORTING date. "Read last entry
Here wa-date Have Max date value.
Thanks,
Vinod. -
Use one value of multi value parameter in dataset query
I have a parameter @Period that is populated with posting periods from our financial system (e.g. 201301, 201302, 201303, etc.). It is set as a multi value parameter to allow users to choose multiple posting periods. This parameter
is used in my main dataset. If the user chooses 201301 and 201302, I want to choose the greatest value chosen and use it in a where clause such that MyPostPeriod <= @Period. Since @Period is a multivalue, the ><= won't work.
I read that SSRS just passes this as a comma separated value (201301,201302). How do I find the greatest value in the list and how do I use that in my where clause?
the user is selecting projects with activity during the posting period but then I want to grab all costs and invoices since the project was created. They choose to see activity in 201301 and 201302 but I need to get all invoices and costs <= 201302.
The only option I have been able to come up with is to have two parameters - one for start period and one for end period. Any better solutions? I'm not using stored procedures.
Milissa HartwellHi Milissa,
Based on your description, you want to get the Maximum value from a multi-value parameter. We can insert the selected values into a temp table and get the Maximum values. Suppose we have main dataset (DataSet1) include Period field, and a parameter Period
in the report. Please refer to the following steps:
Create another dataset named DataSet2 using the query below.
CREATE TABLE #Max (COL1 INT)
INSERT INTO #Max Values(1)
SELECT * FROM #Max
Double click DataSet2, change the dataset using the expression below:
="CREATE TABLE #Max (COL1 INT)" &
"INSERT INTO #Max VALUES (" & Join(Parameters! Period.Value,"),(") &")" &
"SELECT TOP 1 * FROM #Max ORDER BY COL1 DESC"
Create a parameter (Max) set the Data Type to “Integer”, and get the available values and default values from the DataSet2 COL1. Then, set the visibility to “Hidden”.
Double click the DataSet1, click Filters in the left pane. Fill with following values:
Expression: [Period]
Operator: <=
Value: [@Max]
Please refer to the following screenshot:
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
How to determine the "Last Value" in exception aggregation
Hi gurus,
I have a KeyFigure with an exception aggregation -Last value- by time.
I report on a multiprovider ("containing" a infocube and a realtime infocube with BPS-InputLayout). I can correct separate Items with this BPS-Layout. So, at the end I have 2 values for one item.
So, by these facts, my report shows the the last value for the specific KeyFigure, but I expected that both values (the value in the infocube and the correction via BPS)are sumed up.
As this is due to the exception aggregation not the case, I could "overwrite" the normal value in the infocube with the BPS.
But SAP determines the normal value in the Infocube as "Last Value", not the one in the correction cube, which is entered via BPS.
How does SAP determine the "last value" as I can´t see any date...
Thanks in advance!Thank you for your answer...
I got the soltion by myself.
I thought, Last Value means the last Value, depending on the time, but in my opinion the function last value should be called "Greatest Value".
All figures with the same value for the reference characteristc are aggregated anyway. -
Select querry for maximum value
Hi,
I want to select fields A B C D from a database table TAB using some selection criteria from selection screen, but the greatest value of A has to be selected for all unique entries of B C and D. Please suggest an appropriate select querry.
PS: I cannot use SELECT and then DELETE ADJACENT DUPLICATES as it will effect performance in some cases.
Regards.Try using aggregate function MAX with SELECT statement.
MAX Returns the greatest value in the column determined by the database field f for the selected lines. Specifying DISTINCT does not change the result. NULL values are ignored unless all values in a column are NULL values. In this case, the result is NULL .
Have a look at below link:
[Select Clause|http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/select_c.htm]
I hope it helps.
Best Regards,
Vibha
Please mark all the helpful answers -
Ascending order values??
Hi,
I need some small help regarding writing an algorithm. I want to find out maximum array values for given random array.
sample data:
Input :
A[5] = { 3,2,7,4,1}
//here i'm giving random values in an array
output :
1,2,3,4,7
// here i need output like ascending order
if anybody knows ,please help me.
Thank you,
-balaji>
I need some small help regarding writing an
n algorithm. I want to find out maximum array values
for given random array.
If you just want the greatest value in an array, the simplest thing is to loop through it like this (assuming at least one element in the array):
int greatest = a[0];
for (int n = 1; n < a.length; n++) {
if (a[n] > greatest)
greatest = a[n];
sample data:
Input :
A[5] = { 3,2,7,4,1}
//here i'm giving random values in an array
output :
1,2,3,4,7
// here i need output like ascending order
But if you need to output the array in ascending order you will have to sort the array first. You can use the java.util.Arrays.sort() methods for that purpose:
int[] a = {3,2,7,4,1};
java.util.Arrays.sort(a);
for (int n = 0; n < a.length; n++) {
if (n > 0) System.out.print(",");
System.out.print(a[n]);
}Søren -
To measure and hold the peak value of voltage while measuriong using an accelerometer
i would like to measure and hold the peak value of voltage while measuring using an accelerometer,when the voltage goes above certain range . also save highest 5 values.
You could have a shift register on your acquisition loop that is initialized to hold an array of 5 values. Start with all 5 element holding something less than the expected normal input value.
Now each time through the loop, test the new reading to see if it's greater than the minimum value in the 5-element array. If not just go on and repeat the loop.
If the new reading is greater than the minimum value in the 5-element array, append the new reading to the array, sort it in decending order and drop the last element (the old minimum value).
The array will hold the 5 greatest values and the max of the array will be the peak value.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
How to select between sequences on different DB links when one DB is down
Hi!
I'm running Oracle 11.1.0.7.0 on HPUX v3 in a Stream replicated environment.
One of the applications would need to connect to both DBs ensuring some consistency across sequences defined locally.
We cannot use odd/even approach in the sequences so that I thought we may take the greatest value of the two sequences (one on each node).
The SQL would look like:
select greatest(user.SEQ_NUMBER.nextval@DB_B,user.SEQ_NUMBER.nextval@DB_A) from dual;
it works fine but only in a sunny day scenario, i.e. when both nodes are up and running. In case of issues with one of the DBs I would get:
ERROR at line 1:
ORA-12541: TNS:no listener
Is there any way to intercept this error and take the value from the local DB ?
Thanks,
MikeHi Mike,
Maybe something like this would help you:
1 create or replace function f1 return number as
2 lv_stmt varchar2(128);
3 lv_ret number;
4 begin
5 lv_stmt := 'select 1 from dual@dummy_dblnk';
6 execute immediate lv_stmt into lv_ret;
7 exception
8 when others then
9 if sqlcode = -2019 then
10 return -1;
11 else
12 raise;
13 end if;
14* end;
SQL> /
Function created.
SQL> save f1 replace
Wrote file f1.sql
SQL> SELECT f1 FROM dual;
F1
-1Thanks,
Lukasz -
"new selection", restricted key figure and basic key figure
Hi,
I have a test report and i have a basic keyfigure "ZRevenue" and "restricted key figure"(its defined over "ZRevenue") and
a "new selection"(its defined over "ZRevenue").
Now that i have "material number" and "material color" and "request id" in the rows. ("Material color" is a navigational attribute of material number).
In the column level i have a basic key figure "ZRevenue" and "restricted key figure"(its defined over "ZRevenue") and
a "new selection"(its defined over "ZRevenue") .
In a "restricted key figure" or "new selection", we can include a basic key figure or new formula or calculated key figure or an already restricted key figure into it, then we restrict it, with one or more characteristic values. In the report output we get KF values only for those characteristic values, with which it has been restricted. Please correct me if my understanding is wrong.
Initially i restricted the "new selection" (with material number 1 to 3) and "restricted key figure" (with material number 1 to 4).
In the cube i have material numbers 1 to 11. Now all the values were displayed from 1 to 11, but for the
"new selection" (with material number 1 to 3) and "restricted key figure" (with material number 1 to 4) i got values only for 1 to 3 and values for 1 to 4 respectively. This is as expected and is working fine.
Now i tried to restrict the basic keyfigure "ZRevenue" with material number 1, the output was only until the material number 4 (this is the greatest value of the material number defined over the "restricted key figure").
Then i tried to restrict the "new selection" (with material number 1 to 9) , then the output was from 1 to 9 material numbers.
If i remove the restriction over the basic keyfigure "ZRevenue" , then i get all the material numbers from 1 to 11, for "new selection" i get values for the material number 1 to 9 and for "restricted key figure" i get values for the material numbers 1 to 4.
Can some one explain me why this behavior?
Edited by: sapbi enthusiastic on Jan 31, 2012 11:48 AMHi,
This is where set theory comes in handy
So what you have is a basic KF (BKF), a selection (SEL), and an RKF.
When producing an output, BEx seems to be looking for the union of all the restrictions you place on these. So when your BKF is not restricted, the union comes out to everything in the underlying DSO. When you restrict the BKF for material number 1, this is how the restrictions might have been processed internally
BKF: Restriction on material 1
RKF: Restriction on material 1-4
SEL: Restriction on 1-3
Union of these three: 1-4
When you remove the BKF restriction and make SEL restricted to 9, this is how it plays out
BKF: NO Restriction on material
SEL: Restriction on material 1-9
RKF: Restriction on 1-4
Union of these three: everything.
As the union ends up giving you everything, you get 11 records. However, as SEL is restricted for 1-9, the SEL will have values for the materials 1-9. Likewise for RKF, you'll get values only for materials 1-4. Hope this clears things up!
Regards,
Suhas -
Report with "|" Delimited
As per the requirements the report output should be viewed (opened) in Microsoft Excel, the length of the report is too long... so my data in the rows are wrapped to the next line... that makes the report unreadble...
My settings in reports
Layout
Margin Section
Section
Width - 150
Height - 8.5
Orientation- landscape
Horizontal panel per page - 1
Vertical panel per page - 1
Character Mode
Report Width - 240
Report Height - 66
Setting in Oracle Application
Format - Text
Style - Landwide
I tried out the style - BACS, but the report completed with error based onthe above mentioned setting in oracle reports.
Pls do help me out
Regards
YramHi
How long is too long? You are using 240 as widht, son wichever line is longer than that will cause it to wrap. I'm in doubt regarding the report width, as 150 inches would allow for many more characters wide.
If You know how long is the longest line, try this formula to determine the report width by the following:
ceil( characters * 7.65 / 72 )
Modify the width to that number of inches and layout the report to that extent, making fields long enough to allow for the greatest values to be displayed without wrapping.
Then, when defining Oracle Applications concurrent program, specify with accordingly. If BACS is not enough, You may use Dymanic% styles. -
I would firstly like to know the name of that type of table.
ex.
Song name | Artist | Album | Date | Quality | Etc.
select the one you wish to see from least to greatest value, select again to see from greatest to least value.sorttable: Make all your tables sortable
or with jquery
jQuery Table Sort | The Stupid Table Plugin by JoeQuery -
How to read in a file and change the column attributes
Hi,
I'm new to java and i'm stuggling to find a way to read in a text file and perform calculations on the data, such as to normalise it.
What in want to do is normalise the data by finding the greatest value in a column and then divide all the other values in the column with that value.
I know how to read a file in and store each line in a vector but for this problem i think i need to store each column in an array, but i'm not sure how to do this.
Can anyone help please?
ThanksHi,
I'm new to java and i'm stuggling to find a way to
read in a text file and perform calculations on the
data, such as to normalise it.
What in want to do is normalise the data by finding
the greatest value in a column and then divide all
the other values in the column with that value.
I know how to read a file in and store each line in a
vector but for this problem i think i need to store
each column in an array, but i'm not sure how to do
this.
Can anyone help please?
ThanksI think this should work but I wrote it out without completely thinking about it (hopefully to get things started).
So if you had this:
age height earnings
0 2 100
1 3 50
2 1 0
For the age column you'd take 2 as the largest and then divide 0 and 1 by two to get 0, .5.
First build up test files that seperate the columns in different ways. With spaces, tabs, and the ASCI Control character for null ( I think it's 0 ). Your program should detect
numbers and spaces, tabs control character, commas and periods (for money). Because numbers don't have spaces it should be easy to keep track of which column
you're in.
Store each line into a 3D String array with each index containing a String built up from the chars scanned in on each line, when a blank area is found followed by another
number iterate the column index. When you come to the end of the line set column == 0 and row+1.
private String[][][] test = new String[2][6][1];
20 3 11 14 44 0
4 5 7 80 91 49
test[0][0][0] would be row 1 col 1 value 1 ((20))
test[0][1][0] would be r1, c2, v1 ((3))
test[1][0][0] would be r2, c1, v1 ((4))
test[1][2][0] would be r2, c3, v1 ((7))
test[1][5][0] would be r2, c6, v1 ((49))
package source.Final;
import javax.swing.*;
import java.io.*;
public class S7
public static void main(String[] args)
getContents();
System.exit(0);
public static void getContents()
String lineSep = System.getProperty("line.separator");
char c = ' ';
int iterator = 0;
int i = 0;
int charNum = 1;
int lineCount = 1;
//declared here only to make visible to finally clause
BufferedReader input = null;
BufferedWriter out = null;
try {
String line = null;
* This implementation reads / writes one line at a time
* using the buffered reader / writer Java classes.
input = new BufferedReader( new FileReader( "C:\\Scan file test\\Read\\test1.txt" ));
out = new BufferedWriter( new FileWriter( "C:\\Scan file test\\Read\\test2.txt" ));
//input = new BufferedReader( new FileReader( "C:\\Scan file test\\Read\\booked_policies1.txt" ));
//out = new BufferedWriter( new FileWriter( "C:\\Scan file test\\Write\\booked_policies1.txt" ));
//input = new BufferedReader( new FileReader( "C:\\Scan file test\\Read\\booked_policies2.txt" ));
//out = new BufferedWriter( new FileWriter( "C:\\Scan file test\\Write\\booked_policies2.txt" ));
//input = new BufferedReader( new FileReader( "C:\\Scan file test\\Read\\booked_policies3.txt" ));
//out = new BufferedWriter( new FileWriter( "C:\\Scan file test\\Write\\booked_policies3.txt" ));
out.write( "Character\tLine Number\tCharacter Number\tAscii Value" + lineSep );
while (( line = input.readLine()) != null)
i = 0;
charNum = 1;
iterator = 0;
while( i < line.length() )
c = line.charAt(iterator);
if( (int)c == 0 || (int)c == 9 )
break;
else if( c >= '[' && c <= '_')
{out.write( "["+c+"]\t\t"+"["+lineCount+"]\t\t"+"["+charNum+"]\t\t\t"+"["+(int)(c)+"]"+lineSep );}
else if( c < ' ' )// && (int)c != 0 && (int)c != 9 )
{out.write( "["+c+"]\t\t"+"["+lineCount+"]\t\t"+"["+charNum+"]\t\t\t"+"["+(int)(c)+"]"+lineSep );}
else if( c > ';' && c <= '@' && c != '=')
{out.write( "["+c+"]\t\t"+"["+lineCount+"]\t\t"+"["+charNum+"]\t\t\t"+"["+(int)(c)+"]"+lineSep );}
else if( c >= '!' && c < '"' )
{out.write( "["+c+"]\t\t"+"["+lineCount+"]\t\t"+"["+charNum+"]\t\t\t"+"["+(int)(c)+"]"+lineSep );}
else if( c > 'z' && c < '~' )
{out.write( "["+c+"]\t\t"+"["+lineCount+"]\t\t"+"["+charNum+"]\t\t\t"+"["+(int)(c)+"]"+lineSep );}
else if( c == '%' )
{out.write( "["+c+"]\t\t"+"["+lineCount+"]\t\t"+"["+charNum+"]\t\t\t"+"["+(int)(c)+"]"+lineSep );}
else if( c > '~' )
{out.write( "["+c+"]\t\t"+"["+lineCount+"]\t\t"+"["+charNum+"]\t\t\t"+"["+(int)(c)+"]"+lineSep );}
charNum += 1;
iterator += 1;
i++;
lineCount += 1;
catch (FileNotFoundException ex) {ex.printStackTrace(); System.out.println("File not found.");}
catch (IOException ex){ex.printStackTrace(); System.out.println("IO Error.");}
finally{ try{ if( input != null ) input.close(); if( out != null ) out.close();}
catch (IOException ex){ex.printStackTrace(); System.out.println("IO Error #2.");}
} -
Pricing Conditions Rounding Issue
Currently, our system has two pricing condition types. ZP,ZD. The ZP conditions represent a base price and the ZD represent a differential(- discount or + surcharge). Both are based on the same hierarchy. ZP00,ZP01,ZP02.ZP03,ZP04. A ZP01 overrides a ZP00 and ZP03 overrides ZP00, ZP01,ZP02 and so on and so forth. All transactions are settled in USD. However, most of the time the ZP, ZDs are based on prices that extend out more than two decimal places. I am experiencing and issue because SAP calculates the ZP and ZD separately and is rounding each. For example the ZP or base price in this case is $2.245. This times quantity of 3,999Gal = $8,977.755. SAP rounds this to $8,977.76. SAP then calcs. the differential ZD $.0235X3,999Gal = $93.9765. SAP rounds to $93.98. This is a total price of $8,977.76+$93.98 =$9,071.74. However the unit price is ZP $2.245 + ZD $0.0235 = $2.2685. If you take this price multiplied by the quantity $2.2685 X 3,999Gal = $9,071.7315. So the actual total price is off by 1ct because SAP treats the ZP and ZD as two separate calculations. I have seen various ideas on how to fix, from creating another pricing condition, to user exits. I was wondering if there was a preferred method? Or if there is a simpler solution?
Good Evening,
1. Please review OSS NOTE 80183 regarding Rounding.
Values calculated in pricing are always rounded to the amount of
decimal places which the used document currency owns. As subsequent
processing steps setup on this rounded value rounding differences can
occur in the calculation of the price per unit or in subtotal line.
To bypass such effects note 80183 describes possible solutions to
reduce / bypass this effect.
A few problems in rounding after applying note 80183, variant 2 have
been recorded where it was recommended to use the formulas 919 and
920 on all discounts and surcharges that appear before NETP and the
problem was solved.
2. In transaction V/06 there is a field under header 'Control data1'
which can effect how the system rounds off condition values during
pricing:
->> Rounding rule
The rule that determines how the system rounds off condition
values during pricing. The last digit will be rounded.
Example
o In the standard rounding rule '_', values are rounded off according
to business standards:
10.454 -> 10.45 DEM
10.455 -> 10.46 DEM
o In rounding rule 'A', values are always rounded up:
10.459 -> 10.46 DEM
10.451 -> 10.46 DEM
o In rounding rule 'B', values are always rounded down:
1045.9 -> 1045 LIT
1045.1 -> 1045 LIT
In this example, the currency of the condition rate is Italian Lira.
The Italian Lira does not have any places after the point.
3. Also check if the condition type is set as item condition as well
as group condition in transaction V/06. What this means is that
the system will calculate the value of the condition on header level
and compares it with the sum of item values in the document.
Any rounding difference (KONV-KDIFF) detected, will be populated
in the line item with greatest value or in first line item if all are
of equal value.
In other cases where there is no adjustment because there is no
rounding difference when comparing the header value and the sum of
item values.
->> Solution to this scenario -
If you remove the 'group condition' setting, the system will then
calculate amount for the items directly and you will not get the
rounding. You must decide which setting is more suited for your
business. This is not a bug, but works as per designed.
EXAMPLE: MWST - tax condition (a group condition)
Item 10 16% of 100.90 = 16.14
Item 20 16% of 100.90 = 16.14
Total = 32.28
I hope this helps you!
Kind Regards,
Martina McElwain
SD Forum Moderator
Maybe you are looking for
-
Vendor Scorecard Performance Report
The Vendor Scorecard Performance Report data is based on dates entered in the PO (dates provided by the vendor to us at the time we cut the PO or even months after the PO is cut-this date can change) as opposed to our expected lead time (lead time pr
-
Hi, I've just downloaded the trial version of Adobe Muse CC to my desktop. I'm using Windows 7. When trying to launch the app, I get asked to uninstall and reinstall Adobe Muse which i have done but still receive an Error:5. How can i fix this?
-
Pproheadless.exe has encountered an error and needs to close
System Details Windows XP 32 Bit OS HPxw4600 Workstation Intel 2 Core Duo , 3.00 GHZ processor 4 GB Ram Premier Pro CS4 4.1.0 All Updates Installed, English Version 218 GB HD, 37.8 GB Free, NTFS File System When trying to encode large (15 min & Large
-
in the midst of photo shoot yesterday, this vertical line pattern appeared in every photo and can't get rid of it. Triple checked all my settings, nothing's changed about how I take my photos. Through the viewfinder when I prefocus I see the result
-
Suddenly renames files edited with external editor
Not sure what I have done but now when I "edit file with..." (Photoshop CS5) using Aperture3 the version name is changed in Aperture. Looking in PShop it is dislapying the correct masterfile name but on return to Aperture3 it is changing the version