Bapi BAPI_GOODSMVT_CREATE lock issues
Hi all,
I have a problem with BAPI_GOODSMVT_CREATE, FM
I have using this to post goods movement type 309 & 321 and I am calling this in LOOP as there are more number of goods movement.
In each iteration i have to post the goods movement and after that i have to create the delivery using bdc MBRL Tcode.
The problem is the BAPI is locking the Material document number even after posting the goods movement for a while. Because of this the delivery creation is failing.
After BAPI i'm using BAPI commit work FM
I have used FM deque_all, but its not working. wait up to 2 secs.
Even the combination of deque_all & wait up to 2 secs is not working.
Is there anyother way to release locks?
Thanks
Hi,
Try this way ......
SET UPDATE TASK LOCAL.
if sy-subrc eq 0.
call function BAPI_GOODS_MVMT_CREATE
endif.
if return is initial with no errors then
SET UPDATE TASK LOCAL.
if sy-subrc eq 0.
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = return.
endif.
Similar Messages
-
BAPI_GOODSMVT_CREATE lock issue with no access to ABAP!
Hello everyone,
I have written a class in vb .NET that uses the BAPI_GOODSMVT_CREATE to post goods issues. I have done numerous tests myself which all were successful. However, when a colleague wanted to test my class he suddenly got the following error "The plant data of the material <XXXX> is locked by the user <XXXX>". The user specified is the standard background user we use for RFCs. So basically the user is blocking himself.
This issue seems to be quite common as Google turns up with numerous results. They either end up with people being desperate and giving up or finding solutions in ABAP. However, my team has no access to ABAP since SAP-programming has all been outsourced to India. Getting any changes done in ABAP will be a long and tedious progress for which we simply do not have the time.
Is there anyway to resolve this issue on our side? Maybe through other RFCs or changes in how we handle the BAPI? I am quite desperate as this problem occurred shortly before we wanted to go live and now it is not sure we can even do anything on our side.Hi Tom,
If you want to call DEQUEUE_ALL from vb.net then tell your ABAP counterpart to create a new remote enabled function module and he can subsequently make a call to DEQUEUE_ALL in the custom developed function module through ABAP. You can then call the newly created custom function module using its calling parameter.
Also, if required he can expose that newly custom created function module as a webservice that you can call from vb.net.
I hope its clear to you now about how can you access it from vb.net.
Regards,
Sachin -
Delivery Document Lock Issue in Z Program using BAPI(s)
Hi,
I am a functional consultant posting this in ABAP forum. We have developed a Z-Program.
User enters the Service Order no. in this program and executes it.
The program then updates the following linked documents in the following sequence using BAPI(s)
Outbound Delivery
Service Notification
Service Order (This is done using BDC of IW32)
It sometimes happens that once the Program reaches the iw32 bdc, it gives error "Delivery XXXXXXXX is locked by User ID XXXXXX"
The user ID being that of the person executing the transaction.
This happens like 3 out of 100 times in the Production Server. We are unable to replicate this issue in Quality or Development Server.
We believe it to be a performance issue (database updating is slow)
However Client wants us to investigate the Program and see what is possible.
We are thinking of putting WAIT after the BAPI(s) of the Delivery Update.
Any suggestions, please help.Hello Suhas,
Thanks for the reply.
These documents are seperate objects but are interlinked. i.e I can see in the Document Flow for Service Order, which is the Service Notification and Outbound Delivery for the Material.
Also, If I'm in change mode in the Outbound Delivery, I cannot go into the change mode of the Service Order.
Yes, we are using BAPI_TRANSACTION_COMMIT after each BAPI in the Program. We have used the Wait Statement in all BAPIs for the Service Notification. These BAPI(s) are before the IW32 BDC.
I am copying code from one of the commit BAPI(s)
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_x.
WAIT UP TO 1 SECONDS.
I noticed in the Outbound Delivery BAPI(s) (two of them) don't have the wait in the BAPI_TRANSACTION_COMMIT. Hence I though if we add this, could this resolve the issue?
Service Order gets updated last through BDC for IW32 after all the BAPI(s) are executed for Outbound Delivery and Service Notification.
I understand WAIT would increase processing time, that is why I am posting this to know if we have some other solution available for such a lock issue. -
Goods issue using bapi BAPI_GOODSMVT_CREATE getting error E M7
HI consultants,
While posting goods issue using bapi BAPI_GOODSMVT_CREATE . Running the batch job(zprogram) to post the goods issue . The goods issue is been posted by passing goods receipt data's.
while processing 3 goods receipt , 2 works fine one goods receipt getting E M 7 300 NO ITEMS ARE TRANSFERED error.
when i processing one by one all the 3 goods receipt is working fine and process sucessfully. While processing in bulk ,i am getting this issue.
If anybody faces this same problem or knows the solution .Please post the answer.
The way i am passing the parameter to bapi given bellow.
WA_GOODSMVT_CODE-GM_CODE = C_03.
*--populate header data
WA_GOODSMVT_HEADER-DOC_DATE = WA_MKPF-BLDAT.
WA_GOODSMVT_HEADER-PSTNG_DATE = WA_MKPF-BUDAT.
*--populate item data
*-- call the bapi for posting goods issue
IT_GOODSMVT_ITEM-NETWORK = WA_RESBP-AUFNR.
IT_GOODSMVT_ITEM-RESERV_NO = WA_RESBP-RSNUM.
IT_GOODSMVT_ITEM-RES_ITEM = WA_RESBP-RSPOS.
IT_GOODSMVT_ITEM-ACTIVITY = WA_RESBP-VORNR.
IT_GOODSMVT_ITEM-MOVE_TYPE = C_281.
IT_GOODSMVT_ITEM-ENTRY_QNT = WA_RESBP-NET.
*--get the item details
IT_GOODSMVT_ITEM-MATERIAL = WA_MSEG-MATNR.
IT_GOODSMVT_ITEM-PLANT = WA_MSEG-WERKS.
IT_GOODSMVT_ITEM-STGE_LOC = WA_MSEG-LGORT.
IT_GOODSMVT_ITEM-ENTRY_UOM = WA_MSEG-ERFME.
CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
EXPORTING
INPUT = WA_MSEG-PS_PSP_PNR
IMPORTING
OUTPUT = WA_PSPHI_TEMP.
IT_GOODSMVT_ITEM-WBS_ELEM = WA_PSPHI_TEMP.
APPEND IT_GOODSMVT_ITEM.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = WA_GOODSMVT_HEADER
GOODSMVT_CODE = WA_GOODSMVT_CODE
IMPORTING
MATERIALDOCUMENT = WA_MATERIALDOCUMENT
TABLES
GOODSMVT_ITEM = IT_GOODSMVT_ITEM
RETURN = IT_RETURN.
With Regards,
Ambrose Mohandoss.Problem solved.
-
Locking issue with BAPI_GOODSMVT_CREATE in userexit_save_document
Hello All,
I am performing a separate goods movement for one of the materials in the delivery userexit_save_document during PGI. I have an issue. We might have multiple users trying to PGI deliveries and thereby performing the goods movement for the same material through the BAPI in the userexit_save_document.
How do I prevent the locking issue when say two users go through the BAPI for goods movement for the same material data at the same time.
Any answer in this regards is highly appreciated.
Thanks,
MathangiThanks Rich... this make work for me, but one question -
Do you know if this function releases all lock objects for the user system wide or only for the current session? My concern is that if it is system wide, then I could be releasing lock objects for other sessions unintentionally. For example, if there are multiple RFC calls in parallel for the same function and same user then I could be destroying lock entries that I shouldn't be! I am hoping that it removes lock entries only for the current session...
any ideas?
Regards,
Lee
> I've used this BAPI in many of my programs, and
> always after the call, I code.....
>
>
>
> commit work and wait.
> call function 'DEQUEUE_ALL'.
>
>
>
> The DEQUEUE_ALL show release any/all locks.
>
>
> Regards,
> Rich Heilman -
BAPI --- /AFS/BAPI_GOODSMVT_CREATE --- Goods Issue --- AFS
I am trying the BAPI for Goods Issue for Production Orders with reference to a reservation in AFS and getting this error message when executed.
E 8J 607 Internal error
I tried the information found in the page BAPI_GOODSMVT_CREATE - GI for GR but it didn't work out.
I used following fields to send the data to BAPI
/AFS/BAPI_GOODSMVT_CREATE
PSTNG_DATE = 10.01.2008
DOC_DATE = 10.01.2008
PR_UNAME = USER1
GM_CODE = 03
MATERIAL__________= 2004237
PLANT_____________= 1000
STGE_LOC_________= RMPL
BATCH_____________= 0366M
GRID_VALUE________= M
MOVE_TYPE________= 261
SPEC_STOCK_______= E
SALES_ORD________= 40003
S_ORD_ITEM________= 000010
ENTRY_QNT_________= 10.0
ENTRY_UOM________= EA
ORDERID___________= 1046778
VAL_SALES_ORD____= 40003
VAL_S_ORD_ITEM____= 000010
RESERV_NO_________= 0000883202
RES_ITEM___________= 0003
RES_TYPE__________= ' '
Any help is appreciated.How did you solve it?
-
How to post Excise Invoice in GR using BAPI BAPI_GOODSMVT_CREATE ?
Hi,
I want to post Goods Receipt job (MB01) through BAPI 'BAPI_GOODSMVT_CREATE'.
But is there any parameter to post 'Excise Information' through (this/any) BAPI ?
Pls...... answer me soon.
thanks by advance.SEE THE FOLLOWING EXAMPLE
report zbapi_goodsmovement.
parameters: p-file like rlgrap-filename default
'c:\sapdata\TEST.txt'.
parameters: e-file like rlgrap-filename default
'c:\sapdata\gdsmvterror.txt'.
parameters: xpost like sy-datum default sy-datum.
data: begin of gmhead.
include structure bapi2017_gm_head_01.
data: end of gmhead.
data: begin of gmcode.
include structure bapi2017_gm_code.
data: end of gmcode.
data: begin of mthead.
include structure bapi2017_gm_head_ret.
data: end of mthead.
data: begin of itab occurs 100.
include structure bapi2017_gm_item_create.
data: end of itab.
data: begin of errmsg occurs 10.
include structure bapiret2.
data: end of errmsg.
data: wmenge like iseg-menge,
errflag.
data: begin of pcitab occurs 100,
ext_doc(10), "External Document Number
mvt_type(3), "Movement Type
doc_date(8), "Document Date
post_date(8), "Posting Date
plant(4), "Plant
material(18), "Material Number
qty(13), "Quantity
recv_loc(4), "Receiving Location
issue_loc(4), "Issuing Location
pur_doc(10), "Purchase Document No
po_item(3), "Purchase Document Item No
del_no(10), "Delivery Purchase Order Number
del_item(3), "Delivery Item
prod_doc(10), "Production Document No
scrap_reason(10), "Scrap Reason
upd_sta(1), "Update Status
end of pcitab.
call function 'WS_UPLOAD'
exporting
filename = p-file
filetype = 'DAT'
IMPORTING
FILELENGTH =
tables
data_tab = pcitab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
OTHERS = 6
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
gmhead-pstng_date = sy-datum.
gmhead-doc_date = sy-datum.
gmhead-pr_uname = sy-uname.
gmcode-gm_code = '01'. "01 - MB01 - Goods Receipts for Purchase Order
loop at pcitab.
itab-move_type = pcitab-mvt_type.
itab-mvt_ind = 'B'.
itab-plant = pcitab-plant.
itab-material = pcitab-material.
itab-entry_qnt = pcitab-qty.
itab-move_stloc = pcitab-recv_loc.
itab-stge_loc = pcitab-issue_loc.
itab-po_number = pcitab-pur_doc.
itab-po_item = pcitab-po_item.
concatenate pcitab-del_no pcitab-del_item into itab-item_text.
itab-move_reas = pcitab-scrap_reason.
append itab.
endloop.
loop at itab.
write:/ itab-material, itab-plant, itab-stge_loc,
itab-move_type, itab-entry_qnt, itab-entry_uom,
itab-entry_uom_iso, itab-po_number, itab-po_item,
pcitab-ext_doc.
endloop.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gmhead
goodsmvt_code = gmcode
TESTRUN = ' '
IMPORTING
goodsmvt_headret = mthead
MATERIALDOCUMENT =
MATDOCUMENTYEAR =
tables
goodsmvt_item = itab
GOODSMVT_SERIALNUMBER =
return = errmsg
clear errflag.
loop at errmsg.
if errmsg-type eq 'E'.
write:/'Error in function', errmsg-message.
errflag = 'X'.
else.
write:/ errmsg-message.
endif.
endloop.
if errflag is initial.
commit work and wait.
if sy-subrc ne 0.
write:/ 'Error in updating'.
exit.
else.
write:/ mthead-mat_doc, mthead-doc_year.
perform upd_sta.
endif.
endif.
FORM UPD_STA *
form upd_sta.
loop at pcitab.
pcitab-upd_sta = 'X'.
modify pcitab.
endloop.
call function 'WS_DOWNLOAD'
exporting
filename = p-file
filetype = 'DAT'
IMPORTING
FILELENGTH =
tables
data_tab = pcitab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
OTHERS = 6
ENDFORM. -
Error while using BAPI BAPI_GOODSMVT_CREATE for Momvent type 321
Hi Guys,
We trying to transfer material from Inspection to Un.Stock by using momvent type 321...In SAP we do QVM1 and do stock postion.
We are using BAPI BAPI_GOODSMVT_CREATE getting this error " E QA 495 Change the inspection stock of material 11036125 in QM only".
Any one have any idea how to overcome this issue.
AtulHi Sachin,
Pass the Item Number of Reservation to GOODSMVT_ITEM-RES_ITEM .
Regards
DKS -
Error while using the Bapi BAPI_GOODSMVT_CREATE
Hi all,
I am using the BAPI BAPI_GOODSMVT_CREATE to Upload the Data in MB01 and for creating the MATERIAL DOCUMENT for Multiple Lineitems at a time.
But i am getting the error as * NO ITEMS WERE TRANSFERRED*
I am using two separate intenal tables One for Header records and One for Line item records
and passing the tables in the BAPI.
Please Solve my issue and if possible please send me the sample code along with the flatfile or excel sheet.
Thanks and Regards
ajayCheck the below link for a sample code.
[http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm|http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm]
Hope this helps.
Thanks,
Balaji -
Locking issue in workflow with conseutive database update
Dear Workflowers,
We are in ECC 5.0 and release 6.40. We went live for SAP in February and we are currently using workflow in PLM module for DMS and ECM.
We have been facing this locking issue randomly happened in our production and quality system. The error from workflow log is "Document XXXX is locked by WF-BATCH". I have two steps in workflow one is to update the document user( from originator to editor with custom BO "zdraw" new method "setuser") and the next step is to update the document status( BO "zdraw" "setstatus" method which inherited form standard BO "draw").
I have tried to use "wait" (1st try) , statements "BAPI_DOCUMENT_ENQUEUE", "BAPI_DOCUMENT_DEQUEUE" (2nd try) and "Commit work and wait" (3rd try) to add one step in between, however the issue remains.
The other question I had was we need to write "commit work" when we use BAPI to perform database update in the ABAP program. But I don't see "commit work" in the method of BO(for example "setstatus" in "draw" object) which performs database update. How does workflow perform DB update properly without "commit work" by referencing standard method?
Could anyone please share your expertise with the issue I am facing?
Thank you in advance,
MertaHi Merta,
Regarding COMMITs: theoretically you should never use COMMIT statements because the Workflow runtime handles that - the transaction of executing the task is the LUW, not your method. By adding COMMIT WORK you are also committing the workflow task execution.
In practice however there are the occasional exceptions where something just won't work without an explicit commit - but the theory remains that you should always try it without.
Regarding your problem, the one way to be certain that a DB update is complete is to use a terminating event - either through change documents or status management.
Failing that, you can write a wrapper method for SETSTATUS that does something like:
do 10 times.
try to lock it.
if success.
unlock.
swc_call_method self 'SetStatus' container.
set success flag.
else.
wait up to 3 seconds.
endif.
enddo.
if no success, raise exception.
Cheers,
Mike -
Getting error while using BAPI 'BAPI_GOODSMVT_CREATE'
Hi,
I am using the BAPI 'BAPI_GOODSMVT_CREATE' in program for goods issue i.e code 03.I am providing all details. the quatity is in KG and i am also providing ISO code i.e KGM but still getting error that Deficit of BA Unrestricted-use 32,900 KG .what would be the problem.Hi There,
Please check if the PO in question has GR-based IV set to active. In this case please refer to the SAP note 109396 which explains how the IDoc segment has to be filled in order for the posting be successful. The IDoc has to be filled as described in the note when try to post with this particular constellation (i.e. GR-based IV active, more than one goods receipt for the line item, first goods receipt already reversed). Normally when posting in dialog the user has to choose the correct line item to reverse. In the case of IDoc/BAPI processing this is not possible so these particular fields have to be filled at the interface so that the system finds the correct document to reverse.
I hope this helps,
Best Regards,
Elaine. -
BAPI_GOODSMVT_CREATE Lock
Hi ,
I am trying to call the BAPI, 'BAPI_GOODSMVT_CREATE' for goods receipt through a web dynpro application.
In my scenario, we have ABAP stack on different Machine i.e. not on R3. When i call the BAPI, it creates some lock objects for the standard tables in R3 it uses, but no data is updated. Also the lock objects are not released. The return table of the BAPI is blank. But if i test the BAPI on r3 with the same data(in se37), it created a GRN. Please help me out with this.
As suggested in other posts, i have called 'BAPI_TRANSACTION_COMMIT' with wait = 'X'. But still it does not work.
Thanks and Regards,
SagarHi Sahiil and Nagraj,
I have checked the return internal table. It is blank.
and i tried DEQUEUE_ALL as well, but to effect.
And If i am correct as I am using the standard BAPI, there should be no need to call DEQUEUE_ALL.
Regards,
Sagar -
Regarding : bapi BAPI_GOODSMVT_CREATE
Hi Experts,
I have to use bapi BAPI_GOODSMVT_CREATE with GOODSMVT_CODE = 04. for the transfer posting of articles from unrestricted to block status.
The movement type for customer return is 252 and i have to execute the 344 movement type for such articles using this bapi.
Can anyone help me as to how to use this bapi, how to populate the item table etc.
Thanks,
NaveenHi,
Check the links
[http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm]
[http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm]
They will give you idea.
and please resolve your post as soon as they are answered. Keeping more than 10 unresolved post is against the rule of engagement. Moderator may lock your thread or account.
Name: Naveen Sharma - View user's Business Card
Registered: Mar 1, 2007
Total Posts: 39
Total Questions: 35 (34 unresolved)
Forum Points: 0
Reagrds,
Anirban -
Field to MIGO cert.enclosed in the BAPI BAPI_GOODSMVT_CREATE
Hi All,
I am doing Good Receipt for Purchase Order.
In MIGO we have Cert.enclosed (Quality) value Yes or No.
I want to insert the Cert.enclosed (Quality) using BAPI BAPI_GOODSMVT_CREATE.
Please let me know which field in BAPI_GOODSMVT_CREATE, I can insert the Cert.enclosed (Quality) value.
Thanks in Advance.
Debopriya GPlease take a look at SAP KBA- 0001718791. Kindly mark if helpful.
SAP Knowledge Base Article
Symptom
There is no import parameter in BAPI_GOODSMVT_CREATE that you can use to confirm the QM certificate.
Environment
SAP Release Independent
Reproducing the Issue
1. In T-code SE37, execute the function module BAPI_GOODSMVT_CREATE
2. In the import tab and tables tab, check all the parameters, there is no place to enter the QM certificate (COA)
Cause
Missing functionality in BAPI_GOODSMVT_CREATE
Resolution
Please use BDC (batch input) for MB** transactions (MB01, MB0A, MB1A, MB1B, MB1C, etc.) instead.
Keywords
QCERT_MIGO-ANSWER, QBCK_QM_GR_CHECK
Header Data
Product
This document is not restricted to a product or product version
References
This document refers to:
CSS SAP Notes
1718791 - Certificate of Analysis (COA) in BAPI_GOODSMVT_CREATE
Version 1 Validity: 05/15/2012 - active Language English
Released On 02/12/2013 02:32:24
Release Status Released to Customer
Component MM-IM-GF-BAPI BAPIs for Goods Movements
QM-CA Quality Certificates
Priority Normal
Category How To
304122 MIGO: Batch input and CATT not supported
Other Components -
Problem with BAPI "BAPI_GOODSMVT_CREATE"
Hi experts,
I am using BAPI "BAPI_GOODSMVT_CREATE" for posting goods issue document. I am Providing following fields in the BAPI(According as in my system) :
*GOODSMVTHEADER*_
PSTNG_DATE 27.02.2008
*GOODSMVTCODE*_
GM_CODE 03
and in tables:
*GOODSMVTITEM*_
MATERIAL PM-001
PLANT 0001
STGE_LOC 0001
MOVE_TYPE 261
ENTRY_QNT 9,000
ENTRY_UOM_ISO EA
RESERV_NO 0000000026
RES_ITEM 0003
But when i check through transaction "mmbe" it seems BAPI is not working. However there is no return message in BAPI. What could be the error. please help.
Thanks and Regards,
Vaibhav Tiwari.Hi Vaibhav,
Running a function module from SE37 is called test run. And a BAPI absolutely needs a COMMIT WORK after it runs because one of the fundamental rules of a BAPI is that there is no COMMIT done internally.
And to write the changes to database, you need a commit work,
Hence unfortunately you will have to call the function module BAPI_TRANSACTION_COMMIT.
Ok, to try it out, you can call BAPI_TRANSACTION_COMMIT immediately after the goods movement BAPI by:
Go to SE37 -> Shift + F8 -> Enter the two function modules in sequence (first goods movement then commit FM)
Then run and check.
Cheers
Edited by: Aditya Laud on Feb 28, 2008 5:18 AM
Maybe you are looking for
-
I am having trouble resizing images after I installed the FCP update. When I press the transform button, and then click on teh image, I go to the little blue dots on the side of the image that usually resize the image, and when I drag them out, inste
-
Redirect to custom url after successful authentication by OAM
Hello, I need to redirect the user to some custom url instead of original requested url after successful authentication in OAM 11.1.2 (11g release2). The requirement in my case is depending upon the user type and the region(one of the user's ldap att
-
I can`t open jar files though my java version is updated
Hello everybody, I`m using Macbook Pro 13` with Lion on it. As it says in the title, I can`t open jar files though, my java version is updated. It says, I shuld check the console. Right now, my java version is, "1.7.0_15", and i`m trying to open a ja
-
What are the good PRs Report ?
Dear Al, I have used ME5K and ME5A .. but i have ome issues with them because they don't display what i really want .. and there some conflict in ME5A "Closed Prs indicator for example display the prs which not yet even released" and "Released Only
-
Hi Sap Gurus, Could anyone let us know how to transport variants to one environment to another environment, we could not able to save the variants in the Transport Request, could you advise how to move variants related to SAP standard transaction and