OpenText Activator For SAP Solutions 10.0.0 - Programming Guide English (LLESSAP100000-PGD-EN-1)
OpenText Activator For SAP Solutions 10.0.0 - Programming Guide English (LLESSAP100000-PGD-EN-1)
LLESSAP100000-PGD-EN-1
Programming Guide
OpenText Activator for SAP Solutions
LLESSAP100000-PGD-EN-1
Rev.: 2011-Sept-28
This documentation has been created for software version 10.0.
It is also valid for subsequent software versions as long as no new document version is shipped with the product or is
published at https://knowledge.opentext.com.
Open Text Corporation
275 Frank Tompa Drive, Waterloo, Ontario, Canada, N2L 0A1
Tel: +1-519-888-7111
Toll Free Canada/USA: 1-800-499-6544 International: +800-4996-5440
Fax: +1-519-888-0677
Email: [email protected]
FTP: ftp://ftp.opentext.com
For more information, visit http://www.opentext.com
1 Activator basics......................................................................... 5
1.1 Components............................................................................................. 5
1.2 Structure................................................................................................... 6
3 Tutorials ................................................................................... 15
3.1 Using the SAP OSpace.......................................................................... 15
3.2 Using the configuration API ................................................................... 19
IDX Index......................................................................................... 23
1.1 Components
The Content Server loads a Java library (jsaprfc.jar) that contains a Java class
(JRFC) that acts as a wrapper of SAP's JCo library.
The communication between Content Server and an SAP server is done by the SAP
JCo 3.0 library.
regarding SAP system configuration data are hidden in the configuration API of the
SAP OSpace.
Custom OScript can use the configuration API to retrieve the list of configured SAP
systems and to connect to a specific SAP system. To call RFCs or BAPIs, the
RFC/BAPI API of the SAP OSpace provides the necessary functions.
1.2 Structure
This guide covers the following:
• Overview of the components of Activator.
• Tutorials: The first tutorial gives an example on how to use the features available
in the SAP OSpace. The second tutorial makes use of the SAP system configura-
tion API.
sysnr
Type: string
The system number of the SAP ABAP application server; mandatory for a
direct connection.
client
Type: string
The SAP client; mandatory logon parameter. Client numbers are usually
three-digit numbers.
user
Type: string
The SAP user name used to log in to the SAP system.
pass
Type: string
The password associated with the SAP user name.
lang
Type: string
The code for the logon language; parameters are e.g. DE (German) or EN
(English).
groupname
Type: string
The group of SAP application servers; mandatory for a logon balancing
connection.
sysid
Type: string
The system ID of the SAP system; mandatory for a logon balancing
connection.
Return Value
Type: Assoc
.OK: true if call of $SAP.RFC Connect was successful, otherwise false.
.errMsg: error message (.OK is false).
.connection: JCoDestination object already connected to SAP system (.OK is
true).
.exception: Assoc with exception data if .OK is false and an exception occurred.
with all import parameters and an Assoc fExports is created with all export
parameters. Table parameters are added to the fImports and fExports.
To set values of importing or table parameters, just set the values of the features
with the name of the parameter in the newly created RFC object.
Parameters
connection
Type: dynamic
The JCoDestination instance to be used for connecting to the SAP system.
rfcName
Type: string
Name of the RFC for which the RFC object should be created.
Return Value
Type: $SAP.RFC
A new temp of a $SAP.RFC object or undefined in case of an error.
Parameters
rfcObject
Type: object
The $SAP.RFC temp object to be deleted.
Return Value
Type: Assoc
.OK: true if call of $SAP.RFC Connect was successful, otherwise false.
.errMsg: error message (.OK is false).
.found: number of configured SAP systems with the specified logical SAP
system name.
• BASEURL: Configurable URL part that is permanent for this SAP system; can
be used by applications to build URLs for accessing SAP transactions via the
web browser.
• USERNAME: Username to be used for logging into the SAP system.
• SAPSYSTEMID: SAP system ID (SAP server and client number constitute the
unique SAP system ID).
Assoc result
Assoc retval
retval.ok = true
Boolean ok = true
if ok
rfcMethod = $SAP.RFC.New( connection, "RFC_READ_TABLE" )
if IsUndefined( rfcMethod )
retval.errMsg = "ERROR: can't create $SAP.Rfc object for
_ _
RFC READ TABLE - see thread log for more information"
retval.ok = false
ok = false
end
end
if ok
rfcMethod.QUERY_TABLE = "USR01"
result = rfcMethod.Call()
if result.ok == false
ok = false
retval.ok = false
retval.errMsg = Str.Format( "ERROR: rfcErrorGroup: %1,
rfcErrorKey: %2, rfcErrorMessage: %3, rfcErrorCode: %4.",
result.rfcErrorGroup, result.rfcErrorKey, result.rfcErrorMessage,
result.rfcRetCode )
else
// retrieve the results
records = rfcMethod.FIELDS
end
end
if ok
echo ( Str.Format( "Table %1 has %2 records.",
// 5) cleanup
if IsDefined( rfcMethod )
$SAP.RFC.Delete( rfcMethod )
end
When you run the script, you will get the following output in the debug window:
Assoc result
Assoc retval
retval.ok = true
Boolean ok = true
if ok
bapiMethod = $SAP.BAPI.New( connection, "EmployeeAbstract",
"GetList" )
if IsUndefined( bapiMethod )
retval.errMsg = "ERROR: can't create $SAP.BAPI object for
BAPI Employee and method GetList - see thread log for more
information"
retval.ok = false
ok = false
end
end
if ok
bapiMethod.PersonnelNumber = "00001006"
result = bapiMethod.Call()
if result.ok == false
ok = false
retval.ok = false
retval.errMsg = Str.Format( "ERROR: rfcErrorGroup: %1,
rfcErrorKey: %2, rfcErrorMessage: %3, rfcErrorCode: %4.",
result.rfcErrorGroup, result.rfcErrorKey, result.rfcErrorMessage,
result.rfcRetCode )
else
if ok
echo ( retval.message )
else
echo ( retval.errMsg )
end
// 6) cleanup
if IsDefined( bapiMethod )
$SAP.BAPI.Delete( bapiMethod )
end
When you run the script, you will get the following output in the debug window:
Assoc result
Assoc retval
retval.ok = true
Boolean ok = true
if ok
result = $SAP.SapSystems.ConnectToDestination( prgCtx,
logSAPSystemName )
if result.OK
connection = result.connection
else
retval.ok = false
retval.errMsg = result.errMsg
ok =false
end
end
if ok
rfcMethod = $SAP.RFC.New( connection, "RFC_READ_TABLE" )
if IsUndefined( rfcMethod )
retval.errMsg = "ERROR: can't create $SAP.Rfc object for
RFC_READ_TABLE - see thread log for more information"
retval.ok = false
ok = false
end
end
if ok
rfcMethod.QUERY_TABLE = "USR01"
result = rfcMethod.Call()
if result.ok == false
ok = false
retval.ok = false
retval.errMsg = Str.Format( "ERROR: rfcErrorGroup: %1,
rfcErrorKey: %2, rfcErrorMessage: %3, rfcErrorCode: %4.",
result.rfcErrorGroup, result.rfcErrorKey, result.rfcErrorMessage,
result.rfcRetCode )
else
// 4) Retrieve the results
records = rfcMethod.FIELDS
end
end
if ok
echo ( Str.Format( "Table %1 has %2 records.",
rfcMethod.QUERY_TABLE, Length( records ) ) )
else
echo ( retval.errMsg ) end
// 6) Cleanup
if IsDefined( rfcMethod )
$SAP.RFC.Delete( rfcMethod )
End
C
component overview 5
configuration API
$SAP.SapSystems ConnectToDestination
function 11
$SAP.SapSystems ExistsSapSystem
function 11
$SAP.SapSystems
GetEnabledSapSystems function 12
$SAP.SapSystems GetSapSystem
function 13
$SAP.SapSystems GetSapSystems
function 13
tutorial 19
configuration data of SAP system 12, 13
L
logical SAP system name 11
R
RFC/BAPI API 7
S
SAP OSpace
configuration API 11
RFC/BAPI API 7