banner ads

User Exit - Explicit Enhancement Point

When an enhancement is used inside a custom program without disturbing the source code, it is called Explicit enhancement. Here the program is not SAP standard one. That is why it is called explicit. If it is standard one then it will be called implicit. We already have covered the implicit enhancement.

Explicit enhancement is saved in a package and transport in a similar way of implicit enhancement. Explicit enhancement has two types.
A.      Enhancement Point – when we use point, we can add additional functionality to the original program. Here the original program executes with enhanced function.
B.      Enhancement Section – when we use section, the original program is not executed. The enhanced program is executed.

In the following example we have demonstrated an explicit enhancement point. In this program originally we have printed the output of a program with no header information. Now we create an explicit enhancement point where the header information has been implemented. Hence the final output shows the complete output of the Airline information.

1.    We must have an activated custom program to implement explicit enhancement.

2.    Now keep the cursor where we need an enhancement. Right click > Enhancements > Create.

3.    Create Enhancement Point with Code option. Enter the name, description & package as follows.

4.    Now after saving the original program will look as follows. Click on the Enhance (Coin) button.

5.    Now keep the cursor on ENHANCEMENT key word. Right click > Enhancement Implementation > Create.

6.    Enter details and OK.

7.    Now write your enhanced code under Enhancement – Endenhancement. Then activate this.

8.    Finally activate the program and execute.

9.    We have the complete header information.

Similar kind of approach can be achieved by using Enhancement Section of explicit enhancement. In the following example we have used enhancement section and proceed the following output.


TABLES sflight.
DATA: wa_sflight TYPE sflight,
      it_sflight TYPE TABLE OF sflight.

  SELECT-OPTIONS s_carrid FOR sflight-carrid.

  SELECT * FROM sflight INTO TABLE it_sflight
    WHERE carrid IN s_carrid.

ENHANCEMENT-SECTION     zsr_enh_s SPOTS zsr_enh2.

*$*$-Start: ZSR_ENH_S---------------------------------------------------------------------------$*$*
ENHANCEMENT 1  ZSR_ENH2.    "active version
  IF it_sflight IS NOT INITIAL.
    WRITE: / 'Airline Code',
          15 'Flight No.',
          27 'Flight Date',
          45 'Maximum Seat',
          60 'Occupied Seat'.
*$*$-End:   ZSR_ENH_S---------------------------------------------------------------------------$*$*

  IF it_sflight IS NOT INITIAL.
    SORT it_sflight.
    LOOP AT it_sflight INTO wa_sflight.
      WRITE: /3 wa_sflight-carrid,
             15 wa_sflight-connid,
             27 wa_sflight-fldate DD/MM/YYYY,
             45 wa_sflight-seatsmax,
             60 wa_sflight-seatsocc.

No comments