Skip to Content
0
Nov 23, 2011 at 09:43 AM

Movement 352 with BAPI_GOODSMVT_CREATE

284 Views

Hi,

How to do 352 for material document number.

I cannot use ''BAPI_GOODSMVT_CANCEL', since the reason for cancellation is mandatory.

So, I tried 'BAPI_GOODSMVT_CREATE' with - XSTOB = '2' in the GOODSMVT_ITEM table and commenting move_type.

ls_header-pstng_date = sy-datum.

ls_header-doc_date = sy-datum.

ls_header-REF_DOC_NO = ls_ztmm002-mblnr.

ls_code-gm_code = '06'.

ls_item-plant = ls_ztmm002-reswk.

ls_item-stge_loc = ls_ztmm002-reslo.

ls_item-move_reas = 0001.

  • ls_item-move_type = '351'.

ls_item-mvt_ind = ' '.

ls_item-stck_type = ' '.

ls_item-entry_qnt = ls_ztmm002-twqty.

ls_item-entry_uom = ls_mseg_bapi-meins.

ls_item-po_number = ls_ztmm002-ebeln.

ls_item-po_item = ls_mseg_bapi-ebelp.

"----


ls_item-xstob = '2'.

ls_item-matdoc_tr_cancel = ls_ztmm002-mblnr.

ls_item-matitem_tr_cancel = 0001.

ls_item-matyear_tr_cancel = ls_ztmm002-mjahr.

"----


APPEND ls_item TO lt_item.

call function 'BAPI_GOODSMVT_CREATE'

exporting goodsmvt_header = ls_header

goodsmvt_code = ls_code

TESTRUN = 'X'

importing materialdocument = lv_matdoc

matdocumentyear = lv_matyr

tables goodsmvt_item = lt_item

return = lt_return.

But, it gives out the error - 'Check table T156N: entry ST does not exist'. I went to table - T156N and found

Function Code - ST, BWART = 351 & BWART_NEXT = 352 & XSTOR = '2'... do exist! .

Any information.

Thanks In Advance.

Regards,

Sunoj