Skip to Content
0
Former Member
Nov 21, 2005 at 02:26 PM

Custom iView Connecting to SAP R/3 system using JCA !!

19 Views

Environment : SAP Portal : EP 6.p SP2

I am using JCA to connect to the SAP backend systems.

The following code connects to the backend ...

IConnectionFactory connectionFactory = (IConnectionFactory) ctx.lookup("EISConnections/SAPFactory");

IConnectionSpec spec = connectionFactory.getConnectionSpec();

((Map) spec).put("client", "CLIENT_NUMBER");

((Map) spec).put("UserName", "YOUR_LOGIN_ID");

((Map) spec).put("Password", "YOUR_PASSSWORD");

((Map) spec).put("logonmethod", "UIDPW"); // or SAPLOGONTICKET

((Map) spec).put("Language", "YOUR_LOGIN_LANGUAGE");

((Map) spec).put("ashost", "YOUR_APPLICTION_SERVER_NAME");

((Map) spec).put("sysnr", "YOUR_SYSTEM_NUMBER");

IConnection client = connectionFactory.getConnectionEx(spec);

I want to use the message server for load balancing. Is there a way to specify the message server and logon group ??

These is the code to get the BAPI information ...

// Create interaction

IInteraction interaction = client.createInteractionEx();

IInteractionSpec interactionSpec = interaction.getInteractionSpec();

interactionSpec.setPropertyValue("Name", "REMOTE_FUNCTION_MODULE_NAME");

// Create IFunction instance

IFunctionsMetaData functionsMetaData = client.getFunctionsMetaData();

IFunction function

= functionsMetaData.getFunction("REMOTE_FUNCTION_MODULE_NAME");

// CCI api only has one datatype: Record

RecordFactory recordFactory = interaction.getRecordFactory();

MappedRecord importParams

= recordFactory.createMappedRecord("CONTAINER_OF_IMPORT_PARAMS"

and the following code populates the input table parameters ...

IStructureFactory structureFactory

= interaction.retrieveStructureFactory();

IRecordSet table

= (IRecordSet) structureFactory.getStructure(

function.getParameter("TABLE_NAME").getStructure());

table.insertRow();

table.setString("COLUMN_NAME_1", "VALUE_1");

table.setString("COLUMN_NAME_2", "VALUE_2");

table.insertRow();

table.setString("COLUMN_NAME_1", "VALUE_1");

table.setString("COLUMN_NAME_2", "VALUE_2");

importParams.put("TABLE_NAME", table);

The above code causes performance issues in the SAP system because the code is calling the following other BAPI through the JCA java api ...

1) RFC_GET_FUNCTION_INTERFACE

2) DDIF_FIELDINFO_GET

Looks like, the JCA librbary is not caching the metadata information for the BAPI instead for each call, it is calling other BAPI's to get the BAPI metadata information. Also, if I reuse the same IFunction class instance for all connections (Using Singleton Class), it seems to make less "RFC_GET_FUNCTION_INTERFACE" bapi calls.

The problem is with the input table structure which I need to populate for the BAPI. Every time the structure is populated, the internal BAPI's are getting called and it takes more time to poupulate the structure as number of users increases.

I am looking answers to the following questions ...

1) Specify message and logon group in JCA

2) Provide a way to cache the metadata for the BAPI's

More details about JCA can be found here ...

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/bc9baf90-0201-0010-479a-b49b25598ebf

I appreciate your help !!

Thanks

Bhabesh Patel