Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_SALESORDER_CHANGE LOCK UP

Former Member
0 Kudos

Hello,

I hope you can help me.

In my programs, I call on the Bapi_Salesorder_change, this is me then lock. This lock will only be removed after completion program.

Is there a trick as I already can erase.

Thx

Bettina

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

I have encountered about the same issue with "lock" but with different BAPI. Below are the answers from SAP.

Dear Customer,

Regarding BAPI_ENTRYSHEET_RELEASE's lock problem, I found a following suggestion on this issue offered by our developer to a different

customer:

"Please insert into your report an additional statement at the mentioned position:

LOOP AT I_ESSR.

Insert: >>>>> SET UPDATE TASK LOCAL.

CALL FUNCTION 'BAPI_ENTRYSHEET_RELEASE'

... "

Please, try this suggestion in a test / development system first

and check it very carefully. Only if you are fully satisfied with the

results, carry them to your productive environment.

I hope the information above can help solve your problem.

And

Dear Customer,

Regarding your issue, I'm afraid this is the standard behaviour of BAPI:BAPI_ENTRYSHEET_CREATE. It is one kind of method by adding WAIT statement to avoid the locking error message occurs like you reported. And I also find a similar case reported by other customer and my colleague gave an answer about this, please make a reference to it:

"BAPI_ENTRYSHEET_CREATE and BAPI_PO_CREATE are identical in that they each contain their own 'Commit work'.

There are two possible solutions for this kind of situations:

1) Change the 'Commit work', in Function TRANSACTION_END to 'Commit work and wait'. However, this is a modification and will not be

implemented within any SAP patch/note.

2) Suppress the 'Commit work' of BAPI_ENTRYSHEET_CREATE, and then perform your own "commit and wait', or via use of

BAPI_TRANSACTION_COMMIT with the wait flag set.

This would be done within your own program by creating a new data

replacement for TRANSACTION_ID.

DATA: MY_TRANSACTION_ID LIKE ARFCTID.

Then call the FUNCTION 'TRANSACTION_BEGIN' using this new id, before calling the BAPI_ENTRYSHEET_CREATE.

This action will then suppress the internal 'Commit work'

Upon return from the call of BAPI_ENTRYSHEET_CREATE, you will need to code further to obtain the action of the FUNCTION

'TRANSACTION_END' so that the transaction is released and status set

to undefined."

Hope the information above can give you some help.

Regards,

Teddy

4 REPLIES 4

Former Member
0 Kudos

Hi,

I have encountered about the same issue with "lock" but with different BAPI. Below are the answers from SAP.

Dear Customer,

Regarding BAPI_ENTRYSHEET_RELEASE's lock problem, I found a following suggestion on this issue offered by our developer to a different

customer:

"Please insert into your report an additional statement at the mentioned position:

LOOP AT I_ESSR.

Insert: >>>>> SET UPDATE TASK LOCAL.

CALL FUNCTION 'BAPI_ENTRYSHEET_RELEASE'

... "

Please, try this suggestion in a test / development system first

and check it very carefully. Only if you are fully satisfied with the

results, carry them to your productive environment.

I hope the information above can help solve your problem.

And

Dear Customer,

Regarding your issue, I'm afraid this is the standard behaviour of BAPI:BAPI_ENTRYSHEET_CREATE. It is one kind of method by adding WAIT statement to avoid the locking error message occurs like you reported. And I also find a similar case reported by other customer and my colleague gave an answer about this, please make a reference to it:

"BAPI_ENTRYSHEET_CREATE and BAPI_PO_CREATE are identical in that they each contain their own 'Commit work'.

There are two possible solutions for this kind of situations:

1) Change the 'Commit work', in Function TRANSACTION_END to 'Commit work and wait'. However, this is a modification and will not be

implemented within any SAP patch/note.

2) Suppress the 'Commit work' of BAPI_ENTRYSHEET_CREATE, and then perform your own "commit and wait', or via use of

BAPI_TRANSACTION_COMMIT with the wait flag set.

This would be done within your own program by creating a new data

replacement for TRANSACTION_ID.

DATA: MY_TRANSACTION_ID LIKE ARFCTID.

Then call the FUNCTION 'TRANSACTION_BEGIN' using this new id, before calling the BAPI_ENTRYSHEET_CREATE.

This action will then suppress the internal 'Commit work'

Upon return from the call of BAPI_ENTRYSHEET_CREATE, you will need to code further to obtain the action of the FUNCTION

'TRANSACTION_END' so that the transaction is released and status set

to undefined."

Hope the information above can give you some help.

Regards,

Teddy

0 Kudos

Hi,

Thank you for the answer.

I have tried both ways. Unfortunately they do not.

regards

Bettina

0 Kudos

Hi Bettina,

You might need to find an OSS note or ask SAP about this issue. Because the BAPI should release the lock after it is done and not after the program complete. If you happen to find the solution, please kindly post it here. We might need it someday.

Anyway, I found a note 1024902 from OSS below.

Summary

Symptom

You want to change multiple sales and distribution documents within a loop using the BAPI_SALESORDER_CHANGE function module or create them using BAPI_SALESORDER_CREATEFROMDAT2.

This results in various problems if the call is not implemented correctly.

Other terms

BAPI, SD_SALESDOCUMENT_CHANGE

Reason and Prerequisites

This is a consulting note.

Solution

If you change multiple sales documents within a loop using the BAPI_SALESORDER_CHANGE BAPI or create sales documents using the BAPI_SALESORDER_CREATEFROMDAT2 BAPI, note the following:

1. Evaluation of the RETURN return table:

If the return table contains error messages (Type E or A), the system must call the BAPI_TRANSACTION_ROLLBACK function module and subsequently the SD_SALES_DOCUMENT_INIT function module (without parameters). BAPI_TRANSACTION_ROLLBACK rolls back calls registered for the update, SD_SALES_DOCUMENT_INIT initializes the global data that was created by the BAPI in the memory.

Before the call of the BAPI, ensure that no function modules 'in update task' are registered for the update. These can be calls in the SAP standard and calls in user-defined programs. In this case, the function modules would be unregistered again. The data would not be updated.

If the return table does not contain any error messages (type E or A), call the BAPI_TRANSACTION_COMMIT function module with the parameter WAIT = 'X'.

Note that function modules that were registered for update before the call of the BAPI (call 'in update task') are also executed by calling BAPI_TRANSACTION_COMMIT. This anticipates any actual commit work of the relevant application (SAP or user-defined application).

Cheers,

Teddy

0 Kudos

Dear Teddy,

Thanks, this is the Solution!!!