on 09-16-2010 9:12 PM
Experts,
Could you please express your expert opinion on below scenario or similar scenarios that one come across in daily coding.
We have a BTOrder root object with us, we need to find a particular partner function and read its name from this point. We could go this way:
BTOrder->Btadminh->btpartnerall->in collection -> loop to read particular partner function ->read partner details
OR
from order guid we could call crm_order_read -> get partner no. -> call bupa_central_get_detail -> get all relevant data
this fm would internally call *OW module and try to read from buffer.
My question is ->
which is SAP recommended approach
Which is best from performance point of view considering we have lot of such reads to be done
Any particular caution one should take while coding in such scenarios (one i think would be make sure api and bol buffer are in sync in case using apis to read).
Please provide your valuable inputs in this regard
Thanks,
Rohit
Hi Rohit,
When it come to performance the best solution is to use the function moudles to read data. Because even if you use statements like get_related_entities at the end its the function module CRM_ORDER_READ that gets called.
There aren't any special precautions to be taken care. See to that that you don't use the function calls in methods that gets executed during every server event (eg: do_prepare_output, getter/setter methods etc.,). Prefer methods like do_init_context and store the data in a static internal table.
Regards,
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Catch 22!!!
My take is that if you have to fetch data from related entities and to achieve this if you have to traverse more then 2 level down then it's better to use a Standard FM, if provided.
The reason is, if yoy have to loop through the collection and for every entity you go more then 2 level down to fetch the data it will definately hit the performance!! It may seem weird though to some becase sometimes you have no option but to get data from related entities only. But that's the bargain you have to do for performance vis-a-vis functionality.
Rg,
Harshit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Arun and Harshit for the replies.
I would say your replies are in line with what I thought they would be, but I still would like to know what is the SAP recommended approach (if any) for these situations.
And if using function modules is more efficient - then BOL layers significance comes only while creating / modifying entities, right?
Then again, we could use crm_order_maintain - as ultimately before saving this function module only would be called along with crm_order_save in the btil classes.
I hope I am making some sense - I just want to know how and when exactly is BOL layer useful in comparison with the function modules (both in read and write).
Warm Regards,
Rohit Khetarpal
User | Count |
---|---|
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.