on 07-26-2007 3:57 PM
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.