Employee training ABAP command

Development with ABAP now requires a vast amount of knowledge. A lot has happened in ABAP language elements in recent years. It all started with string templates, with which character strings can be put together more easily and without auxiliary variables. Furthermore, other functions from various areas have been gradually added:

  • Table expressions
  • Table functions (LINES, LINE_INDEX, LINE_EXISTS)
  • Expressions and functions (FIND, CHAR_OFF, COUNT, CONDENSE, ESCAPE, SUBSTRING, etc.)
  • Inline declarations (DATA, FIELD-SYMBOLS)
  • Constructor expressions (NEW, VALUE)
  • Iteration expressions (FOR, REDUCE)
  • Filter operator FILTER
  • Meshes
  • Assignments (CORRESPONDING, CONV)
  • There has been an incredible amount of movement in the ABAP environment in the last years. I haven’t even mentioned new techniques such as CDS views, UI5, RAP, CAP or Cloud… The challenges for SAP developers are indeed many and the question arises of how to learn all these language elements. In this blog post, I would like to show how the prerequisites for developers are created in their own SAP system so that they can gradually develop further at their own pace.

Build your own training platform.

Learning new language elements sometimes proves to be quite difficult. Firstly, because there is lack of time and secondly, because there is lack of specific use cases. In addition, developers must recognize which language element can be used sensibly. One idea is that you set small training tasks and let the developers solve them. It makes sense to have the results of the tasks checked automatically using unit tests, so that you don’t have to check them. In this way, learners receive quick and direct feedback on their efforts. My idea is the following:

  • You create an interface with exercises. You can create the task using ABAPdoc.
  • You create a global test class in which you use unit tests to check the results of the practice methods.
  • The learners create a class (with their own abbreviation) in which they implement the interface with the exercises and solve the exercises with the appropriate coding.
  • A test class is created in the class, which inherits from the global test class. This is how the unit tests for the class are run.

The tasks can be gradually expanded and refined. You can define different classes with corresponding tasks for different areas.

Create interface with exercises.

In the following I will demonstrate how the interface with exercises can look like.

Copy to Clipboard

Create a class with sample solutions.

You must create a class that implements the interface with the practice methods. This is needed to ensure that the global master test class works correctly.

The class should look like this:

Copy to Clipboard

Create Test-Master

Create a global test class containing methods with correspondingly meaningful unit tests.

Definition of the class 

The test master class definition contains test methods. These must be placed in the PROTECTED SECTION to inherit the methods from the practice class’s local test class. An instance of the class to be tested is created in the SETUP method. The already created class with the sample tasks is required for this. The instance variable CUT (short for “Code Under Test”) contains the reference to the sample task class.

Copy to Clipboard

Implementation of the class

In the implementation of the test master class, the values generated by the model solution are checked. This is usually done using the method CL_ABAP_UNIT=>ASSERT_EQUALS:

Copy to Clipboard

The more complicated the tasks are, the more comprehensive the unit tests need to be to ensure the correctness of the results.

Arm Sector Unit Tests

Normally, unit tests are created in the designated area of the “Test classes” class with local test classes. Let’s do it in a slightly differently way now and only create the part of the test class that is not covered by the master test class:

  • Definition of the local test class with inheritance from the master test class
  • Definition of the instance variable CUT with the current class with the model solutions
  • Initialization of the instance variable CUT
Copy to Clipboard

Test Class

The unit tests can now be run using the key combination CTRL-SHIFT-F10. If the implementation and the unit tests were correct, this is indicated accordingly (green bar at the bottom of the screenshot):

Unit-Test für ABAP-Selbst-Lern-Plattform

What do practitioners have to do?

Anyone wishing to participate in the exercises should proceed as described in “Creating an interface with exercises” and “Arming unit tests”. The name of the class should contain the exercise area (in this example VALUE) as well as its own abbreviation. In this way, all participants have their own practice area. In addition, everyone has their own sample solution that they can use, if necessary. With a little more effort, the exercise classes could be created automatically using the function module SEO_CLASS_CREATE_COMPLETE. The trainees would then only have to select the class to be copied and enter their initials. The program can do the rest.


The source code for some examples can be installed on the Inwerken Github page using abapGit.

Do you have any questions to this topic? Feel free to write to sapentwicklung@inwerken.de.