05-22-2007 3:03 AM
I know this has been asked many times but I still don't get a clear answer.
Is there a BAPI used for batch uploading for MIGO? Or do I need to use BDC?
05-22-2007 3:05 AM
Use BAPI FM : BAPI_GOODSMVT_CREATE
See the below code :
DATA: w_header LIKE bapi2017_gm_head_01,
w_code LIKE bapi2017_gm_code,
w_headret LIKE bapi2017_gm_head_ret,
w_mblnr TYPE bapi2017_gm_head_ret-mat_doc,
w_mjahr TYPE bapi2017_gm_head_ret-doc_year.
DATA: t_item LIKE bapi2017_gm_item_create OCCURS 0 WITH HEADER LINE.
DATA: t_msg LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
DATA: t_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = w_header
goodsmvt_code = w_code
IMPORTING
goodsmvt_headret = w_headret
materialdocument = w_mblnr
matdocumentyear = w_mjahr
TABLES
goodsmvt_item = t_item
return = t_return.
Commit work
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
Reward Points if it is helpful
Thanks
Seshu
Message was edited by:
Seshu Maramreddy
05-22-2007 3:10 AM
I tried to use that but I'm getting an error when using movement type 101 (Goods receipt).
It this BAPI applicable only for MB01, MB31, MB1A, MB1B, MB1C and MB11?
I'm getting this error message: Goods movement not possible with mvmt type 101
05-22-2007 3:21 AM
05-22-2007 3:24 AM
Here's part of my code. I'm also using 4.6c
wa_mat_hd-pstng_date = sy-datum.
wa_mat_hd-doc_date = sy-datum.
wa_mat_hd-ref_doc_no = 'MIGO1'.
wa_mat_hd-pr_uname = 'WOSYGEN1'.
wa_mat_hd-header_txt = 'MIGO Batch Upload'.
w_gmcode-gm_code = '06'.
LOOP AT itab.
it_migoitem-po_number = itab-ebeln.
it_migoitem-move_type = '101'. "GR Goods Receipt
it_migoitem-stck_type = ' '.
it_migoitem-entry_qnt = itab-erfmg.
it_migoitem-entry_uom = itab-erfme.
it_migoitem-no_more_gr = '1'.
it_migoitem-mvt_ind = 'B'.
it_migoitem-plant = '1100'.
it_migoitem-stge_loc = itab-lgort_d.
APPEND it_migoitem.
ENDLOOP.
BREAK-POINT.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wa_mat_hd
goodsmvt_code = w_gmcode
testrun = 'X'
IMPORTING
goodsmvt_headret = it_headret
materialdocument = it_matdoc
TABLES
goodsmvt_item = it_migoitem
return = it_messages.
05-22-2007 3:48 AM
Hi Adrian,
You can do it. My suggestion is to do it with standard transaction .
I mean to try using migo_gr with the material you are trying. SEE IF IT CREATES THE DOCUMENT NUMBER
Once you get the document number then try to fix the code because your code looks ok
try to post with the same quantity and material number, sometimes what happens the quantity may not be available so try to create a document number and see whether you are succesful in creating one
Thanks
venki
05-23-2007 7:13 AM
I'm still getting the same error which is 'Goods movement not possible with mvmt type 101". I've tried to do it using that tcode and it generated a material document. However, my code still displays the error.
What could be possibly wrong?