The so-called “soft state” mode enables the SAP Gateway runtime to process several requests in one ABAP application server session, similar to stateful behavior. The only difference is the behavior of the application server after the session times out: Instead of breaking the request processing with a time-out exception the server creates a new session and processes the request as usual. For the consumer the change of the application server sessions is transparent and no data is lost on the client session.
The soft state mode should be used for applications built on legacy functionality in the backend, especially when the functionality includes initial loading/caching of big amounts of data for a single request. By using soft state, the resources/functionality which has been loaded during the initial load can be reused for the subsequent requests of the service.
Thus, the main benefit of soft state is a considerable performance optimization of an OData service.
Data Provider Class (DPC)
In the data provider implementation class of your service make sure that the methods OPERATION_START and OPERATION_END of the interface /IWBEP/IF_MGW_SOST_SRV_RUNTIME are implemented. In case either of them is not redefined and the soft state mode is activated for the service the request processing will be stopped with an exception by the SAP Gateway framework.
To prepare OData services for working in soft state mode already in SAP Gateway 2.0 SP08 SAP Note 1986535 provides interface /IWBEP/IF_MGW_SOST_SRV_RUNTIME which is required by the SAP Gateway framework.
However, this SAP Note does not contain a pre-delivery of the soft state processing mode for SAP Gateway 2.0 SP08.
In the metadata provider implementation class of your service make sure that the model has been enabled for soft state mode by using the API /IWBEP/IF_MGW_ODATA_MODEL~SET_SOFT_STATE_ENABLED.
When working in soft state processing mode, bear in mind that transactional behavior must not be implemented by using the soft state processing mode and is not provided by the SAP Gateway framework.
Currently, URLs containing segment parameters such as ;mo, ;o, or ;v=.. cannot be processed in the soft state processing mode, as the path attribute of the context-id sent to the client must not contain a ;. These kind of URLs are always processed in the stateless mode by the SAP Gateway framework.
The SAP NetWeaver 7.0 component SAP_BASIS does not offer security sessions which are prerequisites for soft sate. Hence, soft state is not available on SAP NetWeaver 7.0 and/or 7.01. Security sessions are available from SAP NetWeaver 7.0 EHP2 onwards (see SAP Note 1322944 ). There was also a downport to SAP NetWeaver 7.0 EHP1 (see SAP Note 1477428 ). However, on SAP NetWeaver 7.0 EHP1 only SAP Gateway 2.0 codeline for SAP NetWeaver 7.0 can be used.
The Internet Communication Manager (ICM) handles soft state requests as if they were stateful requests. The SAP Gateway framewok only overwrites the behavior in case of a timeout. See also Stateless/Stateful Communication in the SAP NetWeaver documentation. The framework uses an RFC call to communicate with the backend. Nothing special is being done for soft state. Whether work processes of database connections can be maintained or not is therefore not controlled by the framework.
Note that the default setting for session timeout for a stateful connection is set as 00:00:00 in transaction SICF in section Service Data for an ICF node. This means the session timeout is inactive. The session is terminated after profile parameter rdisp/plugin_auto_logout has run. The default setting for rdisp/plugin_auto_logout is 30 minutes. If you want to change the time when the session context is terminated, set this profile parameter to another value via transaction RZ11. For more information about parameter rdisp/plugin_auto_logout, see the parameter documentation in transaction RZ11.
In addition to activating soft state for individual services, you can also use a central switch which is available in the implementation guide (IMG): In transaction SPRO open the SAP Reference IMG and navigate to . The default setting is an enabled soft state for all services. If you disable this centrally with the IMG activity, then those services which are active remain enabled. The switch is only relevant for the runtime. See also 1986626 .
Instead of a cookie a request header is sent from the client to identify a session as one of the context id transfer alternatives supported by the Web Dispatcher and Internet Communication Manager.
Previously only one session per browser was possible, because the browser manages the cookie handling and the same cookie is used for the same URL in different tabs/browser windows. Now the client can decide when a new session shall be used.
field: sap-contextid-accept with value: header
field: sap-contextid with value: system ID