Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
marcelo_ramos
Active Contributor
0 Kudos

SAPmvc is an Open Source framework created to introduce the MVC design pattern to the ABAP Classical Dynpro using the pure ABAP Objects.

 

I'm not the only one who spent time to create and share a OO Dynpro solution. thomas.jung/blog created your first prototype in 2005 as we can see in your blog OO ABAP Dynpro Programming.

 

SAPmvc will be released in few weeks with:

  • Examples; 
  • Documentation;
  • Main Project Page;
  • Download repository;
  • Bug report;
  • ...

 

I hope that all ABAPer's fans contribute with suggestions, criticisms, Bug reporting and improvements !

 

What's MVC ? 


Model-view-controller (MVC) is a classic design pattern often used by applications that need the ability to maintain multiple views of the same data. The MVC pattern hinges on a clean separation of objects into one of three categories:'

  • Model - The model represents data and the rules that govern access to and updates of this data. In enterprise software, a model often serves as a software approximation of a real-world process.
  • View - The view renders the contents of a model. It specifies exactly how the model data should be presented. If the model data changes, the view must update its presentation as needed. This can be achieved by using a push model, in which the view registers itself with the model for change notifications, or a pull model, in which the view is responsible for calling the model when it needs to retrieve the most current data.
  • Controller - The controller translates the user's interactions with the view into actions that the model will perform. Depending on the context, a controller may also select a new view.
 The controller represents system input, the model represents processing and the view represents the output of the system.

By decoupling models and views, MVC helps to reduce the complexity in architectural design, and to increase flexibility and reuse. Because of this separation, multiple views and controllers can interface with the same model. Even new types of views and controllers that never existed before can interface with a model without forcing a change in the model design.

 

Interaction Between SAPmvc Components

 

Once the model, view and controller objects are instantiated, the following occurs:

SAPmvc

The view is registered as a Model's listener. Any changes in model's data result immediately in a broadcast change notification( Optional ), which the view receives.

Note that the model is not aware of the view or the controller, it simply broadcasts change notifications to all views interested listeners or just allows controllers and/or view to access its data.

The controller is bound to the view. This typically means that any user actions that are performed on the view will invoke a registered listener method in the controller class. The controller is given a reference to the underlying model.

 

Interaction between SAPmvc Components and User

 

Once a user interacts with the view, the following actions occur:

SAPmvc

The view recognizes the Dynpro action (e.g. pushing a button, request match code or request field help) in PAI and trigger the appropriate event, thus all event handler in controller that is listening this event is executed.

The controller access/update the model and call next view if it's necessary. If the model has been modified, it notifies interested views of the change. During the PBO the view trigger the appropriate events and all event handlers in controller that is listening this event is executed. In this moment the controller update the Dynpro accessing the data in the model.

 

SAPmvc has three classes:

 

ZSAPMVC_MODEL - It contain the data and the application rules.

 

SAPmvc supports nested and compound Models. A compound Model contains one or more Models as component Models. These may contain further Models as components. A number of levels of nesting are therefore possible.
Models that do not contain other Models are referred to as simple Models.

Model

ZSAPMVC_VIEW - It's responsible to controls the Dynpro.

 

 

Through the View is possible to take control to PF-Status, Table control, Tab Strip, Sub screen, modal screen, ALV's, etc....

View

View Dynpro

 

Through the View is possible to handle the events like AT-EXIT COMMAND, USER-COMMAND, POV ( ON-VALUE-REQUEST ), POV (ON-VALUE-HELP), etc....

Dynpro

ZSAPMVC_CONTROLLER - It's responsible to handler the user's interactions with the view that the model will perform.

Controller

 SAPmvc can be used for application in the ABAP Platform up to release SAP Netweaver 7.0.

11 Comments