‎2012 Jun 06 3:13 PM
Hello
I am trying to do performence tuning a RFC function module, thisRFC is creating sales orders from contracts by using BDC for VA01, well.
If the sales order is created in this BDC, in next step, we are changing the ship-to address by using VA02 BDC.
Obviously we have n number of custom code in SAPMV45A user-exits, but, i guess, these user-exits will be triggered based on scenarion (like maintaining flags, validations), pls. let me know
1) In performence perspective, do i need to change this BDC into BAPI (i knew BAPI is always recommendable, but, this RFC is widely used in many case, so, ppl scare to change the code code)? if it results very very good performce, then its worth, other wise, if its a little betterment, i guess, its not worthy bcz its widely used
2) There is check on VBAK after VA01 BDC that, whetehr the sales order is created in the system, for that we are using WAIT UPTO 5 SECONDS, but, am thnking to use the below code,
DO 1000 TIMES
SLEECT SINGLE auart
INTO lv_auart
FROM vbak
WHERE vbeln = lv_VA01_BDC_created_new_order
So, in performce perspective, which is best, either WAIT UP TO or DO LOOP?
Thank you
‎2012 Jun 07 8:32 AM
Well, I would not expect a huge difference between batch input and BAPI performance. But still, I do recommend to switch to BAPI calls. It has less overhead (dynpro processing) and has better maintainability/readability. What is also important for you, is the ugly "wait up to 5 seconds" statement can be removed. Changing of the ship-to party address should also be faster with change BAPI.
When you switch to BAPI, you'll need to call "BAPI_TRANSACTION_COMMIT" function after the call with "wait" flag, thus making sure that the changes are committed (at least V1 updates).
If you do not want to invest time/effort for rewriting your code and testing, I can suggest you one relatively small change. Your idea with 1000 selects is very bad. Never ever do it like this, especially without waits inbetween.
Instead, batch input (CALL TRANSACTION statement) allows using UPDATE 'S' flag which makes sure that the commit is finished. If you use it, you will not need "WAIT UP TO 5 SECONDS" anymore.
Regards,
Yuri
‎2012 Jun 06 6:23 PM
‎2012 Jun 07 6:39 AM
Hi!
Why don't you create a copy of this code and make the necessary changes and test it? In that case the other people who use the code will not be affected and if your code turns out better then you can implement it.
For your second question, I will not recommend running a DO loop for 1000 times with a select statement inside it. This means that each time the loop runs your program accesses the database which shouldn't be done. It is recommended that, Select statement that accesses a particular table should access it just once.
Please mark as correct or helpful answer if found fruitful.
‎2012 Jun 07 8:32 AM
Well, I would not expect a huge difference between batch input and BAPI performance. But still, I do recommend to switch to BAPI calls. It has less overhead (dynpro processing) and has better maintainability/readability. What is also important for you, is the ugly "wait up to 5 seconds" statement can be removed. Changing of the ship-to party address should also be faster with change BAPI.
When you switch to BAPI, you'll need to call "BAPI_TRANSACTION_COMMIT" function after the call with "wait" flag, thus making sure that the changes are committed (at least V1 updates).
If you do not want to invest time/effort for rewriting your code and testing, I can suggest you one relatively small change. Your idea with 1000 selects is very bad. Never ever do it like this, especially without waits inbetween.
Instead, batch input (CALL TRANSACTION statement) allows using UPDATE 'S' flag which makes sure that the commit is finished. If you use it, you will not need "WAIT UP TO 5 SECONDS" anymore.
Regards,
Yuri