Application Development and Automation 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: 
Read only

Data conversion program for t-code MB1C (561 movement types)

Former Member
0 Likes
814

hai,

Iam working on BDC.

iam getting message as MSEG-ERFMG(02) is not an input field after execution of BDC program ( In call Transaction method with No mode display.)

Below is recording of MB1C.

LOOP AT it_header INTO wa_header.

REFRESH it_bdcdata.

flg = space.

PERFORM bdc_dynpro USING 'SAPMM07M' '0400'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'MKPF-BLDAT'

wa_header-bldat.

PERFORM bdc_field USING 'MKPF-BUDAT'

wa_header-budat.

PERFORM bdc_field USING 'RM07M-BWARTWA'

wa_header-bwartwa.

PERFORM bdc_field USING 'RM07M-WERKS'

wa_header-werks.

PERFORM bdc_field USING 'RM07M-LGORT'

wa_header-lgort.

LOOP AT it_item INTO wa_item WHERE id = wa_header-id.

IF flg = space.

PERFORM bdc_dynpro USING 'SAPMM07M' '0421'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'MSEG-MATNR(01)'

wa_item-matnr.

PERFORM bdc_field USING 'MSEG-ERFMG(01)'

wa_item-erfmg.

PERFORM bdc_field USING 'DKACB-FMORE'

'X'.

PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTE'.

PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTE'.

flg = 'X'.

ELSEIF flg = 'X'.

PERFORM bdc_dynpro USING 'SAPMM07M' '0421'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'MSEG-MATNR(02)'

wa_item-matnr.

PERFORM bdc_field USING 'MSEG-ERFMG(02)'

wa_item-erfmg.

PERFORM bdc_field USING 'DKACB-FMORE'

'X'.

PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTE'.

PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTE'.

ENDIF.

ENDLOOP.

PERFORM bdc_dynpro USING 'SAPMM07M' '0421'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BU'.

PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTE'.

CALL TRANSACTION 'MB1C' USING it_bdcdata UPDATE 'A' MODE 'A' MESSAGES INTO it_msg.

ENDLOOP.

if above is wrong please revert back your suggestion immedietly.

with regards,

Naveen

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
748

hi,

Instead of directly mentioning the literal in the BDC PROGRAMMING.

Try out like this

MSEG-ERFMG(02)

data:

w_no(2) type n,

line type char15.

concatenate 'MSEG-ERFMG(' w_no ')' into line.

PERFORM bdc_field USING line

wa_item-matnr.

Increment the counter w_no appropriately as per the logic.

This should work for you.

Thanks

Sharath

6 REPLIES 6
Read only

Former Member
0 Likes
748

Use BAPI 'BAPI_GOODSMVT_CREATE' instead of BDC

Refer this

Read only

Former Member
0 Likes
749

hi,

Instead of directly mentioning the literal in the BDC PROGRAMMING.

Try out like this

MSEG-ERFMG(02)

data:

w_no(2) type n,

line type char15.

concatenate 'MSEG-ERFMG(' w_no ')' into line.

PERFORM bdc_field USING line

wa_item-matnr.

Increment the counter w_no appropriately as per the logic.

This should work for you.

Thanks

Sharath

Read only

0 Likes
748

Thanks for your reply..............i got ouput.

Read only

Former Member
0 Likes
748

Hi Naveen ,

I guess the problem is with uploading .

Jus make sure in debigging that all the data is uploading in to the respective fields ('MSEG-ERFMG(02)')

Or

The problem might be like this.

If flag = space .

PERFORM bdc_dynpro USING 'SAPMM07M' '0421'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'MSEG-MATNR(01)'

wa_item-matnr.

PERFORM bdc_field USING 'MSEG-ERFMG(01)'

wa_item-erfmg.

Here you are are appending the first row .

If flag = u2018Xu2019 .

PERFORM bdc_dynpro USING 'SAPMM07M' '0421'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'MSEG-MATNR(02)'

wa_item-matnr.

PERFORM bdc_field USING 'MSEG-ERFMG(02)'

wa_item-erfmg.

Your appending the second row of the same screen .

So try it like first call yor screen and then check with flag .

Hope you get it!

Much Regards ,

Amuktha .

Read only

Former Member
0 Likes
748

Hi,

ermg is quantity right,so in the internal table the field length is 13 and your screen field length might be less than this ,so better condense this and write to the screen field in bdc steps.

Read only

0 Likes
748

Hi,

Problem in your BDC you are putting data in first row else part and giving structure 'MSEG-MATNR(02)' but it represnt the row number to currect it with your requirment.

ELSEIF flg = 'X'.

PERFORM bdc_dynpro USING 'SAPMM07M' '0421'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'MSEG-MATNR(02)'

wa_item-matnr.

PERFORM bdc_field USING 'MSEG-ERFMG(02)'

wa_item-erfmg.

PERFORM bdc_field USING 'DKACB-FMORE'

'X'.

PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTE'.

PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ENTE'.

ENDIF.