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

Comparting Entries

Former Member
0 Likes
543

Hi,

In development we have a z table with 50 entries and in testing environment the same table contains 55 entries.

My question is, how can i compare the same table in two different environments and see what new entries are added in testing environment?

Thanks.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
492

Here is an example program showing how you can get the data from the other system. It will come back as comma delimited, you can simply loop this IDATA talble and SPLIT the line into the specific fields.



REPORT zrich_0001.

DATA: idfies TYPE TABLE OF dfies WITH HEADER LINE.
DATA: iopt TYPE TABLE OF rfc_db_opt WITH HEADER LINE.
DATA: ifld TYPE TABLE OF rfc_db_fld WITH HEADER LINE.
DATA: idat TYPE TABLE OF tab512 WITH HEADER LINE.

PARAMETERS: p_table TYPE   ddobjname.


CALL FUNCTION 'DDIF_NAMETAB_GET'
  EXPORTING
    tabname   = p_table
  TABLES
    dfies_tab = idfies
  EXCEPTIONS
    not_found = 1
    OTHERS    = 2.

LOOP AT idfies.
  ifld-fieldname = idfies-fieldname.
  APPEND ifld.
ENDLOOP.

CALL FUNCTION 'RFC_READ_TABLE'
     DESTINATION 'TST'       "<- Your RFC Destination to Test system
  EXPORTING
    query_table                = p_table
    delimiter                  = ','
*   NO_DATA                    = ' '
*   ROWSKIPS                   = 0
*   ROWCOUNT                   = 0
  TABLES
    OPTIONS                    = iopt
    fields                     = ifld
    data                       = idat
 EXCEPTIONS
   table_not_available        = 1
   table_without_data         = 2
   option_not_valid           = 3
   field_not_valid            = 4
   not_authorized             = 5
   data_buffer_exceeded       = 6
   OTHERS                     = 7.

LOOP AT idat.
  WRITE:/ idat.
ENDLOOP.

Regards,

Rich Heilman

Hi,

In development we have a z table with 50 entries and in testing environment the same table contains 55 entries.

My question is, how can i compare the same table in two different environments and see what new entries are added in testing environment?

Thanks.

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
492

Well, since there are only 50 or so, you can dump both tables to excel sheet, sort them and compare. If you would like to do this programatticaly, then you will need to create an RFC function module to retrieve the data and bring it back. Or you can use the RFC function module RFC_READ_TABLE to get the data. Once you have the data from the target system, you can compare it against the data in your dev system using simply internal table comparison routines.

Regards,

Rich Heilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
493

Here is an example program showing how you can get the data from the other system. It will come back as comma delimited, you can simply loop this IDATA talble and SPLIT the line into the specific fields.



REPORT zrich_0001.

DATA: idfies TYPE TABLE OF dfies WITH HEADER LINE.
DATA: iopt TYPE TABLE OF rfc_db_opt WITH HEADER LINE.
DATA: ifld TYPE TABLE OF rfc_db_fld WITH HEADER LINE.
DATA: idat TYPE TABLE OF tab512 WITH HEADER LINE.

PARAMETERS: p_table TYPE   ddobjname.


CALL FUNCTION 'DDIF_NAMETAB_GET'
  EXPORTING
    tabname   = p_table
  TABLES
    dfies_tab = idfies
  EXCEPTIONS
    not_found = 1
    OTHERS    = 2.

LOOP AT idfies.
  ifld-fieldname = idfies-fieldname.
  APPEND ifld.
ENDLOOP.

CALL FUNCTION 'RFC_READ_TABLE'
     DESTINATION 'TST'       "<- Your RFC Destination to Test system
  EXPORTING
    query_table                = p_table
    delimiter                  = ','
*   NO_DATA                    = ' '
*   ROWSKIPS                   = 0
*   ROWCOUNT                   = 0
  TABLES
    OPTIONS                    = iopt
    fields                     = ifld
    data                       = idat
 EXCEPTIONS
   table_not_available        = 1
   table_without_data         = 2
   option_not_valid           = 3
   field_not_valid            = 4
   not_authorized             = 5
   data_buffer_exceeded       = 6
   OTHERS                     = 7.

LOOP AT idat.
  WRITE:/ idat.
ENDLOOP.

Regards,

Rich Heilman

Read only

0 Likes
492

Thanks Rich. I did award the points.