BAPI DimAs problem
I have been tasked with creating an application that will create goods movements in SAP through watching a database table. That in and of itself isn't that big of a task (I believe).
So using the SAP documentation on BAPIs I created a little test driver to try and do some test transactions on our company's test system. So I have the following code:
Set oBAPICtrl = CreateObject("SAP.BAPI.1")
Set oLogonCtrl = CreateObject("SAP.LogonControl.1")
oBAPICtrl.LogLevel = 9
oBAPICtrl.BAPIExceptionCodes = True
Set oBAPICtrl.Connection = oLogonCtrl.NewConnection
oBAPICtrl.Connection.Client = "800"
oBAPICtrl.Connection.Destination = TESTSYSTEM
oBAPICtrl.Connection.Language = "E"
oBAPICtrl.Connection.User = USERNAME
oBAPICtrl.Connection.Password = PASSWORD
oBAPICtrl.Connection.Logon 0, True
Set oGM = oBAPICtrl.GetSAPObject("GoodsMovement")
From there I started out testing against the GetItems which worked exactly as expected. So I next started working with the CreateFromData function and this is where I've encountered a problem that I'm having problems solving.
When I try to use the DimAs method to create the objects for the parameters sent in the CreateFromData method, 3 of the 5 calls fail.
i.e. take the following code
Set oGM_CFD_Code = oBAPICtrl.DimAs(oGM, "CreateFromData", "GoodsmvtCode")
Set oGM_CFD_Header = oBAPICtrl.DimAs(oGM, "CreateFromData", "GoodsmvtHeader")
Set oGM_CFD_Item = oBAPICtrl.DimAs(oGM, "CreateFromData", "GoodsmvtItem")
Set oGM_CFD_Return = oBAPICtrl.DimAs(oGM, "CreateFromData", "Return")
Set oGM_CFD_HeaderRet = oBAPICtrl.DimAs(oGM, "CreateFromData", "GoodsmvtHeadret")
Setting using DimAs against GoodsmvtCode, GoodsmvtHeader, and GoodsmvtHeadret fails and instead sets the corresponding objects to "Error 0"
I've turned on tracing to the highest level and still don't see anything that may lead to why these 3 calls are failing. At first I thought that there may be some form of typo, so I copied the named directly out of the tracing file and still the same result.
Can anyone give me some ideas as to why these are failing?
There isn't really a good forum to post this question. So failing that, the ABAP forum is probably the best as it attracts the most people.
In my experience, not many people who are doing much VB integration with SAP (I am sure there are lots, but I mean relative to Java,COM,XML,etc.), so I guess there isn't a deep pool of people who can address your question (as demonstrated by the lack of responses).
I did check the parameters of the BAPI to see if there was anything different with the three that failed, but they seem to be pretty straight forward to me.
As you had success with the Getlist, its clear that all your software layers are put together ok, the only possible explanation that comes to mind is some non-obvious bug in your code. All I can suggest doing is to cut out your code and start again. Sometimes typos are incredibly hard to spot (and not just in the parameter names), and it could be something is just missing somewhere. If the second time works then you can compare old with new.
Not really a very encouraging response but the best I can come up with at this point.