Adding Explicit Enhancement to custom program

...Previous

STEP 7: Now to include the custom code in the program which will replace the original code, enable the 'Enhancement Mode' by clicking on the 'Spiral' button.

Description: http://wiki.sdn.sap.com/wiki/download/attachments/77988719/ENHC_11.JPG?version=1&modificationDate=1234179692881

Place the cursor on the 'Enhancement-section' and navigate to 'Edit' à 'Enhancement Operations' à 'Create Implementation'.

Description: C:\Documents and Settings\enteg12\Desktop\ppp\114.JPG

Fill in the details for the 'Create Enhancement Implementation' dialog. Click on 'Create' button for the 'Select or Create Enhancement Implementation' dialog.

Description: C:\Documents and Settings\enteg12\Desktop\ppp\115.JPG

STEP 8: Now, write the code within the 'ENHANCEMENT' and 'ENDENHANCEMENT' statements as the replacement code.

STEP 9:  Don't forget to 'Activate' the enhancement à  Switch the 'Enhancement' mode OFF and 'Activate' the entire program.

STEP 10: Execute the transaction/program to find out the difference.

Before Enhancement:

Description: C:\Documents and Settings\enteg12\Desktop\ppp\108.JPG  

After Enhancement:

Description: C:\Documents and Settings\enteg12\Desktop\ppp\118.JPG

Summary:

1.     Here we deals with the enhancement of a 'Z' program it is possible to 'CREATE' an 'ENHANCEMENT-SECTION'. But, in case of a 'STANDARD SAP' program there are certain places (provided by SAP) like 'ENHANCEMENT-POINT...' and 'ENHANCEMENT-SECTION...' where we can create implementations based on customer’s business functionality.

2.     There can be only one and only one 'ACTIVE' implementation for an 'ENHANCEMENT-SECTION'.

Source Code:

*&---------------------------------------------------------------------*
*& Report  YDEV_CODE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  YDEV_CODE.
TABLES VBAKVBAP.
DATA IT_VBAK TYPE STANDARD TABLE OF VBAK INITIAL SIZE 0,
       WA_VBAK 
TYPE VBAK,
       IT_VBAP 
TYPE STANDARD TABLE OF VBAP INITIAL SIZE 0,
       WA_VBAP 
TYPE VBAP.

INITIALIZATION.
  
REFRESH IT_VBAK,
            IT_VBAP
.
  
CLEAR WA_VBAK,
          WA_VBAP
.

START
-OF-SELECTION.
ENHANCEMENT-SECTION YDEV_ENHANCE_SECTION SPOTS YDEV_IMPLEMENT_SPOT .
SELECT *
    
FROM VBAP
    
INTO TABLE IT_VBAP[]
    
UP TO 15 ROWS.


  
WRITE/02 'Sales Document',
          
20 'Date',
          
40 'Time',
          
65 'Name of Person'.
ULINE .
  
IF IT_VBAP[] IS NOT INITIAL.
    
LOOP AT IT_VBAP INTO WA_VBAP.
      
WRITE/02 WA_VBAP-VBELN,
              
20 WA_VBAP-POSNR,
              
40 WA_VBAP-MATNR,
              
65 WA_VBAP-MATWA.
    
ENDLOOP.
  
ENDIF.
END-ENHANCEMENT-SECTION.
*$*$-Start: YDEV_ENHANCE_SECTION----------------------------------------------------------------$*$*
ENHANCEMENT 1  YDEV_IMPLEMENT_ENHC_SECTION.    "active version
SELECT *
    
FROM VBAP
    
INTO TABLE IT_VBAP[]
    
UP TO 10 ROWS.


  
WRITE/02 'Sales Document',
          
20 'Sales Item',
          
40 'Material Number',
          
65 'Material entered'.
ULINE .
  
IF IT_VBAP[] IS NOT INITIAL.
    
LOOP AT IT_VBAP INTO WA_VBAP.
      
WRITE/02 WA_VBAP-VBELN,
              
20 WA_VBAP-POSNR,
              
40 WA_VBAP-MATNR,
              
65 WA_VBAP-MATWA.
    
ENDLOOP.
  
ENDIF.
ENDENHANCEMENT.
*$*$-End:   YDEV_ENHANCE_SECTION----------------------------------------------------------------$*$*

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image