cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro context Best Practices

Former Member
0 Kudos

Hello Experts,

While i am going through the Best Practices for optimizing web Dynpro applicaion performance document provided by SAP,there is a point which talks about best practices for Web Dynpro contexts while using ARFC models.

the point is :Donu2018t Declare Context Model Nodes and Attri- butes NOT used for Data Binding Purposes.

Further explanation for this point is:

When model data retrieved via backend connections (Adaptive RFC, Web Service, EJB) has NOT to be transferred to the user interface via data binding:

􀂄There is no need to declare context model nodes and attributes bound to model classes and attributes for storing business data in the context.

􀂄Just programmatically operate on model objects directly to access model data in your controller classes

By omitting the definition of a context-to-model binding relation in a controller context, the generated context interfaces are kept as slim as possible, and this reduces the permanent memory space* on server side.

Can some body explains what exactly meaning of this Best practice?

Futher to this Best Practice,i want am looking for some suggestions in my current scenario.

In Our application we have model nodes created for each RFC and we do have Value nodes which are similar to model nodes.After RFC FM is executed ,data from model nodes are copied to value nodes with some processing and these values nodes are used throughout the application.Now my webdynpro context is holding similar data with some changes in two context nodes(Model and Value).I want some suggestion on reducing memory consumption.

Thanks in Adavance.

Regards,

Balaram Naidu

Accepted Solutions (0)

Answers (1)

Answers (1)

pravesh_verma
Active Contributor
0 Kudos

Hi Balaram,

There are various best practices for any kind of framework you are working in. I guess you already know the meaning of best practices, however, I gues you just wanted to know what is best practice for webdynpro framework.

Best practcies is nothign but what to do what not to do while developing application to increase the efficieny of the code and make it performance effective.

Now for your scenario:

1) Since you have already got the modeled nodes and there is change in only 2 of your nodes therefore I would suggest not to make the copy of those modeled nodes whose data is not edited in the application.

2) If you have some kind of the save() or flush() or comit() method exposed from the BAPI, then I guess I guess no need to make the copy of the modeled node. You can just set the values of the attributes used in the modeled node directly and then can flush use the save()/ flush() methods...

3) However if you have some tricky modifications in the modeled node then probably you need to copy the vaue of te modeled node to value node. Make the changes to the value node. And while saving get the value from Value node and set it back to Modeled node before doing save(). This will help in removing the performance hit during the copy of elements from modeled node to value node.

4) Youcan also make sure that once you dont require the values in Value node you just invalidate() that value node so that it does ot hold any data.

5) Or if you want to execute the model again and get new values from the modeled node to copy into the value node. Just invalidate() the value node and then copy the elements from modeled node to value node. You need not have to use the node.removeElements() method. Inlidating the node will solve this purpose.

There are lot of other best practices it just depends no your scenario. What may be the best practice for your case may hold good for other scenario.

I hope this helps!!

Thanks and Regards,

Pravesh

Former Member
0 Kudos

Hi Pravesh,

Thanks for your quick response..

What i am looking for is what exactly the meaning of the best practice that i have mentioned.

Second point is We have developed out application based on model nodes and copy of it's data in value nodes .There value nodes data is used in entire application.So we can't avoid that as it already in procution.I am looking as if there is any mechanism to invalidate the model data after it is copied to values nodes.

Thanks in adavance

Regards,

Balaram Naidu

pravesh_verma
Active Contributor
0 Kudos

Hi Balaram,

That's what I thought! I was confusing with the question as to whether you are asking for the meaning of Best Practice or something else !!

The practice which yiu have given is just mentioning that if you dont require much operations on the model nodes you can just execute the model directly get the required values from the model output and can store them in some value nodes to operate upon them.

You need not have to create the model node in that case. Just craete the model object and execute the model. Get the result out of the model and use it directly.

This will save the memory in trhe sence that you need not have to create the model node in the contoller side. So there is no Model-Context mapping happening. Directly youa re using the model values from result for your application.

handling in this way will keep the Controller context as slim as possible, as you are avoiding the overhead of creating the model node.

I guess if you are doing nothing with the model node except from copying the values of model node to Value node then you can also go for this method. If you are using this way then you need not have to invalidate the model node.

Also for you anotehr question:

>>I am looking as if there is any mechanism to invalidate the model data after it is copied to values nodes.

Ans: There is no much difference even if you invalidate the model node after the copying. As invalidate function will just reinstantiate the model node instead of deleting the values from model node. However you can invalidate the Value node once your operation with that value node is over. This will make the context attribute holding mode slimmer.

I hope this will clarify your issue. Please close the thread if issue is resolved Or revert back in case you need any further information.

Thanks and Regards,

Pravesh

Former Member
0 Kudos

Hi Pravash,

Thank you very much for detailed explanation.Still there are some points not clear time.As you suggested in our case, we can directly use model class with out going for model binding.Does that means i can directly create object for model class like BAPI_PO_GET_LIST_INPUT obj = new BAPI_PO_GET_LIST_INPUT() and call execute method.This calls RFC FM module in Back end system and returns results,using the same object we can fetch all out put parameter values as well,There out put parameter values can be copied to my values nodes,This will autmatically invalidate the model objects after method scope.so each time RFC is called,instane for input class is created and execute method is called with appropraite parameters.

Can you plz check whether my understanding is correct or not?

Thanks,

Balaram Naidu