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: 

MIGO Batch Input

Former Member
0 Kudos

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?

6 REPLIES 6

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

I have verified in 4.6C Version and i did not get anything.

0 Kudos

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.

0 Kudos

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

0 Kudos

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?