BAPI BAPI_GOODSMVT_CREATE FOR GOODS RECEIPT WITHOUT ORDER – MOVEMENT TYPE 501

   

Goods receipt merupakan proses pada system SAP yang digunakan untuk melakukan proses penerimaan barang.

Secara manual kita bias melakukan Goods Receipt without ourder di tcode MIGO dengan movement type 501, bisa dilihat sebagai berikut :

Berikut merupakan source code untuk posting document goods receipt other dengan movement type 501 :

*&---------------------------------------------------------------------*
*& Report YWHY_TEST11
*&---------------------------------------------------------------------*
*& Author : Wahyu Amaldi
*& Title  : Posting Goods Receipt Other (Movement Type : 501)
*&---------------------------------------------------------------------*
 
REPORT ywhy_test11.
DATA: ls_goodsmvt_header  TYPE bapi2017_gm_head_01,
      ld_goodsmvt_code    TYPE bapi2017_gm_code,
      lt_goodsmvt_item    TYPE TABLE OF bapi2017_gm_item_create WITH HEADER LINE,
      lt_return           TYPE TABLE OF bapiret2 WITH HEADER LINE,
      ld_materialdocument TYPE bapi2017_gm_head_ret-mat_doc.
 
"Header Data
ls_goodsmvt_header-pstng_date = sy-datum.
ls_goodsmvt_header-doc_date = sy-datum.
ls_goodsmvt_header-ref_doc_no = 'test upload'.
ls_goodsmvt_header-bill_of_lading = ''.
ls_goodsmvt_header-gr_gi_slip_no = ''.
ls_goodsmvt_header-pr_uname = ''.
ls_goodsmvt_header-header_txt = 'heade teks'.
ls_goodsmvt_header-ver_gr_gi_slip = ''.
ls_goodsmvt_header-ver_gr_gi_slipx = ''.
ls_goodsmvt_header-ext_wms = ''.
ls_goodsmvt_header-ref_doc_no_long = ''.
ls_goodsmvt_header-bill_of_lading_long = ''.
ls_goodsmvt_header-bar_code = ''.
 
"GM Code
ld_goodsmvt_code = '05'. "Goods Receipt Other/ receipt w/o order
 
"Item Data
lt_goodsmvt_item-material   = '000000000000300466'.
lt_goodsmvt_item-plant      = 'P001'.
lt_goodsmvt_item-stge_loc   = 'GSTK'.
lt_goodsmvt_item-entry_qnt  = '1'.
lt_goodsmvt_item-entry_uom  = 'PC'.
lt_goodsmvt_item-move_type    = '501'.
APPEND lt_goodsmvt_item.
 
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
  EXPORTING
    goodsmvt_header  = ls_goodsmvt_header
    goodsmvt_code    = ld_goodsmvt_code
  IMPORTING
    materialdocument = ld_materialdocument
  TABLES
    goodsmvt_item    = lt_goodsmvt_item
    return           = lt_return
  .
IF ld_materialdocument IS INITIAL.
  "Jika nomor material dokumen tidak ada, berarti terjadi error
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
 
  "Tampilkan Error
  LOOP AT lt_return.
    WRITE lt_return-message.
  ENDLOOP.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = 'X'.
 
  "Tampilkan Nomor Dokumen Material
  WRITE ld_materialdocument.
 
ENDIF.

Sekian artikel mengenai BAPI BAPI_GOODSMVT_CREATE FOR GOODS RECEIPT WITHOUT ORDER – MOVEMENT TYPE 501,

Semoga bermanfaat.

   

Wahyu Amaldi, M.Kom has written 178 articles

Hallo Pembaca,
Saya merupakan konsultan di dunia SAP dan merupakan Spesialis .Net Programming.
Saya gemar berbagi pengalaman mengenai SAP & Dunia Programming, dan jika ada sesuatu yang perlu ditanyakan, bisa hubungi saya di email berikut ini:

Email 1 : wahyu.amaldi@outlook.com
Email 2 : wahyu.amaldi@ilmuprogram.com

Semoga Artikel yang Anda baca di website ini berguna dan dapat membantu Anda dalam menemukan solusi.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>