‎2006 Oct 03 11:30 AM
HI everybody
Has anybody done batch input for tcode MIGO?if yes, can you please send me a sample of the code plz?
ive tried the batch input several times but its not working for me.
the inputs are:
PO number
PO item number
material number
quantity
thanks
anjali
‎2006 Oct 03 11:36 AM
HI,
MIGO is enjoy sap transaction. So please don't use it for batch input or recording. Instead use BAPI or other function module to achive ur purpose
MIGO can't be used with call transaction.
Use BAPI_GOODSMVT_CREATE instead.
Regards,
Laxmi.
‎2006 Oct 03 11:36 AM
HI,
MIGO is enjoy sap transaction. So please don't use it for batch input or recording. Instead use BAPI or other function module to achive ur purpose
MIGO can't be used with call transaction.
Use BAPI_GOODSMVT_CREATE instead.
Regards,
Laxmi.
‎2006 Oct 03 11:41 AM
‎2006 Oct 03 11:49 AM
would u be able to send me a sample code of the function module, i dnt know what to put for the parameter GOODSMVT_CODE in the fm BAPI_GOODSMVT_CREATE
‎2006 Oct 03 12:00 PM
Check this code it may help u.
DATA : V_HEADER_TXT LIKE X_GOODS_MVT_HEAD-HEADER_TXT.
DATA : X_GOODS_MVT_HEAD LIKE BAPI2017_GM_HEAD_01,
X_GOODS_MVT_CODE LIKE BAPI2017_GM_CODE,
IT_GOODS_MVT_ITEM LIKE BAPI2017_GM_ITEM_CREATE OCCURS 0 WITH HEADER LINE,
IT_RETURN LIKE BAPIRET2 OCCURS 0
WITH HEADER LINE.
X_GOODS_MVT_HEAD-PSTNG_DATE = SY-DATUM.
X_GOODS_MVT_HEAD-DOC_DATE = SY-DATUM.
X_GOODS_MVT_HEAD-HEADER_TXT = V_HEADER_TXT.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = X_GOODS_MVT_HEAD
GOODSMVT_CODE = X_GOODS_MVT_CODE
IMPORTING
MATERIALDOCUMENT = P_MATDOC
TABLES
GOODSMVT_ITEM = IT_GOODS_MVT_ITEM
RETURN = IT_RETURN.
u need to call this fm if the above is successful
IF NOT P_MATDOC IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
V_BAPI_NO_ERR = 'X'.
ENDIF.
Regards
‎2006 Oct 03 12:00 PM
HI,
Check this sample examples.
Structures for BAPI
data: gm_header type bapi2017_gm_head_01.
data: gm_code type bapi2017_gm_code.
data: gm_headret type bapi2017_gm_head_ret.
data: gm_item type table of
bapi2017_gm_item_create with header line.
data: gm_return type bapiret2 occurs 0.
data: gm_retmtd type bapi2017_gm_head_ret-mat_doc.
clear: gm_return, gm_retmtd. refresh gm_return.
Setup BAPI header data.
gm_header-pstng_date = sy-datum.
gm_header-doc_date = sy-datum.
gm_code-gm_code = '06'. " MB11
Write 551 movement to table
clear gm_item.
move '551' to gm_item-move_type .
move '000000000040001234' to gm_item-material.
move '1' to gm_item-entry_qnt.
move 'EA' to gm_item-entry_uom.
move '0004' to gm_item-plant.
move '4000' to gm_item-stge_loc.
move '201' to gm_item-move_reas.
Determine cost center per plant
case xresb-werks.
when '0004'.
move '0000041430' to gm_item-costcenter.
when '0006'.
move '0000041630' to gm_item-costcenter.
when '0007'.
move '0000041731' to gm_item-costcenter.
when '0008'.
move '0000041830' to gm_item-costcenter.
endcase.
append gm_item.
Call goods movement BAPI
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gm_header
goodsmvt_code = gm_code
importing
goodsmvt_headret = gm_headret
materialdocument = gm_retmtd
tables
goodsmvt_item = gm_item
return = gm_return.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm
http://www.4ap.de/abap/bapi_goodsmvt_create.php
DATA : V_HEADER_TXT LIKE X_GOODS_MVT_HEAD-HEADER_TXT.
DATA : X_GOODS_MVT_HEAD LIKE BAPI2017_GM_HEAD_01,
X_GOODS_MVT_CODE LIKE BAPI2017_GM_CODE,
IT_GOODS_MVT_ITEM LIKE BAPI2017_GM_ITEM_CREATE OCCURS 0 WITH HEADER LINE,
IT_RETURN LIKE BAPIRET2 OCCURS 0
WITH HEADER LINE.
X_GOODS_MVT_HEAD-PSTNG_DATE = SY-DATUM.
X_GOODS_MVT_HEAD-DOC_DATE = SY-DATUM.
X_GOODS_MVT_HEAD-HEADER_TXT = V_HEADER_TXT.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = X_GOODS_MVT_HEAD
GOODSMVT_CODE = X_GOODS_MVT_CODE
IMPORTING
MATERIALDOCUMENT = P_MATDOC
TABLES
GOODSMVT_ITEM = IT_GOODS_MVT_ITEM
RETURN = IT_RETURN.
u need to call this fm if the above is successful
IF NOT P_MATDOC IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
V_BAPI_NO_ERR = 'X'.
ENDIF.
Regards,
Laxmi.
‎2006 Oct 03 12:24 PM
one more question
if im using the tcode MIGO, should i insert a record for that tcode in the table t185g or does this tcode resemble tcode MB01 and therefore can use its associated gm_code in the fm BAPI_GOODSMVT_CREATE ?
thanks for the quick replies