Compares two tables S780 and S720 by material , Print the Difference value
Hi abapers,
Report which compares the two tables S780 and S720 by material
the Statistic currency value of these two tables if show the differences
the report should display only Diffrece value:
The selection should be by
Revenue country, Salesorganisation , month and version
output like this
Material Value S720 / Value S780 / currency difference should be print out.
Regards
Raj
Hi
Use join or for all entries
then move the records into a final table
loop at itab
then get the difference.
modify the itab by transporting the difference.
Regards
Shiva
Similar Messages
-
I attempted to compare two strings whether they are equal or not. They should return true if both are equal.
One string is based on Taxonomy's Term (i.e. Term.Name) whereas other string is based on String object.
The problem is that both strings which seem equal return false instead of true. Both string values have different special characters though their special characters are & and &
Snapshot of different design & same symbols:
Is it due to different culture or language?
How to compare two strings whether both are equal while ignoring the difference in special characters (& vs &)?Hi Jerioon,
If you have a list of possible ambiguous characters the job is going to be easy and if (& vs &) are the only charracters in concern awesome.
You can use the below solution.
Before comparing pass the variables through a replace function to standarize the char set.
$Var = Replace($Var,"&","&")
This is going to make sure you don't end up with ambiguous characters failing the comparison and all the char are "&" in this case.
Similar technique is used to ignore Character Cases 'a' vs. 'A'
Regards,
Satyajit
Please “Vote As Helpful”
if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you. -
To recover data of two tables ORACLE and to create IDOC Finsta
Hello expert:
I have the following scene:
SAPR/3 <----
XI <----
ORACLE
(To process Idoc) (CREAR IDOC PAYEXT) (Table: Header and Table: Detail).
i need to recover the information of ORACLE of two tables (Headed and it details), to take the data to XI
and to create the IDOC(PAYEXT), finally to give it to SAPR/3.
my problems are two:
Not like recovering the information of the two tables at the same time related by the field key.
In addition I need to create in IDOC (Finsta) to SAPR/3.
I hope that they can help me
thanks
Raúl.Help me please!
Example one:
select H.ID_TRANSAC H.FEC_PAGO H.HOR_PAGO D.NUM_REFERENCIA D.IMPTE_PAGO
FROM PPQ_PAGO_CENTRA_H AS H INNER JOIN PPQ_PAGO_CENTRA_d AS D ON H.ID_TRANSAC = D.ID_TRANSAC where H.ID_TRANSAC = '5686496'
Example two:
SELECT PPQ_PAGO_CENTRA_H.ID_TRANSAC PPQ_PAGO_CENTRA_H.FEC_PAGO PPQ_PAGO_CENTRA_D.ID_TRANSAC PPQ_PAGO_CENTRA_D.NUM_REFERENCIA
FROM PPQ_PAGO_CENTRA_H INNER JOIN PPQ_PAGO_CENTRA_d ON PPQ_PAGO_CENTRA_H.ID_TRANSAC = PPQ_PAGO_CENTRA_D.ID_TRANSAC
WHERE PPQ_PAGO_CENTRA_H.ID_TRANSAC = '5686496'
It gives errors me of the two forms. You help me with an example of the Join? -
I need a report that will join two tables BKPF and VBRK in QuickViewer. The only field with the right character length is XBLNR but when creating the join no records are dispalyed beacuse the values of this field in both tables are not the same.
There are also other fields available in BKPF but the char length is not the appropriate.
Does anyone have any idea how I can link these two tables?
Thank youNeither of these combinations is possible with QuickViewer because the fields need to have the same length of characters in order to create the join.
VBRK - VBLEN char(10) and BKPF - AWKEY char(20)
VBRK -ZUONR char(18) BKPF- BELNR char (10)
Any other idea?
Thank you, JP -
Compare two tables and log the difference
Hi,
I want to compare two tables and log the difference in new table with the fields as (old value,new value, column name). The column name should be the changes value columnCan you show an example?
SELECT Foo.*, Bar.*
FROM Foo
FULL OUTER JOIN
Bar
ON Foo.c1 = Bar.c1
AND Foo.c2 = Bar.c2
AND Foo.cn = Bar.cn
WHERE Foo.key IS NULL
OR Bar.key IS NULL;
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Comparing Two tables with 300k records and update one table
Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
Column B has same data in both the tables.
I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
I m trying to do using PLSQL Tables.
Any suggestion?
Thanks.Hi,
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
If you're asking about a DML statement, such as UPDATE, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results will be the contents of the changed table(s) when everything is finished.
Always say which version of Oracle you're using (for example, 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002
ef2019c7-080c-4475-9cf4-2cf1b1057a41 wrote:
Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
Column B has same data in both the tables.
I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
I m trying to do using PLSQL Tables.
Any suggestion?
Thanks.
Why are you trying to use PL/SQL tables? If tabl_1 and tabl_2 are regular database tables, it will be much simpler and faster just to use them.
Depending on your requirements, you can do an UPDATE or MERGE, either in SQL or in PL/SQL. -
Comparing two tables and picking the records
I have two tables A and B. I have to compare a column ID in both table A and table B A.ID=B.ID And based on the above comparison if the match is found I need to pick the records from table A and if no match then need to pick the records from table B My problem is if I join then I will have table A and table B as one record and will be difficult to separate out. Please let me know how this can be acheived. Thnx.
I have two tables A and B. I have to compare a column ID in both table A and table B A.ID=B.ID And based on the above comparison if the match is found I need to pick the records from table A and if no match then need to pick the records from table B My problem is if I join then I will have table A and table B as one record and will be difficult to separate out. Please let me know how this can be acheived. Thnx.
-
BUG? BRIDGE statement to compare two tables
Hello,
I tried to compare two tables in different dbs and remembered a post about Cross Connectin Queries
http://barrymcgillin.blogspot.com/2010/11/cross-connection-queries.html
BRIDGE temparb AS "EB05 01"
(SELECT * FROM arb)
(SELECT * FROM temparb
MINUS
SELECT * FROM arb
UNION ALL
(SELECT * FROM arb
MINUS
SELECT * FROM temparb
);I would expect to get the differences between the table arb in my current schema and the table arb alias temparb in the other db. Yet it seems, that in this case only the table in my current schema is read.
I materialize the BRIDGE table with
BRIDGE temparb AS "EB05 01"
(SELECT * FROM arb)and select the value I know to be only in the remote schema
SELECT id FROM temparb WHERE id = 2562;
SELECT id FROM arb WHERE id = 2562;Both times I get no result. I even tried to use aliases on the table, same result. Tested in 3.0 and 3.1 EA3.
Has anyone tried this before?
Regards
MarcusHi Marcus,
Have you tried it without the double quotes around the connection name?
I have a connection called
system_local
which I run the following command in
drop table testbridge_remote;
drop table testdbrige;
create table testbridge(col1 int);
insert into testbridge values (1);
insert into testbridge values (2);
insert into testbridge values (3);
commit;
I have a connection called
Connection Name With Space
which I run the following in
drop table testdbrige;
create table testbridge(col1 int);
insert into testbridge values (4);
insert into testbridge values (5);
insert into testbridge values (3);
commit;
Then in the system_local connection/worksheet I can run the following statement
BRIDGE testbridge_remote as Connection Name With Space(select * from testbridge)
+(SELECT * FROM testbridge_remote+
MINUS
SELECT * FROM testbridge
+)+
UNION ALL
+(SELECT * FROM testbridge+
MINUS
SELECT * FROM testbridge_remote
+);+
It works ok.
Returning rows in the remote table not in the local table , and rows in the local table not in the remote table .
Regards,
Dermot
SQL Developer Team. -
hi all,
i am using db10g.
my task is to compare two table's data for example
table1 is having
col1 col2 col3
a b c
e f g
table2 is
col4 col5 col6
a e c
e f g
so i have to compare col1 first record and col4 first record.
in otherwords first table first column first item with second table first table first value and so on.
for ex: a= a
b= e
c= c etc
how can i acheive this?
both are database tables.
i cannot use minus function because data types are different for the corresponding column
how can i compare it?
Thanks..
Edited by: user13329002 on Jan 13, 2011 1:09 AMHi,
Try this
select
case
when a.col1 = b.col1 then 'EQUAL' else 'NOT EQUAL' end column1,
case
when a.col2 = b.col2 then 'EQUAL' else 'NOT EQUAL' end column2,
case
when a.col3 = b.col3 then 'EQUAL' else 'NOT EQUAL' end column3
from (select col1,col2,col3,rownum rn from table1) a,
(select col1,col2,col3,rownum rn from table2) b where a.rn = b.rn Try to see how you order the rows of the two tables.
cheers
VT -
how to compare two tables between two systems ?
hi sravan, u can go to t/c OY19 to compare the two tables.
Choose Manual selection
Enter the name of the table that you want to compare
Choose Execute
in the next screen you have to give the description and RFC connection name which will make the link between two clients.
Regards...
Arun.
Reward points if useful. -
How to compare two tables in SSIS?
I am creating an SSIS package that will compare two tables and then insert data in another table.
Which tool shall I use for that? I tried to use "Conditional Split" but it looks like it only takes one table as input and not two.
These are my tables:
TABLE1
ID
Status
TABLE2
ID
Status
TABLE3
ID
STatus
I want to compare STATUS field in both tables. If Status in TABLE1 is "Pending" and in TABLE2 is "Open" then insert this record in TABLE3.You can use MERGE command , Sorry cannot test it right now.
MERGE INTO tbl3
USING (SELECT tbl2.ID, tbl2.status,tbl1.status as st1 FROM tbl1 JOIN tbl2 ON tbl1.ID=tbl2.ID) AS t ON T.ID=tbl3.ID
AND t.status='OPEN' AND t.st1='pending'
WHEN NOT MATCHED
INSERT (status) VALUES (t.status)
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to compare two tables data...need sql report or utility to find differe
Hi,
We have a requirement where we are asked to find data differences between two tables and one of the tables reside on remote database. The database version is same ( 10g ) and datatypes for the tables are similar.
The client is looking for a sql report or kind of utility to display the data differences for each column ( if possible count differences ) with some meaningful error messages.
Could anyone let me know the best possible way of doing it..?
Thanks
HitarthHi,
I found something for tables comparison but getting one error...can you check this please and let me know what is wrong
Here is the function:
CREATE OR REPLACE FUNCTION compare_query_results (
p_query1 IN VARCHAR2
, p_query2 IN VARCHAR2
, p_raise_error_if_not_equal IN BOOLEAN DEFAULT FALSE
, p_raise_error_if_no_rows IN BOOLEAN DEFAULT FALSE
RETURN NUMBER
IS
-- Constants
c_query_results_equal CONSTANT PLS_INTEGER := 0;
c_query_results_not_equal CONSTANT PLS_INTEGER := 1;
oracr CONSTANT VARCHAR2 (1) := CHR (10);
-- Variable Declaration
v_sql_stmt VARCHAR2 (32767);
v_record_count PLS_INTEGER;
v_return_code PLS_INTEGER;
v_record DUAL.dummy%TYPE;
v_result_set_has_rows BOOLEAN;
-- Ref Cursors
v_cursor sys_refcursor;
-- Custom Defined-Exceptions
result_sets_do_not_match EXCEPTION;
query_returns_no_rows EXCEPTION;
BEGIN
-- Get the count of differing records between p_query1 and p_query2
dbms_output.put_line('Start-1');
v_sql_stmt :=
' (SELECT /*+ materialize */'
|| SUBSTR (p_query1, INSTR (UPPER (p_query1)
, 'SELECT'
, 1
, 1
) + 6)
|| ')
, (SELECT /*+ materialize */'
|| SUBSTR (p_query2, INSTR (UPPER (p_query2)
, 'SELECT'
, 1
, 1
) + 6)
|| ')
SELECT ''X''
FROM (
(SELECT * FROM test1 MINUS SELECT * FROM test2)
UNION ALL
(SELECT * FROM test2 MINUS SELECT * FROM test1)
dbms_output.put_line('Start-2');
OPEN v_cursor
FOR v_sql_stmt;
dbms_output.put_line('Start-3');
FETCH v_cursor
INTO v_record;
dbms_output.put_line('Start-4');
v_result_set_has_rows := v_cursor%FOUND;
dbms_output.put_line('Start-5');
CLOSE v_cursor;
dbms_output.put_line('Start-6');
-- If there are rows - the result sets do NOT match...
IF v_result_set_has_rows
THEN
v_return_code := c_query_results_not_equal;
IF p_raise_error_if_not_equal
THEN
RAISE result_sets_do_not_match;
END IF;
-- If there are no rows - the result sets do match...
ELSIF NOT v_result_set_has_rows
THEN
IF p_raise_error_if_no_rows
THEN
-- Check to make sure that the queries contain rows if desired...
v_sql_stmt := 'SELECT ''X''
FROM (' || oracr || p_query1 || oracr || ')';
OPEN v_cursor
FOR v_sql_stmt;
FETCH v_cursor
INTO v_record;
IF v_cursor%NOTFOUND
THEN
CLOSE v_cursor;
RAISE query_returns_no_rows;
END IF;
CLOSE v_cursor;
END IF;
v_return_code := c_query_results_equal;
END IF;
RETURN v_return_code;
EXCEPTION
WHEN result_sets_do_not_match
THEN
raise_application_error (-20101, 'The Queries'' result sets do NOT match. Error returned
as requested.');
WHEN query_returns_no_rows
THEN
raise_application_error (-20102, 'The Queries'' result sets match, however they contain no
rows. Error returned as requested.');
WHEN OTHERS
THEN
-- Raise the error
raise_application_error (-20103
, 'There is a syntax or semantical error in one or both queries
preventing comparison.'
|| oracr
|| 'Error Stack :'
|| oracr
|| DBMS_UTILITY.format_error_stack ()
|| oracr
|| 'Error_Backtrace:'
|| oracr
|| DBMS_UTILITY.format_error_backtrace ());
END compare_query_results;
I have created two tables ( test1 and test2 ) with few columns and with the same datatypes and executed the above function...I am getting error as folliowing:
DECLARE
ERROR at line 1:
ORA-20103: There is a syntax or semantical error in one or both queries
preventing comparison.
Error Stack :
ORA-00900: invalid SQL statement
Error_Backtrace:
ORA-06512: at "ORAOWNER.COMPARE_QUERY_RESULTS", line 53
ORA-06512: at "ORAOWNER.COMPARE_QUERY_RESULTS", line 121
ORA-06512: at line 12
Could someone please help me fixing this error..It would be really appreciated
Thanks
Hitarth -
Joining two tables LIKP and VBUK
HI,
I want to join two tables LIKP and VBUK, can u give some explaination ?
points will be given for good answers...
regards
VijayaHi,
see this example of joining two tables zairln & zflight.
These 2 tables are logically joined by the airln field.
Select a~airln
a~lnnam
b~fligh
b~cntry
Into table int_airdet
From zairln as a inner join zflight as b on aairln = bairln.
In order to restrict the data as per the selection criteria, a where clause can be added to the above inner join.
rgds,
latheesh
Message was edited by: Latheesh Kaduthara -
Compare two .txt files and show result
HI
Could anybody show me how to compare two text files and show the result.
i.e.
textfile1.txt
harry.denmark
karry.sweden
textfile2.txt
harry.denmark
karry.sweden
marry.usa
Compare
result=
marry.usa
The text files I want to compare are how ever much larger than this example. (up to 2-3.000 words)
anybody ??
Sincerly
PederHI & thanks for reply
I know almost nothing about java so could you or anybody please show me the code to do this? Or is it perhaps too large or difficult a code?
I know how to compile a .java file and run it in prompt :-) and thats about it (almost)
I offcourse understand if its too much to ask for :-) -
Two tables KUWEV and KUAGV joining
Hi all,
I have two tables KUWEV and KUAGV
The following field I have taken from two tables
KUWEV u2013VABED
KUWEV- LLAND
KUAGV-LAND1
If KUWEV u2013VABED =TRLOZ - VABED
and KUWEV- LLAND = TRLOZ - LLAND
and KUAGV-LAND1 = TRLOZ - LAND1
then only I have to pickup TRLOZ- ROUTE
after that i have to Substitute the value in VBAP-ROUTE
can anybody help to write the code
I have doubt that how can data we will pick up 2 fields from one table 1 field from another table and two tables (KUWEV and KUAGV) having common field KUNNR
Pointes will be rewarded by useful information
Thanks in advance
krishnaHi KCH,
either use joins or write separate select statements.
Hope it helps.
Aditya
Maybe you are looking for
-
Fields For Good Reciept and Issed !
Hi all, I want the fields for the goods reciept and good issued for getting the stock for a particular material as on to date (which is my selection screen) ... I have selected the sales data from the VBRK and VBRP tables which is for sales informati
-
Can't update my iPod. Software download keeps on timing out. how do i fix this?
i tried to download the software update for my ipod touch & when it's about finished, it says "the connection timed out." i already have the new version of iTunes. how can i fix this that way i can download the update for my device, please help?..
-
How come i keep getting a network error when trying to register my ipad for imessage?
I am trying to register my new ipad to imessage, when i click on message it says to enter my apple id to autherize this ipad, so i do.... then it sits there for about 30-45 seconds and comes back with a pop up apple error saying "imessage activation
-
New Services Taking forever to be connected
BT's disgustingly poor level of service - worse than a 3rd world country's debt. Constant lack of any level of professionalism or ability to provide the service that we as customers pay for. This has been since day 1 and we have been with BT now for
-
How to select freehand in CS6?
Hi, I am looking for a way to select areas in my picture completely freehand (i.e. by painting over them with a paintbrush), similar to how the quick selection tool works, but I don't want the program to select anything but what I paint over. The qui