After hours on hours of googling, I fail to find the solution to my problem.
Goal Create a simple Excel application to post "return delivery" for multiple material documents in SAP.
My assumption is that I would need to utilize the BAPI "BAPI_GOODSMVT_CREATE".
Firstly I initiate the SAP Logon Prompt:
'------'
'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
Then I define the function
'------'
'Define function
'------'
Dim objRfcFunc As Object
Set objRfcFunc = sapConn.Add("BAPI_GOODSMVT_CREATE")
Now, here is where it all stops. I've used this method to run other BAPI's by populating it through worksheet-iteration (looking at cell values).
Lastly (at the end of the function) I do the error handling:
If objRfcFunc.Call = False Then
MsgBox "Call failure" + objRfcFunc.Exception
End If
What I truly fail to understand, is which fields are the minimum required in order to execute the BAPI? What BAPI field sto I need to populate?
If I do it manually in SAP through MIGO transaction, I require: Material Document and Material Document Year.
Function I selected are "Return Delivery" -> "Material Document".
Obviously I lack some code to fill the data, but I simply do not know where to start out. I've worked through this post, without any luck. Any help or pointers to the right direction are greatly appreciated.