Sub topic 9
Working with several sessions
This chapter assumes you can log on to SAP GUI and start a transaction from the command field. It also assumes you know the /n and /o prefixes from the previous chapter. Here you will learn what a session is, how to open and manage several of them, and which mistakes cost people their work.
What a session is
A session is one SAP GUI window inside a single logon. When you log on, you get session 1. You can open more sessions without logging on again. Each session runs its own transaction, has its own screen, and keeps its own unsaved data.
All sessions of one logon share the same user, client, and language. They also share the same connection to the SAP system. Logging on a second time is a different thing. It creates a separate logon with its own set of sessions, and the system may warn you about multiple logons.
The point of sessions is that you can do two things at once. You can look up a customer in one window while you post a document in another. You can leave a long report running and keep working in a second window.
The session limit
The system administrator sets how many sessions each logon may have. The default is 6, and the limit can be set anywhere from 2 to 6. If you try to open more than your system allows, SAP GUI shows a message that the maximum number of sessions has been reached, and no new window opens.
Each session uses memory on the application server, so more sessions are not free. A practical habit is to keep two or three open and close the ones you no longer need.
Opening a new session
You can open a session in several ways.
- Type
/oin the command field and press Enter. The new session opens at the SAP Easy Access screen. - Type
/ofollowed by a transaction code, for example/oSE16. The new session starts that transaction directly. - Choose System > Create Session from the menu bar.
- Click the Create New Session button in the standard toolbar.
Option 2 is the one you will use most. Your current session stays exactly where it is, and the new one starts the transaction you asked for.
/oSE16/oThe first command opens SE16 (Data Browser) in a new session. The second opens a new session at the Easy Access menu.
Opening a session from a menu entry or link
You can also open a session without typing anything. In the Easy Access menu, right-click a transaction and choose Open in New Window, or hold the modifier your SAP GUI version supports when double-clicking. The exact wording differs between SAP GUI versions, so look at the context menu in your own installation.
This is useful when you are browsing the menu and want the transaction to start in a fresh window while your current work stays open.
Switching between sessions
Each session is a normal operating system window. Depending on your SAP GUI settings, each one appears as its own taskbar entry or button. You can switch with the mouse or with the usual Alt+Tab shortcut of your operating system.
The title bar or the status bar shows the session number, such as 1, 2, or 3, along with the system ID and client. When several windows look alike, check this number before you start typing. It is easy to post or change data in the wrong session if you only glance at the screen.
Ending a session
There are two ways to end one, and they behave differently.
| Action | What it does | Effect on other sessions |
|---|---|---|
| Close the window (X button or **System > Log Off**) from a session when others are open | Closes only that session after a prompt | Other sessions stay open |
| Close the last remaining session | Logs you off the system | None left to affect |
| `/nex` | Closes all sessions and logs off at once, with no prompt | All sessions end |
| `/i` | Deletes the current session | Other sessions stay open |
The command /i ends the session you are in. If it is your only session, it behaves like a log off. The command /nex is the dangerous one, because it skips the save prompt.
/nex/iWhen you close a session that has unsaved data, SAP GUI normally asks you to confirm. Treat that prompt as a safety net, not as a guarantee. A transaction may be partway through a posting, and closing it can leave you unsure whether the document was saved. Check the status bar message after a save before closing.
How sessions relate to /n and /o
The two prefixes do different jobs, and mixing them up is a common source of confusion.
| Command | Where the transaction runs | What happens to the current transaction |
|---|---|---|
| `SE16` | Current session | Replaced, but only if no unsaved data blocks it |
| `/nSE16` | Current session | Ended without a prompt, unsaved changes are lost |
| `/oSE16` | New session | Left untouched |
Typing /nSE16 does not ask whether you want to save. If you are halfway through entering a document, those entries are gone. When you are not sure the work is saved, use /o instead. It costs one session and risks nothing.
A plain transaction code without a prefix works only on a screen where the command field accepts it. On many screens inside a transaction, the plain code is rejected, and you must use /n first.
A worked example
Suppose you are entering a long order and you need to check a customer number. You do not want to leave the order screen.
- In the order screen, type
/oSE16in the command field and press Enter. - A second window opens with the Data Browser. Look up the customer.
- Note the number. Close the second window by typing
/iand pressing Enter. - You are back in session 1, where the order is still as you left it.
Things to watch for
Sessions are independent windows, but they are not fully independent in effect. Keep these points in mind.
- Locks. If you open the same object for change in two sessions, the second session can be blocked by the lock your first session holds. The message usually says the object is locked by your own user name. Close or save the first one.
- Shared defaults. Settings such as your user parameters apply to the whole logon. Changing them in one session affects the others, though some values are read only when a transaction starts.
- Memory and speed. Large reports in several sessions at once can slow your work and the system for others.
- Timeouts. If your logon is idle for too long, the system can end it. This closes every session, and unsaved data in all of them is lost.
- Wrong window. Because windows look alike, check the session number before you save or post.
Quick reference
| Goal | Command |
|---|---|
| Open a new session at the Easy Access menu | `/o` |
| Open a new session running a transaction | `/oSE16` |
| End the current session | `/i` |
| Leave the current transaction, stay in this session | `/n` |
| Close all sessions and log off without a prompt | `/nex` |
Exercises
Exercise
You are halfway through entering a document and need to check data in SE16 without losing your entries. Which command do you type, and why is /nSE16 the wrong choice?
Show answer
Type /oSE16. It opens SE16 in a new session and leaves the current transaction untouched. /nSE16 ends the current transaction in the same session without a save prompt, so your unsaved entries would be lost.
Exercise
You have three sessions open and want to close only the one you are working in. Which command do you use, and what would be the effect of /nex instead?
Show answer
Use /i, which deletes the current session and leaves the others open. /nex would close all three sessions and log you off immediately, with no save prompt, so unsaved work in every session would be lost.
Exercise
You try to open a seventh session and nothing happens except an error message. What is the most likely cause, and what can you do?
Show answer
Your logon has reached the maximum number of sessions set by the system administrator, which is at most 6. Close a session you no longer need, for example with /i, and then open the new one.