This is a test message to test the length of the message box.
Login
ABAP Tools Work with Eclipse
Created by Software-Heroes

ABAP Tools - Work with Eclipse (Source code compare)

1580

Here we look at how we can use the ABAP Development Tools to compare source code, both across systems and the latest versions.



SAP has its own version history in the system when it comes to managing source code. With the ABAP Development Tools, another variant for storing versions has been added. In this article we will take a look at the different types of comparisons.

 

Introduction

In the past, it was standard practice to write change notes in the source code and thus present the reader with the history of the last 10 years at a glance. In most cases, however, this resulted in little clarity and there were hardly any opportunities to properly clean up the source code or carry out refactoring. Fortunately, this has changed with Clean ABAP and we, as ABAP developers, care about clean source code. The system takes over the management of the different versions of source code, similar to how Git does it today.

 

Execute comparison

If you want to start the comparison with an object, you can do this via the object (context menu), the Project Explorer or using a keyboard shortcut.

 

Object

To do this, simply right-click in the source code and look for the item “Compare with …” in the lower part of the menu. Depending on the object, the menu can be very long and the search takes a moment.

 

Project Explorer

To do this, select the object you want to compare in the Project Explorer and right-click to open the context menu. This time the "Compare with..." menu is last.

 

Shortcut

When you're in the source code, you can press CTRL + ALT + C (default setting) and you'll be right in the menu. This variant saves you having to search in the context menu. This option works in the source code, but also for the selected objects in the Project Explorer.

 

Options

All options are only available via the context menu; the local history is hidden by default using a keyboard shortcut.

 

The individual options are explained:

  • Local History - Lists all local changes (save and activation) made in the workspace and the project. The advantage is the history of development without having to write a real version entry in the system.
  • Each Other - Is active when two objects have been selected in the Project Explorer. The two objects are then compared with each other.
  • Previous Revision - The comparison of the current, active, resource against the last change in the history.
  • Revision History - Display of all versions of the version history; a comparison can be started by selecting two versions.
  • Systems - All open systems are displayed under the history so that the resource of the current system can be compared with another system.

 

Analyze comparison

If you compare an object, it will be called up in its own window and the two resources will be compared against each other. The current source code is on the left side, the source code for the comparison is on the right side.

The comparison is displayed in different colors, so new elements are displayed in green, changes in gray and elements that have been removed in red. Shifts of commands are also displayed, such as with ENDCLASS. If the object contains a lot of coding, all differences are highlighted next to the scroll bar, making it easier for you to navigate to the differences.

 

Comparison method

A comparison can produce a false positive and show changes in the class even though nothing may have changed. Transporting a class can lead to deviations in the method order. Since the class components are stored in their own includes and these are also transported, the order in the subsequent system may differ.

 

The different comparison methods can be selected using the three points in the view at the top left. In this case we switch from “Default Compare” to “ABAP Compare (Sorted Class Methods)”.

 

The comparison is run again, in this case no more changes are displayed, the two versions are the same again, since the order of the methods has no influence on the processing.

 

Local history

The local history is created in the Eclipse workspace and is only available to you. Every time you activate a resource, an entry is written. However, this history is not persisted on the ABAP server. If you select the "Local History" entry in the "Compare With" menu, you will receive an overview in its own view:

 

Cross-system

Using the open systems at the bottom of the "Compare with..." menu, you can analyze one or more objects across systems. If the object is the same, you will receive a message that no differences could be determined.

 

Hint: If you mark multiple entries in the Project Explorer, they will all be compared. Objects that have differences are opened directly in the workspace, objects that are the same are added to the popup (see screenshot above).

 

Conclusion

The version comparison in the ABAP Development Tools works like in the SAP GUI, but still offers some advantages over it. This means that local changes can be analyzed and no transport release has to be made. Accidental deletion during development can thus be cushioned.


Included topics:
ToolsADTEclipseSource code compareVersion compare
Comments (0)



And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.


ABAP Tools - Working with Eclipse (SAP GUI Language)

Category - ABAP

Do you have the wrong SAP GUI language when you start the GUI in the ABAP Development Tools? You can find the solution here.

09/10/2024

ABAP Tools - Working with Eclipse (CDS Templates)

Category - ABAP

Did you select the wrong CDS template when creating the view? Here's a little tip to correct the view in ABAP afterwards.

07/02/2024

ABAP Tools - Quick Actions und Highlighting (ABAP Unit)

Category - ABAP

With the last release of the ABAP Development Tools, Quick Actions were added for ABAP development in the ABAP Unit area. Here we take a closer look at them.

06/18/2024

ABAP Tools - Configure Tool Bridge

Category - ABAP

Let's take a look at what the Tool Bridge is in the ABAP Development Tools and how you can easily configure it.

05/28/2024

ABAP Tools - Work with Eclipse (Execute object)

Category - ABAP

In this article a little tip for starting objects directly, without having to go through the display of the object.

03/19/2024