Skip to Content
Author's profile photo François Henrotte

Code Inspector – excluding standard includes (continued)

I have recently taken the role of Quality Control for ABAP developments and we use the Code Inspector as the main tool to detect when the code is not compliant with internal rules as naming conventions and so on.

It is very handy as we can implement our own checks in a very flexible way.

But the tool is not so flexible for some other constraints. For example, when you use a standard include, the checks are applied on it.

This topic has already been discussed in a blog on SCN:

Code Inspector – excluding standard SAP includes

I just want to give my 50 cents on the topic. The solution provided in the blog is very good but it is also very complex. I have been interested in the solution mentioned by Marcin Cholewczuk in the comments, as it is far more easy to implement. But, the solution is not completely good as it is restricted to some objects starting with Y or Z, and this is not always the case. So let me present you an enhanced version that fits the needs while staying simple.

You just need one implicit enhancement of method HANDLE in global class CL_CI_INSPECTION. The code is pretty short.


Explanation: the “real” includes are stored into table TADIR just like other development objects, but the includes generated by SAP are not stored into TADIR. For them, we need to use the parent object i.e. the function group.

Reading TADIR is necessary to get the develoment class (“package”). This is the only attribute that tells if an object is a customer object or not (not the name of the object). The development type is Z for customer. You could add the type P for partner if you want to check also the objects in partner name ranges.

Additionnaly I do not check constants that are defined in type-pool object as the naming convention is already checked during the syntax check.

As you can see it, the solution is pretty simple. Maybe some cases are not taken into account but it really helps to clean the CI report !

Do not hesitate to share your thoughts about it.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.