‎2010 Apr 30 6:25 AM
Hi all,
I am using BAPI_GOODSMVT_CREATE to do Goods Issue Reversal( MB1A). I am using Movement type 262.Its creating goods movement but its moving material in to differnet storage stype.actual it has to move to 001, Buts moving to 914.can any body help me in this regard.
lw_goodsmvt_header-pstng_date = sy-datum. " Posting Date in the Document
lw_goodsmvt_header-doc_date = sy-datum. " Document Date in Document
lv_goodsmvt_code = c_code. " movement code 06
lw_goodsmvt_item-material = lv_matnr.
lw_goodsmvt_item-plant = v_plant.
lw_goodsmvt_item-stge_loc = lv_lgpro . " Storage Location
lw_goodsmvt_item-batch = lv_charg. " Batch Number
lw_goodsmvt_item-move_type = c_movtype ." Movement Type (Inventory Management) 262
lw_goodsmvt_item-entry_qnt = lv_menge. " Quantity in Unit of Entry
lw_goodsmvt_item-entry_uom = lv_meins. " Unit of Entry
lw_goodsmvt_item-orderid = lv_aufnr. " Order Number
lw_goodsmvt_item-stge_bin = lv_lgpla.
append lw_goodsmvt_item to lt_goodsmvt_item.
clear : lw_goodsmvt_item.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = lw_goodsmvt_header
goodsmvt_code = lv_goodsmvt_code
TESTRUN = ' '
GOODSMVT_REF_EWM =
importing
GOODSMVT_HEADRET =
materialdocument = lv_matdoc
matdocumentyear = lv_matdoc_year
tables
goodsmvt_item = lt_goodsmvt_item[]
GOODSMVT_SERIALNUMBER =
return = lt_return[]
GOODSMVT_SERV_PART_DATA =
EXTENSIONIN =
.
Thanks,
siva
‎2010 Apr 30 6:44 AM
I think, you have to fill two records in the structure "lw_goodsmvt_item" one for source storage location and second for receiving storage location.
Regards
Vinod
‎2010 Apr 30 7:20 AM
‎2010 Apr 30 8:08 AM
Try this
DATA: w_header TYPE bapi2017_gm_head_01,
w_item TYPE bapi2017_gm_item_create,
i_item TYPE STANDARD TABLE OF bapi2017_gm_item_create,
******select and loop from requied table and then append into table.****
w_item-stge_loc = w_mseg-lgort.
w_item-batch = w_mseg-charg.
w_item-move_type = '101'.
w_item-entry_qnt = w_mseg-menge.
w_item-entry_uom = w_mseg-meins.
w_item-plant = w_mseg-werks.
W_ITEM-po_number = w_mseg-EBELN.
W_ITEM-po_item = w_mseg-EBELP.
w_item-move_batch = w_mseg-charg.
w_item-mvt_ind = 'B'.
w_item-deliv_numb = w_mseg-oivbeln.
w_item-deliv_item = w_mseg-oiposnr.
w_item-quantity = w_mseg-menge.
w_item-base_uom = w_mseg-meins.
w_item-po_pr_qnt = w_mseg-menge.
w_item-orderpr_un = w_mseg-meins.
APPEND w_item TO i_item.
********and then call your BAPI************
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = w_header
goodsmvt_code = '01'
IMPORTING
goodsmvt_headret = gt_mblnr
materialdocument = gt_mblnr1
TABLES
goodsmvt_item = i_item
return = w_message.
‎2010 Jun 03 7:46 AM