Example of External Tools in Eclipse for ABAP developers
Photo created by Elena and Michael Keller

Example of External Tools in Eclipse for ABAP developers

By choosing Eclipse as the development environment for ABAP, SAP has opted for open source software that is inherently open to extensions. This becomes particularly clear when you visit the Eclipse Marketplace. There you will find thousands of extensions that can significantly increase the functionality of Eclipse. Not only in relation to ABAP, but also for ABAP. These include, for example, the plugins “ABAP Favorites” by Lukasz Pegiel and “ABAP Code Search” by Ludwig Stockbauer-Muhr.

In addition to the option of integrating self-programmed plugins into Eclipse, the standard version also includes the function of “External Tools”. These can be used, for example, to start programs and scripts on the system on which Eclipse is also running. All that is required is a configuration, no programming. This makes setup quick and easy.

In this blog, we want to take a look at an example of how to configure and use such an external tool.

Use case “Translation”

For historical reasons, there are many German comments in ABAP sources. These often contain helpful information that every developer should have access to, for example when debugging. However, German is not as widely spoken as English, for example.

For this reason, the use of English comments is a good approach. This makes sense because, on the one hand, ABAP itself consists of English syntax, which ensures consistency when reading. On the other hand, people from different countries now work on many projects. Using a globally spoken language such as English gives everyone the opportunity to read the comments.

Therefore a translation aid from German to English and vice versa would be helpful in Eclipse. Surprisingly, I couldn’t find a standard function for this right away. I couldn’t find a plugin for it in the Eclipse Marketplace either.

So what’s the use case for this blog? We build the function ourselves with the help of External Tools by integrating Google Translate context-sensitively via an internet browser.

In practice, this configuration shouldn’t be used without further consideration. It would be important to clarify in advance what Google Translate will do with the input. It might, for example, save it for the purpose of training your translation skills. This is certainly not desirable with comments from company-specific ABAP applications.

Configure External Tools

In Eclipse, the last entry in the “Run” menu is “External Tools.” This is a submenu from which you can select the entry “External Tools Configuration…”.

Use the “New launch configuration” function to create a new configuration. The name could be “Translate DE, EN” for example.

I used “${system_path:chromium}” as the location. This is how Eclipse starts the Chromium internet browser in my Ubuntu Linux. In Windows, the call for Microsoft Edge or Google Chrome must be adjusted accordingly.

Chromium accepts parameters when called. I assume that this is also possible with Chrome and Edge. A parameter can be a URL, for example, which is then displayed directly. The transfer of this parameter from Eclipse is set as an argument in “Arguments”. I used the following setting: “https://translate.google.com/?sl=de&tl=en&text=”${selected_text}“&op=translate”.

The use of the variable “${selected_text}”, which Eclipse provides, is interesting. This makes the call context-sensitive, i.e. the currently selected text is passed to Chromium as an argument.

Those were the necessary settings.

Using External Tools

Using the configuration is easy. First, you need to select a German comment in the ABAP source code and then select the name of the configuration in the “Run” menu, sub menu “External Tools”. In my case, this is “Translate DE, EN”. Google Translate will then open in your internet browser. The German comment is on the left and the English translation is on the right.

Incidentally, you can avoid selecting the “Run” menu because there is an icon for the External Tools in the icon list. This makes it a little easier to use.

Key binding is also possible via the “Window→Preferences” menu. Select the “General→Keys” entry there. The command is “Run Last Launched External Tool” which you can assign to a function key such as F12. Unfortunately, this only allows you to run the last configuration used. But that’s better than nothing.

Summary

The example of using External Tools in Eclipse shows that it only takes a few steps to launch another application from Eclipse in a context-sensitive manner. The technology is part of the Eclipse standard, so it does not require any additional plug-ins.

One final note: There is a GitHub Copilot plugin for Eclipse. Among other things, Copilot can also translate. All you have to do is copy and paste the German comment with a request to translate it into English.


Thank you for reading. If you enjoyed the post, please leave a like, comment, or share the article with your community. Thanks in advance.

Michael

It is also possible to build IDE actions in Eclipse only using ABAP 🤯 - great devtoberfest video by Björn Schulz https://www.youtube.com/live/BAALIiRtChA?si=ApQYrDlBRvyPuryA

To view or add a comment, sign in

More articles by Michael Keller

  • Code, Comments, AI

    In my early days as a developer, I wrote a lot of comments. They were necessary because otherwise I would have quickly…

    11 Comments
  • Attributes, states and time

    Classes, with their attributes and methods, unite two fundamental concepts of computer science: data and algorithms…

    4 Comments
  • Distinguish between the functionality and its implementing code

    Many ABAP source codes clearly show signs of having been modified repeatedly over the years. The code bears the…

    3 Comments
  • What you can find in an ABAP class

    What would you least expect to find in an ABAP class? Take your time to think about it and create your own top three…

    1 Comment
  • The new public enemy number one: static code analysis

    Static ABAP code analysis can be a real asset. It depends on the specific checks being performed.

    9 Comments
  • Technically possible but not good style in ABAP

    There are different solutions for many ABAP tasks. Even if the result of each solution appears to be the same at first…

    4 Comments
  • ABAP Development Tools for Eclipse on Ubuntu Desktop

    Recently, I noticed a sentence on the SAP Development Tools website stating that you don’t need an SAP GUI for ABAP…

    8 Comments
  • 4 experiences with FINAL in ABAP

    With the declaration operator FINAL, you can create immutable variables in ABAP. This means that a variable is…

    9 Comments
  • Thoughts about taking data records out of use

    Dear developer community, "taking data records out of use" is a common topic in IT. Many applications require such a…

  • Markdown table via ABAP CDS and ABAP SQL

    Dear SAP Community, since I really appreciate Markdown and you can easily design tables with it, I was wondering…

    4 Comments

Others also viewed

Explore content categories