2011 Nov 24 9:29 AM
Hi Experts,
I am facing a problem when I am going to run a bdc program for Tcode u2018MB1Cu2019 . In this program, I have gathered all the required data for bdc in an internal table . Then running a loop with loop at statement on that table , I am trying to pass those data in the bdc recording . My code is as follows :
LOOP AT IRN_BDC .
CONCATENATE SY-DATUM6(2) '.' SY-DATUM4(2) '.' SY-DATUM+0(4) INTO CUR_DAT .
*SHIFT MAT_NT_WT LEFT DELETING LEADING '-' .
CLEAR zbdcdata .
REFRESH zbdcdata .
perform bdc_dynpro using 'SAPMM07M' '0400'.
perform bdc_field using 'BDC_CURSOR'
'RM07M-WERKS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MKPF-BLDAT'
CUR_DAT .
perform bdc_field using 'MKPF-BUDAT'
CUR_DAT. .
perform bdc_field using 'RM07M-BWARTWA'
'261'.
perform bdc_field using 'RM07M-WERKS'
'1000'.
perform bdc_field using 'RM07M-LGORT'
'1010'.
perform bdc_field using 'XFULL'
'X'.
perform bdc_field using 'RM07M-WVERS2'
'X'.
perform bdc_dynpro using 'SAPMM07M' '0421'.
perform bdc_field using 'BDC_CURSOR'
'MSEG-CHARG(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MSEG-MATNR(01)'
IRN_BDC-MAT.
perform bdc_field using 'MSEG-ERFMG(01)'
IRN_BDC-MAT_NT_WT.
perform bdc_field using 'MSEG-ERFME(01)'
'TO'.
perform bdc_field using 'MSEG-CHARG(01)'
IRN_BDC-BAT .
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_CURSOR'
'COBL-AUFNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_field using 'COBL-GSBER'
'1000'.
perform bdc_field using 'COBL-AUFNR'
IRN_BDC-PR_NO .
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_CURSOR'
'COBL-GSBER'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_field using 'COBL-GSBER'
'1000'.
perform bdc_field using 'COBL-AUFNR'
IRN_BDC-PR_NO .
CALL TRANSACTION 'MB1C' USING zbdcdata MODE 'E'.
CLEAR : IRN_BDC-PR_NO , IRN_BDC-BAT , IRN_BDC-MAT , IRN_BDC-MAT_NT_WT , CUR_DAT .
ENDLOOP.
But when I run the program I am geeting an error message saying :
u201CThe plant data of the material IRN01001 is locked by the user ABAP1u201D.
So, please tell me how to eradicate this problem .
2011 Nov 25 3:42 AM
Hi.
when you are calling transaction change thedefault update mode
It is by default A, change it to S or vice versa. This will solve ur problem
2011 Nov 24 10:35 AM
Hey run the BDC in mode A and check where exactly the error is coming??
2011 Nov 24 10:49 AM
Hi Suruchi ,
Thanks for the reply . According to your advise I have run the program in mode 'A' . Then the error is not occuring . But running the program in mode 'E' is not possible for uses . So what should I do now ?
DEB
2011 Nov 24 10:52 AM
Sorry Suruchi ,
Running the program in mode 'A' is not possible for uses . So what should I do now ?
DEB
Edited by: DEB. ABAP on Nov 24, 2011 11:53 AM
2011 Nov 24 11:01 AM
2011 Nov 24 11:03 AM
2011 Nov 24 11:14 AM
Hi Deb,
There is a lot of help available on BAPI for MB1C. Refer the links below:
Link: [http://wiki.sdn.sap.com/wiki/display/ERPSCM/HowToGoodsMovementswith+BAPI]
Link: [http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm]
Please refer these links for details. Hope this helps.
Regards,
Pranav.
2011 Nov 24 11:16 AM
Hi Deb,
can you try this.Even if you go with lsmw record method also it will lock.
Batch Input,Object 0110 Goods movement,Method 0000,Program Name RM07MMBL,Program Type B
Business Object BUS2017 Goods Movement,Method CREATEFROMDATA
Regards,
Madhu
2011 Nov 24 10:53 AM
When you run in mode E, obviously the transaction screen would appear right whereever there is error...
Try to run in mode N also and change the update mode by default check check its A, change it to S
2011 Nov 24 2:46 PM
I assume that you are running this program under userid ABAP1. the problem is that when the program tries to update a record, the locks on the previous record have not been completely released. so long as you are doing this in the session method, you can solve this by simply processing the error session.
Rob
2011 Nov 25 3:42 AM
Hi.
when you are calling transaction change thedefault update mode
It is by default A, change it to S or vice versa. This will solve ur problem
2011 Nov 25 6:33 AM
Thanks Suruchi ,
Your advice really works fine . The problem has gone now.
DEB
2011 Nov 25 3:59 PM
You should use BAPI_GOODSMVT_CREATE with GM_CODE 05.
Always use BAPI instead BDC... Obviously, when avaiable.
Regards,
Flavio