520813-FAQ:BAPIsforgoods_SAP刘梦_新浪博客

Symptom

This note contains frequently asked questions/answers regarding 'BAPIs for goods movements'.

Questions

  1. 1. Where can I find the documentation for calling the BAPI_GOODSMVT_CREATE BAPI?

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

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

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


  2. (Entry 101 X X)'.


  3. Which fields do I have to fill when calling the BAPI to avoid this error?

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

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

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

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


  2. Can I assign a batch number to the BAPI during the call?

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

  1. 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 & & &'.


  2. How can this error be corrected?

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

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

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

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


  2. What are the reasons for this and what do I have to keep in mind?

  1. 15. How can I determine the transaction code that is used by BAPI_GOODSMVT_CREATE to create the corresponding material document?

  1. 16. Which goods movements should I not post using the BAPI_GOODSMVT_CREATE BAPI?

  1. 17. What do I have to consider with goods receipts for purchase orders that are subject to acknowledgement?


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

  1. 19. Can BAPI_GOODSMVT_CREATE create a new batch and maintain the data of the classification at the same time?


Answers

  1. 1.

  2. Question:
  3. Where can I find the documentation for calling the BAPI_GOODSMVT_CREATE BAPI?



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



  6. Transaction BAPI


  7.   -> Materials Management


  8.     ->Inventory Management


  9.       ->GoodsMovement


  10.         Choose 'CreateFromData' and go to the 'Documentation' tab page



  11. Further information about possible problems during the call can be found in the following text.



  12. ----------------


  1. 2.

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



  4. Answer:
  5. 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 evaluating this table and for triggering the update that is dependent on this.



  6. If the posting is correct (return table is initial), a 'Commit Work' must be carried out in order to complete the posting. To do this, call BAPI_TRANSACTION_COMMIT.



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



  8. A detailed description is available in Note 457499.



  9. --------------------------


  1. 3.

  2. Question:
  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. Answer:
  5. The material for which you want to carry out a goods movement must be the same as the material in the reservation:



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



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



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



  9. --------------------------


  1. 4.

  2. Question:
  3. 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


  4. (Entry 101 X X)'.


  5. Which fields do I have to fill when calling the BAPI to avoid this error?



  6. Answer:
  7. The system checks the combination movement type - allowed transactions. Make sure that you assign a GM_CODE to the BAPI for the required transaction.



  8. --------------------------


  1. 5.

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



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


  1. 6.

  2. Question:
  3. Can I assign the SPEC_MVMT special movement indicator for warehouse management (displayed as BSSKZ in the program) to the BAPI during the call?



  4. Answer:
  5. No, this is not possible:



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



  7. Alternatively, you can use the IDoc of message type WMMBXY since structure E1MBXYJ contains field BSSKZ here.



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



  9. --------------------------


  1. 7.

  2. Question:
  3. 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.


  4. Which fields do I have to fill when calling the BAPI to avoid this error?



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



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


  1. 8.

  2. Question:
  3. 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'.


  4. Can I assign a batch number to the BAPI during the call?



  5. Answer:
  6. You cannot assign the batch for the component to the BAPI.



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



  8. You cannot transfer 'Dummy' lines with the batches for the components to MB_CREATE_GOODS_MOVEMENT.



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



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



  11. Note: As of Release 4.70, you can


  12. also assign the subcontracting components to the BAPI.


  13. For more detailed information, refer to the documentation for method CreateFromData.


  14. Call transaction BAPI 'BAPI Explorer -> Materials Management


  15. -> Inventory Management -> GoodsMovement -> CreateFromData ==>


  16. Subcontracting components transfer.


  17. --------------------------


  1. 9.

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



  4. Answer:
  5. For detailed information about this, see Note 424014.



  6. --------------------------


  1. 10.

  2. Question:
  3. 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 & & &'.


  4. How can this error be corrected?



  5. Answer:
  6. See Note 369518 for more information about the cause and solution of this problem..



  7. --------------------------


  1. 11.

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



  4. Answer:
  5. See Note 407265 for more information about possible errors and how to avoid them.



  6. --------------------------


  1. 12.

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



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



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



  7. For additional information regarding output determination, see Note 522591.




  8. --------------------------


  1. 13.

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



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



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



  7. --------------------------


  1. 14.

  2. Question:
  3. When I call BAPI_GOODSMVT_CREATE using Visual Basic, the system does not fill and return the return parameters or any other return value.


  4. What are the reasons for this and what do I have to keep in mind?



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



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



  8. --------------------------


  1. 15.

  2. Question:
  3. How can I determine the transaction code that is used by BAPI_GOODSMVT_CREATE to create the corresponding material document?



  4. Why does the system carry out the posting using an 'older' transaction code instead of transaction MIGO?



  5. Answer:
  6. The BAPI uses the T158G table to determine which transaction code is to be used.



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



  8. --------------------------


  1. 16.

  2. Question:
  3. Which goods movements should I not post using the BAPI_GOODSMVT_CREATE BAPI?



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



  6. --------------------------


  1. 17.

  2. Question:
  3. What do I have to consider with goods receipts for purchase orders that are subject to acknowledgement?




  4. Answer:
  5. You want to use the BAPI to post a goods receipt for a purchase order that is subject to acknowledgment.


  6.   The goods receipt always updates the first order acknowledgment.


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



  8. --------------------------


  1. 18.

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



  4. Answer:
  5. These data inconsistencies can occur under the following conditions:


  6. A customer-specific transaction exists that uses the BAPI_GOODSMVT_CREATE BAPI to post goods movements.


  7. There is no guarantee that each goods movement is carried out with a new roll area in this program.


  8. The users use this transaction and post several goods movements (sometimes for the same material) in succession without leaving this transaction.


  9. - In Customizing for materials management, "Late Lock" is activated.


  10. In transaction MMPV 'Close Periods', the period is closed during the dialog mode, before the last day of the month.


  11. Postings with the BAPI_GOODSMVT_CREATE BAPI after the period closing program runs can cause data inconsistencies in the previous period.



  12. There are two ways to correct this:


  13. a) Implement the modification from Note 194070.


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


  1. 19.

  2. Question:
  3. Can BAPI_GOODSMVT_CREATE create a new batch and maintain the data of the classification at the same time?



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

Reason and Prerequisites

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用\[2\]:前几天用到HR模块的一个函数:HR_INFOTYPE_OPERATION。这个函数是用来操作HR信息类型的。在调用这个函数之前,需要先加锁,然后调用HR_INFOTYPE_OPERATION函数进行操作,最后再解锁。\[2\]根据参数OPERATION的不同取值,可以实现不同的操作,比如创建、修改、删除等。其中,主要的取值有INS、INSS和MOD。\[2\]INS表示创建一个的记录,即使系统中已经存在相同类型的记录。INSS表示创建一个的记录,如果系统中已经存在相同类型的记录,则将其转换为修改操作。MOD表示修改已存在的记录。\[3\]根据你的需求,你可以查找类似的BAPI函数来实现相同的功能。 #### 引用[.reference_title] - *1* [SAP 函数HR_INFOTYPE_OPERATION报错](https://blog.csdn.net/ptpassword/article/details/131400421)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [HR_INFOTYPE_OPERATION_SAP刘梦_](https://blog.csdn.net/senlinmu110/article/details/109652316)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值