Skip to Content
avatar image
Former Member

How to close a model object connection for Adaptive RFC?

Hi,

I'm calling two update RFC one after another in a single WebDynpro program. I like to close the session/connection after calling the first RFC. I'm using twp separate JCo connection for calling these two RFCs. Still I find both the RFCs are called in the same session.

Is there any way to close the JCo session from the code?

Thanks ,

Dipankar

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jul 15, 2005 at 04:27 PM

    Hi Dipankar

    1.Get the instance of the Model object

    2. Get the JCO connection

    3. Close the connection

    Ex:

    <Model Name> obj = (<Model Name>)wdContext.currentBapi_XXX_InputElement().model();

    JCo.Client jcoclient = obj.getJCoClient();

    Regards

    NagaKishore

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Rakesh,

      You get this error because your are suppling class of query (*_Input) but not class of complete model, check again:

      <b><Model Name></b> anyName = 
      (<b><Model Name></b>)WDModelFactory.getModelInstance(<b><Model Name></b>.class);
      anyName.disconnectIfAlive();

      VS

  • avatar image
    Former Member
    Jul 18, 2005 at 05:55 AM

    Hi Dipankar

    If you want the framework to control the opening and closing of the connections , then use TASK_SCOPE when initializing the modelobjects ,in which case the connection will remain open, for the lifecycle of a single call.

    The intialization should be as below

    (CompanyCodeList is your model object)

    
    CompanyCodeList compCode = (CompanyCodeList)WDModelFactory.getModelInstance(CompanyCodeList.class, WDModelScopeType.TASK_SCOPE); 
    Bapi_Companycode_Getlist_Input bapIn = (Bapi_Companycode_Getlist_Input) compCode.createModelObject(Bapi_Companycode_Getlist_Input.class); 
    wdContext.nodeBapi_Companycode_Getlist_Input().bind(new Bapi_Companycode_Getlist_Input()); 
    
    
    

    Regards

    Pran

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Pran,

      Using TASK_SCOPE force model object to be disconnected from model (and garbage collected later) right after request/response phase is ended. Therefor <b>you must not add such objects to context nodes</b>!!!

      Valery Silaev

      EPAM Systems

      http://www.NetWeaverTeam.com

  • avatar image
    Former Member
    Jul 18, 2005 at 06:13 AM

    Hi Diankar,

    Yes, Jaydeep is correct. You have to add that code after executing that RFC.

    Go through the following link:

    disconnect-method

    Regards,

    Bhavik

    Add comment
    10|10000 characters needed characters exceeded