For any SE24 class method we can define pre-exit, post-exit and overwrite-exit method by enhancing the original method.
We can apply pre exit and post exit both on a single method.
If per-exit or post-exit is applied to a method then we can not apply over-write exit on the same method.
Step1. Go to TCODE-SE24, Provide a class name and click on the Create button.
Step2. Provide the description and click on the SAVE button.
Step3. In the methods section, create a new method 'SHOW_MESSAGE' with level, visibility and description as shown below. Now double click on the method name to implement it.
Step4. Provide some statement in the method. Activate it .
Step5. Now go to TCODE-SE38 and create a report progam.
Step6. Create the object of the above created class, call the method and run it.
Step7. The out put of the method is as follows.
Step8. Enhancing the method to create a pre-exit method of the existing method. Select the method and from the menu Class select Enhance.
Step9. From the appearing screen provide the enhancement implementation name and short text and click on the continue button.
Step10. Now in the method right hand side some now tabs are added as a result of method enhancement.
Step11. Now select the method, click on the EDIT menu, go to Enhancement Operations and select insert Pre-Method.
Step12. Click YES to continue.
Step13. Now click on the Editor that inserted under PRE-EXIT tab against the method 'SHOW_MESSAGE'.
Step14. Provide some statement in the pre-exit method of the SHOW_MESSAGE method.
Step15. Now run the above created report.
Step16. The Out Put is shown below. For any method if pre-exit method is there and the program calls the method, the pre-exit method is executed first and then the original method is called.
Step17. Creating Post-Exit . Select the method and from the EDIT menu select Enhancement Operations and click on Insert Post-Method.
Step18. Now click on the Editor that inserted under Post-Exit tab against the method 'SHOW_MESSAGE'.
Step19. Provide some statement in the post-exit method of the SHOW_MESSAGE method.
Step20. Now run the above created report.
Step21.The Out Put is shown below. For any method if pre-exit and post-exit method exists and the program calls the method, the pre-exit method is executed first and then the original method is called and then the post exit method is called.
Step22. Now creates a over-write exit method. IF pre-exit and post-exit method exists for any method we can not create a overwrite-exit method for the same. So lets create another method 'DISP_MESSGAE'. Double click on it to implement it.
Step23. Provide some statement and activate it.
Step24. Now run the report by calling the method 'DISP_MESSGAE'.
Step25. Now the output is as shown below.
Step26. Select the method 'DISP_MESSAGE' and form the menu 'CLASS' click on Enhance.
Step27. Select the above created enhancement implementation and click on continue button.
Step28. Now form the EDIT menu, goto Enhancement Operations and then select Insert OverWrite-Exit Methods.
Step29. Now click on the Editor that inserted under Overwrite-Exit tab against the method 'DISP_MESSAGE'.
Step30. Click on YES to continue.
Step31. Provide some statement in the overwrite-exit method and activate it.
Step32. Now run the report.
Step33. The over-write Exit method is called suppressing the original DISP_MESSAGE.
No comments:
Post a Comment