There are three types of exits available for changing existing method of the class.
- Pre Exit
This exit will be called before execution of the original method. So when method is called then pre exit code will be executed first and then original code of the method will be executed. Pre exit method is useful for defaulting or initializing parameters. Pre exit method name starts with IPR. e.g. IPR_ZSA_ENH_MAT~ADD_ITEM.
- Post Exit
Post exit will be called after execution of the original method. So when method is called then original code of the method will be executed then post exit code will be called. Post exit method name starts with IPO. e.g. IPO_ZSA_ENH_MAT~ADD_ITEM.
- Overwrite Exit
Overwrite exit is replacement of original method code. When method is called then code written in overwrite exit will be called and original method code will not be executed. Overwrite Exit cannot be created simultaneously with PRE/POST exits.Overwrite exit method name starts with IOW. e.g. IOW_ZSA_ENH_MAT~ADD_ITEM.
1. Go to transaction SE24, Enter class name and click on Display.
2. On next screen Click on Enhance button in toolbar options.
3. POPUP will be displayed to create enhancement implementation.
Enter Enhancement implementation name and Short text.Click on Enter.
Enter Package name and click on SAVE.
4. Click cursor on method name to be enhanced.
Go to EditEnhancement operationsInsert Pre-Method
Click on editor in Pre Exit column.
5. Pre exit method IPR_ZSA_ENH_MAT~ADD_ITEM will be created. Enter code and activate.
6. Repeat above steps 4and 5 to add post exit method and overwrite method.