2006 Dec 08 11:51 PM
Hi forum!
I'll to start a new project in ABAP and i want to use the mvc approach, i really need examples, one of them can be a controller class handle 2 UI's (in a function group each), how to handle Ok_code, how to call the first screen when the user push 'BACK' on the second one, etc....
I want switch to this programing model, i know that in classic dynpro i have to handle the mvc approach by myself.
Any information can be very helpful,
Thanks in advance,
John.
2006 Dec 09 1:00 PM
Thanks for your help Uwe,
I did 2 function groups and each one have an function module, my function module export the ok code, but how do you handle the back button if you always leave to screen 0 to exit the function module?. or you handle the pai event with an event?
I mean, if you have a fm "A" , when the ok code is pressed, it leaves to screen 0 to exit the function module, then, in your controller class you handle the ok code and call fm "B", but, when you hit 'BACK' you leave again to screen 0, exit the FM, handle the ok code and then call again fm "A"?, but if i want to press forward, back, forward, back 10+ times?
thanks in advance, i'm a little confused here
John.
Hi forum!
I'll to start a new project in ABAP and i want to use the mvc approach, i really need examples, one of them can be a controller class handle 2 UI's (in a function group each), how to handle Ok_code, how to call the first screen when the user push 'BACK' on the second one, etc....
I want switch to this programing model, i know that in classic dynpro i have to handle the mvc approach by myself.
Any information can be very helpful,
Thanks in advance,
John.
2006 Dec 09 9:31 AM
Hello John
I recently developed a report completely OO-based using the MVC approach. The "report" contained two dynpros, one for the summary ALV lists and one for the detailed ALV list.
My <b>controller class</b> corresponded to the classical frame report. Within this controller I created my <b>model class</b> (holding all the business logic) and my view class. The <b>view class</b> created all the required container and ALV grid instances.
In order to display the ALV lists I called a function module to which I exported simply the reference to the containers holding the ALV lists. In the function module I linked this reference to the completely <b>empty</b> dynpro using the container's link method (e.g. go_docking->LINK).
The dynpros contained no flow logic except for calling the next or the previous dynpro. When the user pushed a button this ok-code was exported from the function module to my controller class which execute the corresponding function. Again, the dynpro did not handle any ok-code but is only used to display data.
Hope I could give you some ideas how to move on with your own project.
Regards
Uwe
2006 Dec 09 1:00 PM
Thanks for your help Uwe,
I did 2 function groups and each one have an function module, my function module export the ok code, but how do you handle the back button if you always leave to screen 0 to exit the function module?. or you handle the pai event with an event?
I mean, if you have a fm "A" , when the ok code is pressed, it leaves to screen 0 to exit the function module, then, in your controller class you handle the ok code and call fm "B", but, when you hit 'BACK' you leave again to screen 0, exit the FM, handle the ok code and then call again fm "A"?, but if i want to press forward, back, forward, back 10+ times?
thanks in advance, i'm a little confused here
John.
2006 Dec 09 2:46 PM
Hello John
My solution for handling the ok-codes is like you described. In the controller method (e.g. HANDLE_USER_COMMAND) I used a DO loop to evaluate the ok-codes.
METHOD handle_user_command.
md_okcode = 'DISPLAY'. " set default ok-code = display first dynpro
DO.
CASE md_okcode.
* display summary ALV lists on first dynpro
WHEN 'DISPLAY'.
CALL FUNCTION '...'. " containing the first dynpro
* display detailed ALV list on second dynpro
WHEN 'DETAIL'.
CALL FUNCTION '...'. " containing the second dynpro
WHEN 'BACK' OR
'CANC'.
EXIT. " leave DO loop
ENDCASE.
ENDDO.
ENDMETHOD.The trick is that the function module for the second dynpro changes a 'BACK' command to a 'DISPLAY' command before returning it to the controller method.
I hope I could clarify my logic. Of course, this is just one way to solve this problem.
Regards
Uwe
2006 Dec 09 3:18 PM
Uwe,
Thanks for your approach, it was very helpful.
Regards,
John.
2007 Jun 14 8:11 AM
Hi John,
I also want to develop a simple report by using the mvc-approach and I'm looking for some examples. Is it possible to post the classes you have developed? You could use <a href="http://code.google.com/p/saplink/">SapLink</a> to post it.
Thanks in advance,
Frank Classens
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |