Close jco connection

Hi
   Can anyone tell me how to retrieve the existing jco connection and close it. Can we write that code in wdExit.
Thanks
Vidyadhar

Hi,
  Following code can be used
AAAAModel thisModel =
                    (AAAAModel) WDModelFactory.getModelInstance(
     AAAAModel.class);
               thisModel.disconnectIfAlive();
You can call this code's method in wdDoExit()

Similar Messages

  • Finding component that does not close JCO connections

    Hi,
    I'm working on a big project with many webdynpro components. My problem is that I seem to be loosing JCO connections. After a while I get JCO connection errors. I just can't find which component is causing this. I checked over and over again.
    Is there a way to check how many JCO connections an application/component has or at least how many open connections a model has?
    I really need to know which component is causing my loss of JCO connections.
    Thanks all!
    Jeschael

    Hi Jeschael,
    Go to System Administration -> System Configuration -> Select Web Dynpro Console -> (Model & backend- You  can check JCo performance by component)  or ( JCo Connection Pools you can check max. calls and active connections for JCos)
    Regards,
    Siva

  • Jco connection :null

    Hi sap gurus
    I am using rfc  connection for executing bapi using some jco connections. but if  the jco are being used for one time it is being executed . but when we deploy application another time . the exception is received as dynamicrfcexecution error jco connection:null.
    when we change the poolsize it is being . the rfc is executed  for only one time.
    please suggest a way to close jco connections . if already present.
    Thanks & Regards
    prasad

    hi , logon mechanism  while creating the JCO Destinations.
    Is  Logon Ticket
    This is code what iam using for rfc access
    Zhr_Emp_List_Input input = new Zhr_Emp_List_Input();
              wdContext.nodeZhr_Emp_List_Input().bind(input); 
         wdContext.nodeZhr_Emp_List_Input().currentZhr_Emp_List_InputElement().setPernr("10" );
              try {
                   wdContext.nodeZhr_Emp_List_Input().currentZhr_Emp_List_InputElement().modelObject().execute();
                   wdContext.nodeOutput().invalidate();
              } catch (WDDynamicRFCExecuteException e) {
                   wdComponentAPI.getMessageManager().reportSuccess(e.toString());
                                  // TODO Auto-generated catch block
                   e.printStackTrace();
              }finally {          
         wdContext.currentZhr_Emp_List_InputElement().modelObject().modelInstance().disconnectIfAlive();  
    for the above code where  Zhr_Emp_List_Input  is the rfc . which will return employee details when we set the Pernr(personal number) to rfc
    the exception is
    com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException: Error connecting using JCO.Client: null
    for only one time the rfc is executing . for the other time if we increase the pool size or change the whole jco references for webdynprojava application . we are able to execute the application

  • Unable to close metadata jco connection

    Hi Experts,
    when checking the JCo Connection Pools in Web Dynpro Console, I found that all MetaData JCo are in use and unable to disconnect automatically.
    the following is metadata jco destination setting
    Maximal Pool Size 1
    Maximum Connections 5
    Connection Timeout 60
    Maximum Wait Time 10
    how can i do to close these jco connection?

    Hi Sidney,
    I dont really understand why you want to remove the Jco connections. If you click on the "Remove" button as posted earlier by someone, it will completely remove your Jco configurations and you have to create them again on your own. SO, dont do that.
    If you want to disconnect the Jco connection in webdynpro java, we can do that by using the following piece of code at the end of the  connection process.
    As far as I know, by default the Jco connections gets disconnected after certain time limit. Because, I never had to disconnect the Jco whenever I used one.
    wdContext.currentModelElement().modelObject().modelInstance().disconnectIfAlive()
    Regards,
    Gopal.

  • JCO Connection close

    Hi  All,
    I wanted to know is the connection to close the JCO should be handled in the program or the system will handle since I am using the JCO connection handled by content admin with JCo Pool Configuration.
    <b>I am seeing in SAP backend all the sessions are still open.</b>
    Thanks,
    Rakesh

    Valery,
    We are having an issue wherein the JCo connections are still listed in AL08 output long after the applications are closed. We do call disconnectIfAlive method after executing the Adapative RFC calls.
    Do let me know if there is anyway we can force webdynpro to release connections to the backend or is there any timeout setting in R3 that has to be configured so these connections dont stay open for indefinite time.
    Thanks in advance !

  • JCO connection pool is exhausted

    hi
    I am using RFC module in my web dynpro application. When the application is used for sometime, the JCO connection will get exhusted. The JCO connection will not release itself. I can't find any method in web dynpro to release the connection manually. How can I solve this problem?

    Hi,
    What is scope of the connection. View properties of MODELDATA and METADATA  destinations.
    You can change the scope of the connection..
    or
    wdContext.current<BAPI INPUT>Element().modelObject().modelInstance().disconnectIfAlive();
    For more ways , give a forum search.. There are a lot of close forum posts.. Gud luc..
    Regards
    Bharathwaj

  • Open and close RFC connection with portals...

    Hi Experts,
    I created a RFC having a query which is taking a long time to execute. So i want to close RFC connection with portals which is via java connector(JCO)  before that query and open the connction again after that query.
    Please advice is it possible to achieve this. If yes, then how.
    Regards,
    Guddan

    Hi Guddan,
    I created a RFC having a query which is taking a long time to execute. So i want to close RFC connection with portals which is via java connector(JCO) before that query and open the connction again after that query.
    I guess i will need to understand your requirement a little more in detail, as i understand you have an RFC which has a query within to fetch some data and is taking a long time to do so. In the meantime you don't want to keep the connection open?
    My question would be, Is the role of this RFC to only execute the query and fetch the data or does it do something else?
    If it does other things and these are independent of the query execution, then you can span a parallel call within the RFC to execute the query and in the meantime the RFC does the other things (or vice versa) hence reducing the overall time taken.
    If the sole purpose of this RFC is to execute the query, then you will not be able(i mean to say there is no simple and direct way of doing this) to close the connection after the Query is started and re-establish the connection after its execution, for a simple reason that - how will you know if the query has completed it's execution, so that you can establish the connection back.
    Alternate solutions, make this a two way asynchronous call, 1) You invoke the RFC asynchronously and close the connection, the RFC in turn will execute the query and transfer the data to JCO via another RFC call.
    If this needs to be a synchronous call, then you will need to optimize the query to its best.
    Regards,
    Chen

  • Need to close RFC connection

    Hi all,
    Currently we developed a application in NWDS, the same is operational from portal.
    As per the requirment we have to run the RFC many times to extract the data from R/3. After running the RFC many times
    we are getting the following Error "Error connecting using JCO.client: null"
    But if we redeploy the application the problem is solved but after a while the same issue is persisting.
    Please suggest how the problem can be solved ??
    Thanks,
    vijay.

    Hi venkat,
    Thanks for the example suggested by you.
    The following is the RFC iam executing many times.
    Z_Hr_Aprsl_Init_Input input= new Z_Hr_Aprsl_Init_Input();
    input.setI_Usrid("UserId");
    wdContext.nodeZ_Hr_Aprsl_Init_Input_new().bind(input);
    wdContext.nodeZ_Hr_Aprsl_Init_Input().currentZ_Hr_Aprsl_Init_InputElement().modelObject().execute();
    the code iam using to close the connection is
    JCO.Client client = JCO.getClient(" "); // Please specify the parameter to be used to refer the above RFC
    client.disconnect();
    Please suggest the required the parameter to close the RFC connection
    Thanks
    vijay

  • JCO connection error:Couldn't create JCOClientConnection for logical System

    Hi All,
    We are facing a production outage issue.
      We have a Federated Portal Network setup where one of our producer goes down automatically (seems on heavy load).
      On this Producer server we have 3 Web Dynpro applications deployed and default trace is full with JCO connection error   saying Could   not create JCOClientConnection for logical System: CSVMR_WD_MODELDATA_DEST.
    We had issue with max allowed JCO connections so we changed the below mentioned parameters for JCO connection settings in portal:
    u2022     Minimum value of JCo Pool Size in total = 80
    u2022     Minimum value for CPIC_MAX_CONV per SAP Web AS = 320
    u2022     Maximum Number JCo Connections = 160
    Please let us know if we are missing on some settings, any help in this regard is appreciated.
    Regards,
    Priyanka

    Hi,
    As you have already increased the maximum number of connections/pool size but still you are facing this problem. I would suggest you to check the web dynpro application which might not be able to release/disconnect the JCO connection.
    Please check this [Thread|How to close a model object connection for Adaptive RFC?; for more details.
    Regards
    Puneet

  • JCO Connection issue

    Dear All,
    I have created WebDynpro  application by importing track.
    When I deploy the application, it say,
    Deployment completed with warning.
    The warning is "Clusterwide exception: Failed to prepare application".
    Here I guess I need to find out which JCO connection is getting used and to which backend system it is pointing to.
    Could you please tell me where to look for to find out the JCO connection for the application.
    I am not creating new connection for the application, need to use the already created one.
    Thanks and regards,
    Pradnya Ghalsasi

    Hello Pradnya,
    to see what JCO connection you are using
    Go to Contant Admin Role
    click on  Weddynpro Contant there you can see Create Jcos and Maintan Jcos ,
    click on maintain Jcos
    check weather you have WD_METADATA and WD_MODELDATA , if not create one and use it.
    i think you know how to create JCos
    Points if helpful
    Please Close thread if problem solved
    Thanksyou,
    Regards
    Vijai

  • Close RFC Connection

    Hi,
    I have some problems with the availibility of my WebDynpro-Application. It seems to be, that to much connections are opened at the same time. Is it necessary to close the connection in the code or should it closed by the system automatically?
    To use a model I use the following code(example):
    wdContext.nodeZ_Rfc_GetData_Input().bind(new Z_Rfc_GetData_Input());
    wdContext.currentZ_Rfc_GetData_InputElement().modelObject().execute();
    wdContext.nodeOutput().invalidate();
    I don't know if there is a option to close the connection.

    Hi,
    Use below code:
    wdContext.currentRFC_InputElement().modelObject().modelInstance().disconnectIfAlive();
    Please check below forum ,
    webdynpro JCO - RFC Connections are not closing  in back end ECC (SM51)
    Regards
    Deepak

  • Regarding doubt in JCO Connection

    Hai,
         I am doing jco connection in jsp page. its getting executed with out any errors. i have give the detaisl below whci is working fine but where i have to mention the url of "bsp page" ie (http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,295199,sid63_gci1154530,00.html) . Please go through the code below so that by establishing the following connection it should (ie take username and password automatically) straightly go that url mentioned. 
    client = JCO.createClient( "020",  // SAP client "balal",   // userid
    "143bala",  // password "EN",        // language
    "sealerp.sealconsult.com", // host name "00" );      // system number
    <%@ page import="com.sap.mw.jco.*" %>
    <html>
    <head>
    </head>
    <body >
    <form name="form1">
    <%
    //String paramView = request.getParameter("h1")==null?"":request.getParameter("h1");
    //if(paramView.equals("view"))
        JCO.Client client = null;
    JCO.Repository mRepository;
    try {
      // Print the version of the underlying JCO library
    // out.println("\n\nVersion of the JCO-library:\n" +
    \n" +      JCO.getMiddlewareVersion());
      // Create a client connection to a dedicated R/3 system
      client = JCO.createClient( "020",       // SAP client
                         "balal",   // userid
                         "143bala",     // password
                         "EN",        // language
                         "sealerp.sealconsult.com", // host name
                         "00" );      // system number
      // Open the connection
      client.connect();
    mRepository = new JCO.Repository("seal",client);
      // Get the attributes of the connection and print them
      JCO.Attributes attributes = client.getAttributes();
      out.println("Connection attributes:\n" +"----
    \n" + attributes);
      // All done
      out.println("\n\nCongratulations! It worked.");
    catch (Exception ex) {
      out.println("Caught an exception: \n" + ex);
    finally {
        // do not forget to close the client connection
        if (client != null) client.disconnect();
    %>
    </form>
    </body>
    </html>
    Please help me in getting solution.
    Thanks in Advance.
    Thanks & Regards,
    Giridhar.

    Hai,
    sorry i have mentioned wrong bsp url. please check this url.
    http://sealerp.sealconsult.com:8080/sap/bc/bsp/sap/zbsp_primv/project.htm
    the above the bsp page url to be viewed.
    Please help me.
    Thanks in Advance.
    Thanks & Regards,
    Giridhar.

  • JCo Connection / RFC in Pricing Userexit

    Hi Experts,
    Need your help: I have a requirement to make a RFC call in IPC Pricing Userexit.  First I made a simple test java class to make RFC call and run it locally without any problem. then I copy the same code to the Userexit, but it failed on the 1st statment JCO.createClient(.....).  Do I need to add a different JAR file to make JCo Connection work in the Userexit? Any advise or documentation?.
    Thanks, Jin
    Here is the error message:
    Message: document not existing
    --> com.sap.spe.document.rfc.DocIllegalArgumentException: document 49149C3E59925857E10000000A02901D not existing
    at com.sap.spe.document.rfc.DocHandlerAdapter.appendProtocolLine(I[Ljava/lang/Object;)V(DocHandlerAdapter.java:123)
    at com.sap.spe.document.rfc.GetPricingDocumentInfo.handleDocRequest()V(GetPricingDocumentInfo.java:73)
    at com.sap.spe.document.rfc.DocHandlerAdapter.handleRequest()V(DocHandlerAdapter.java:72)
    at com.sap.spe.base.util.jco.HandlerAdapter.handleRequest(Lcom/sap/vmc/RFCContainer/Call;)V(HandlerAdapter.java:103)
    at com.sap.vmc.remserver.RFCDispatcher.privHandleRequest(Lcom/sap/conn/jco/JCoFunction;)V(RFCDispatcher.java:895)
    at com.sap.vmc.remserver.RFCDispatcher.handleRequest(Lcom/sap/conn/jco/JCoFunction;)V(RFCDispatcher.java:673)
    at com.sap.conn.jco.rt.JCoServer.dispatchRequest(Lcom/sap/conn/jco/rt/AbapFunction;)V(JCoServer.java:1605)
    at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcServer.dispatchRequest(Lcom/sap/conn/jco/rt/JCoServer;Ljava/lang/String;)V(MiddlewareJavaRfc.java:2387)
    at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcServer.listen(Lcom/sap/conn/jco/rt/JCoServer;Ljava/lang/String;)V(MiddlewareJavaRfc.java:1694)
    at com.sap.conn.jco.rt.JCoServer.listen()V(JCoServer.java:1375)
    at com.sap.conn.jco.rt.JCoServer.run()V(JCoServer.java:1299)
    at com.sap.vmc.remserver.RfcServer.run()V(RfcServer.java:386)
    at java.lang.Thread.startup(Z)V(Thr
    Thanks, Jin

    Hello Jin,
    IPC does make calls to CRM . To do so it maintains a JCo connection. We got to leverage this connection object and make calls to our RFC. We can use the get_current_connection(); from connection_factory.
    import com.sap.mw.jco.JCO;
    import com.sap.sce.engine.ddb_inst;
    import com.sap.sxe.db.*;
    import com.sap.sxe.db.imp.rfc.*;
    import com.sap.mw.jco.IFunctionTemplate;
    import com.sap.mw.jco.IRepository;
    // For the default connection
    JCO.Client crmJCO = null;
    try{
    / RFC and JCO connection to CRM
         connRFC cRFC = (connRFC)connection_factory.get_current_connection();
         crmJCO = cRFC.getIdleConnection();
    }catch(Exception e){
         log_api.log_write_msg("LOG1", "LOG2",1,
           "Error establishing JCO connection to CRM: "+ e);
    // Now for the BAPI (RFC calls)
    try{
         IRepository repository = JCO.createRepository
                               ("<my BAPI RFC module>", crmJCO);
         IFunctionTemplate ftemplate = repository.getFunctionTemplate
                              ("<my BAPI RFC module>");
         JCO.Function bapiFunc= new JCO.Function(ftemplate);
    // Set your IMPORT, EXPORT, TABLE parameters here
    // Call the JCo function
         crmJCO.execute(bapiFunc);
    // Process the output.
    }catch(Exception e){
         log_api.log_write_msg("LOG3", "LOG4",1,
           "Error calling BAPI "+ e);
    /// DO NOT FORGET TO CLOSE ***+++ MUST DO +++***
    }finally{
         if(crmJCO != null)
              JCO.releaseClient(crmJCO);
    Hence this is using standard connection, no need for any additional jars.
    Easwar Ram
    http://www.parxlns.com

  • JCo Connection Not Proper!

    Hi,
    I am getting this warning message in the web dynpro screen while I am trying to run a particular method;
    Could not create JCOClientConnection for logical System: WD_MODELDATA_DEST - Model: class com.dow.dc.model.Model. Please assure that you have configured the RFC connections and/or logical system name properly for this model!
    Any idea why we get this error?
    I have not received this error while I was running the component first!
    Harika

    Hi
    It seems that this is a custom webdynpro application which when executed causes such problem. This might be due to JCO connection not released back to the pool.
    Please refer to the following threads and that might be helpful.
    Re: JCO Connection close
    How to close a model object connection for Adaptive RFC?
    You might have to call disconnectIfAlive method on your model.
    Regards,
    Anup

  • Disconnect JCO Connection

    Hi,
    In WebdynPro Application without using Adaptive RFC, we are able to disconnect a connection after few seconds as we using disconnect() method for that.
    But for a WebdynPro Application using Adaptive RFC, we are not able to disconnect a connection as fast as we were able to do in first case.
    We are using following to disconnect:
    wdContext.currentInputElement().modelObject().modelInstance().disconnectIfAlive();
    In SM04 transaction, we observed that the connection(Adaptive RFC) is taking more time to close than it is taking for without Adaptive RFC WD application. The connection still exists even the memory utilized becomes 0 MB.
    Also, when we are not disconnecting in Adaptive RFC WD application, then memory is utilized as long as connection exists. But, when we are disconnecting the connection, the memory utilized is 0 MB though the connection still exists.
    While creating the JCo connection for metadata and modeldata we gave:
    Max pool size : 5
    Max connection: 1000
    Connection Timout (msec.) : 1000
    Maximum Waiting Time (msec.): 5000
    Can anybody suggest how to disconnect the connection to overcome above problem?
    Thanks and Regards,
    Vaibhav

    Hi
    Check this URL
    Actually The Connection will be Terminated when it is inactive for particular time
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/85a483cb-0d01-0010-2990-c5168f01ce8a">Jco Connection Pools</a>
    Regards
    Chandran S

Maybe you are looking for

  • Passing variable of 'DynamicParameter' to a SAPGUI Iview using ApplicationP

    Hi all, We are calling a R/3 Transaction QM03 within an IView in the Portal which works fine. Now, we also want to call this QM03 Iview from a URL in the PCUI screens. Since the PCUI framework passes all required info through the 'DynamicParameter',

  • Problem opened document convert PDFExport(IBR) with peoplesoft

    Hi ive problem. when i want to opened document after checkin document with peoplesoft(9.1 tools 8.5.2) to WCC 11.1.1.7 used PDFExport(IBR 11.1.17),i got this error. but if no convert to IBR 11.1.1.7(Passthru) can open and no problem user only have ro

  • External memory for macbook pro

    I have bought an external memory for my mac and I saved there all my photos. Now when I try to connect to it, it says I cannot see my photos with iPhoto because I need another program to open those photos. It also says the photos are blocked and I ne

  • CP1215 Can't print in black and white with low colour cartidge

    I have a CP1215 that has run out of yellow, but the status reports that I can print over 1000 pages with black, but when I choose black and white, I get an error stating that I need to replace the yellow. How do I get around this as it is very annoyi

  • How to upgrade Vista Capable laptop on the moduslink site?

    I bought Toshiba laptop with Comet, but cannot find the way to upgrade my Windows, though it is signed as Windows Vista Capable. The laptop was bought in the right time, eligible for update, but the shop did not give me any redemption form nor it is