Creating a BSP using the Model View Controller ( MVC ) technique

Tutorial 1 - Creating the View & the controller (htm page & events) Step 1 - Create new BSP Application Using SE80 create BSP Application (I.e. Zbsp_usingmvc). Step 2 - Create new Controller (main.do) Right click on BSP application name and select create->controller. Enter name main.do or your own name + description. Press the green tick to continue Step 3 - Populate controller class (zcl_controller_01) Enter the name of your controller class i.e. zcl_controller_01. We also need to create this class so double click on the name. Yes. Step 4 - Creating controller class Once you have double clicked on the controller class name and pressed yes you will need to check the properties tab and ensure its super class is CL_BSP_CONTROLLER2 Step 5 - Redefine Methods You will have inherited a number of methods from the superclass. As these methods work in much the same way as events do within classic BSPs and ABAP you will now need to redefine a number of these methods. These are DO_INIT and DO_REQUEST Step 6 - Redefine DO_INIT Ensure you have this method available for change by pressing the pencil button. Place your cursor on the method called DO_INIT and press the redefine button. For this current example you dont have to do anything in this method but for a follow on exercise you will be creating the MODEL instance in the DO_INIT method. Step 7 - Redefine DO_REQUEST(call a layout of type VIEW) Ensure you have this method available for change (done in previous step). Place your cursor on the method called DO_REQUEST and press the redefine button. In the DO_request we will call a layout(View). We create a reference variable referencing the page and then call the method create_view and pass it the actual view (not yet created). We then call the view. Enter the following code: * Create reference variable from the interface if_bsp_page DATA: r_view TYPE REF TO if_bsp_page. * Create object r_view with view_name main1.htm * Layout is provided by view main1.htm r_view = create_view( view_name = 'main1.htm' ). * Process view-> response is set accordingly call_view( r_view ). Step 8 - Create BSP Page (View) Right click the BSP Application and create a new page called main1.htm. When this is done make sure you save and activate it. Step 9 - Activate whole BSP Application Step 10 - Execute Go to the controller main.do and double click. Use the test(execute) button to view the results. Tutorial 1 Tutorial 2 Tutorial 3


Related Articles

Javascript to capture when a user closes or leaves sap bsp html page
Using AJAX functionality within our SAP BSP
Close BSP Session (type 'Pluggin HTTP') including when in SAP portal
SAP BSP to auto select region when user selects country using HTML and Javascript
HTML and Javascript code to force enter key to perform tab
JavaScrip command getElementById useful examples
MVC BSP input field - Demonstrate how to retrieve a value entered into text input field
Allowing multiple instances of a BSP application to be run by a user
Execute Standard SAP Transaction from BSP using dynamically created shortcut
Uplaod file within SAP BSP application using HTML and ABAP coding
UUseful SAP BSP application code - ABAP, HTML, HTMLB, Javascript, CSS
Creating a BSP Application class to help store and pass data betwenn your BSP pages
Training Course and Workshop Booking Form
BSP checkboxes using HTML and the OnInputProcessing BSP Event
BSP checkboxes using HTML and the OnInputProcessing BSP Event
Check HTML checkbox is checked using Javascript within your SAP BSP
BSP Dropdown List - create a BSP dropdown list which allows user selection!!
ABAP BSP to allow user to select from SAP HR org structure - CSS file
Java script to display tree structure on your SAP BSP web page
Create a Simple BSP - Simple BSP to display text and call section BSP page using HTML
SAP BSP Training course booking - Creating an example training course booking form using BSP
Creating an SAP BSP which executes an ABAP report to retrieve data for use within BSP application
org selection BSP - detials.htm page
Display page of the SAP BSP example application to store favourite tcodes as a cookie
Execute.htm page of the SAP BSP example application to store favourite tcodes as a cookie
Favourites cookie bsp - initial page to display input fields and retrieve user input
BSP using cookies - Demonstrate use of cookies within a BSP to store user favourits
ABAP Export data to memory - Demonstrate use of ABAP program to retrieve data for use in BSP
MVC BSP HTMLB input field - Demonstrate how to retrieve a value entered into text input field
BSP development using standard HTML code instead of Business HTML (HTMLB)
Business HTML (HTMLB) - List of business HTML tags you can use within your BSP
Adding JavaScript to BSP (HTML) pages - Shows how to add javascript to your BSP pages
Example JavaScript code which can be added to your BSP application
BSP MIME Objects for Org. search application
Call onInputProcessing event from SAP BSP page via href or button
Organisation selection BSP - close internet window using javascript
Organisation selection BSP - get server side cookie ( get_server_cookie )
orgaisation selection BSP - set and get server side cookie ( set_server_cookie )
Display orgaisation selection BSP
BSP which allows HR Organisation Structure search and selection using javascript
Organisation update program - get server side cookie ( get_server_cookie )
BSP to capture user entry into HTML input fields
Capture BSP radiobutton selection using HTML and the OnInputProcessing BSP Event
BSP checkboxes using HTML and the OnInputProcessing BSP Event
Stateful and stateless BSP applications
Get user entry into HTML input fields with SAP BSP
Javascript to capture when a user closes or leaves sap bsp html page
Creating a BSP using the Model View Controller ( MVC ) technique
Using SAP Model View Controller (MVC) development techniques to develop BSPs
Adding a JavaScript date selection field to a BSP
Creating a BSP using the Model View Controller(MVC) technique
Creating a BSP using the Model View Controller ( MVC ) technique
Retrieve value from input text field within a model view controller ( MVC) BSP
Web Application Development - Example code and information on development using BSP
SAP BSP / Business Server Pages combine ABAP and other web technologies such as HTML, CSS
BSP development screen - developing application using business server pages
Standard Program created in SE38 or SE80