cancel
Showing results for 
Search instead for 
Did you mean: 

Jco 3.0 to SAP RFC connection and holding SAP session global data

Former Member
0 Kudos

Hi Guru's,

I am trying to connect SAP R/3 System from Jco and i am successfull. But i am loosing the global data of SAP session on next RFC call.

As a first step, i called BAPI_XMI_LOGON and which updated External Company and Agent details in INTERFACES_USED global table.

In next step i called BAPI_XBP_JOB_OPN, but by this time INTERFACES_USED global internal table is becoming empty, so i am getting

Interface not logged on Issue.

Below is the Piece coding format i followed.

void executeCalls(String destName)

    {

        JCoDestination dest;

        try

        {

            dest = JCoDestinationManager.getDestination(destName);

            dest.ping();

            System.out.println("Ping Destination " + destName + " working fine");

            JCoFunction function1 = dest.getRepository().getFunction("BAPI_XMI_LOGON");

                        function1.getImportParameterList().setValue("EXTCOMPANY","TBP" );

                        function1.getImportParameterList().setValue("EXTPRODUCT","TBP" );

                        function1.getImportParameterList().setValue("INTERFACE","XBP" );

                        function1.getImportParameterList().setValue("VERSION","3.0" );

                        function1.execute(dest);

                        System.out.println("RFC - XMI Logon Successfull");

                        JCoFunction function = dest.getRepository().getFunction("BAPI_XBP_JOB_OPEN");

            try

                    {   function.getImportParameterList().setValue("JOBNAME","ZTEST_TBP" );

                        function.getImportParameterList().setValue("EXTERNAL_USER_NAME","SAPX" );

                        function.getImportParameterList().setValue("JOBCLASS","C" );

                        function.execute(dest);

                        System.out.println("RFC - FM Job Open successful " );

                        JCoFunction function5 = dest.getRepository().getFunction("BAPI_XBP_JOB_ADD_ABAP_STEP");

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I think you just have to keep the conenction open. Add:

JCoContext.begin(dest);

before the dest.ping();

and end the session after you are done, e.g. in a finally-block, with:

JCoContext.end(dest);

You can find a document here somewhere with an example for a multithreaded-application which goes a litte bit more in detail. E.g. how it is possible to have more than one session in parrallel if you need it.

But as a startingpoint I would try just the begin() and end().

Greez

Ingo

former_member192152
Active Participant
0 Kudos

Hi Pratap,

Explain to me how is the architecture of your application. It is a JSP / EBJ deployed on Web AS (7.0/7.3)? Send me also how are the settings that Destination.

Best regards,

Angelo