on 06-26-2013 7:41 AM
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");
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
72 | |
11 | |
10 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.