Hi Luis,
But, and I hope we are agreen on this, BOL should be used it in a very specific layer, not in BADIs unless you are pretty sure in which layer is the BADI allocated, it's not the same the ORDER_SAVE BADI than the CRM_BP_UIU_DEFAULTS, right? To me calling the BOL inside the ORDER_SAVE is pretty much the same as calling the api CRM_ORDER_SAVE and In that level of application you may not have the BOL component set up or maybe yes, depends if you are calling it from a WebUI process or from an IDoc, Webservice, BDoc flow, etc. This uncertainty/lack of controll is reason enough to question the design and approach, don't you think? Remeber today we are using Web UI tomorrow we can use...well...whatever
I fully agree with you on this. My initial response was a little to brief. Of cause you have to take into consideration on which layer you are working. If you, e.g. are in a BADI in the GenIL layer using the BOL would naturally be the wrong choice.
However, I don't see any problems implementing, for example, a Web service using the BOL. Even if you will have to instantiate the BOL core with each call, I would always accept this overhead if it lead to cleaner design and maintainable code. That's the reason I'm suggesting to always check first if the BOL is suitable for a given requirement.
I sacrificed performance in order to be able to offer a better support during upgrades, enhancement packages or even changes provided by this black box we call SAP.
This is also a very valid design decision in my point of view. However, what I wanted to point out when I mentioned performance weren't this kind of conscious designs decisions but the "performance as an excuse" design decision. I have seen lots of custom code that was written without the use of any APIs by directly selecting from some tables because performance was very important. After a few iterations the result was unmaintainable and slow. The reason is that very few developers are able to implement better caching and optimizations then the ones available in the SAP standard APIs. Therefore, the first priority for me is always a clean design with clean code. If performance becomes an issue then, it's easy to optimize. The other way around its usually impossible.
Something else just came to my mind. Do you think it would be useful to create a list of layers / areas / BAdIs for which BOL should or shouldn't be used? We could e.g. create a Wiki page and collect this information there.
Christian