Skip to Content
As a beginner it is very confusing how to map the model nodes and the value nodes in the WebDynpro. In my initial works, it was a common practise that I followed, to map the model nodes into the view. It causes a lot of problems when the model structure gets changed. With many a times the model re-import not working as it is supposed to work, I have had the worst of times to re create the model,re-perform the mapping into the view and many a times to the UI elements that make up the screen design. I am not so sure of the avenue that the WebDynpro developers really travel. So I expect the experts to correct me if I am going astray.

The underlying motto of what I have written is to keep things simple and I feel that, one way of doing this is to keep the model node away from the view. I tried it in my recent work and found it useful and worth sharing.

image

According to the above mapping model the View contains the screen layout which forms the presentation logic. It should contain the value nodes and value attributes which would assist in the creation of the presentation. Try to avoid mapping the model nodes into the view.Instead map the model nodes and the value node into the controller and write methods which would help in copying the values from the model node to the value nodes and vice versa.

Now suppose there is any structural change in the backend and the deletion of the model becomes a necessity. Then you can go ahead delete the model and then create it again. As the RFC do not have any mapping with any other components other than the component controller you need to bother only about change in the method which copies the values to the corresponding nodes. Thereby reducing many overheads you might have to come across.

This method of developing WebDynpro application was helpful in creating small components (one view and RFC as backend) and change in the model would mean only that a change in the component controller is required. This was not however tested in big applications containing numerous screens which would load the component controller heavily. Also the methodology in the light of dynamic programming is also to be tested for.

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Harsh Chawla
    Hi Noufal,
       Can you elaborate with an example method? I personally feel that it is not a very good idea to break the mapping chain(model->controller->view) and insert custom code, especially if the methods are custom coded for each instance. That is, the method implementation is not generic and depends on the structure of the node being handled.
    Regards,
    Harsh
    (0) 
    1. Valery Silaev
      +1

      Also: do you know (I believe you do), that value/model node divide is a bit artificial, and exists at design time only? At run-time you have homogenous API for all nodes (hmmm, actually there is just one type 😉

      Also in early builds of NW 7.1 there is no such divide even at design time 😉

      VS

      (0) 
      1. Anonymous
        best to make your attributes the same name as the model attributes then use WDCopySerivice to copy dat a from model to value node and vice-versa.
        (0) 
    2. Anonymous
      Hi Harsh,

      As I have already said I have not tested the above method too much. I used it just in one of the recent works of mine.

      The work I did was,

      I need to display a table, data comes from the RFC. I created the table by binding the table UI with the value nodes and in the controller, I wrote the function copying values from the model node from the RFC to the value nodes.

      Later due to change in the RFC  a re-import was necessary. Even the re-import was not working (even after the server restart )and I ended up re creating the model. Other than changing the method in the controller and a simple mapping to the controller, it did not affect the view.

      I tried this because I have seen in may forum posts that they never wanted to delete the model just because the re-mapping was a complex work. So I felt that it was better to isolate the view from the back end model.

      Regards,
      Noufal

      (0) 
    3. Pran Bhas
      Hi Harsh

      I have more often required to break the model -> controller ->view mappings than not,Several use cases have presented where model node object graphs are not appropriate for a UI control, Eg:Data in tables need to be populated to recursive node for a tree element, or if I had to use calculated attributes, or if a table control was used for both read and write.However I also use the WDDCopyService to do mass transfer of data wherever possible.

      (0) 
      1. Harsh Chawla
        Hi Pran,
           “Several use cases have presented where model node object graphs are not appropriate for a UI control.” In such cases I totally agree that there is no choice, you need to do some sort of processing on the data coming from the model to make it suitable for the UI. However I was refering to the cases where a direct mapping would suffice. There again I could be wrong, but I’ve used direct mappings in such cases.

        Also Pran/Gary can you tell us a bit more about the WDDCopyService and an instance where one should use it.
        Thanks & Regards,
        Harsh

        PS: Did anyone get what Valery was saying about the “value/model node divide”? 🙂

        (0) 

Leave a Reply