I have a VB program using BAPIs with the DCOM Connector. The BAPI object and session object are exported to an MTS
server machine. In the VB program I create a global OSession object and logon to R/3 at the form load event. In one
function I instantiate the BAPI Object locally with Set oBO = oSession.CreateInstance("BOprogId"), and run some methods
on the object that work fine and Set oBO = nothing at the end of the function.
In a followup function I instantiate the BO again locally with Set oBO = CreateInstance("BOprogid"), then do a change
method on instance dependant object after doing oBO.InitKeys. The BAPI return is succesful, so I want to commit the
change and issue an oSession.CommitWork. The DCOM connector monitor shows the last function is ABAP4_COMMIT_WORK but it
remains in an active state there and the VB program gets a nonzero returen: error> -2147023170, automation error The
remote procedure call failed. I don't know why this happens. If I use oBO.CommitWork I get an error also: -2147467259
Object created in Session, so I assume if you instantiate an object with oSession.CreateInstance you have to commit
changes using the Session object.
If I use Set oBO = CreateObject("BOprogId") and commit with oBO.Commit, it works without error. This is not practical
since I need to enqueue the SAP object in the first function with oBO.Enqueue method before the user makes changes in
the UI. When the user requests the update I invoke the change function, then oBO.Dequeue, then oSession.CommitWork.
Can you tell me why the commit fails, or what I may be doing wrong? Incedentanlly, the SAP object is sucessfully
changed. The change BAPI does not have a commit work, so my program must request it.
Please don't suggest using the doNet Connector, this is anot an option for this project.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!