‎2006 Jun 30 7:13 PM
We are running a job in PROD that is taking alot longer than anticipated and will continue to run for the next day.
We are doing a
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
After every bapi call, hence every record in the input file.
Does it make sense to commit after every 1000 , if so:
1. How much time would we hope to gain (estimate)
2. what are the rollback issues?
Any ideas
‎2006 Jun 30 7:14 PM
Should have mentioned . we do the following Rollbakc or commit after every record
IF sy-subrc IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
RAISE update_failed.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
‎2006 Jun 30 7:19 PM
It's recommended to have BAPI COMMIT after each BAPI call.
Check code in the bapi if it's using update task, if it's there, SET UPDATE TASK LOCAL before the bapi call, it saves some time.
Regards
Sridhar
‎2006 Jun 30 7:21 PM
‎2006 Jun 30 7:23 PM
No, before the actual BAPI FM call, BTW what bapi is it?
Regards
Sridhar
‎2006 Jun 30 7:27 PM
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = key
objecttable = c_table
classnum = c_num
classtype = c_type
TABLES
allocvaluesnumnew = it_num
allocvaluescharnew = it_char
allocvaluescurrnew = it_curr
return = it_ret.
‎2006 Jun 30 8:12 PM
The bapi is not using update task, instead it's using perform on commit, so you must have bapi commit after each bapi call, because, if you commit after certain number of records, only the last one is going to be commited.
Regards
Sridhar
‎2006 Jun 30 7:34 PM
Are you sure that's the bottleneck? Have you checked ST05?
Rob
‎2006 Jun 30 7:38 PM
No. I am not sure. This cam second hand to me actually. I will have a look at the code.
‎2006 Jun 30 7:59 PM
THe bottleneck is actually more the db accesses it does prior to the BAPI call. but considering the lookups are required... the only thing I can think of doing is not committing every record to try to speed this up ?
‎2006 Jun 30 8:14 PM
Why don't you post the code of the database access. There may be issues there as well.
Rob
‎2006 Jun 30 8:26 PM
The database accesses are so many and cascade into many different function calls that its not feasible to post or analyse at this point. I am looking at another workaround now since I know I cannot move the commit.
thanks for your effort. I would like to know how you tell the BAPI is using PERFORM on COMMIT?
‎2006 Jun 30 8:36 PM
Here's the chain of FM calls leading to perform on commit: BAPI_OBJCL_CHANGE ->CACL_CLASSIFICATION_SAVE ->CLAP_DDB_SAVE_CLASSIFICATION -> perform insert_classification on commit (line 91).
Regards
Sridhar
‎2006 Jun 30 8:46 PM
Just checked inside the perform insert_classification tatement, there's an update task. Use SET UPDATE TASK LOCAL before the BAPI_OBJCL_CHANGE call, saves some time.
Yo still need to have bapi commit after the bapi call.
Regards
Sridhar
‎2006 Jun 30 8:57 PM
thanks.
waht are the implications of adding
SET UPDATE TASK LOCAL before the BAPI call. I read the documentation but not really clear on what it will add.
If I use it, do I need do do the BAPI COMMIT with a WAIT or without . I ask because the docuemtation states (see *)
The update works as before. The only difference is that it is not performed in a separate process, but in the same process as the calling program, i.e. when a COMMIT WORK occurs, processing does not continue until all the update requests have been performed. In the standard setting, the normal update task is always active.
‎2006 Jun 30 9:13 PM
Commit work an wait, keeps the calling program work process waiting untill all update tasks complte in the update work process.
Set update task local, makes all FM calls in update task to process in the calling program work process instead of update work process.
If a program is executing in background, waiting for update process to finish for each record takes time. SO if there are few table updates, set upd task local executes faster.
I've used this statement without any complications in scenarios like this.
BAPI commit with and without WAIT works the same if set upd task locl is used, but I would use BAPI commit with wait because, some bapis calls multiple commits, which deactivates local update.
Regards
Sridhar