SAP Function BAPI_GOODSMVT_CREATE_OIL - Post goods movements with MB_CREATE_GOODS_MOVEMENT

Parameter Reference Type Length Default Optional Text
GOODSMVT_CODE BAPI2017_GM_CODE u 2 Assign Code to Transaction for Goods Movement
GOODSMVT_HEADER BAPIOIL2017_GM_HEAD_CREATE u 214 Material Document Header Data
TESTRUN BAPI2017_GM_GEN-TESTRUN C 1 SPACE X Simulate Goods Movement

Parameter Reference Type Length Text
GOODSMVT_HEADRET BAPI2017_GM_HEAD_RET u 14 Material Document Number/Material Document Year
MATDOCUMENTYEAR BAPI2017_GM_HEAD_RET-DOC_YEAR N 4 Material Doc. Year
MATERIALDOCUMENT BAPI2017_GM_HEAD_RET-MAT_DOC C 10 Number of Material Document

Parameter Reference Length Optional Text
EXTENSIONIN BAPIPAREX 990 X Ref. structure for BAPI parameter ExtensionIn/ExtensionOut
GOODSMVT_ITEM_01 BAPIOIL2017_GM_ITM_CRTE_01 1046 BAPI Communication Structure: Create Material Document Item
GOODSMVT_ITEM_02 BAPIOIL2017_GM_ITM_CRTE_02 298 X BAPI Communication Structure: Create Material Document Item
GOODSMVT_ITEM_PARAM BAPIOIL2017_GM_ITM_CRTE_PARAM 632 X BAPI-Kommunik.Strukt: Mat.Bel.Pos. Param. anl.
GOODSMVT_ITEM_QUAN BAPIOIL2017_GM_ITM_CRTE_QUAN 40 X BAPI-Kommunik.Strukt: Mat.Bel.Pos. alt. Mengen. anl.
GOODSMVT_SERIALNUMBER BAPI2017_GM_SERIALNUMBER 94 X Serial Number
RETURN BAPIRET2 548 Return Messages

Functionality
You can use this method to create a material document for a goodsmovement.
You can only create one material document each time you call up themethod.
You can use a simulation function before posting the goods movement tocheck how the data is updated in the database. The standard system isconfigured so that the goods movement is posted immediately withoutsimulating beforehand.
Ensure that you transfer the data in the same way as it is run in thedatabase, for example,

  • Material number 18-figure with leading zeros

  • Batches with uppercase letters

  • Note that for all transactions/events listed below, the posting date isentered in the header data of the material document. In theBAPI2017_GM_HEAD_01 interface, fill the PSTNG_DATE (importstructure GOODSMVT_HEADER) field.

    Industry-Specific Information for SAP Oil & Gas when Calling MethodCreateFromDataOil
    The system transfers the material document data for a document item tothe method using the following interface tables:

    • GOODSMVT_ITEM_01 STRUCTURE BAPIOIL2017_GM_ITM_CRTE_01

    • GOODSMVT_ITEM_02 STRUCTURE BAPIOIL2017_GM_ITM_CRTE_02 OPTIONAL

    • GOODSMVT_ITEM_PARAM STRUCTURE BAPIOIL2017_GM_ITM_CRTE_PARAM OPTIONAL

    • GOODSMVT_ITEM_QUAN STRUCTURE BAPIOIL2017_GM_ITM_CRTE_QUAN OPTIONAL

    • When calling the method, make sure that all of the above interfacetables contain the fields LINE_ID, PARENT_ID, andLINE_DEPTH as these are needed to identify a document item. Ofthese fields, at the very least, the LINE_ID field must contain aunique number for each document item so that there is a unique linkbetween each of these document items and the corresponding item data inthe four tables.
      Example
      Post a material document with two document items, the the first itemfora standard material (without any industry-specific data), and theseconditem for an industry-specific material. The header data is istransferred in the same way as with method CreateFromData.
      Enter the relevant data for the first item in table GOODSMVT_ITEM_01.Enter 000001 in the LINE_ID field.
      Enter the relevant data for the second item in table GOODSMVT_ITEM_01.Enter 000002 in the LINE_ID field.
      Enter the external details and excise duty data in tableGOODSMVT_ITEM_02. Enter 000002 in the LINE_ID field.
      Enter the quantity conversion parameters in table GOODSMVT_ITEM_PARAM.Enter 000002 in the LINE_ID field.
      The system transfers the additional quantities (number n) to tableGOODSMVT_ITEM_QUAN. For each item, enter 000002 in theLINE_ID field.
      Posting the Additional Quantities
      Table GOODSMVT_ITEM_PARAM contains two control parameters for postingitems with additional quantities:
      • CALCULATEMISSING

      • USEDEFAULTPARAMETERS

      • If the value you enter for the USEDEFAULTPARAMETERS parameterdiffers from the default value, the system ignores any any quantityconversion parameters you entered manually and determines theseparameters from the relevant default value tables.
        If the value you enter for the CALCULATEMISSING parameter differsfrom the default value, the system determines all all necessary units ofmeasure for this posting item and calculates the missing quantities.Otherwise you must ensure that the system can access all quantities inall required units of measure through the interface.
        For each quantity and unit of measure, in the QUANTITYCHECK fieldin table GOODSMVT_ITEM_QUAN, you can enter a value that differs from thedefault value. If you do this, the system compares the additionalquantities with the calculated additional quantities, and in line withthe Customizing settings, performs a tolerance check. If you do notenter a value in the QUANTITYCHECK field, no check takes placeand the system posts the additional quantities without a check takingplace (in this case, there is a U in the MANEN field).

        Notes
        Authorization check,,,,check
        In the MM Inventory Management component, the method does not executeany authorization checks.
        Note that during a posting of a goods movement, depending on thebusiness transaction of the system, authorization objects of otherapplications can also be checked.
        Transfer
        The following information about the material document that is to becreated is transferred to the method:

        • a structure with 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 carried out in the SAP R/3 via theMB_CREATE_GOODS_MOVEMENT function module.
          Confirmations
          INCLUDE BAPI_RET LANGUAGE EN

          Further information
          INCLUDE BAPI_INVENTUR_WEITERINF LANGUAGE EN
          Which fields have to be filled during the various transactions/events?
          The following sample scenarios demonstrate which fields have to befilled for which business transactions/events (code).
          There are the following types of transactions/events:
          GM_Code 01: Goods receipt for purchase order
          GM_Code 02: Goods receipt for production order
          GM_Code 03: Goods issue
          GM_Code 04: Transfer posting
          GM_Code 05: Other goods receipts
          GM_Code 06: Reversal of goods movements
          GM_Code 07: Subsequent adjustment to a subcontract order
          Entering the movement indicator
          Depending on the transaction, you must enter the following in themovement indicator:

          • GM_Code 01 (Goods receipt for purchase order): B

          • GM_Code 02 (Goods receipt for production order): F

          • For all other transactions, you leave the field blank.

          • For 1: GM_Code 01: Goods receipt for purchase order
            • Purchase order known

            • The following fields have to be filled:
              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 filled in some cases (incompletelisting):
              Shelf life expiration date (if it has been configured like this in thesystem)
              Reason for movement (if it has been configured like this in the system)
              Batch (if the material is handled in batches and batch numbers are notassigned automatically)
              Storage location (if a storage location has not been specified in thepurchase order item)
              The following fields can be filled (incomplete listing):
              Stock type
              Item text
              Unloading point
              Delivery completed indicator
              You cannot fill the following fields (incomplete listing):
              Account assignment fields (account assignment is adopted from thepurchase order)
              Reservation
              Receiving/issuing material
              Receiving/issuing plant
              Receiving/issuing storage location
              In the case of a purchase order item with the "subcontracting" itemcategory, only the GR item in the interface is to be transferred. Thesystem automatically determines GI items.
              • Purchase order unknown: Shipping notification known

              • The following fields have to be filled:
                Delivery
                Delivery item
                Movement type
                Other fields, such as those under "Purchase order known". The systemdetermines the relevant purchase order item via the delivery/deliveryitem.
                • Purchase order unknown: Purchase order should be created automatically

                • The following fields have to be filled:
                  Material number
                  Plant
                  Storage location
                  Vendor
                  Movement type
                  Movement indicator
                  Quantity in unit of entry
                  ISO code unit of measurement for unit of entry
                  The following fields may have to be filled in some cases (incompletelisting):
                  Shelf life expiration date (if it has been configured like this in thesystem)
                  Reason for movement (if it has been configured like this in the system)
                  Batch (if the material is handled in batches and batches are notassigned automatically)
                  The following fields can be filled (incomplete listing):
                  Stock type
                  Item text
                  Unloading point
                  You cannot fill the following fields (incomplete listing):
                  Account assignment fields (automatic creation of purchase order itemswith account assignment is not supported)
                  Reservation
                  Receiving/issuing material
                  Receiving/issuing plant
                  Receiving/issuing storage location
                  • Purchase order unknown: A purchase order should not be created

                  • The following fields have to be filled:
                    Material number
                    Plant
                    Storage location
                    Vendor
                    Movement type
                    Movement indicator
                    Quantity in unit of entry
                    ISO code unit of measurement for unit of entry
                    The following fields may have to be filled in some cases (incompletelisting):
                    Shelf life expiration date (if it has been configured like this)
                    Reason for movement (if it has been configured like this)
                    Batch (if the material is handled in batches and automatic assignment ofbatch numbers is not set)
                    The following fields can be filled (incomplete listing):
                    Special stock indicator
                    Item text
                    Unloading point
                    Goods recipient
                    The following fields cannot be filled (incomplete listing):
                    Account assignment fields (automatic creation of purchase order itemswith 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 combinedwithin an input table so that they can be posted in a material document.Items can also be posted for different purchase orders, provided thatall the purchase orders refer to the same vendor.
                    • Transfer of subcontracting components

                    • During the posting of the ordered material of a subcontract order withmovement type 101, for the transfer of the subcontracting components,the filled unique identification of the document line (LINE_ID) is alsorequired.
                      More information on LINE_ID andPARENT_ID
                      The following fields have to be filled for the components:
                      Unique identification of the document line
                      Identification of the immediately superior line
                      Material number
                      Plant
                      Storage location
                      Quantity in unit of entry
                      The following fields can be filled for the components:
                      All other fields in the method that are included in thislist.
                      The following fields cannot be filled for the components:
                      All fields that are not included in the list above. The movementindicator must be initial.
                      • Additional fields in goods-receipt-based invoice verification

                      • When you post a goods receipt to purchase order with movement type102, an issue with reference to a previously posted goods issue,the following fields must also be transferred:
                        REF_DOC_IT (LFPOS): Item of a reference document
                        REF_DOC (LFBNR): Document number of a reference document
                        REF_DOC_YR (LFBJA): Fiscal year of a reference document
                        Only when you transfer these fields is it guaranteed that the referenceto the original goods movement stay the same.
                        For 2 GM_Code 02: Goods receipt for production order
                        The following fields have to be filled:
                        Order
                        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 filled in some cases (incompletelisting):
                        Shelf life expiration date (if the system has been configured like this)
                        Reason for movement (if the system has been configured like this)
                        Batch (if the material is handled in batches and automatic batch numberassignment is not set)
                        Storage location (if storage location has not been specified in theorder)
                        The following fields can be filled (incomplete listing):
                        Order item (co-product)
                        Stock type
                        Item text
                        Unloading point
                        "Delivery completed" indicator
                        The following fields cannot be filled (incomplete listing):
                        Account assignment fields (the account assignments are adopted from thepurchase order)
                        Reservation
                        Receiving/issuing material
                        Receiving/issuing plant
                        Receiving/issuing storage location
                        Receiving/issuing batch
                        For 3 GM_Code 03: Goods issue
                        • Goods issue without reference to a reservation

                        • The following fields have to be filled:
                          Material number
                          Plant
                          Storage location
                          Movement type
                          Movement indicator
                          Quantity in unit of entry
                          ISO code unit of measurement for unit of entry
                          The following fields may have to be filled in some cases (incompletelisting):
                          Special stock (e.g. sales order, project, vendor etc.)
                          Shelf life expiration date (if the system is configured like this)
                          Reason for movement (if the system has been configured like this)
                          Batch (if the material is handled in batches and automatic batch numberassignment is not set)
                          Account assignment fields
                          The following fields can be filled (incomplete listing):
                          Special stock indicator
                          Item text
                          Unloading point
                          Goods recipient
                          The following fields cannot be filled (incomplete listing):
                          Reservation
                          Receiving/issuing material
                          Receiving/issuing plant
                          Receiving/issuing storage location
                          Receiving/issuing batch
                          • Goods issue with reference to a reservation

                          • The following fields have to be filled:
                            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 filled in some cases (incompletelisting):
                            Shelf life expiration date (if this has been configured in the system)
                            Reason for movement (if this has been configured in the system)
                            Batch (if the material is handled in batches and automatic batch numberassignment is not set)
                            Storage location (if not planned in the reservation)
                            The following fields can be filled (incomplete listing):
                            Special stock indicator
                            Item text
                            Unloading point
                            Goods recipient
                            The following fields cannot be filled (incomplete listing):
                            Movement type
                            Material
                            Plant
                            Account assignment fields
                            For 4 GM_Code 04: Transfer posting
                            • Transfer posting without reference to a reservation

                            • The following fields have to be filled:
                              Material number
                              Plant
                              Storage location
                              Movement type
                              Movement indicator
                              Quantity in unit of entry
                              ISO code unit of measurement for unit of entry
                              The following fields may have to be filled in some cases (incompletelisting):
                              Receiving material
                              Receiving plant
                              Receiving storage location
                              Receiving batch (if material is handled in batches and you want tochange batches)
                              Receiving/issuing special stock (e.g. sales order, project, vendor etc.)
                              Shelf life expiration date (if this has been configured in the system)
                              Reason for movement (if this has been configured in the system)
                              Batch (if the material is handled in batches and automatic batch numberassignment is not set)
                              The following fields can be filled (incomplete listing):
                              Special stock indicator
                              Item text
                              Account assignment fields (for automatic posting lines: Expense/incomefrom stock transfer)
                              The following fields cannot be filled (incomplete listing):
                              Reservation
                              • Transfer posting with reference to a reservation

                              • See goods issue with reference to a reservation
                                For 5 GM_Code 05: Other goods receipts
                                • Other goods receipt without 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
                                    For 6 GM_Code 06: Reversal of goods movements
                                    You can use the Cancel method to reverse goods movements. But youmay also want to cancel a goods movement without referring to a materialdocument (see the Cancel method).
                                    If you want to work without referring to the document, you have to fillthe field BAPI_GM_ITEM_CREATE-XSTOB in the interface (importtable GOODSMVT_ITEM). In this case, the system converts themovement type assigned in the interface to the reversal movement type.Alternatively, you can set the reversal movement type in the interface.In this case, the BAPI_GM_ITEM_CREATE_XSTOB field must betransferred blank.
                                    If you want to cancel a goods movement with reference to a reservation(without using the Cancel method) you can only transfer the fieldBAPI_GM_ITEM_CREATE_XSTOB if it is filled. Movement types are nottransferred when you post with reference to a reservation, as themovement type is contained in the reservation item.
                                    For 7. GM_Code 07: Subsequent adjustment to a subcontract order
                                    • Ordered material of subcontract order

                                    • The following fields have to be filled:
                                      Unique identification of document line (can be assigned to anything)
                                      Posting date in document header
                                      Document number of purchasing document
                                      Item number of purchasing document
                                      Material number,,,, check
                                      Plant,,,,check
                                      Movement type (select movement type 121)
                                      Movement indicator (must be O)
                                      Further entries are not allowed. The entry quantity for the orderedmaterial of a subcontract order must be zero.
                                      • Components

                                      • The following fields have to be filled:
                                        Unique identification of document line (can be assigned to anything)
                                        Identification of the immediately superior line
                                        Plant
                                        Material number,,,, check
                                        Quantity in unit of entry; can also be negative
                                        The following fields can be filled:
                                        Storage location
                                        All other fields in the method that are included in thislist.
                                        The following fields may not be filled:
                                        All fields that are not in the list above. The movement indicator mustbe blank.
                                        More information on LINE_ID andPARENT_ID
                                        • Additional fields in goods-receipt-based invoice verification

                                        • When you post a subsequent adjustment, the following fields must also betransferred:
                                          REF_DOC_IT (LFPOS): Item of a reference document
                                          REF_DOC (LFBNR): Document number of a reference document
                                          REF_DOC_YR (LFBJA): Fiscal year of a reference document
                                          Only when you transfer these fields is it guaranteed that the referenceto the original goods movement stays the same.

                                          Description
                                          This structure transfers the fields that are filled to the initiatorwhen the material document was successfully posted.
                                          INCLUDE BAPI_DATAELEMENT
                                          number of material document
                                          material document year

                                          Default

                                          Description
                                          INCLUDE BAPI_KEYFIELD

                                          Description
                                          INCLUDE BAPI_KEYFIELD

                                          Description
                                          This parameter transfers the new key assignment of the GM_CODE to therelevant transactions in Inventory Management.
                                          INCLUDE BAPI_DATAELEMENT

                                          Default

                                          Description
                                          This structure contains the header data of the material document that isto be created.
                                          INCLUDE BAPI_DATAELEMENT

                                          Default

                                          Description
                                          This parameter passes on the data for simulating the goods movementprior to posting.
                                          INCLUDE BAPI_DATAELEMENT OBJECT DOKU ID TX LANGUAGE EN
                                          TESTRUN

                                          Default

                                          Description
                                          General
                                          You can use this parameter to transfer user-specific enhancments to aBAPI. The customer has to complete the EXTENSION structure and thesystem automatically continues processing it. If you have not definedany user-specific fields, then you can transfer a blank EXTENSIONINstructure.
                                          Special
                                          With this it is possible to enrich DB table MSEGO1 with user-specificenhancements via customer include CI_MSEGO1.
                                          Preparations
                                          User has to create customer includes CI_MSEGO1 and CI_MSEGO1_CHAR.

                                          • CI_MSEGO1 is included in DB table MSEGO1 and structure BAPI_TE_MSEGO1.
                                          • It may contain fields of some sort.
                                            • CI_MSEGO1_CHAR is included in structure BAPI_TE_MSEGO1_CHAR. It must
                                            • contain the same number of fields with the same names in the samesuccession as in CI_MSEGO1 - but in character format. Check that thelength of each CI_MSEGO1_CHAR field is equal to the output length of thecorresponding CI_MSEGO1 fiield. ( you will find the necessary technicalinformations about data elements using transaction SE11 ).
                                              Example
                                              You can find more information in the BAPI programming guide in thechapter for enhancements to BAPIs.

                                              Description
                                              This table contains the item data for the material document that is tobe created.
                                              It contains the fields from SAP standard.
                                              For more information on the individual parameter fields, see the dataelement documentation in the ABAP Dictionary.

                                              Description
                                              This table contains the item data for the material document that is tobe created.
                                              It contains the IS-Oil part of fields
                                              For more information on the individual parameter fields, see the dataelement documentation in the ABAP Dictionary.

                                              Description
                                              This table contains the conversion parameters for each item of thematerial document that is to be created - if the material is an oilmaterial.
                                              For more information on the individual parameter fields, see the dataelement documentation in the ABAP Dictionary.

                                              Description
                                              This table contains a set of quantities in additional unit of measurefor each item of the material document that is to be created - in casethe material of that item is an oil material.
                                              For more information on the individual parameter fields, see the dataelement documentation in the ABAP Dictionary.

                                              Description
                                              Serial number

                                              Default
                                              If the XSAUT indicator is set in the table parameter GoodsmvtItem
                                              , the system automatically determines the serial numbers for an item.
                                              When creating a goods movement with serial numbers, various scenarios ar
                                              e possible:
                                              The XSAUT indicator is set:

                                              • If all the serial numbers for an item are to be determined automatically

                                              • If serial numbers have been preset for a partial quantity of an item,
                                              • but the remaining serial numbers are determined automatically.
                                                The XSAUT indicator is not set:
                                                • If the serial numbers are preset for the complete quantity of an item.

                                                • If serial numbers are preset for only a partial quantity of an item.
                                                • However, if you have not specified that the remaining serial numbers areto be determined automatically, an error occurs.
                                                  • An error occurs if the number of serial numbers exceeds the quantity
                                                  • forthe item.

                                                    Description
                                                    INCLUDE BAPI_TABLE

                                                    Default
                                                    INCLUDE BAPI_WARENBEWEGUNG_RETURN

943156IS-OIL BAPI_GOODSMVT_CREATE_OIL WITH ACTIV RETAIL