Beruflich Dokumente
Kultur Dokumente
SAP AG
<Course Number>
Unit Title - 1
Course Objectives
SAP AG
<Course Number>
Unit Title - 2
PRT
SDK
Java API
SAP
Connector
R/3 App
Svr
Wizard
PeopleSoft
Connector
PeopleSoft
App Svr
Unification
Service
JDBC
Connector
RDBMS
Connector
Gateway
Java API
SDK
iView
SAP AG
<Course Number>
Unit Title - 3
SAP AG
<Course Number>
Unit Title - 4
The connector gateway is used as any other service in the portal is accessed.
SAP AG
<Course Number>
Unit Title - 5
The connector gateway is used as any other service in the portal is accessed.
SAP AG
<Course Number>
Unit Title - 6
The connector gateway is used as any other service in the portal is accessed.
SAP AG
<Course Number>
Unit Title - 7
<PDK>/j2eeclient/activation.jar
<PDK>/j2eeclient/connector.jar
<PDK>/portalapps/com.sap.portal.ivs.connectorserviceapi.jar
<J2EE>/bin/ext/com.sap.genericconnector/GenericConnector.jar
<PDK>/j2eeclient/jta.jar
The required libraries can be found in the PDK Library convenience ZIP file.
SAP AG
<Course Number>
Unit Title - 8
import com.sapportals.portal.ivs.cg.ConnectionProperties;
import com.sapportals.portal.ivs.cg.IConnectorGatewayService;
import com.sapportals.portal.ivs.cg.IConnectorService;
import com.sapportals.connector.connection.IConnection;
....
IConnectorGatewayService cgService =
(IConnectorGatewayService)
PortalRuntime.getRuntimeResources().
getService(IConnectorService.KEY);
The connector gateway is used as any other service in the portal is accessed.
SAP AG
<Course Number>
Unit Title - 9
import com.sapportals.portal.ivs.cg.ConnectionProperties;
...
ConnectionProperties cp = new
ConnectionProperties(request.getLocale(),
request.getUser());
...
SAP AG
<Course Number>
Unit Title - 10
SAP AG
<Course Number>
Unit Title - 11
SAP AG
<Course Number>
Unit Title - 12
Interactions
An Interaction describes the data needed to call a specific
function or method in the backend system. It provides a generic
interface to talk to disparate systems and is created via a
Connection object.
You must build an InteractionSpec, fill in the required input
parameters, then execute the Interaction.
The result will be returned in an output type record
import com.sapportals.connector.execution.functions.IInteractionSpec;
import com.sapportals.connector.execution.functions.IInteraction;
...
IInteraction ix = connection.createInteractionEx();
...
SAP AG
<Course Number>
Unit Title - 13
Interaction Specs - 1
An InteractionSpec contains the data needed to call a specific
function or method in the backend system.
It is obtained from the Interaction object by calling
getInteractionSpec()
import com.sapportals.connector.execution.functions.IInteractionSpec;
import com.sapportals.connector.execution.functions.IInteraction;
...
IInteraction ix = connection.createInteractionEx();
// Get interaction spec
IInteractionSpec ixspec = ix.getInteractionSpec();
...
SAP AG
<Course Number>
Unit Title - 14
Interaction Specs - 2
After obtaining the InteractionSpec, you need indicate which
function/method you wish to call using setPropertyValue();
Next, build an input record via the RecordFactory that contains
the input parameters for the function/method you intend to call.
Use IndexedRecord for positional parameters, or MappedRecord
for named parameters.
...
// Specify name of function/procedure to call.
ixspec.setPropertyValue("Name", "CustOrderHist");
RecordFactory rf = ix.getRecordFactory();
//create input record for parameters to function
IndexedRecord input = rf.createIndexedRecord("input");
input.add(custNo); // Customer No is 1st param
...
SAP AG
<Course Number>
Unit Title - 15
SAP AG
<Course Number>
Unit Title - 16
SAP AG
<Course Number>
Unit Title - 17
SAP AG
<Course Number>
Unit Title - 18
Next record
previous()
Previous record
getInt(String field)
getString(String field)
getColumnName(int col)
deleteRow()
SAP AG
<Course Number>
Unit Title - 19
getColumnLabel(int column)
getColumnName(int column)
getColumnType(int column)
SAP AG
<Course Number>
Unit Title - 20
...
// write data
response.write("</tr>");
while (rs.next()) {
response.write("<tr>");
for (int index = 1; index <= columnCount; index++) {
response.write("<td>" + rs.getString(index) + "</td>");
}
response.write("</tr>");
}
response.write("</table>");
...
SAP AG
<Course Number>
Unit Title - 21
CF API Queries
A Query can be used for simple interactions with back-end systems
A query is usually the easiest way to interact with a RDBMS
Some resource adapters may not provide a query interface and will
throw an exception if queries are not supported.
IQuery Interface:
For the IQuery interface, the execution of the query will result in
boolean success/failure flag
The result of the query (IRecordset) can be obtained if successful
IQuery does not work until NW04 Stack 10 See SAP Note 782106
INativeQuery Interface:
For the INativeQuery interface on a JDBC system, the execution of a
SELECT query will result in a native JDBC java.sql.ResultSet
For other types of systems, the result of the query execution will be
the native result type for particular system type.
SAP AG 2004, Connector Framework Basics Using the JDBC Connector / 22
SAP AG
<Course Number>
Unit Title - 22
import com.sapportals.connector.execution.objects.IQuery;
...
IQuery query = connnection.newQuery();
String qstr = "SELECT title_id,title,price FROM titles " +
"WHERE title_id LIKE 'P%'");
boolean success = query.execute(qstr);
...
SAP AG
<Course Number>
Unit Title - 23
...
IRecordSet rs = query.retrieveRecordSet();
IRecordMetaData rsMD = rs.retrieveMetaData();
response.write("<table><tr>");
int columnCount = rsMD.getColumnCount();
for (int index = 1; index <= columnCount; index++) {
response.write("<th>" + rsMD.getColumnLabel(index) + "</th>");
}
SAP AG
<Course Number>
Unit Title - 24
SAP AG
<Course Number>
Unit Title - 25
Java Documentation
Available in the PDK documentation
Java Development > Javadocs > Connector Framework / Connector Gateway
Service
SAP AG
<Course Number>
Unit Title - 26
More Information
SDN Articles:
SAP Connector Framework Examples
PDK Documenation:
Java Development -> Portal Development -> Connector Framework
Books:
J2EE Connector Architecture and Enterprise Application Integration
Sun Information:
http://java.sun.com/j2ee/connector/
http://java.sun.com/j2ee/connector/download.html
SAP AG
<Course Number>
Unit Title - 27
Unit Summary
SAP AG
<Course Number>
Unit Title - 28