Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Design dialog program using the MVC pattern

Former Member
0 Likes
861

Hi,

I have to design a dialog program using the MVC pattern , with all the controllers lying inside function modules.

I have searched out on net and could find out that BSP applications are designed using the MVC concept.Please suggest how can the dialog program be designed using MVC pattern.

5 REPLIES 5
Read only

former_member242255
Active Contributor
0 Likes
678

BSP applications are web applicatioons where u can design the web pages to do all sort of processes and update the data back into the database...

Read only

Former Member
0 Likes
678

Take a look at the slides in this link [State-of-the-Art ABAP u2013a PracticalProgramming Guide|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/com.sap.km.cm.docs/media/streamingmedia/events/sap%20teched%202006/premium%20content/state-of-the-art%20abap%20-%20a%20practical%20programming%20guide/cd356.pdf]

Also have a look at this [weblog|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2322] [original link is broken] [original link is broken] [original link is broken];

The basic idea of implementing the MVC for classic dynpro's is as follows :

1 A Function group is required, who's top include will contain the selection screen declaration and local classes definitions and implementations. ( Views )

2 The function modules of the above FG will have calls to the respective selection screens/ dynpro screens. Call selection screen ( control )or Call Screen XXXX ( this is the view and control )

3 In the PBO and PAI of the screens, you will use the data from the screens and call the class methods ( local or global ) which will interact with the database. This will be the MODEL.

regards,

Advait

Read only

Sm1tje
Active Contributor
0 Likes
678

That's gonna be a bit difficult since dialogue programs do not support the MVC model, that is, it is not enforced.

For example, reacting to user input, in MVC this should be done in a View controller which is especially created for this purpose. However, in dialogue programming, there is no such controller. User validation is done in the PAI (process after input). So you will not be able to separate this. The one thing you could do, is create a controller (class) in which the model is defined (retrieving data from back end). This way, at least the module can be reused.

But again, only WebDynpro and BSP support the MVC paradigm.

Read only

Former Member
0 Likes
678

Hi,

I think MVC can not be used as the design pattern for dialog programs. Can we use BAPIs to create the dialog programs.

Read only

matt
Active Contributor
0 Likes
678

I'm currently developing a classic Dynpro dialog program. I have a module pool, with screens. I've tightly coupled the module pool with a controller class. Anything that happens in the module pool, is handled by the controller class. All the logic of screen handling is done by the controller class.

What remains in the module pool is the capturing of the okcode. the next screen to go to (if applicable), the setting of field attributes. But the okcode is sent straight to the controller for processing, and the screen/field information is also held in the controller.

I've also rewritten the auto-generated tab handling code, so the logic is done via a class.

So, it is possible - just aim to have as LITTLE as possible in the module pool or function group.

The model, of course, is in a separate class.