Link to this Page Link Tiny Link OK Wiki Markup Cancel Close Click to select the Move Page How Search Error reading the
You could try relo HTTP Status Move failed. Ther ERP SCM Unknow n user or 88113270
There w ere no pa Show ing <b>{0}< ERPSCM Reorder Close Move Save
You cannot move How To Goods M MM-IM-GF-BAPI You cannot move Page Ordering Page Restrictions Editing restricted Back Cancel
Page restrictions apply Added by Haiko Emmerling, last edited by Haiko Emmerling on Mar 25, 2009 Comment:
view
Content 1. Content 2. BAPIs in Inventory Management 3. Introduction 4. Data population 5. Further information 6. Which fields must be populated during the various transactions/events? 7. GM_Code 01: Goods receipt for purchase order 1. Purchase order known 2. Purchase order unknown: Shipping notification known 3. Purchase order unknown: Purchase order is to be created automatically 4. Purchase order unknown: A purchase order is not to be created 1. Transfer of subcontracting components 8. GM_Code 02: Goods receipt for production order 9. GM_Code 03: Goods issue 1. Goods issue without reference to a reservation 2. Goods issue with reference to a reservation 10. GM_Code 04: Transfer posting 1. Transfer posting without reference to a reservation 11. GM_Code 05: Other goods receipts 12. GM_Code 06: Reversal of goods movements 13. GM_Code 07: Subsequent adjustment with regard to a subcontract order 14. More information on LINE_ID and PARENT_ID
1.
choices:
An application that calls the BAPI_GOODSMVT_CREATE BAPI, has the following Additional fields in goods-receipt-based invoice verification How to test he BAPI Example Code for calling the GM BAPI to post a 561 Goods Movement Calling the BAPI several times within one roll area Here you have to adhere to the following procedure: Example 1: Example 2: SAP Notes
Introduction
You can use the BAPI BAPI_GOODSMVT_CREATE to create a material document for a goods movement. You can only create one material document each time you call up the method. You can use a simulation function before posting the goods movement to check how the data is updated in the database. The standard system is configured so that the goods movement is posted immediately, without prior simulation.
Data population
Ensure that you transfer the data in the same way as it is managed in the database. For example: Material number 18-character with leading zeros Batches with uppercase letters Ensure that the header data of the material document includes the posting date for all transactions/events listed below. Populate the PSTNG_DATE field (import structure GOODSMVT_HEADER) in the interface BAPI2017_GM_HEAD_01 for this purpose. The following information about the material document that is to be created is passed on to the BAPI: A structure with the header data A structure with the code for the movement A table with the item data A table with the serial numbers The posting is made by the function module MB_CREATE_GOODS_MOVEMENT. Confirmations
Messages are returned in the Return parameter. The parameter documentation shows the return codes and their meanings.
Further information
The BAPI can only perform your function if no error messages were generated in the Return table. This is the case if the header data and all the items were processed successfully. Transaction control is not implemented. The calling program therefore has to execute the Commit Work itself after this method has been successfully invoked (in other words, if no errors were reported in the Return parameter).
Entering the movement indicator Depending on the transaction (GM_CODE), you must enter the following in the movement indicator field: GM_Code 01 (Goods receipt for purchase order): B GM_Code 02 (Goods receipt for production order): F For all other transactions, leave the field blank.
Purchase order Purchase order item Movement type Movement indicator Quantity in unit of entry ISO code unit of measurement for unit of entry or quantity proposal The following fields may have to be populated (this is not a complete list):
Minimum shelf life expiration date (if set up in the system) Reason for movement (if set up in the system) Batch (if the material is handled in batches and no automatic batch assignment has been set up) Storage location (if no storage location us specified in the purchase order item) The following fields can be populated (this is not a complete list):
Stock type Item text Unloading point Delivery completed indicator The following fields must not be populated (this is not a complete list): Account assignment fields (the account assignment is adopted from the purchase order) Reservation Receiving/issuing material Receiving/issuing plant Receiving/issuing storage location In the case of a purchase order item with the item category "subcontracting", only the GR item is to be passed on in the interface. The GI items are determined automatically in the system.
The following fields may have to be populated (this is not a complete list): Minimum shelf life expiration date (if set up in the system) Reason for movement (if set up in the system) Batch (if the material is handled in batches and batches are not assigned automatically) The following fields can be populated (this is not a complete list): Stock type Item text Unloading point You cannot populate the following fields (this is not a complete list): Account assignment fields (automatic creation of purchase order items with account assignment is not supported) Reservation Receiving/issuing material Receiving/issuing plant Receiving/issuing storage location
Receiving/issuing batch The input combinations listed above for the GM_CODE 01 can be combined within an input table so that they can be posted in a material document. Items can also be posted for different purchase orders, provided that all the purchase orders relate to the same vendor.
Order item (co-product) Stock type Item text Unloading point "Delivery completed" indicator The following fields cannot be populated (this is not a complete list):
Account assignment fields (the account assignments are adopted from the purchase order) Reservation Receiving/issuing material Receiving/issuing plant Receiving/issuing storage location Receiving/issuing batch
Reservation number Reservation item Record type of the reservation Movement indicator Quantity in unit of entry ISO code unit of measurement for unit of entry The following fields may have to be populated in some cases (this is not a complete list):
Minimum shelf life expiration date (if set up in the system) Reason for movement (if set up in the system) Batch (if the material is handled in batches and automatic batch number assignment is not set) Storage location (if not planned in the reservation) The following fields can be populated (this is not a complete list):
Special stock indicator Item text Unloading point Goods recipient The following fields cannot be populated (this is not a complete list):
Special stock indicator Item text Account assignment fields (for automatic posting lines: expense/income from stock transfer) The following fields cannot be populated (this is not a complete list):
Reservation Transfer posting with reference to a reservation See goods issue with reference to a reservation
See goods issue without reference to a reservation Other goods receipt with reference to a reservation See goods issue with reference to a reservation
Unique identification of document line (can be freely assigned) Identification of the immediately superordinate line Plant Material number check Quantity in unit of entry; can also be negative The following fields can be populated: Storage location All other fields in the method that are included in this list. The following fields may not be populated:
All fields that are not in the list above. The movement indicator must be blank.
An application that calls the BAPI_GOODSMVT_CREATE BAPI, has the following choices:
Goods receipt for subcontract order with components Only transfer of end product (ordered material of subcontract order) with movement type 101, all components are therefore read with the ME_READ_COMP_GOODS_RECEIPT function. Transfer of end product (ordered material of subcontract order) and components, the components are posted with the data from the BAPI2017_GM_ITEM_CREATE (BAPI communication structure: Create material document item) structure. Subsequent adjustment, the end product and all components must be transferred to the BAPI_GOODSMVT_CREATE BAPI. How for the last two cases the BAPI2017_GM_ITEM_CREATE structure is to be filled, is explained in the following examples. Nomenclature of the examples In the following, you will find a list of fields mentioned in the following examples. The name of the particular field in the interface is specified in brackets. Field Interface Description LINE_ID (MB_LINE_ID): Unique identification of document line PARENT_ID (MB_PARENT_ID): Identification of immediately superior line MATERIAL (MATNR): Material number PLANT (WERKS_D): Plant STGE_LOC (LGORT_D): Storage location ENTRY_QNT (ERFMG): Quantity in unit of entry
MOVE_TYPE (BWART): Movement type (Inventory Management) MVT_IND (KZBEW): Movement indicator PO_NUMBER (BSTNR [EBELN]): Purchase order number PO_ITEM (EBELP): Item number of purchasing document Examples Transfer of end product (ordered material of subcontract order) and components LINE_I D 000001 000002 000003 PARENT_I D 000000 000001 000001 MATERIA L END COMP1 COMP1 PLAN T 0001 0001 0001 STGE_LO C 0001 0001 0001 ENTRY_QN T 10 15 20 MOVE_TYP E 101 MVT_IN D B PO_NUMBE R 4500000012 PO_ITE M 10 -
Subsequent adjustment LINE_I D 000001 000002 000003 PARENT_I D 000000 000001 000001 MATERIA L END COMP1 COMP1 PLAN T 0001 0001 0001 STGE_LO C 0001 0001 0001 ENTRY_QN T 0 15 20 MOVE_TYP E MVT_IN D O PO_NUMBE R 4500000012 PO_ITE M 10 -
Note that the ENTRY_QNT field can be negative in subsequent adjustment. This is then allowed if a goods receipt instead of a goods issue is posted for a component. In the BAPI for the MVT_IND field, the special stock indicator O is supported. In the example above, only a few fields are used, although the BAPI2017_GM_ITEM_CREATE structure has over one hundred fields. Only a few of these fields are useful for subcontracting components; they can be found in the GOCOMP (Components for subcontracting) structure (see this list).
You can use transaction SE37 to execute/ test the BAPI. You can also specify a test sequence of calling several BAPI in a series via the menu. For a real simulation you should create a test report with Tx SE38. See example followed on.
Example Code for calling the GM BAPI to post a 561 Goods Movement
ZBAPI_GDSMVT
REPORT
z_bapi_gdsmvt.
DATA: ls_mmdochdr LIKE bapi2017_gm_head_01, lt_gm ls_gm lt_ret ls_ret ls_hdr ls_ser lt_ser TYPE STANDARD TABLE OF bapi2017_gm_item_create, LIKE bapi2017_gm_item_create, TYPE STANDARD TABLE OF bapiret2, LIKE bapiret2, LIKE bapi2017_gm_head_ret, LIKE bapi2017_gm_serialnumber, LIKE STANDARD TABLE OF bapi2017_gm_serialnumber.
PARAMETERS: p_pstdat LIKE bapi2017_gm_head_01-pstng_date, p_docdat p_matnr p_plant p_sloc p_quant p_batch LIKE bapi2017_gm_head_01-doc_date, LIKE bapi2017_gm_item_create-material, LIKE bapi2017_gm_item_create-plant, LIKE bapi2017_gm_item_create-stge_loc, LIKE bapi2017_gm_item_create-entry_qnt, LIKE bapi2017_gm_item_create-batch.
START-OF-SELECTION.
ls_gm-move_type = '561'. ls_gm-material = p_matnr. ls_gm-plant = p_plant. ls_gm-stge_loc = p_sloc. ls_gm-entry_qnt = p_quant. ls_gm-batch = p_batch.
* Call BAPI CALL FUNCTION 'BAPI_GOODSMVT_CREATE' EXPORTING goodsmvt_header goodsmvt_code IMPORTING goodsmvt_headret = ls_hdr TABLES goodsmvt_item return = lt_gm = lt_ret. = ls_mmdochdr = '05'
* If no error, commit IF lt_ret IS INITIAL. WRITE: 'Material Document posted:', ls_hdr-mat_doc, ' ', ls_hdr-doc_year.
Alternative ROLLBACK WORK. WRITE: 'Error during posting Material document:', /. LOOP AT lt_ret INTO ls_ret. WRITE: ls_ret-type, ls_ret-id, ls_ret-number, ls_ret-message, ls_ret-log_no, ls_ret-log_msg_no, ls_ret-message_v1, ls_ret-message_v2, ls_ret-message_v3, ls_ret-message_v4. ENDLOOP. ENDIF.
2. 3.
This function module must be called with command CALL FUNCTION func DESTINATION 'NONE'. As a result, the system opens a new roll area. Then you must implement function module RFC_CONNECTION_CLOSE.This function module closes the roll area of the function module.As a result, a new roll area is opened when you call a function module with DESTINATIN 'NONE' for the next time, and thus, for example, no more internal buffer data is available.
Example 1:
Test
Program Test. ... LOOP. .... CALL FUNCTION func1 DESTINATION 'NONE'. CALL FUNCTION RFC_CONNECTION_CLOSE. .... ENDLOOP.
Func1
FUNCTION func1. .... CALL FUNCTION 'BAPI_GOODSMVT_CREATE'. ... IF 'no errors'. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. ELSE. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. ENDIF. ... ENDFUNCTION. Example 2:
ZBAPI_GDSMVT
REPORT
zbapi_gdsmvt.
START-OF-SELECTION.
* Call BAPI to create Goods Movement CALL FUNCTION 'BAPI_GOODSMVT_CREATE' DESTINATION 'NONE'
* If no error, commit CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' DESTINATION 'NONE' EXPORTING wait = 'X'. * ELSE * Error handling CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK' DESTINATION 'NONE'.
* Call BAPI to create Goods Movement CALL FUNCTION 'BAPI_GOODSMVT_CREATE' DESTINATION 'NONE'
* If no error, commit CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' DESTINATION 'NONE' EXPORTING wait = 'X'. * ELSE * Error handling CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK' DESTINATION 'NONE'.
SAP Notes
520813 FAQ Note for GM with BAPIs