[英]Mandatory parameters for BAPI_GOODSMVT_CREATE call?
經過數小時的谷歌搜索,我未能找到解決問題的方法。
目標創建一個簡單的 Excel 應用程序,以在 SAP 中為多個物料單據過帳“退貨交貨”。
我的假設是我需要使用 BAPI“BAPI_GOODSMVT_CREATE”。
首先,我啟動 SAP 登錄提示:
'------'
'Logon to SAP
'------'
Dim sapConn As Object ' Declare variant
Set sapConn = CreateObject("SAP.Functions") ' Create ActiveX object
With sapConn.Connection
.Destination = "somehost"
.ApplicationServer = "someserver.com"
.Client = "someclient"
.User = "someuser"
.Password = "somepassword"
.SystemNumber = "somesystem"
End With
If sapConn.Connection.Logon(1, False) <> True Then 'Try Logon
MsgBox "Cannot Log on to SAP"
End If
然后我定義函數
'------'
'Define function
'------'
Dim objRfcFunc As Object
Set objRfcFunc = sapConn.Add("BAPI_GOODSMVT_CREATE")
現在,一切都到此為止了。 我已經使用此方法通過工作表迭代(查看單元格值)填充它來運行其他 BAPI。
最后(在函數的末尾)我進行了錯誤處理:
If objRfcFunc.Call = False Then
MsgBox "Call failure" + objRfcFunc.Exception
End If
我真正無法理解的是,執行 BAPI 所需的最少字段是哪些? 我需要填充什么 BAPI 字段?
如果我通過 MIGO 事務在 SAP 中手動執行此操作,我需要:物料憑證和物料憑證年份。
我選擇的功能是“退貨交貨”->“材料單據”。
顯然我缺少一些代碼來填充數據,但我根本不知道從哪里開始。 我已經完成了這篇文章,但沒有任何運氣。 非常感謝任何幫助或指向正確方向的指針。
對於特定的材料單據編號(或多個,如果可能)
不可能。 BAPI_GOODSMVT_CREATE文檔在第一行中指出,每次調用該方法時只能創建一個物料文檔。
您應該將 GM_CODE 01 用於貨物移動 122(退貨交貨),並且 BAPI 文檔列出了此 GM_CODE 的以下必填字段:
對於已知采購訂單:
可能需要填充以下字段(這不是完整列表):
- Reason for movement (if set up in the system)
- Batch (if the material is handled in batches and no automatic batch assignment has been set up)
- Storage location (if no storage location us specified in the purchase order item)
可以填充以下字段(這不是完整列表):
- Item text
- Unloading point
- Delivery completed indicator
不得填充以下字段(這不是完整列表):
- Reservation
- Receiving/issuing material
- Receiving/issuing plant
- Receiving/issuing storage location
這完全取決於 PO 已知/未知以及是否應該創建它。 只是RTFM。
要填充的絕對最小字段:
**Header**
DOC_DATE = 20050513 | Document date in document BLDAT
REF_DOC_NO = 345060A| Reference document number XBLNR
PR_UNAME = JOHNDOE | User name UNAME
GM_CODE = 01 | Assign code to transaction for BAPI goods movement
**Item**
MOVE_TYPE = 122 | Movement type (inventory management)
VENDOR = 1008056 | Vendor’s account number
ENTRY_QNT = 1.00 | Quantity in unit of entry
ENTRY_UOM = EA | Unit of entry
PO_NUMBER = ASA99834| Purchase order number
PO_ITEM = 00001 | Item Number of Purchasing Document
MVT_IND = B | Goods movement for purchase order Movement indicator
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.