SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Reference: BAPIs for goods movements (OSS 520813)



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Oct 06, 2007 11:25 pm    Post subject: Reference: BAPIs for goods movements (OSS 520813) Reply with quote

There have been a lot of posts about 'BAPIs for goods movements'. I found this OSS note which acts as an FAQ: 520813

The note is quoted below for reference.

Quote:
Symptom
This note contains frequently asked questions and answers regarding 'BAPIs for goods movements'.

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:

BAPI transaction
->Materials Management
->Inventory Management
->GoodsMovement
->CreateFromData -> '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 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?

Answer:
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.

--------------------------

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 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.

--------------------------

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 &"
"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?

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 to use it for the warehouse stock or batch determination?

Answer:
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.

--------------------------

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. 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.

--------------------------

7. Question:
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.
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 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 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?

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, 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.
This documentation is available in the BAPI Explorer (transaction BAPI) Materials Management
Inventory Management - GoodsMovement - CreateFromData ==>
Transfer subcontracting components.
--------------------------

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:
When 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 displays error message M7022: & exceeded by &&&
How can I avoid this error?

Answer:
For a detailed description of the cause and how you can correct this problem, see Note 369518.

--------------------------

11. Question:
What do I have to bear in mind if I want to use the BAPI_GOODSMVT_CANCEL BAPI to cancel material document items?

Answer:
For a detailed description of possible errors and how to avoid them, see Note 407265.

--------------------------

12. Question:
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?

Answer:
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.

--------------------------

13. Question:
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?

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 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.

--------------------------

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 may be the possible reasons for this and what do I have to bear in mind?

Answer:
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.

--------------------------

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. For more information, 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:
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?

Answer:
These data inconsistencies may occur in the following situations:
- 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.

There are two possible solutions:
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.

Related Notes

959797 - WMMBXY/MBGMCR/BAPI_GOODSMVT_CREATE order confirmation
906314 - BAPI_GOODSMVT_CREATE: Order confirmation updating
457499 - No material document generated for BAPI BAPI_GOODSMVT_CREATE
424014 - BAPI: Goods receipt for the outbound delivery
407265 - Transfer parameter with BAPI BAPI_GOODSMVT_CANCEL
398801 - Missing import parameters for BAPI BAPI_GOODSMVT_CREATE
369518 - Transfer stock not reached if posted with BAPI
329367 - No dialog for SC components possible
194070 - Problems with goods movement with late block
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.