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: 

How can I compare two separate programs?

pokrakam
Active Contributor

Hello,

How can I compare two different reports or classes in Eclipse?

It's easy to compare a single report's version history or with a copy in another system, but the option to compare ZREPORT1 and ZREPORT2 is somehow not available or hidden.

Am I missing something obvious? I couldn't even find anyone else asking this question...

Regards,

Mike

1 ACCEPTED SOLUTION

ChrisSolomon
Active Contributor

Isn't there an Eclipse plug-in for comparison of two files?!?!

Also found this...

http://stackoverflow.com/questions/4623564/how-do-i-compare-two-files-using-eclipse-is-there-any-opt...

15 REPLIES 15

gregorw
Active Contributor
0 Kudos

HI Mike,

I haven't tried in Eclipse but exporting with SAPlink or abapGit and comparing then using a diff tool should work quite nicely.

Best regards

Gregor

pokrakam
Active Contributor

Hi Gregor,

Thanks, but if I'm going to go that route then surely a simpler hack is to do it all within Eclipse: generate a new version, paste the other code over the one I'm comparing against, and do a version comparison

Still more hassle than just using SE39, was hoping to use the tool that already exists in ADT.

Regards,

Mike

paula_ditallo
Participant
0 Kudos

Mike,

To compare any two files in Eclipse, select them in the Project Explorer/Package Explorer/ Navigator with control-click. Righ-clic on one of the files. You'll see a context menu appear. When you do, select Compare With/Each Other.  If you're on a different version of Eclipse than I, and the option "Each Other" doesn't appear in the menu "Compare with", go to Preferences>Capabilities>Advanced and enable Team> Core Team Support, then restart Eclipse.

Hi Paula,

Thanks for the input. I had already tried the multi-select but all I get is Compare with... "New Project" / "Revision History".

I can't see the option you're talking about, using Eclipse Mars on OSX all with latest updates installed.

My config:

No Core Team options, and I've gone through all the ABAP and General > Compare options.

Thanks & regards,

Mike

0 Kudos

Mike,

Take a look at a reference I found online with a screen shot-- let me know if you see something similar in the context of the file versions you want to compare.

Use Eclipse as diff tool « Heiko Behrens (Blog)

0 Kudos

Hello Paula,

Thanks for the info, no I do not have this option available for ABAP sources. Do you see it on your installation, and what version are you using?

Regards,

Mike

ChrisSolomon
Active Contributor

Isn't there an Eclipse plug-in for comparison of two files?!?!

Also found this...

http://stackoverflow.com/questions/4623564/how-do-i-compare-two-files-using-eclipse-is-there-any-opt...

Hi Christopher,

Thanks, are you referring to two disk files? That could be compared easily, but because ABAP sources don't live on the local drive, a native comparison would have to be specifically provided by ADT.


Sure a download and compare of text is feasible, but as per my answer to Gregor, it's not worthwhile if it's more effort than alt-tabbing over to an SE39 compare in the SAPGUI.

It just strikes me as odd that ADT provides a quick and useful tool to compare versions but not alternate reports...

Thanks & regards,

Mike

0 Kudos

Seems odd to me too. You would think this "feature" would be high on the list as "most needed".

Actually, ABAP sources are cached on the local disk and therefore the built-in comparison feature can already be used - there is currently some additional work needed. Let's see if this will be improved in the future...

  • Ensure that you have loaded both sources in there latest version at least once in ABAP in Eclipse. (This ensures that the files are on the disk)
  • Open the view 'Navigator'
  • Open the '.adt' folder underneath the project the sources are located
  • Look for the folders that are called the same as the report sources
  • Mark the files ending with '.asprog'
  • Select Compare with -> Each other in the context menu
  • Ensure that you switch to 'Text Compare'
  • You will get a nice comparison even with syntax highlighting etc.

This also works with all other source code-based ABAP development objects, e.g. classes, DDL sources, interfaces etc. You may even compare classes with reports etc. The only thing you need to do is find the proper folder where the cached files are located and select the correct file (there are header and content files).

0 Kudos

Hi Sebastian,

Excellent, still a bit of a hack but definitely workable. Not sure if it's by design, but things like F3 navigation doesn't work. But that's also reasonably easy to get around.

By the way I did have a go to see if it could be used to do offline editing or at least viewing, but no joy. This would be a nice feature too...

Thanks & regards,

Mike

0 Kudos

Hi Sebastian,

There is something one should know about the "Cache Navigator workaround". Do not try to merge or copy differences between the cache files from the compare editor. Most of the time these files are not writable but chances exist that you may have opened and already changed one or both of them in native ADT editors. In this case the SFS cache files are opened for writing also and changing them directly may destroy your cache consistency. So consider this approach as "look but don"t touch" one 🙂

Best Regards,

Mario


Andre_Fischer
Product and Topic Expert
Product and Topic Expert

The compare with each other function is now available for ADT is well.

Simply select two objects such as two programs or classes in the project explorer.

Right click on the selected objects and choose "Compare with" --> "Each Other".

I have tested this on 750 with the latest ADT released for customers.

ceterum censeo RAP esse utendam

Heck yeh! Don't just let a post from 2016 die! Raise that zombie back up! Great job!

0 Kudos

Thanks. Same remark about 2016. I guess it's ADT 3.34. I hope there will be a short blog post about it with screenshots of comparison. I hope it's not the ugly comparison view of old program RSVRSRS3 😉