Sets a session variable with a specified string value. If you specify a numeric
value, it is saved as a string.
Input Variables
- Variable – name of the session variable to set.
- Value – value to save in the session variable. To set
Variable with the value of another session
variable, specify the session variable name as
{sessionVariable} where
sessionVariable contains the value to copy.
Follow-up State – OK
The name of the follow-up state after successful processing.
This process always succeeds and moves to the next state.
Note: This state performs no error checking. Even if the input variables are empty, it
proceeds to the follow-up state. SAP recommends that you use the Copy Variables
state to set session variables, because it performs input validations, and uses the
Fail follow-up state for error handling and debugging.
Follow-up State – Fail
Not applicable.
Follow-up State – Dynamic
Not applicable.
State Editor
This example sets the session variable CREDIT to 1000. The
variable can be accessed by any state in the application.

Notes
Session variables are also set in these circumstances:
- If you specify a value surrounded by parentheses in the Expression field for
a follow-up state, and specify the session variable name in the Assign To
field.
- If a state returns values, they are copied to session variables, so they are
accessible by follow-up states.
Note: Setting session variables overwrites any values that are
already set for them. For example, if a state returns a value in the session
variable X, and the follow-up state also sets variable X, the return value is lost.
To avoid this issue, use the Copy Variables state, instead of Set Variable.
Usage
This example sets the session variable ALERT_MESSAGE with a
message sent by the Send SMS state.
