Classes can lead a double life: they can hide in a report source as a local class, or they can sit out in the system's class repository as a global class. Difference ? Nothing internally. There is nothing that you can arrange in a global class that can not be arranged in a local class and the other way around. Local classes are written in abap coding with a DECLARATION
and an IMPLEMENTATION
section. Global classes are created with the class builder (transaction SE24
). If you are writing a report to do a certain task, you can use the local class to profit from OO benefits, without having to worry about the world outside your report. When you are working on a class that may be of interest to other reports as well, consider setting it up as a global class.
Global classes may be available to the world, they don't get to play if they are not called. Actual calls can be done from other classes, but would eventually start from a report call (mostly, for argument sake, rfc function module calls are de-scoped for this article). The report can utilize class functionality, or adjust it via a local class.
Maestro Korolev set up this development tool report: it saves your global class in an XML file and rebuilds it from that same file. Take your re-usable global class coding with you wherever you go...
Can a locally defined method be called from an external program ? Could be useful if you are preparing software components that require easy installation and external calls are also a requirement. Here's how.