As everyone knows, if you code an explicit commit or a call to BAPI_TRANSACTION_COMMIT inside a user exit or implicit enhancment within an SAP "posting" function module ("FM") that SAP has called "in update task", you will get a short-dump.
But I need someone to explain how and why SAP is allowing the following sequence of events to occur.
In the SAP function group V45U, there is an FM RV_SALES_DOCUMENT_ADD, and this FM is called "in update task" from the beleg_sichern form of the core SAP Sales Doc progtam SAPLMV45A.
At the end of the FM RV_SALES_DOCUMENT_ADD, I've coded an implicit enhancement which winds up calling a custom FM of my own in a custom function group. (This custom FM group is NOT called "in update task".)
Inside this custom FM, I do the following:
1) I insert a record into a custom transparent table (but of course do not commit it, because that would cause a short-dump.)
2) Later on, inside the same custom FM, I call SAP's FM MASTER_IDOC_DISTRIBUTE to send an IDOC, and when I get the IDOC number back from this FM, I successfully update the record that I've previously inserted into the custom table. (In particular, I update the previously inserted record with the IDOC number I get back from SAP.)
So how is it possible that I can update a record in a transparent table when this record hasn't yet been committed?
Here in the office, we're convinced that it must be because an "indirect" commit occurs during the SAP IDOC FM - either an explicit commit which SAP issues, or an implict commit at the end of this function.
Because if such an explicit or implict commit does occur within the SAP IDOC FM, it would of course commit the record that I previously inserted into the custom table, and that would explain why I can update this record with the IDOC number I get back from the SAP FM.
Can someone confirm that this is in fact what's happening, or set us straight as to how and when and why the inserted record is getting committed prior to the update of this record, even though this commit is taking place inside the larger context of an SAP "posting" FM that's called "in update task"?