Application Development 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: 

Comparing files on Application Server

Former Member
0 Kudos

Hi experts,

I've a requirement, i have to compare two files of application server and should get a new file. Compare file1 with file2 and get records which were excess in file2.

Please help.......

with regards,

jay

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Read the first file using OPEN DATASET into an ITAB.

Read the second file using OPEN DATASET into an ITAB1.

loop at ITAB1.

read table ITAB ...

if sy-subrc <> 0.

move the different records to a third internal table. ITAB2

endif.

endloop.

Move the ITAB2 records into a third file using TRANSFER ..

hope this serves you.

reward points if useful

regards,

ANJI

3 REPLIES 3

Former Member
0 Kudos

Hi,

Read the first file using OPEN DATASET into an ITAB.

Read the second file using OPEN DATASET into an ITAB1.

loop at ITAB1.

read table ITAB ...

if sy-subrc <> 0.

move the different records to a third internal table. ITAB2

endif.

endloop.

Move the ITAB2 records into a third file using TRANSFER ..

hope this serves you.

reward points if useful

regards,

ANJI

Former Member
0 Kudos

Hi Jaya

here is an alternative to coding an ABAP program - there is a tool called Compare It that I have used. It can compare fairly large files quickly (>10MB) and the latest version has reporting. It runs on a PC so the user running it will need access to the app server in order to run the comparison. You will have to check the website for pricing but I think it is cheap: <b>http://www.grigsoft.com/wincmp.htm</b>

or

The fastest file compare is definitely at the operating system level. However, you need to have some shell scripting experience to write such a program. Once you have the shell ready, you can execute it inside an ABAP program as an external command (defined in SM69)with 'SXPG_EXECUTE_COMMAND' function.

Another option is using "open dataset in text mode" to load file into an internal table and then comparing it with .

If it helps reward with points

Regards rk

Former Member
0 Kudos

Jus give me 2 mins I will send you the code for comparing the filed from application server...

Ihave done a program in comparing both the Unix file and also PC files

But make sure That you reward full ponts to teh correct answers