Monday, February 7, 2011

Enhancing a Standard Class

Go to TCode SE24.

Enter the name of the Class to be enhanced.

The Following Screen would be displayed.

Click on Class > Enhance.

Give the name of the enhancement implementation and short text

Click on continue.

Enter the New method “GET_DATA_NEW”

Click on Parameters.

Enter the Required parameters, Type, Associated Type.

Click on Back and get back to method screen.

Enter the Source code.

Click on Save Check and activate.

Create a Report program on SE38 T- Code.

Click on Pattern.

Select ABAP Object Patterns.

Click on continue.

Enter the Enhance Class name and method name.

Click on continue.

Paste the Below Code.

*&---------------------------------------------------------------------*
*& Report ZENHANCE_TEST
*&  DEMO FOR ENHANCING THE STANDARD CLASS.
REPORT  ZENHANCE_TEST.
* TYPE DECLARATIONS
DATA : TABLE TYPE STRING,
ROW_COUNT TYPE I,
DATA_OUT TYPE TABLE OF SFLIGHT,
W_OUT LIKE LINE OF DATA_OUT.
* Calling the Enhanced class and Enhanced methods.
CALL METHOD CL_WDR_FLIGHTS=>GET_DATA_NEW
EXPORTING
* ROW_COUNT =
TAB_NAME = 'SFLIGHT'
CHANGING
DATA = DATA_OUT.
LOOP AT DATA_OUT INTO W_OUT.
WRITE :/ W_OUT-CARRID, W_OUT-FLDATE.
ENDLOOP.  

Click on Save Check and Activate.

Execute the program:

No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive

goodsites