Skip to Content

good/bad programming from OOPS perspective


If I have one INCLUDE for all CLASS DEFINITIONs and one for CLASS IMPELEMENTAION and invoking those class in the main program, will be considered as a bad programming approach from OOPS perspective ?


ZINCLUDE1."for all class definitions

ZINCLUDE2."for all class implementations

invoking those class and methods here in the ZPROG.


Defining all the class definition and implementations in ZPROG (without using INCLUDES) and then invoking them there itself.

Is having an INCLUDE comes under the purview of using OOPS in the first place or INCLUDES will be considered as Classical approach of programming.

Kindly opine.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Nov 27, 2017 at 12:08 PM

    The historic intention of Includes was

    1. prevent the editor from loading the whole source code because of a low network bandwith
    2. reusage of code

    Regarding 1.) I think in this times we just can ignore this

    Regarding 2.) the use of local classes in your Z-Report tells me, that you will never reuse your code

    Conclusion: don't use Includes at all, there's really no need of them anymore.

    Add comment
    10|10000 characters needed characters exceeded

    • Horst just provided one part of my intended answer when he wrote "But never, never, never reuse includes."

      I treat includes are local to the program (although people can break those rules but then that's their responsibility). Global classes are effectively released for all & sundry to use as they please.

      It's partly personal style too, I write code and refine, rename and refactor often before my final version is ready, this is quick and easy in local classes, especially with Eclipse.
      My globals often start life this way too for the same reason - I also don't like 15 transports with method renames and deletions, which tends to be the case on projects with daily transports.

  • Nov 27, 2017 at 09:41 AM

    Hello Kiran,

    As per the ATC/SCI/SLIN checks the class definition include [ (L)Z...Dnn ] should be defined in the TOP include of the program or function-pool. The implementation include [ (L)Z...Pnn ] should be part of the main program.

    If you don't follow this structure, then you get a warning message from the checks.


    Personally i don't follow this structure when defining reports. It's easier to have everything in one place & makes life easier when refactoring.

    IMHO i don't relate using(or not using) includes to OOP. Infact a CLASS-POOL itself is structured in several includes!



    Add comment
    10|10000 characters needed characters exceeded

    • Completely agree, I don't think SAP guidelines are appropriate in this instance.

      There's a technical reason too: using Eclipse it's a pain to work with synchronization of definitions and code in separate units, so I gave up on that a long time ago. In my opinion it's better to group classes by function if anything.

  • Nov 27, 2017 at 04:23 PM

    We recommend to organize large programs in includes.

    For class pools and function groups it is a must anyhow.

    For reports, it is your decision, from which point on, it is better to create includes.

    This is independent from ABAP objects.

    For large local classes, it is not a bad idea to put declaration part and implementation part into different includes, where the declaration include then should be included in a top include.

    But never, never, never reuse includes.

    Add comment
    10|10000 characters needed characters exceeded