Application Development 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: 

'MB1C' BDC program problem

Former Member
0 Kudos
320

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 .

1 ACCEPTED SOLUTION

Former Member
0 Kudos
167

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

12 REPLIES 12

Former Member
0 Kudos
167

Hey run the BDC in mode A and check where exactly the error is coming??

0 Kudos
167

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

0 Kudos
167

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

0 Kudos
167

Hi,

Did you tries with existing bapi.

Regards,

Madhu.

0 Kudos
167

Hi Madhu,

What's the name of that bapi ?

DEB

0 Kudos
167

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: [;

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.

0 Kudos
167

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

Former Member
0 Kudos
167

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

Former Member
0 Kudos
167

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

Former Member
0 Kudos
168

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

0 Kudos
167

Thanks Suruchi ,

Your advice really works fine . The problem has gone now.

DEB

0 Kudos
167

You should use BAPI_GOODSMVT_CREATE with GM_CODE 05.

Always use BAPI instead BDC... Obviously, when avaiable.

Regards,

Flavio