Before you can use the SAP components in a production, you must perform several setup activities. This chapter discusses them:
Setting Up the Java Gateway
Installing the SAP JCo Jar File
Obtain, from SAP, the SAP Java Connector 3.x, as appropriate for your operating system. Generally, this is provided as a compressed file. Uncompress it and place the contents in a convenient location. The directory should contain the following items:
Generating Proxy Classes for SAP JCo
To communicate with SAP JCo, your Ensemble namespace must contain proxy classes that represent SAP JCo. To generate these classes, do the following:
The easiest way to do this is as follows:
Start the production, which starts the Java Gateway.
Testing the SAP Connection
To test the SAP connection, do the following in the Terminal (or in code):
Set the following properties of that instance. These are string properties unless otherwise noted.
Call the PingSAP()
method of your instance. This method connects to SAP and performs a dynamic invocation of the STFC_CONNECTION function. It returns a %Status
Generating Message Classes
Ensemble provides sample CSP pages to enable you to generate message classes that carry requests for SAP functions. These are available in the ENSDEMO
namespace. To use these pages:
Use the page /csp/ensdemo/sap/Index.csp
to search for all the BAPIs and RFCs on the SAP system to which you are currently connected.
You can also search by complete or partial name.
The page now provides a link.
This displays a new page with details on that BAPI or RFC.
This page provides a link you can use to generate messages for that BAPI or RFC.
Click the link to generate messages.