on 05-26-2017 2:19 PM
Hi All,
Help needed!
I've been facing this strange problem for sometime. I'm using BAPI_GOODSMVT_CREATE to post a stock transfer from plant to plant during creation of Sales Order. Now, a line item in Sales Order might have unrestricted stock in multiple batches( txn. MMBE). So, I will have to call the BAPI multiple times to post multiple batches. Eventually, I'm calling this BAPI inside a loop. Now, the real problem is, it posts the material document on the first iteration of the loop. It doesn't post on subsequent loops. So, my goods movement is done from only one batch. I added a BAPI_TRANSACTION_COMMIT after the call, still it doesn't post after the first iteration. This happens in random sales orders. Not everytime.
Thank You!
Did you look at the return parameter of the BAPI_GOODSMVT_CREATE? When calling the BAPI inside a loop, you could encounter issue that the material/plant locks created by previous call may not have release yet. You could try putting a wait of 3 sec after commit statement to prevent this. Or could try commit only outside the loop.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the response Sireesh. I thought of doing this. But, do you think adding a 3 second WAIT might have an impact on the performance? Also, I did try this earlier in another program, as a 5 second pause and it only works when i debug the program. It doesn't when the program is run on the fly or if it is part of a transaction. The moment I save the Sales Order, I'm able to see the record in the table the next second.
Thanks,
Harish M
You might want to read the answer again - the first suggestion was to look at the return table of the BAPI. Are you doing that and when the document does not get posted don't you see any messages in the table?
Before taking an action you need to establish the root cause first. Otherwise you could be solving a non-existent problem.
Also post the actual code when asking such questions.
Harish,
Please check and report on the return parameter of the BAPI. Since this is not happening in debug, you might want to use Message or write statement.
Based on how you are describing, if this is working in Debug and not otherwise, it could most likely be a Lock issue at the material/plant level. Just for testing purpose, you could introduce a 5 sec wait after commit. It will definitely effect the performance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
106 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.