SAP MM BAPI BAPI GOODSMVT CREATE NOTES

From SapWiki
SAP BAPI_GOODSMVT_CREATE NOTAS

De Sapwiki

SAP Note No. 520813

Number: 520813

Version: 3 from 17.12.2002

Status: Released for Customer

Set on: 15.01.2003

Language: EN

Master language: DE

Responsible: SAP AG

Component: MM-IM-GF-BAPI (BAPIS for Goods Movements)

FAQ: BAPIs for goods movements

Symptom
This note contains frequently asked questions/answers relating to 'BAPIS for goods movements'.

Q&A

1. Where can I find the documentation for the call of BAPI BAPI_GOODSMVT_CREATE?
Answer:
Information on the fields that must be filled for the call of BAPI_GOODSMVT_CREATE can be found in the documentation under the following menu path:
BAPI transaction -> Materials Management -> Inventory Management -> GoodsMovement -> CreateFromData -> 'Documentation' tab page.
Further information on possible sources of problem during the call can be found in the following text.

2. Which function modules must be called after the call of the BAPI in order to complete the posting once the material document has been successfully created? 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 on 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 in order 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 make sure that it is carried out at the correct point in the source code. More information on this is available in the documentation at BAPI_TRANSACTION_COMMIT or ROLLBACK.
A detailed description can be found in note 457499.

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?
Answer:
The material for which you want to carry out a goods movement must match the material in the reservation:
If a reservation number is transferred to the BAPI during the call, the system must read the data from this reservation. This is necessary in order to be able to update the reservation correctly. The BAPI will only update the quantity fields, other reservation fields are not affected.
If the material for the goods movement does not match the material from the reservation, the system updates the quantities for the incorrect material. Availability checks, ATP and so on refer to the reservation dates. Therefore it is important to update the reservation for the correct material. Otherwise these checks do not work. In case of a missing match, the system generates error message M7042.
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. The BAPI can then be called with reference to this reservation.

4. During the attempt to call BAPI_GOODSMVT_CREATE one of the following error messages is generated:

M7096: "Goods movement not possible with mvmt type &"

"Incorrect update control of the movement type (entry 101 X X)".
Which fields must be filled when the BAPI is called in order to avoid this error?
Answer:
The system checks the combination movement type allowed transactions. Make sure that you transfer a GM_CODE to the BAPI for the required transaction.

5. Can a wildcard '*' be transferred to the BAPI for the storage location / the batch in order to use it for the warehouse stock or batch determination?
Answer:
No. The determination must take place before the BAPI is called in order to be able to provide it with the required information. If you transfer a wildcard to the BAPI for the storage location/batch, the system displays an error message.

6. Can I also transfer the movement special character for warehouse management SPEC_MVMT (displayed within the program as BSSKZ) to the BAPI during the call?
Answer:
No, this is not possible:
Field SPEC_MVMT is available as of Release > 4.6C. On account of the BAPI guidelines, you cannot change structure BAPI2017_GM_ITEM_CREATE 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 message type WMMBXY because structure E1MBXYJ here contains field BSSKZ.

7. When I try to post a goods receipt for the purchase order via BAPI, the system generates 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. Which fields must be filled when the BAPI is called in order 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 will not be able to find the correct document. Also refer here to Note 109396. Although this note refers to an IDoc processing, the same logic also applies for 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. When I create a goods receipt for a subcontract order, the system should explode the BOM in the background. If the components to be provided are in special stock O with batch, the BAPI returns error message M7018 'Please enter batch'. Can a batch number be transferred to the BAPI during the call?
Answer:
You cannot transfer the batch for the component at the BAPI.
Either the batch must already be specified in the purchase order, or you must set the batch determination in such a way that this runs in the background.
You cannot transfer 'Dummy' lines with the batches for the components to MB_CREATE_GOODS_MOVEMENT.
The BAPI uses function module MB_CREATE_GOODS_MOVEMENT for the goods movement/posting. Just the 101 posting line, for example, is transferred to this function module. The individual components are not still known at this time, they are dynamically determined later and are proposed by function module ME_READ_COMP_GOODS_RECEIPT. Now the system notices that a component is to be handled in batches and requires a batch to be entered. For a dialog posting (transaction MIGO/MB01), you can enter a batch, however, when you use the BAPI the system displays the error 'Please enter a batch' (See also note 329367).
The same technical restriction also applies for the batch input (see also Note 40176 for additional information), and also when you use Transaction MIGO up to and including Release 4.6B (see note 213318).

9. Which fields is it essential that I 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 also the delivery correctly?
Answer:
A detailed response to this question can be found in note 424014.

10. When I want to post a goods issue and the corresponding goods receipt for a stock transfer in the same roll area via BAPI, the system displays error message M7022: How can this error be eliminated?
Answer:
A detailed description of the cause of and the solution to this problem can be found in note 369518.

11. What is to be considered in order to cancel material document items, if BAPI_GOODSMVT_CANCEL is to be used?
Answer:
A detailed description of possible errors and how to avoid them can be found in note 407265.

12. What do I need to bear in mind in order to trigger the print output of a GR document or GI document with the execution of the BAPI?
Answer:
You must make sure that a user name is also transferred in field PR_UNAME in the header structure. This user is used for determining the print parameter. You must set the value 'X' for parameter ID 'NDR' for this user. Make sure that all customizing-related settings have been made for this user.
Import parameter GOODSMVT_CODE is relevant for the print version. The transaction code derives 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 via transaction OMBR. Check you Customizing and make sure that a print version was assigned to this transaction and that an output conditional record exists.
You can find additional information on the topic output determination in note 522591.

13. If you attempt to execute a goods movement via Business Connector and call the BAPI via RFC (Remote Function Call), this returns the material document. However, this document does not exists in the R/3 system. What should be done?
Answer:
The call of BAPI_GOODSMVT_CREATE via RFC does not work as 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 via RFC, a report can be written that calls the BAPI and then executes a Commit or a rollback dependent on the contents of the return table.

14. When BAPI_GOODSMVT_CREATE is called via Visual Basic, neither the return parameters nor any other return code are filled and returned. Which are the possible causes and what should I bear in mind?
Answer:
Conversion. (Note: The original document appears truncated or incomplete for this answer).

15. How can I determine which transaction code is used by BAPI_GOODSMVT_CREATE in order to create the corresponding material document? Why is the posting partially carried out using an 'older' transaction code instead of via Transaction MIGO?
Answer:
By means of table T158G, the BAPI makes the assignment which transaction code is supposed to be used.
The BAPI is available as of Release 4.5. Some transactions, as for example MB01, remained in Release 4.6. As there is no difference in the continuous program components, it is unimportant whether posting occurs by MB01 or MIGO.

16. Which goods movements should not be posted with BAPI BAPI_GOODSMVT_CREATE?
(Note: The answer to this question was cut off in the provided source document).

Additional Information

Additional key words:
FAQ, Q&A, Q+A, BAPI, BAPI_GOODSMVT_CREATE, BAPI_GOODSMVT_CANCEL, VB, Visual Basic.

Valid releases:

SAP_APPL SAP Application 46C - 46C

SAP_APPL SAP Application 46B - 46B

SAP_APPL SAP Application 45B - 45B

Reference to related Notes:

398801 - Missing import parameters for BAPI BAPI_GOODSMVT_CREATE

424014 - BAPI: Goods receipt for the outbound delivery