Typically, when calling a Connect API, the call opens a new session in SAP, executes the needed functionality, and then closes the session. Sometimes it is desirable to execute multiple API calls in a single session for performance purposes - ensuring that various pieces of data remain in memory in SAP. Specifically, the most frequent use case for this functionality is when doing variant configuration - that RIO is specifically designed to allow you to take advantage of keeping the prior configuration round in memory to reduce the need to recompute every piece of the configuration.
There are two session APIs:
These APIs are added to every Connect end point - they do not need to be selected on the API screen.
Note that if the end point supports multiple connections, these API calls will exist for each one.
To start a session, simply call the
startAPI. You will get back a response with a
set-cookieheader for a cookie named
Sap-session.Store the value of that cookie for use below.
Whenever you want to execute a call in a session you previously created, simply add a
cookieheader to the normal API call and pass in a cookie named
SAP-sessionwith the value returned in the
startcall. This call will behave normally in all respects, other than it will be executed in the same SAP session as any other call with that cookie.
Passing an invalid session cookie value will result in an error response.
To end a session, simply call the
stopAPI, including the same cookie header used when executing calls in the session. This will end the session in SAP. Failure to end a session will result in the session being closed according to the settings of the particular SAP system (often something like 30 minutes after last use).