Post

Finding Empty Development Classes

Finding Empty Development Classes

When preparing for an S/4 migration, one of the key tasks is to ensure that your system is clean and free of unnecessary or unused development classes. During our preparation, we identified many empty development classes in our system that had no associated DDIC objects or development classes assigned to them. This can lead to unnecessary complexity and potential issues during the migration. To help identify these empty development classes, I created a simple ABAP report that lists all development classes without any objects or sub-classes assigned to them.


đź§  Understanding the Problem

In SAP, a development class is a container for related development objects, such as programs, function modules, data dictionary objects (DDIC), and more. When preparing for a system migration, it’s essential to identify development classes that are unused or empty to ensure a smooth transition. Empty development classes can indicate that they were once used but no longer have any active objects or might have been created erroneously.

Finding these empty classes manually can be a tedious process. Luckily, with ABAP, we can automate this task efficiently.


đź”§ The Solution: ABAP Report to Find Empty Development Classes

The following ABAP report will help you list development classes that don’t have any objects or sub-development classes assigned to them. This simple yet effective solution can be integrated into your migration preparation process to identify unused development classes.

📜 ABAP Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
DATA: lf_count_tadir TYPE i,
      lf_count_tdevc TYPE i.

DATA: ls_outtab TYPE t_outtab.

SELECT devclass
  FROM tdevc
  INTO TABLE @DATA(lt_devclass)
  WHERE devclass LIKE 'Z%'
    OR   devclass LIKE 'Y%'
  ORDER BY devclass.

LOOP AT lt_devclass ASSIGNING FIELD-SYMBOL(<s_devc>).
  CLEAR: ls_outtab, lf_count_tadir, lf_count_tdevc.

  ls_outtab-devclass = <s_devc>-devclass.

  SELECT SINGLE COUNT( * )
    FROM tadir
    INTO @lf_count_tadir
    WHERE devclass EQ @<s_devc>-devclass
      AND object NE 'DEVC'.

  SELECT SINGLE COUNT( * )
    FROM tdevc
    INTO @lf_count_tdevc
    WHERE parentcl EQ @<s_devc>-devclass.

  ls_outtab-count = lf_count_tadir + lf_count_tdevc.

  CHECK ls_outtab-count EQ 0.

  APPEND ls_outtab
    TO gt_outtab.

ENDLOOP.

🔍 How It Works:

  • Data Selection: The report selects all development classes starting with “Z” or “Y”, which are typically custom development classes in SAP systems.
  • Empty Check: For each development class, the report checks two things:
    1. If any objects are assigned to it in the TADIR table.
    2. If any sub-development classes are assigned to it in the TDEV table.
  • If both counts are zero, it considers the development class “empty.”
  • Output: The report then outputs the empty development classes, which can be displayed in an ALV Grid using the CL_SALV_TABLE class.

📊 Displaying Results in an ALV Grid

To visualize the results from the report, you can pass the generated gt_outtab internal table to the CL_SALV_TABLE class for an interactive display. This makes it easy to review the empty development classes in your system.

Here’s a basic example of how to display the output:

1
2
3
4
5
6
DATA(lo_alv) = cl_salv_table=>factory( 
  IMPORTING r_salv_table = DATA(lo_table)
  CHANGING  t_table      = gt_outtab 
).

lo_table->display( ).

This will display the results in a user-friendly ALV Grid, allowing for easier review and further action.


đź§  Final Thoughts

Identifying and cleaning up empty development classes is a crucial step when preparing for an S/4 migration. By automating the process using the ABAP report provided, you can save valuable time and reduce the complexity of your system. This approach also ensures that no unused development classes remain, which can help maintain the cleanliness and efficiency of your SAP environment.

If you find that this process is helpful, you might want to consider expanding it further, such as integrating it with your transport management system or scheduling it as a regular housekeeping job in your SAP landscape.

By taking these steps, you will ensure that your migration to S/4 is as smooth and efficient as possible.

This post is licensed under CC BY 4.0 by the author.