Ask the Expert

Session object vs. direct declare

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".

    Requires Free Membership to View


'Session:
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
With oRcv
.destination = "stg"
.userid = "UsrName"
.Password = "Password"
.client = "100"
End With
'Build the recordsets
oRcv.BapiCreateFromData GoodsmvtHeader:=RsHeadIn, GoodsmvtCode:=RsCodeIn, goodsmvtitem:=RsItemsIn, Return:=rsReturn
oRcv.CommitWork

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: