cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Custom ABAP oops in webdynpro ABAP

former_member193460
Contributor
0 Kudos

I am trying to achieve MVC approach recommended by SAP for the web dynpro application. I am trying to have only the UI related commands in view controller and have the business logic in the component controller. I assume we have to use ABAP classes to achieve that. I am just wondering how we can initiate an event from the view to trigger in the component controller . Please help.

It is easy to trigger a method in view controller but how to do the same for component controller.

Regards,

Tashi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Tashi,

In MVC design pattern you have to do clear seperation between MODEL( Bussiness logic ) and Presentation ( View ) related codings .

you can create a assistance class for your WDA and write all your bussiness logic as methods and use the WD_ASSIST attribute to call those methods

WD_ASSIST-> method_name(  ) .

wd_assist->on_perform_update( i_event = wdevent i_is_test_mode = is_test_mode ).

http://wiki.sdn.sap.com/wiki/display/WDABAP/Assistance+class+functionality+in+WDA

you can call your component controller methods in view using attribute WD_COMP_CONTROLLER

WD_COMP_CONTROLLER->component_controller_method_name_here( ).

WD_COMP_CONTROLLER->get_details ( ).

Regards

Chinnaiya Pandian

Answers (3)

Answers (3)

amy_king
Active Contributor
0 Kudos

Hi Tashi,

In addition to what the other folks have suggested, take a look at wiki post High performance of Web dynpro ABAP. It provides a good break-down of implementing MVC architecture in WDA.

Cheers,

Amy

singhmanishekhar
Explorer
0 Kudos

Hi Tashi,

        SAP provided a way to integrate method, FM (Including RFC) and Web Service Proxy into webdynpro component is called service call. For creating service call, there is also service call wizard. Service call wizard automatically guide you to integrate method, FM (Including RFC) and Web Service Proxy.

*     Select your component in se80.

*     Right-click your component and select "service call".

*     Service call wizard will open with initial screen. Press next.

*     Select existing controller or create new controller.

*     Select your Business Logic provider (Assistance class method/class method/FM/Web Service Proxy).

*     Select name of selected type.

*     Specify context( context node & attribute/ Comp. attribute/ parameter)

*     Give name of new method that will be created in your controller.

*     Finish, will create service call.

    Now, you can use created method in your view with controller reference.

So, your business logic will always in model (your class), your screen logic is always in view controller.

Former Member
0 Kudos

Hi Tashi,

    In the MVC architechture keep your business logic in a class ( like your select queries ...) . Component Controller is global to every view therefore if you keep any method in comp controller it will be visible & accessible from all the view.

   Therefore as posted above by Chinnaiya call any component controller method in a particular action of a view or from  defaults methods ( wdddoinit ....). Check in your view attribute .. there is a attribute called 'WD_COMP_CONTROLLER' which refers to component controller. Use that attribute to access any method.

Regards,

Monishankar