Thursday, February 3, 2011

Using controller in BSP Application

This document describes the how to create a controller in BSP Application.

1. Creating BSP Application

Create a BSP Application in SE80 e.g., YH1328_TEST_BSP and provide short description and create it.

2. Creating Controller on BSP Application –

Right click on the application and create-> controller and enter name as main.do along with description and press continue.

3. Populating Controller Class

Enter the name of your controller class i.e. yh1328_controller_main. We also need to create this class in SE24

(Double click on yh1328_controller_main to create the class and press YES)

4. Creating Controller Class

In the Properties Tab of the class yh1328_controller_main ensure its super class is CL_BSP_CONTROLLER2.

5. Redefining Methods of the Class

We need to redefine some methods inherited from the superclass i.e. DO_INIT and DO_REQUEST.



6. Redefine method DO_INIT, dbl click on the method in change mode.

The DO_INIT Method behaves just like initialization event wherein we provide the data declaration.

Here we can fetch the data form the database table SFLIGHT into internal table t_flight

The attributes have to be set in the Attributes Tab of the Class

7. Redefine Method DO_REQUEST

Select the method DO_REQUEST and press the Redefine button and open the method in change mode. In this method we would be calling Layout (View) we create a reference variable referencing the page and then call the methods CREATE VIEW and pass it the actual view (not yet created). We then call the view.

.

8. Create a BSP Page (View)

In SE80 right click on the BSP Application and select Create->Page->Page Type-> View

Provide the page as main1.htm and description.

9. Assigning attributes to the View.

10. Populate the view with data.

11. Save and Activate BSP Application

12. Execute the controller: Go to the controller index and double click. Use the test (execute) button to view the results.




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