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: 

BAPI_GOODSMVT_CREATE for mov.type 101 for Delivery

Former Member
0 Kudos

Hi expert,ù

I have to use the BAPI_GOODSMVT_CREATE to create a 101 referring to a delivery but I can't find wich parameters I have to set.

If I refre to a purch.order it works correclyt, but the same settings are not applicable for delivery.

Any documentations or example?

Thanks

6 REPLIES 6

Former Member
0 Kudos

Check BAPI_GOODSMVT_CREATE Documentation.you will find the answer.

kesavadas_thekkillath
Active Contributor
0 Kudos


 wa_header-pstng_date = sy-datum.
  wa_header-doc_date = sy-datum.
  wa_header-ref_doc_no = v_no. "Delivery No

 wa_item-material = v_matnr. "Material
  wa_item-plant = v_plant."Plant
  wa_item-stge_loc = v_sloc."Storage Location
  wa_item-batch = v_charg. "Batch
  wa_item-entry_qnt = v_qty. "Qty
  wa_item-entry_uom_iso = v_uom. "UOM
  wa_item-deliv_numb = v_no."Delivery No
  wa_item-deliv_item = wa_lips-posnr."Delivery Item No
  wa_item-mvt_ind = 'B'.
  wa_item-move_type ='101'.
  wa_item-po_number = wa_lips-vgbel. "PO NO
  wa_item-po_item = wa_lips-vgpos. "PO Item
  APPEND wa_item TO i_item.
  CLEAR wa_item.

  wa_serial-matdoc_itm = '1'. 
  wa_serial-serialno = v_sernr.
  APPEND wa_serial TO i_serial.
  CLEAR wa_serial.

  CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
    EXPORTING
      goodsmvt_header       = wa_header
      goodsmvt_code         = c_bapi_gm_code01
    IMPORTING
      materialdocument      = v_matdoc
    TABLES
      goodsmvt_item         = i_item
      goodsmvt_serialnumber = i_serial
      return                = i_ret.

0 Kudos

I'm sorry but it doesn't work...

Error message:

M7 036 No goods receipt possible for purchase order 81011404 00010

where 81011404 is my delivery number.

If I try using MIGO (manually) it works!

Former Member
0 Kudos

Hi,

Check if this is useful.

*-Step 1: Create Inbound delivery from outbound delivery

  • Input the delivery number, date & creator name

  • to impkf structure

*-- Do MIGO using Outbound delivery

wa_imkpf-bldat = goodsrecdate.

wa_imkpf-budat = goodsrecdate.

wa_imkpf-xblnr = deliverynumber.

wa_imkpf-usnam = sy-uname.

CLEAR ws_i_cnt.

*-- Pass all the necessary details to I_MSEG - item details

CLEAR wa_wueb. REFRESH i_mseg.

LOOP AT i_wueb INTO wa_wueb.

CLEAR wa_lips. CLEAR wa_mseg.

READ TABLE i_lips INTO wa_lips WITH KEY vbeln = wa_wueb-vbeln

posnr = wa_wueb-vbelp BINARY SEARCH.

IF sy-subrc = 0 AND wa_lips-lgnum NE space. " only for WH managed

ws_i_cnt = ws_i_cnt + 1.

wa_mseg-line_id = ws_i_cnt. " Line Number

wa_mseg-global_counter = ws_i_cnt. " Line Number

wa_mseg-bwart = '101'. " Movement Type

wa_mseg-matnr = wa_wueb-matnr. " Material Number

wa_mseg-werks = wa_wueb-werks. " Plant

wa_mseg-lgort = wa_wueb-lgort. " Storage Loc

wa_mseg-charg = wa_wueb-charg. " Batch

wa_mseg-kzbew = c_b. " Movement Indicator ( B indicates

  • Goods movement for purchase order)

wa_mseg-erfmg = wa_wueb-erfmg. " Quantity

wa_mseg-erfme = wa_wueb-erfme. " UoM

wa_mseg-bprme = wa_wueb-erfme. " UoM

wa_mseg-menge = wa_wueb-erfmg. " Qty

wa_mseg-meins = wa_wueb-erfme. " UoM

wa_mseg-ebeln = wa_wueb-ebeln. " STO Number

wa_mseg-ebelp = wa_wueb-ebelp. " STO Item Number

wa_mseg-migo_elikz = 1. " Delivery completion indicator( 1 - set automatically)

wa_mseg-bstmg = wa_wueb-erfmg. " QTY

wa_mseg-lgnum = wa_lips-lgnum. " WH No

wa_mseg-vbeln = wa_wueb-vbeln. " Delivery Number

wa_mseg-posnr = wa_wueb-vbelp. " Delivery Item number

wa_mseg-lsmng = wa_wueb-erfmg. " QTY

wa_mseg-lsmeh = wa_wueb-erfme. " UoM

wa_mseg-bukrs = wa_wueb-ekorg. " Purchase org

*-- Get Vendor Number from STO

CLEAR wa_ekko.

READ TABLE i_ekko INTO wa_ekko WITH KEY ebeln = wa_wueb-ebeln BINARY SEARCH.

IF sy-subrc = 0.

wa_mseg-lifnr = wa_ekko-lifnr. " Vendor number

ENDIF.

wa_mseg-ean11_bme = wa_wueb-ean11. " EAN11

wa_mseg-insmk = space. " Stock Type ( space - Unrestricted use)

wa_mseg-weanz = 1. " Number of GR/GI Slips to Be Printed

wa_mseg-weanzx = c_x. " Updated information in related user data field

wa_mseg-wempfx = c_x. " Updated information in related user data field

wa_mseg-abladx = c_x. " Updated information in related user data field

APPEND wa_mseg TO i_mseg.

ENDIF.

ENDLOOP.

*-- Do MIGO

CALL FUNCTION 'MB_CREATE_GOODS_MOVEMENT'

EXPORTING

imkpf = wa_imkpf

xallp = c_x

xallb = c_x

xallr = c_x

ctcod = c_migo

xlisu = c_x

IMPORTING

emkpf = i_emkpf

TABLES

emseg = i_emseg

imseg = i_mseg.

IF i_emkpf-subrc = 1. "Inbound delivery creation is success

ws_c_indelvry = i_emkpf-msgv1.

0 Kudos

Thanks,

I'll try...

I missed an information: the delivery came form another SAP Plant and not from a vendor.

Thanks

0 Kudos

The same result using MB_CREATE_GOODS_MOVEMENT...

HeplMe!!!!