0% found this document useful (0 votes)
95 views5 pages

Enhancement To A Standard Class

This document discusses enhancing standard classes in ABAP by adding custom methods and modifying existing method behavior. It provides three exits for enhancing methods: pre-method, post-method, and overwriting the method. The steps shown are: 1) Open a standard class in SE24 for enhancement, 2) Create an enhancement implementation, 3) Add a custom method, 4) Add pre/post-method exits to existing methods to add custom logic before or after, 5) Implement display method pre/post-exits to add information messages. It notes that pre/post exits cannot be used with overwriting the method.

Uploaded by

parthasc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views5 pages

Enhancement To A Standard Class

This document discusses enhancing standard classes in ABAP by adding custom methods and modifying existing method behavior. It provides three exits for enhancing methods: pre-method, post-method, and overwriting the method. The steps shown are: 1) Open a standard class in SE24 for enhancement, 2) Create an enhancement implementation, 3) Add a custom method, 4) Add pre/post-method exits to existing methods to add custom logic before or after, 5) Implement display method pre/post-exits to add information messages. It notes that pre/post exits cannot be used with overwriting the method.

Uploaded by

parthasc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Enhancement to a Standard Class

By Pranshu Kukreti

Introduction
Sometimes we come across a requirement which cannot be solved using available standard methods. In
such cases we can either enhance the existing method or go for our custom development. This document
explains how to add a custom method to a standard global class and how to enhance an existing method
using exits. Below are three different exits available to enhance a standard method:
1. Pre-Method Exit: Implement this exit if we want to execute our custom logic before standard method
gets executed.
2. Post-Method Exit: Implement this exit if we want to execute our custom logic after the standard
method gets executed.
3. Overwrite-Method Exit: If we want to completely replace the standard logic then this exit should be
implemented.
Steps
1) Go to transaction SE24 and open up a standard class (CL_SALV_TABLE) in our case.

2) Now select the option class->Enhance to create an enhancement implementation.

3) A pop up screen will appear where we need to pass enhancement implementation name and
description.

4) Once the implementation gets created successfully a message will appear at the bottom of the screen
and standard interface screen opens up in change mode.

5) Now add a public method as shown below and implement the logic inside this method.

6) We are going to display an information message inside this method.

7) Now our next task is to add/modify the logic of existing standard method. For this put your cursor on
the method name (DISPLAY in our case) and select the option Edit->Enhancement Operations>Insert Pre-Method / Insert Post-Method/Add Overwrite Method. Pre-Method gets called before the
standard method and Post-Method gets called after the standard method. But if we want to
completely replace the standard method logic with our won logic we can go for Over write method
which gets called (if implementation is active) in place of standard method.

8) We are going to implement the pre method first. So once we select the Insert Pre-Method option,
source code button
starts appearing on the Pre-Exit column. Press this button to implement
the pre-method of display.

9) In pre-method of display add logic to display an information message.

10) Repeat steps 7 & 8 to implement Post-Exit method of display.

11) Implement the post-exit method to display an information message.

12) It should be noted that, if at this point we try to implement the over write exit, it will give a
compilation error. This happens because we cannot have over write exit along with Pre/Post
exit.

You might also like