|Home • Trainings • Quiz • Tips • Tutorials • Functional • Cert Q's • Interview Q's • Jobs • Testimonials • Advertise • Contact Us|
BSP Application using MVC Architecture - Displaying Business Partner data using a BAPI
Enter the name of the controller class that you want to create as shown in
the above screen.
Double click on the controller class to enter into it. Give the attributes
of the class as shown.
_ Redefining The Controller Class
to use our model and views in controller class
zcontroller_bupa.do, we have to redefine some of the methods inherited from base
class cl_bsp_controller2 using the class builder’s redefine function.
The redefinition steps automatically add
commented coding (shown in bold in the do_init example below:
method do_init . * call method super->do_init. * . endmethod.
Redefine the methods i.e. do_init, do_request, do_handle_event.
After that double click on the method do_init to implement it (write the
code in the method).
BUPAOBJ ?= me->create_model( class_name = 'ZBUPA_MODEL' model_id = 'BUPAOBJ' ).
Follows the same procedure for the ‘do_request’, ‘do_handle_event’.
CODE: method DO_REQUEST. *CALL METHOD SUPER->DO_REQUEST * .
* Define a variable for the view we are about to create data view type ref to if_bsp_page.
* Dispatch the input so that the event handler can process * events like when the agent clicks on the Search button me->dispatch_input( ).
* The attribute me->view_name can be set by the event handler * to change navigation to the flights display if me->view_name is initial. me->view_name = 'input.htm'. endif.
* Create the response view view = me->create_view( view_name = me->view_name ). if view is bound. * Add a reference to the model instance to the view, * so that the view can access the model view->set_attribute( name = 'BUPAOBJ' value = me->BUPAOBJ ).
me->call_view( view ). endif. endmethod.
CLICK ON DO_HANDLE_EVENT METHOD.
method DO_HANDLE_EVENT. * Check that the event has been triggered by the search button if htmlb_event is bound and
htmlb_event->server_event = 'myclick1'. * Execute the search implemented in the query model
me->BUPAOBJ->GETBUPA( ). * Flights have been found, new target is the hit list display
if not me->BUPAOBJ->SEARCHRESULT is initial.
me->view_name = 'output.htm'.
elseif not me->BUPAOBJ->RETURN is initial.
me->view_name = 'output.htm'.
Save, check and activate the application.
Testing the application.
Input the user name and password for the authentication and click on
The View is displayed in the browser window as shown below.
Provide the information to get business partner data.
Click on the GET DATA button.
Then business partner information gets displayed as follows
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM
©2006-2007 SAPTechnical.COM. All rights reserved.
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG.
Graphic Design by Round the Bend Wizards