Skip to Content

Compare two tables

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 14, 2008 at 10:10 AM

    Try the FM

    CATSXT_COMPARE_STRUCTURES

    CTVB_COMPARE_TABLES

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 14, 2008 at 10:12 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 14, 2008 at 10:14 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 14, 2008 at 10:18 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 14, 2008 at 12:25 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 08:58 AM

    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?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 07 at 12:09 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.