Skip to main content

Setup Tasks

Before you can use the SAP components in a production, you must perform the setup activities discussed in this chapter.

To access SAP, it is necessary to provide a username and password. This means that you must also create production credentials that contain an SAP username and password. For information on creating credentials, see Configuring Productions.

Setting Up the Java Gateway

The Java Gateway server runs within a JVM, which can be on the same machine as InterSystems IRIS or on a different machine. Complete the following setup steps on the machine on which the Java Gateway will run:

  1. Install the Java Runtime Environment (for example, JRE 1.8.0_67).

  2. Make a note of the location of the installation directory for JRE. This is the directory that contains the subdirectories bin and lib.

    This is the value that you would use for JAVA_HOME environment variable. For example: c:\Program Files\Java\jre8

    You use this information later when you configure your production.

  3. Also make a note of the Java version. If you are uncertain about the Java version, open a DOS window, go to the bin subdirectory of your Java installation, and enter the following command:

    java.exe -version

    You should receive output like the following, depending on your platform:

    java version "1.8.0_67"
    Java(TM) SE Runtime Environment (build 1.8.0_67-b24)
    Java HotSpot(TM) 64-Bit Server VM (build 23.19-b22, mixed mode)
    

It is not necessary to set any environment variables. To access the JVM, InterSystems IRIS uses information contained in the production.

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:

  • examples subdirectory

  • javadoc subdirectory

  • Readme.txt file

  • sapjco3.dll file

  • sapjco3.jar file

  • sapjcomanifest.mf file

Generating Proxy Classes for SAP JCo

To communicate with SAP JCo, your interoperability-enabled namespace must contain proxy classes that represent SAP JCo. To generate these classes, do the following:

  1. Start the Java Gateway.

    The easiest way to do this is as follows:

    1. Create a simple production that contains only one business host: EnsLib.JavaGateway.ServiceOpens in a new tab. For details about configuring settings for this business host, see EnsLib.JavaGateway.Service Settings.

    2. Start the production, which starts the Java Gateway.

  2. In the Terminal, change to your interoperability-enabled namespace and use the ImportSAP() method of EnsLib.SAP.BootStrapOpens in a new tab, as follows:

    do ##class(EnsLib.SAP.BootStrap).ImportSAP(pFullPathToSAPJarFile,pPort,pAddress)

    Where:

    • pFullPathToSAPJarFile is the full path to the SAP Jar file.

    • pPort is the port used by the Java Gateway.

    • pAddress is the IP address used by the Java Gateway.

Testing the SAP Connection

To test the SAP connection, do the following in the Terminal (or in code):

  1. Create an instance of EnsLib.SAP.UtilsOpens in a new tab.

  2. Set the following properties of that instance. These are string properties unless otherwise noted.

    • SAPClient — SAP Client e.g 000.

    • SAPUser — Username that has access to the SAP server.

    • SAPPassword — Password for the user.

    • SAPLanguage

    • SAPHost— Host name or IP address of the SAP server.

    • SAPSystemNumber — SAP SystemNumber e.g 00.

    • JavaGatewayAddress — IP address or name of the machine where the JVM to be used by the Java Gateway server is located.

    • JavaGatewayPort — Port used by the Java Gateway.

    • SAPTransactionAutoCommit — Specifies whether to execute the BAPI "BAPI_TRANSACTION_COMMIT" after a successful BAPI/RFC-call. This property is %BooleanOpens in a new tab.

  3. 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 %StatusOpens in a new tab.

FeedbackOpens in a new tab