Using the Properties Files to Set Up SessionInfo 

Use

To provide the SessionManager with the necessary information for handling the connection, you must set the properties of SessionInfo.

If you set up an r3_connection.props properties file with all the necessary fields (including user password), starting an R/3 session is simple. You do not need to take any action to set the SessionInfo; the SessionManager sets the necessary properties automatically, taking the information from the properties file.

Procedure

All you need to do to start a session is:

  1. Create the properties file.
  2. Since the SessionManager never writes password information into the properties file, if you keep password information in the properties file and you wish to preserve it, then make the file read-only.

    However, if you are going to supplement or change in your program any of the information in the properties file, then make the file write-enabled.

  3. Instantiate the SessionManager object.
  4. Use the open method of SessionManager to start a session.

Result

The SessionManager copies the information in the properties file into SessionInfo, and then starts a connection using SessionInfo.

If the connection is established successfully, the SessionManager re-writes the contents of the properties file (except for the password).

Next Step

You can now use this connection to create, manage and call RFC function module(s).

Your next step is to set up the IRfcModule object and all of its parameters.

Example

The following code uses the SessionInfo properties file. It instantiates the SessionManager and then starts a session:

// Obtain an instance of the SessionManager:
SessionManager sessionMgr = SessionManager.getInstance();
// Start the session:
SessionMgr.open();