Symptom
This note contains frequently asked questions/answers regarding 'BAPIs for goods movements'.
Questions
- 1. Where can I find the documentation for calling the BAPI_GOODSMVT_CREATE BAPI?
- 2. Which function modules must be called after the BAPI is called to complete the posting once the material document has been created successfully? What should I do if there is an error?
- 3. 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?
- 4. When I call BAPI_GOODSMVT_CREATE, the system issues one of the following error messages: - M7 096: "Goods movement not possible with mvmt type <(>&<)>"-'Incorrect update control of the movement type
- (Entry 101 X X)'.
- Which fields do I have to fill when calling the BAPI to avoid this error?
- 5. Can I assign a wildcard '*' for the storage location/the batch to the BAPI, which I can then use for the warehouse stock or batch determination?
- 6. Can I assign the SPEC_MVMT special movement indicator for Warehouse Management (displayed as BSSKZ in the program) to the BAPI during the call?
- 7. When I try to post a goods receipt for the purchase order using a BAPI, the system displays error message M7 021 'Deficit of & & & &'. The goods-receipt based invoice verification is active, and the item in the purchase order may have already been cancelled once.
- 8. When I create a goods receipt for a subcontract order, the system should explode the bill of material (BOM) in the background. If the subcontracting components are in special stock O with batch, the BAPI returns error message M7 018 'Enter batch'.
- Can I assign a batch number to the BAPI during the call?
- 9. Which fields do I have to fill when posting a goods issue for a goods delivery (with reference to a stock transport order) so that the system updates the purchase order and the delivery correctly?
- 10. If I want to use the BAPI to post a goods issue and the corresponding goods receipt for a stock transfer in the same roll area, the system issues error message M7 022 'Stock in transfer exceeded by & & &'.
- How can this error be corrected?
- 11. What do I have to keep in mind if I want to use the BAPI_GOODSMVT_CANCEL BAPI to cancel material document items?
- 12. What do I have to keep in mind if I want to trigger the printout of a goods receipt or goods issue document when I execute the BAPI?
- 13. If you try to execute a goods movement using the Business Connector and you call the BAPI using Remote Function Call (RFC), this returns a material document. However, this document does not exist in the R/3 system. What do I have to do?
- 14. 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 are the reasons for this and what do I have to keep in mind?
- 15. How can I determine the transaction code that is used by BAPI_GOODSMVT_CREATE to create the corresponding material document?
- 16. Which goods movements should I not post using the BAPI_GOODSMVT_CREATE BAPI?
- 17. What do I have to consider with goods receipts for purchase orders that are subject to acknowledgement?
- 18. Why do data inconsistencies occur in the previous period after you use the BAPI_GOODSMVT_CREATE BAPI to post goods movements even though the data of the current period is consistent?
- 19. Can BAPI_GOODSMVT_CREATE create a new batch and maintain the data of the classification at the same time?
Answers
- 1.
- Question:
- Where can I find the documentation for calling the BAPI_GOODSMVT_CREATE BAPI?
- Answer:
- Information about the fields that must be filled for the call of BAPI_GOODSMVT_CREATE can be found in the documentation under the following menu path:
- Transaction BAPI
- -> Materials Management
- ->Inventory Management
- ->GoodsMovement
- Choose 'CreateFromData' and go to the 'Documentation' tab page
- Further information about possible problems during the call can be found in the following text.
- ----------------
- 2.
- Question:
- Which function modules must be called after the BAPI is called to complete the posting once the material document has been created successfully? What should I do if there is an error?
- Answer:
- The BAPI returns a return table for the error handling, that is, if the posting is incorrect, this table contains an entry describing the cause of the error. The 'caller' is responsible for eval(return table is initial), a 'Commit Work' must be carried out in order to complete the posting. To do this, call BAPI_TRANSACTION_COMMIT.
- The Commit or rollback always applies to the current LUW (Logical Unit of Work). Therefore, you must make sure 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.
- A detailed description is available in Note 457499.
- --------------------------
- 3.
- Question:
- 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?
- Answer:
- The material for which you want to carry out a goods movement must be the same as the material in the reservation:
- 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 wrong material. Availability checks, ATP (Available-to-Promise) 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 issues error message M7 042.
- If the information from the reservation is no longer valid, for example, because the material has been replaced with a substitute, you should change this reservation accordingly. You can then call the BAPI with reference to this reservation.
- --------------------------
- 4.
- Question:
- When I call BAPI_GOODSMVT_CREATE, the system issues one of the following error messages: - M7 096: "Goods movement not possible with mvmt type <(>&<)>"-'Incorrect update control of the movement type
- (Entry 101 X X)'.
- Which fields do I have to fill when calling the BAPI to avoid this error?
- Answer:
- The system checks the combination movement type - allowed transactions. Make sure that you assign a GM_CODE to the BAPI for the required transaction.
- --------------------------
- 5.
- Question:
- Can I assign a wildcard '*' for the storage location/the batch to the BAPI, which I can then use for the warehouse stock or batch determination?
- Answer:
- No. The determination must take place before the BAPI is called to be able to provide it with the required information. If you assign a wildcard '*' to the BAPI for the storage location/batch, the system issues an error message.
- --------------------------
- 6.
- Question:
- Can I assign the SPEC_MVMT special movement indicator for warehouse management (displayed as BSSKZ in the program) to the BAPI during the call?
- Answer:
- No, this is not possible:
- The SPEC_MVMT field is available as of Release 4.6C or higher. Due to the BAPI guidelines, you cannot change structure BAPI2017_GM_ITEM_CREATE in Hot Package systems. One consequence of this is that, for example, it may no longer be possible to generate the respective IDoc with message type MBGMCR.
- Alternatively, you can use the IDoc of message type WMMBXY since structure E1MBXYJ contains field BSSKZ here.
- Note that the BAPI cannot process different special movement indicators at item level. This function is available only in transaction MIGO. The BAPI, message types WMMBXY and MBGMCR and the older MB* transactions do not provide this function. In this case, only one different special movement indicator can be used for each posting.
- --------------------------
- 7.
- Question:
- When I try to post a goods receipt for the purchase order using a BAPI, the system displays error message M7 021 'Deficit of & & & &'. The goods-receipt based verification is active, and the item in the purchase order may have already been cancelled once.
- Which fields do I have to fill when calling the BAPI to avoid this error?
- Answer:
- 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 an 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.
- 8.
- Question:
- When I create a goods receipt for a subcontract order, the system should explode the bill of material (BOM) in the background. If the subcontracting components are in special stock O with batch, the BAPI returns error message M7 018 'Enter batch'.
- Can I assign a batch number to the BAPI during the call?
- Answer:
- 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, when you are using the BAPI , the system issues the error message asking you to enter a batch (see Note 329367).
- The same technical restriction also applies to the batch input (for more information, see Note 40176) and when you are using transaction MIGO up to and including Release 4.6B (see Note 213318).
- Note: As of Release 4.70, you can
- also assign the subcontracting components to the BAPI.
- For more detailed information, refer to the documentation for method CreateFromData.
- Call transaction BAPI 'BAPI Explorer -> Materials Management
- -> Inventory Management -> GoodsMovement -> CreateFromData ==>
- Subcontracting components transfer.
- --------------------------
- 9.
- Question:
- 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?
- Answer:
- For detailed information about this, see Note 424014.
- --------------------------
- 10.
- Question:
- If I want to use the BAPI to post a goods issue and the corresponding goods receipt for a stock transfer in the same roll area, the system issues error message M7 022 'Stock in transfer exceeded by & & &'.
- How can this error be corrected?
- Answer:
- See Note 369518 for more information about the cause and solution of this problem..
- --------------------------
- 11.
- Question:
- What do I have to keep in mind if I want to use the BAPI_GOODSMVT_CANCEL BAPI to cancel material document items?
- Answer:
- See Note 407265 for more information about possible errors and how to avoid them.
- --------------------------
- 12.
- Question:
- What do I have to keep in mind if I want to trigger the print output of a goods receipt or goods issue document when I execute the BAPI?
- Answer:
- You must make sure that a user name is transferred in the PR_UNAME field in the header structure. This user is used for determining the print parameters. You must set the value 'X' for the 'NDR' parameter ID for this user. Make sure that all customizing-related settings have been made 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 sure that you have assigned a print version to this transaction and that a conditional output record exists.
- For additional information regarding output determination, see Note 522591.
- --------------------------
- 13.
- Question:
- If you try to execute a goods movement using the Business Connector and you call the BAPI using Remote Function Call (RFC), this returns a material document. However, this document does not exist in the R/3 system. What should I do?
- Answer:
- 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 therefore, the posting cannot be carried out.
- Instead of a call using RFC, a report can be written that calls the BAPI and then executes a Commit or a rollback depending on the contents of the return table.
- --------------------------
- 14.
- Question:
- 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 are the reasons for this and what do I have to keep in mind?
- Answer:
- To be able to use this BAPI in Visual Basic, you must have SAP BAPI Wizard Type Library Version 4.5A or higher installed on your system.
- In the interface for the R/3 system in Visual Basic, make sure 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 any automatic field conversion.
- --------------------------
- 15.
- Question:
- 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?
- Answer:
- 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.
- --------------------------
- 16.
- Question:
- Which goods movements should I not post using the BAPI_GOODSMVT_CREATE BAPI?
- Answer:
- 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. See Note 199703.
- --------------------------
- 17.
- Question:
- What do I have to consider with goods receipts for purchase orders that are subject to acknowledgement?
- Answer:
- 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.
- --------------------------
- 18.
- Question:
- Why do data inconsistencies occur in the previous period after you use the BAPI_GOODSMVT_CREATE BAPI to post goods movements even though the data of the current period is consistent?
- Answer:
- These data inconsistencies can occur under the following conditions:
- A customer-specific transaction exists that uses the BAPI_GOODSMVT_CREATE BAPI to post goods movements.
- There is no guarantee that each goods movement is carried out with a new roll area in this program.
- The users use this transaction and post several goods movements (sometimes for the same material) in succession without leaving this transaction.
- - In Customizing for materials management, "Late Lock" is activated.
- In transaction MMPV 'Close Periods', the period is closed during the dialog mode, before the last day of the month.
- Postings with the BAPI_GOODSMVT_CREATE BAPI after the period closing program runs can cause data inconsistencies in the previous period.
- There are two ways to correct this:
- a) Implement the modification from Note 194070.
- b) The customer-specific program must be designed in such a way (similar to Note 369518) that a new and initial roll area is used whenever you call the BAPI_GOODSMVT_CREATE BAPI.
- 19.
- Question:
- Can BAPI_GOODSMVT_CREATE create a new batch and maintain the data of the classification at the same time?
- Answer:
- As of Release 4.7, use BAPI_BATCH_SAVE_REPLICA to create a new batch with classification data. Up to Release 4.6C, you can use BAPI_OBJCL_CHANGE. See Note 619913 for this.
Other Terms
FAQ, frequently asked questions, Q&A, questions and answers, Q+A, BAPI, BAPI_GOODSMVT_CREATE, BAPI_GOODSMVT_CANCEL, VB, Visual Basic, data inconsistency, roll area, period closing, previous period, inconsistencies