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: 

BDC -MIGO

Former Member
0 Kudos
450

As a requirment i need to create a bdc for the transcation migo

All i need to do is go in and select a po that has already been created and tick all the line items ok and then save so that the GR gets created .

When i record the transaction in shdb it also extracts the values that are in the line items when the po is selected eg the quantity etc

Will i need to pass all the values in thru again thru the bdc or can i only go and select the sequence of ticking and only pass those values .

1 ACCEPTED SOLUTION

Former Member
0 Kudos
144

Hi,

You are not supposed to use BDC for MIGO. Please see OSS Note #381630. Look for a BAPI instead.

You really don't want to do a BDC over the MIGO transaction. Reason for this is because MIGO uses a lot of frontend gui controls. You should use MB11 or the BAPI BAPI_GOODSMVT_CREATE.

clear: return, retmatdoc. refresh return.

  • Setup BAPI header data.

gdsmt_header-pstng_date = sy-datum.

gdsmt_header-doc_date = sy-datum.

gdsmt_code-gm_code = '06'. " MB11

  • Write 262 movement to table.

clear gdsmt_item.

move '262' to gdsmt_item-move_type .

move i_resb-matnr to gdsmt_item-material.

move p_bdmng to gdsmt_item-entry_qnt.

move i_resb-meins to gdsmt_item-entry_uom.

move i_resb-werks to gdsmt_item-plant.

move i_resb-lgort to gdsmt_item-stge_loc.

move i_afko-aufnr to gdsmt_item-orderid.

append gdsmt_item.

  • Write 551 movement to table

clear gdsmt_item.

move '551' to gdsmt_item-move_type .

move i_resb-matnr to gdsmt_item-material.

move p_bdmng to gdsmt_item-entry_qnt.

move i_resb-meins to gdsmt_item-entry_uom.

move i_resb-werks to gdsmt_item-plant.

move i_resb-lgort to gdsmt_item-stge_loc.

move p_grund to gdsmt_item-move_reas.

  • Determine cost center per plant

if i_resb-werks = '0004'.

move '0000041430' to gdsmt_item-costcenter.

elseif i_resb-werks = '0006'.

move '0000041630' to gdsmt_item-costcenter.

elseif i_resb-werks = '0007'.

move '0000041730' to gdsmt_item-costcenter.

elseif i_resb-werks = '0008'.

move '0000041830' to gdsmt_item-costcenter.

endif.

append gdsmt_item.

  • Call goods movement BAPI

call function 'BAPI_GOODSMVT_CREATE'

exporting

goodsmvt_header = gdsmt_header

goodsmvt_code = gdsmt_code

importing

goodsmvt_headret = gdsmt_headret

materialdocument = retmatdoc

tables

goodsmvt_item = gdsmt_item

return = return.

if not retmatdoc is initial.

wait up to 5 seconds.

commit work and wait.

call function 'DEQUEUE_ALL'.

else.

commit work and wait.

call function 'DEQUEUE_ALL'.

message i013.

endif.

Regards

3 REPLIES 3

Former Member
0 Kudos
144

refer this site.

amit_khare
Active Contributor
0 Kudos
144

Instead of writing BDC for MIGO use BAPI - BAPI_GOODSMVT_CREATE .

Refer link for sample -

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos
145

Hi,

You are not supposed to use BDC for MIGO. Please see OSS Note #381630. Look for a BAPI instead.

You really don't want to do a BDC over the MIGO transaction. Reason for this is because MIGO uses a lot of frontend gui controls. You should use MB11 or the BAPI BAPI_GOODSMVT_CREATE.

clear: return, retmatdoc. refresh return.

  • Setup BAPI header data.

gdsmt_header-pstng_date = sy-datum.

gdsmt_header-doc_date = sy-datum.

gdsmt_code-gm_code = '06'. " MB11

  • Write 262 movement to table.

clear gdsmt_item.

move '262' to gdsmt_item-move_type .

move i_resb-matnr to gdsmt_item-material.

move p_bdmng to gdsmt_item-entry_qnt.

move i_resb-meins to gdsmt_item-entry_uom.

move i_resb-werks to gdsmt_item-plant.

move i_resb-lgort to gdsmt_item-stge_loc.

move i_afko-aufnr to gdsmt_item-orderid.

append gdsmt_item.

  • Write 551 movement to table

clear gdsmt_item.

move '551' to gdsmt_item-move_type .

move i_resb-matnr to gdsmt_item-material.

move p_bdmng to gdsmt_item-entry_qnt.

move i_resb-meins to gdsmt_item-entry_uom.

move i_resb-werks to gdsmt_item-plant.

move i_resb-lgort to gdsmt_item-stge_loc.

move p_grund to gdsmt_item-move_reas.

  • Determine cost center per plant

if i_resb-werks = '0004'.

move '0000041430' to gdsmt_item-costcenter.

elseif i_resb-werks = '0006'.

move '0000041630' to gdsmt_item-costcenter.

elseif i_resb-werks = '0007'.

move '0000041730' to gdsmt_item-costcenter.

elseif i_resb-werks = '0008'.

move '0000041830' to gdsmt_item-costcenter.

endif.

append gdsmt_item.

  • Call goods movement BAPI

call function 'BAPI_GOODSMVT_CREATE'

exporting

goodsmvt_header = gdsmt_header

goodsmvt_code = gdsmt_code

importing

goodsmvt_headret = gdsmt_headret

materialdocument = retmatdoc

tables

goodsmvt_item = gdsmt_item

return = return.

if not retmatdoc is initial.

wait up to 5 seconds.

commit work and wait.

call function 'DEQUEUE_ALL'.

else.

commit work and wait.

call function 'DEQUEUE_ALL'.

message i013.

endif.

Regards