Where does your business logic resides
SAP business or application logic may be coded in the various modularization unit : globally such as function modules, global class methods or locally such as subroutines, includes.
There are 2 approaches to enhance business or application logic :
- Implicit Enhancements
- Explicit Enhancements
Both approaches can be thought as "hooks" (technically, termed as "enhancement option"), in which you need a container (technically called "enhancement implementation") to contain your custom code. It is a name you have to give (like any development object) and assign to a package. Enhancement implementation that you have created lived in customer namespace, hence, it survives upgrade.
As the name implies, the pre-defined hooks are "given" and no additional effort is required from your developers to define it. Implicit enhancements can be found, typically at the beginning and ending of the modularization unit. Within the development environment, there is an avenue to show the exact position(s) of the "hooks". After deciding where to place your code, you will create the "enhancement implementation" to contain your custom declaration or code.
With function modules, you can add additional (optional) parameters. With global class, you can add additional attributes and methods, and within existing standard methods, you can extend further by :
- adding additional parameters
- introducing pre-exit (called prior to calling the method), over-write exit (replaces the method) and post-exit (called after the method)
As the name implies, the "hooks" has to be pre-defined by SAP Developer. Unlike implicit enhancement where the placement is predictable, explicit enhancement can be placed anywhere in any modularization unit, as determined by the SAP Developer.
There are 3 different flavors, namely :
- Enhancement Point : Where you can place additional declaration or code
- Enhancement Section : Allows you to replace SAP's section of code
- New BADI : like the classical BADI but more efficient (40-600 times faster than the classical ones)
In the event you have to resort to modification, it is good practice to introduce your own "explicit enhancement" as a "hook" to contain your custom code. After an upgrade or application of support package, your custom code (in this case, is merely the "explicit enhancement option" you introduced and not the custom code you placed in the "enhancement implementation" which reside on customer namespace) will be wiped off. What you need to do is merely re-introduce the "explicit enhancement option" (hook) and your custom code which lived in the "enhancement implementation" will find its way back to the "hook".