Goods Movement Transaction
Goods Movement Transaction
Scenario
At the time of implementation, we need to upload large amount master data and transactional data in the MM Module. For Example to Upload the initial stock. Secondly there may be a situation that we need to upload a large amount of Goods Movement transaction. In order to achieve that we can use the following BAPI. This document explains the steps to arrange the data and upload in the system using BAPI. This document will provide a guideline with respect to your requirement. Use this BAPI template for all types of Goods movement transaction by Changing appropriate movement indicator, GMcode of header information of BAPI and execute it.
Pre-requisite
Arrange the Data in the following format. Preferably in the Excel format Ths is a comprehensive list of data. You can use the relevent fields based on your movement type. But do not change the sequence. External Document Number - Any reference document number you need to maintain Movement Type - Movement type viz 561 311 etc Plant - plant code Material Number - Material code Quantity - Quantity Issuing Location - From Storage location Receiving Location - Receiving Storage location Purchase Document No - PO document Purchase Document Item No - PO item number Delivery Purchase Order Number - Delivery document no Delivery Item - Delivery item no Production Document No - Production doc no Scrap Reason - Reason code Document Date - Document date on which you post it Posting Date - Posting date
05 - MB1C - Enter Other Goods Receipt 06 - MB11 Movement Indicator Goods movement w/o reference B - Goods movement for purchase order F - Goods movement for production order L - Goods movement for delivery note K - Goods movement for kanban requirement (WM - internal only) O - Subsequent adjustment of "material-provided" consumption W - Subsequent adjustment of proportion/product unit material BAPI - Details Name : BAPI_GOODSMVT_CREATE Header Data : Header, Code Item Details : Internal table that contain material details that we fetch from Excelsheet Technical details Now we see the technical details for writing this BAPI Execution code Data Defention parameters: p-file like ibipparms-path default 'c:\datasource\MB1C.xls'. data: begin of gmhead. include structure bapi2017_gm_head_01. data: end of gmhead. data: begin of gmcode. include structure bapi2017_gm_code. data: end of gmcode. data: begin of mthead. include structure bapi2017_gm_head_ret. data: end of mthead. data: begin of itab occurs 100. include structure bapi2017_gm_item_create. data: begin of itemtab occurs 100, ext_doc(10), "External Document Number mvt_type(3), "Movement Type plant(4), "Plant material(18), "Material Number qty(13), "Quantity issue_loc(4), "Issuing Location recv_loc(4), "Receiving Location pur_doc(10), "Purchase Document No po_item(3), "Purchase Document Item No del_no(10), "Delivery Purchase Order Number
del_item(3), "Delivery Item prod_doc(10), "Production Document No scrap_reason(10), "Scrap Reason doc_date(8), "Document Date post_date(8), "Posting Date end of itemtab. Read Data Read data from Excel and store in Internal table form UPLOAD_DATA . DATA: loc_filename TYPE rlgrap-filename. "string. DATA: it_raw TYPE truxs_t_text_data. loc_filename = p-file. CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP' EXPORTING i_line_header = 'X' i_tab_raw_data = it_raw i_filename = loc_filename TABLES i_tab_converted_data = pcitab EXCEPTIONS conversion_failed = 1 OTHERS = 2. endform. " UPLOAD_DATA Set Header information gmhead-pstng_date = sy-datum. "you can change it from the data you read from excl gmhead-doc_date = sy-datum. gmhead-pr_uname = sy-uname. gmcode-gm_code = '04'. "04 - MB1B - Transfer Posting Set Item Details loop at itemtab. itab-move_type = itemtab-mvt_type. itab-mvt_ind = ''. itab-plant = itemtab-plant. itab-material = itemtab-material. itab-entry_qnt = itemtab-qty. itab-move_stloc = itemtab-recv_loc. itab-stge_loc = itemtab-issue_loc. itab-po_number = itemtab-pur_doc. itab-po_item = itemtab-po_item. itab-move_reas = itemtab-scrap_reason.