The note is quoted below for reference.
This note contains frequently asked questions and answers regarding 'BAPIs for goods movements'.
Where can I find the documentation for calling the BAPI_GOODSMVT_CREATE BAPI?
Further information about possible problems during the call can be found in the following text.
Which function modules must be called after the call of the BAPI to complete the posting once the material document has been created successfully? What should I do if there is an error?
The BAPI returns a return table for error handling, that is, if the posting is incorrect, this table contains an entry regarding the cause of the error. The 'caller' is responsible for evaluating this table and for triggering the update that is dependent on this.
If the posting is correct (return table is initial), a 'Commit Work' must be carried out to complete the posting. This is carried out by calling BAPI_TRANSACTION_COMMIT.
The Commit or rollback always applies to the current LUW (logical unit of work). Therefore, you must ensure that it is carried out at the correct point in the source code. More information about this is available in the documentation for BAPI_TRANSACTION_COMMIT or ..._ROLLBACK.
For a detailed description, see Note 457499.
What do I need to bear in mind when I call BAPI_GOODSMVT_CREATE with a material number and a reservation number at the same time?
If you assign a reservation number to the BAPI during the call, the system must read the data from this reservation. This is necessary to be able to update the reservation correctly. The BAPI only updates the quantity fields, other reservation fields are not affected.
If the material for the goods movement is not the same as the material from the reservation, the system updates the quantities for the incorrect material. Availability checks, ATP and so on refer to the reservation data. Therefore it is important to update the reservation for the correct material. Otherwise these checks do not work. If the materials do not match, the system generates error message M7 042.
If the information from the reservation is no longer valid, for example, because the material has been replaced by a substitute, you should change this reservation accordingly. You can then call the BAPI with reference to this reservation.
- M7 096: "Goods movement not possible with mvmt type &"
"Update control of movement type incorrect (entry 101 X X)".
Which fields do I have to fill when calling the BAPI to avoid this error?
The system checks the combination movement type - allowed transactions. Make sure that you assign a GM_CODE to the BAPI for the required transaction.
Can I assign a wildcard '*' for the storage location/the batch to the BAPI to use it for the warehouse stock or batch determination?
No. The determination must take place before the BAPI is called to provide it with the required information. If you assign a wildcard '*' to the BAPI for the storage location/batch, the system displays an error message.
Can I assign the SPEC_MVMT special movement indicator for warehouse management (displayed as BSSKZ in the program) to the BAPI during the call?
The SPEC_MVMT field is available as of Release 4.6C. On account of the BAPI guidelines, you cannot change the BAPI2017_GM_ITEM_CREATE structure in R/3 Support Package systems. As a consequence, you can no longer generate, for example, the respective IDOC with message category MBGMCR.
Alternatively, you can use the IDOC of the WMMBXY message type because here the E1MBXYJ structure contains the BSSKZ field.
When I try to post a goods receipt for the purchase order using a BAPI, the system displays error message M7021 'Deficit of & & & &'. The GR-based invoice verification is active, and the item in the purchase order may have already been cancelled once.
In this case, you must also transfer fields LFBJA, LFBNR and LFPOS from the purchase order history (table EKBE) - otherwise the system cannot find the correct document. For more information, see Note 109396. Even though this note refers to IDoc processing, the same logic also applies to BAPI_GOODSMVT_CREATE.
Fill fields GOODSMVT_ITEM-REF_DOC_YR, GOODSMVT_ITEM-REF_DOC and GOODSMVT_ITEM-REF_DOC_IT in the BAPI interface and test the system behavior again.
When I create a goods receipt for a subcontract order, the system should explode the BOM in the background. If the subcontracting components are in special stock O with batch, the BAPI returns error message M7 018 'Please enter batch'.
Can I assign a batch number to the BAPI during the call?
You cannot assign the batch for the component to the BAPI.
You must already specify the batch in the purchase order or you must set the batch determination in such a way that it runs in the background.
You cannot transfer 'dummy' lines with the batches for the components to MB_CREATE_GOODS_MOVEMENT.
The BAPI uses the MB_CREATE_GOODS_MOVEMENT function module for the goods movement/posting. Only the 101 posting line, for example, is transferred to this function module. The individual components are not yet known at this time, they are dynamically determined at a later stage and then proposed by the ME_READ_COMP_GOODS_RECEIPT function module. Now the system notices that a component is to be handled in batches and prompts you to enter a batch. In a dialog posting (transactions MIGO/MB01), you can enter a batch, however, if you are using the BAPI, the system displays error message 'Please enter a batch' (See also Note 329367).
The same technical restriction also applies to the batch input (see also Note 40176 for additional information) and when you are using transaction MIGO up to and including Release 4.6B (see Note 213318).
Note: As of Release 470 you have the option of assigning the subcontracting components to the BAPI.
For more detailed information, refer to the documentation for the CreateFromData method.
Which fields do I have to fill when posting a goods issue for a goods delivery (with reference to a stock transport order) to ensure that the system updates the purchase order and the delivery correctly?
For detailed information about this, see Note 424014.
How can I avoid this error?
For a detailed description of the cause and how you can correct this problem, see Note 369518.
What do I have to bear in mind if I want to use the BAPI_GOODSMVT_CANCEL BAPI to cancel material document items?
For a detailed description of possible errors and how to avoid them, see Note 407265.
What do I have to bear in mind if I want to trigger the print output of a GR or GI document when I execute the BAPI?
You must ensure that a user name is entered in the PR_UNAME field in the HEADER structure. This user is used to determine the print parameters. You must set the value 'X' for the 'NDR' parameter ID for this user. Ensure that all Customizing-related settings have are for this user.
The GOODSMVT_CODE import parameter is relevant for the print version. The transaction code is derived from this code (see table T158G, for example, code 04 stands for MB1B). The BAPI uses the print version that is assigned to this transaction for the goods receipt/goods issue document. This is customized in transaction OMBR. Check your Customizing and make ensure that you have assigned a print version to this transaction and that a conditional output record exists.
For additional information about output determination, see Note 522591.
If you try to execute a goods movement using the Business Connector and you call the BAPI via RFC (Remote Function Call), this returns a material document. However, this document does not exist in the R/3 system. What do I have to do?
The call of BAPI_GOODSMVT_CREATE using RFC does not work because an RFC also creates a new LUW (logical Unit of Work). As a result, no Commit or rollback can take place with reference to this BAPI and thus the posting cannot be carried out.
Instead of a call using RFC, you can use a report that calls the BAPI and then executes a Commit or a rollback depending on the contents of the return table.
When I call BAPI_GOODSMVT_CREATE using Visual Basic, the system does not fill and return the return parameters or any other return value.
What may be the possible reasons for this and what do I have to bear in mind?
To be able to use this BAPI in Visual Basic, you must at least have SAP BAPI Wizard Type Library Version 4.5A installed on your system.
In the interface for the R/3 system in Visual Basic, ensure that you specify all numeric parameters with leading zeros because - unlike in R/3 systems (for example, transactions SE37 and SE16) - this is not linked to an automatic field conversion.
How can I determine the transaction code that is used by BAPI_GOODSMVT_CREATE to create the corresponding material document?
Why does the system carry out the posting using an 'older' transaction code instead of transaction MIGO?
The BAPI uses the T158G table to determine which transaction code is to be used.
The BAPI is available as of Release 4.5. Some transactions, for example transaction MB01, still exist in Release 4.6. Since there is no difference in the continuous program components, it is irrelevant whether you use transaction MB01 or transaction MIGO to carry out the posting.
Which goods movements should I not post using the BAPI_GOODSMVT_CREATE BAPI?
You should not post the goods receipt for the inbound delivery using BAPI_GOODSMVT_CREATE BAPI because the document base and the status of the inbound delivery are not updated. For more information, see Note 199703.
What do I have to consider with goods receipts for purchase orders that are subject to acknowledgement?
You want to use the BAPI to post a goods receipt for a purchase order that is subject to acknowledgment.
The goods receipt always updates the first order acknowledgment.
Background: At present, you cannot assign the sequence number for the purchase order confirmation (EKES-ETENS) to the BAPI at item level in the interface. For this reason, the system posts all goods receipts against the first order acknowledgment. For customers using Release 600 or higher, the solution is provided in Note 906314.
After you post goods movements using the BAPI_GOODSMVT_CREATE BAPI, why are there data inconsistencies in the previous period even though the data of the current period is consistent?
- There is a customer-specific transaction that uses the BAPI_GOODSMVT_CREATE BAPI to post goods movements.
- In this program, behind this transaction, it is not guaranteed that a new roll area is used for each goods movement.
- Users call this transaction and post several goods movements (for the same material in certain circumstances) one after the other without exiting the transaction.
- In Customizing for Materials Management, the "Late block" isactivated.
- Using transaction MMPV 'Close Period for Master Material Records', the period is closed in dialog mode, and before the last day of the month.
- Postings made using the BAPI_GOODSMVT_CREATE BAPI after the period closing program has run may cause data inconsistencies in the previous period.
a) Implement the modification contained in Note 194070.
b) Design the customer-specific program as described in Note 369518 to ensure that a new and initial roll area is used each time the BAPI_GOODSMVT_CREATE BAPI is called.