Local classes are defined within a program, It is available in the context of the program and is used when found by system. However, it brings forth a problem – the functionality created within the scope of a program cannot be easily used by other programs. Not only the idea of reusability is defeated, the idea of encapsulation is not appropriately harnessed. In such cases, Global Class comes into picture.
Global classes are widely used in SAP standard and should be used where and when ever possible in custom developments. Usually, custom developments don’t happen in isolation and more than often same functionality is repeatedly used. Such functionalities can be clubbed together in a class with methods tackling those functionalities. These methods can be appropriately called.
Example: In a system, both PR and PO creation uses a logic to add text based on Plant and Storage Location. Instead of writing the code in exits twice, a global class with a method handling the functionality can be written and can be called in both exits to accomplish the requisite. Furthermore, the same can be used in delivery, invoice, work order if needed.
~S
Recent Comments