Application Development and Automation 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: 
Read only

Change number locked while changing Document + BAPI_DOCUMENT_CHANGE2

Former Member
0 Likes
869

In my conversion program , i  creating a document info record(DIR) using BAPI   'BAPI_DOCUMENT_CREATE2' and then change the DIR using BAPI

BAPI_DOCUMENT_CHANGE2. If i do for few records in the Fore ground it works find, when i execute for huge number of records in back ground it gives message 'Change number locked by WF-BATCH'.Could you please suggest any solution apart from using WAIT statement, as this is not recommended as there will be huge number of records.

2 REPLIES 2
Read only

Former Member
0 Likes
653

hello,

Wait is required since the DB update takes a while before oyu can change the record. Another approach would be separate your processes. Do the Create first and then run another job for changing it, this way you do not need the WAIT statement.

best regards,

swanand

Read only

Former Member
0 Likes
653

Hi Shiva,

Use one Indicator Variable in your Program , like...

data : I_BAPI_TY(2) type C.

if I_BAPI_TY = 'CR' then Call your        

"BAPI_DOCUMENT_CREATE2"  then "BAPI_TRANSACTION_COMMIT.

elseif  I_BAPI_TY = 'CH'

"BAPI_DOCUMENT_CHANGE2"  then "BAPI_TRANSACTION_COMMIT .

else.

Error MSG Wrong Choice .

Endif .