Blog > Friendlier SAP: Configuration Tree Path

Friendlier SAP: Configuration Tree Path

Mateusz Adamus SAP Integration Consultant
icon__calendar 2021-05-05

In this article you will learn:

  • How to create a customizing tree enhancement which will allow you to easily create and parse tree paths.

Reading time: 7 minutes


Imagine a situation where you’re creating a training material and need to provide a configuration path. Or, from the other side, you’re reading a manual and want to find the tree path yourself. Standard SAP requires you to do it manually – node by node. This enhancement is meant to make these tasks easier – concatenating the full path to a selected node or finding the node from the copied path.

The basics

As the configuration tree is a standard functionality contained in a standard report, you want to make as few modifications as possible. You can achieve this by enhancing the context menu of the tree and adding two new items to it:

  1. Paste Node Path – this item will be responsible for finding the configuration node from the configuration path stored in the clipboard,
  2. Copy Node’s Path – this item will be responsible for creating a full path to the first selected node and copying it into the clipboard.


To add new context menu items, you need to create an implicit enhancement (or code modification) at the end of the SPROJECT_CONTEXT_MENU function. In this enhancement, call the MODIFY_CONTEXT_MENU method of the custom class with the enhancement logic.


Context Menu Modification

Context menu implicit enhancement

To handle the new context menu items, you need to create an implicit enhancement (or code modification) at the end of the S_IMG_USER_EXIT_1 function. In this enhancement, call the HANDLE_COMMAND method of the custom class.

Handle command implicit enhancement

Handle command implicit enhancement

This is all that you need to modify in the standard code. The rest of the logic is contained in a custom class.


The enhancement logic

As mentioned before, the whole logic of the enhancement is contained in one custom class. The class is available for download from the link presented at the bottom of this article.


For the ease of use, all of the methods of the class are marked as static. These could be instance methods as well. Below you will find a short description of what each of the methods does.



The HANDLE_COMMAND method is used to execute the action after the user picks an item from the context menu. The method itself does not contain any action-related logic, it reroutes the processing to other appropriate methods.



The MODIFY_CONTEXT_MENU method contains the code responsible for appending custom items to the context menu of the configuration tree. The logic is very simple, although there are two things worth mentioning:

  1. The empty item appended in the first line of the method is later converted by the system to a separator.
  2. Custom commands assigned to the context menu items are taken from constants defined in the class, thus making it possible to reuse the same values in other methods of the class.


To concatenate the whole path of the first selected configuration tree node, a separator is needed. The GET_DEFAULT_SEPARATOR method is responsible for providing it. It first checks user parameters to look for a user-defined separator and, if none is found, the first from the list of possible separators is used. The name of the user parameter is defined in the AC_USER_PARAMETER_SEPARATOR constant.


When parsing a copied path, the class first tries to split it with the use of different separators. These possible separators are defined in method GET_POSSIBLE SEPARATORS. The parsing is done using the same sequence that separators are added to the list.



The HANDLE_COMMAND_COPY method is responsible for concatenating the whole path of the first selected configuration tree node. A separator obtained from the GET_DEFAULT_SEPARATOR method is used to separate the path elements. After the concatenation is complete, the result is copied to clipboard for easy use in other applications.


The method tries to obtain the nodes description in four different languages:

  1. The language of the configuration tree,
  2. The language of the system for the current user,
  3. English,
  4. German.


If the description is not found in any of the languages, a hard-coded text “NODE {node_id} DESCRIPTION MISSING” is used instead.


The maximum length of the path is defined as 4096 characters.


The HANDLE_COMMAND_PASTE method is responsible for parsing a pasted configuration tree path. Separators listed in the GET_POSSIBLE_SEPARATORS method are used to split the path into separate elements. The separators are used in the sequence defined in the GET_POSSIBLE_SEPARATORS method and splitting is stopped after the first success. 


Because not all nodes of the configuration tree are available after the tree is presented, the method loads missing nodes if required. For better performance, only the children of the parsed path elements are loaded.

Similar as in the HANDLE_COMMAND_COPY method, the logic responsible for finding configuration tree nodes uses four different languages. This is to maximize the chance of finding the node.


When parsing is finished, a success message is presented to the user at the bottom of the screen.


A custom class and two implicit enhancements is all you need to simplify the configuration tree navigation. Now you’re able to easily create and parse a configuration tree path.

Final Result Animation


Read also:

1. IDoc modification made easy with ABAP Object Oriented Programming

2. Programming is an art! Secrets of ABAP with Michael

Mateusz Adamus SAP Integration Consultant
Working with SAP environment since 2007. Involved in several international projects as an ABAP developer and programming team leader. Mateusz has broad experience in designing and implementing custom SAP solutions. Supporter of all solutions that allow to streamline work processes.