cancel
Showing results for 
Search instead for 
Did you mean: 

WDA Model Design Question

Former Member
0 Kudos

Hi everyone. We are creating ESS applications in WDA. I just have a design question regarding model classes.

Just in case the WAS and the SAP HR system are on different servers all our function module/bapi calls must be in RFC. Destination 'NONE' if the WAS and the SAP HR are running on one system. This is determined through a configuration table.

We have a model class that will function as the base class for all model classes that we plan to use. This base class has common utility methods that we use like locking/unlocking an employee, determining the currently logged in user etc... In the class constructor of this base class we determine if the WAS and SAP HR are on different systems and the RFC destination is stored in an attribute of this base class so all function module calls within the base class and subclasses should include the destination clause with the attribute containing the RFC destination name. So all RFC calls are encapsulated in the model class methods.

ex. call 'REMOTE_FUNCTION'

destination me->rfcdest

The model class subclassed from this base class is then added as an attribute of the web dynpro assistance class and is instantiated in the constructor of the assistance class. This guarantees that the model class is always instantiated by the web dynpro framework automatically.

Then all database access is done through wd_assist->model->get_some_data( ).

Advantages are because all model classes are derived from one base class all the utility methods are there as well as the RFC destination is always properly determined in all model classes.

Another way to do this would be to use the assistance class as the model, however it would not be possible for the assistance class to inherit from the base class therefore I lose all my utility methods and rfc destination determination.

And yet another way to do this would be to call the RFC's directly from the component controller or custom controller methods with the destination being determined individually by each web dynpro component.

I find the first technique more elegant then the others. Does anyone have any inputs? If anyone has a better way to do this please let me know. Your comments are very much appreciated.

Generous points will be awarded! Thanks guys!

Accepted Solutions (0)

Answers (2)

Answers (2)

thomas_szcs
Active Contributor
0 Kudos

Hi Alexander,

Personally, I would move all rfc calls to either the assistance class or some other class. You will than have the power of the class builder and its associated tools on your disposal along with all the neat abap language features being usable. Web Dynpro has to a bit more restrictive here. In addition, having that stuff outside of the Web Dynpro component allows for great reuse.

Best regards,

Thomas

Former Member
0 Kudos

Hi,

the best way would be to have the Central Model Class and with the attribute as a RFC Destination. So that it could be used in other WDA as well and it would be best suited for MVC Concept where we would be clear picture of Model Concept.

Cheers