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

Compare two tables

UmaArjunan
Active Participant
0 Likes
17,203

Plz let me know if there is any transaction to compare the fields used in two tables or anyother way to do the same.

just to check the guid and partner id

Like we used to compare two programs in the same screen using SE 39

1 ACCEPTED SOLUTION
Read only

lucdealethea
Participant
9,705

DDIC tables and views:

Goto SE16 using view DD03VV and specify the two tables you want to compare in selection field TABNAME, then sort by FIELDNAME.

9 REPLIES 9
Read only

Former Member
0 Likes
9,705

Try the FM

CATSXT_COMPARE_STRUCTURES

CTVB_COMPARE_TABLES

Read only

Former Member
0 Likes
9,705

Hi,

We can have one choice that we can compare the contents in 2 internal tables using FM 'CTVB_COMPARE_TABLES'. Just extract the data from those 2 tables and use this function module this will return three internal tables with deleted entries, new entries and modified intries in new table.

Rgds,

Bujji

Read only

Former Member
0 Likes
9,705

Hi

Try T-Code SCMP or you can go into the specific table you want to compare (SM31) and select "Utilities" then "Comparison"

Thanks

Vasudha

Edited by: Vasudha L on Feb 14, 2008 11:15 AM

Read only

kiran_k8
Active Contributor
0 Likes
9,705

Uma,

IF it_1[] = it_2[]. " Tables contents are the same

ELSE.

" Tables contents are different

ENDIF.

If they have different structure, loop one of the tables, and then read the other in the loop, then compare field by field.

Or if you don't need the contents (just comparing) you can do like this, for example:

LOOP AT it_1 INTO wa_1.

READ TABLE it_2 WITH KEY field2 = wa_1-field2

field5 = wa_1-field5

TRANSPORTING NO FIELDS.

IF sy-subrc = 0.

Records are in both the tables (field2 and field5 are the fields which are common in both tables).

ENDIF.

ENDLOOP.

K.Kiran.

Read only

UmaArjunan
Active Participant
0 Likes
9,705

friends,

when i try to execute the FM CTVB_COMPARE_TABLES . i got the following error message.

I want to compare the fields used in two differeent tables..

and not the contents.

Thanks for all ur answers.

Error generating the test frame

Message no. FL819

Diagnosis

The system could not generate a syntactically correct test frame for function module CTVB_COMPARE_TABLES. You therefore cannot test the function module using the test environment. You have probably used an ABAP feature in the interface definition that is not yet supported in the test environment.

The error message is:

"ANY TABLE" expected, not "STANDARD TABLE".

System Response

Procedure

Check whether you can change the interface of the function module so that it is possible to generate the test frame. If this is not possible,you will have to write your own utility for testing the function module.

Procedure for System Administration

Read only

Former Member
0 Likes
9,705

Sorry,

I have the problem with function "CTVB_COMPARE_TABLES" that when I have "STRING"-Fields in my table, then it produce a shortdump ASSIGN_CASTING_ILLEGAL_CAST in include LBUSSF00.

(line 95)

**....Prepare key for selection.........................................

<b> **assign <lfs_table_old> to <lfs_table_x> casting. "UNICODE!**</b>

assign <lfs_table_x>(key_length) to <lfs_table_key> casting.

**....Select corresponding record in new table if it is changed.........

WHAT CAN I DO?

Read only

lucdealethea
Participant
9,706

DDIC tables and views:

Goto SE16 using view DD03VV and specify the two tables you want to compare in selection field TABNAME, then sort by FIELDNAME.

Read only

9,705

You have answered a 12 years old question

Read only

9,705

Thanks Luc, your answer on 12 years old question was helpful to me.