‎2009 May 10 2:34 AM
Hi experts,
I need to do enhance to post additional 313 movement after post 962 movement.
I picked up MB_DOCUMENT_BEFORE_UPDATE to be triggered after press save button and used BAPI_GOODSMVT_CREATE to post 313.
The problem is BAPI_GOODSMVT_CREATE returned error 'Enter Plant'!.
All parameters were already tested with SE37 and it worked great.
I did a lot debugging and found that all MSEG data were mysteriously cleared after it run 'PERFORM fusszeile_wa_pruefen(sapmm07m) USING x.' in source code SAPLMBWL.
After that, I tried a new way. I submitted my Z program ,which call BAPI_GOODSMVT_CREATE with exactly same parameter, in BADI and it returned error that material ... batch ... is already locked.
I'm not sure that is it possible to post additional material document in this BADI(MB_DOCUMENT_BEFORE_UPDATE).
Best regards,
Amornpon
‎2009 May 10 4:57 AM
r u using COMMIT WORK or BAPI_TRANSACTION_COMMIT? i guess, u know that, its not supposed to use COMMIT WORK and BAPI_TRANSACTION_COMMIT in badis, inperspective of data integration, data guarantee!!!
So, try to build a custom FM (instaed of SUBMITting ur Z report) and call it with addition of NEW TASK in ur badi .
thanq
‎2009 May 10 5:38 AM
Thanks for reply.
I did create FM and called it in BADI but it gave the same result as I called BAPI directly from enhance program.
and what do you mean 'NEW TASK' Is that you mean call function in update task?
I did try call function in update task but it didn't work.
The problem is BAPI function returned that Mat XXX Batch XXX is alreay locked by XXX and also cannot get created material doc number.
‎2009 May 10 5:46 AM
Before executing BAPI its good Idea to check if that data is already Locked for editing or so, so that BAPI does not error out. As far as your problem with BAPI is concerned you will be able to solve them after proper analysis. I could sense the problem in code.
Regards
Shital
‎2009 May 10 5:57 AM
I think that I get the problem wrong.
The problem actually causes by MB11. When I entered material ,batch, sloc, qty ,the MB11 will lock this batch for material I entered. That is why I cannot do any MIGO related to this batch.
I think that I cannot post additional MIGO in MB_DOCUMENT_BEFORE_UPDATE anyway but is there any way that I will be able to post 313 after MB11 unlocks this batch?
‎2009 May 11 6:17 AM
I will use batch session. It will work for sure but it needs manual action.
Thanks
‎2009 May 11 11:04 AM
Hi,
An alternate way to achive a solution to your problem is to trigger a workflow after you do the first posting.
When the first posting is done, the workflow event will be triggered.
In this workflow you can write the code for the 2nd posting.
Regards,
Ankur Parab