With the SAP DCOM Connector, when is the best time to use a session object
vs. direct declare as far as performance is concerned? This RFM/BAPI
requires a "Commit work".
Public oSession As TRIPoRcvLib.PoRcvSessionComponent
Set oSession = New TRIPoRcvLib.PoRcvSessionComponent oSession.PutSessionInfo "STG", "UsrName", "Password", "EN", "100"
VS Simple declare:
Set oRcv = oSession.CreateInstance(NAMESPACE & ".GoodsMovement") Set oRcv = New TRIPoRcvLib.GoodsMovement
.destination = "stg"
.userid = "UsrName"
.Password = "Password"
.client = "100"
'Build the recordsets
oRcv.BapiCreateFromData GoodsmvtHeader:=RsHeadIn, GoodsmvtCode:=RsCodeIn, goodsmvtitem:=RsItemsIn, Return:=rsReturn
Both of these work but there is a huge performance issues with the session object on the commit work call.
I am a little confused by the supplied source code since you seem to have oSession in both cases. So my answer makes the assumption that in case A) you use a session object, in case B) you don't. Then the answer is that you need A) whenever you want to commit multiple updates executed on different business object instances, otherwise the choice is yours./
This was first published in November 2001