Sub topic 4
Switching and opening transactions with /n and /o
Prerequisites and scope
This chapter assumes you can log on to an SAP system and type a transaction code into the command field, as covered in the previous chapters. You also need authorisation for a few common transactions, such as SU3 and SE16.
By the end, you will know what the command prefixes /n, /o and /nex do, when to use each one, and which errors to expect.
Why prefixes exist
A plain transaction code works only from the SAP Easy Access screen. Inside another transaction, typing SE16 in the command field usually produces an error or is treated as screen input. A prefix tells SAP GUI what to do with the current screen before it starts the new transaction.
Two decisions are involved:
- Do you want to leave the current transaction, or keep it?
- Do you want the new transaction in this window, or in a new one?
The prefixes answer these two questions.
The plain form
On the SAP Easy Access screen, type the code and press Enter.
SU3SU3 opens your own user data and defaults. The plain form is the right choice when you are on the Easy Access screen and nothing is waiting to be saved.
If you type a plain code while inside another transaction, one of two things happens. Either you get a message that the transaction does not exist, or the text is read as input for the current screen. Neither result is what you want. Use a prefix instead.
/n: leave this transaction and start another
The /n prefix ends the current transaction in this session and starts the new one in its place.
/nSE16This starts SE16 (Data Browser) in the current session. It also works from inside another transaction. Your window count does not change. Only the content of the current window changes.
What happens to unsaved data
SAP GUI checks for unsaved changes when you leave a transaction with /n. If you have entered data, a dialog usually asks whether you want to save, exit without saving, or cancel. Read it before you click. Choosing to exit without saving discards your input.
The check depends on the transaction. Some transactions do not warn you, especially simple display transactions. Do not rely on a prompt as a safety net. Save before you switch.
Returning to the Easy Access menu
Entering /n with nothing after it leaves the current transaction and returns you to the SAP Easy Access menu.
/nThis is the quickest way to get back to a known starting point. Many people use it before typing a plain code, but /nSE16 does the same job in one step.
/o: open a new session and start a transaction there
The /o prefix opens a new session and starts the transaction in it. The transaction in your current session stays where it is.
/oSE16A session is an additional window within the same logon. You can have several at once. Each runs its own transaction, and each keeps its own screen state. The next chapters cover sessions in more detail. Here, you only need to know that /o creates one.
Use /o when you want to look something up without losing your place. For example, you are in the middle of entering a document and need to check a table in SE16. Open SE16 with /oSE16, read what you need, close that session, and carry on.
Limits on the number of sessions
Each logon can have a limited number of sessions. The default maximum is 6, and an administrator can set it lower or higher through a system parameter. When you reach the limit, SAP GUI shows a message and does not open another session. Close a session you no longer need and try again.
Each session also uses memory on the application server. Opening many sessions that you do not use is wasteful and can slow the system for other users.
/o on its own
Entering /o without a code opens a new session and shows a session list or the Easy Access menu, depending on your system and GUI version. Check how it behaves on your system before you rely on it. If you only need a blank new session, /o is usually enough.
/nex: close everything and log off
The /nex command closes all sessions of the logon and logs you off immediately.
/nexThere is no save prompt. Unsaved work in every open session is lost.
This differs from /o and /n in scope. Those affect one session. /nex affects the whole logon. Because it is quick, it is also dangerous when you have several sessions open and forget what is in them.
A safer way to leave is to end each transaction deliberately, then log off through the menu. Use /nex when you are certain that nothing needs saving.
Comparing the forms
| Entry | Effect on the current session | New session? | Typical use |
|---|---|---|---|
| `SE16` | Starts the code on the Easy Access screen only | No | Starting from the menu screen |
| `/nSE16` | Ends the current transaction and starts SE16 in it | No | Switching tasks in one window |
| `/oSE16` | Leaves it unchanged | Yes | Looking something up and keeping your place |
| `/n` | Ends the current transaction and shows the menu | No | Returning to the starting point |
| `/nex` | Closes all sessions and logs off | No | Quick exit when nothing is unsaved |
Deciding which form to use
The choice follows from what you want to keep.
In practice, many users type /n plus the code by default, because it works from every screen. Use /o when losing the current screen would cost you time.
Worked example
Suppose you are in SU3 and want to look at a table without losing your settings changes.
- In SU3, you have changed a default value but have not saved it.
- Type
/oSE16in the command field and press Enter. - A second session opens with SE16. SU3 is still open in the first session, with your change intact.
- Look up what you need in the second session.
- Close the second session with the window close button, or type
/iin it to end that session. - Return to the first session and save your SU3 change.
If you had typed /nSE16 at step 2 instead, SAP GUI would have asked what to do with the unsaved change. If you had chosen to discard it, you would have had to enter it again.
Common errors
- Typing the code without a prefix inside a transaction. The result is a "transaction does not exist" message or unwanted screen input. Add
/nor/o. - Typing the prefix after the code. Writing
SE16/ndoes not work. The prefix always comes first. - Leaving a space. Write
/nSE16, not/n SE16. A space is not part of the syntax and may cause an error on some versions. - Using
/nexwhile other sessions are open. All sessions close without a save prompt. Check each window first. - Hitting the session limit.
/ofails with a message. Close a session and repeat. - Missing authorisation. If you lack rights for the code, both
/nand/oshow the same authorisation message as the plain form. In the/ocase, the new session may open and then show the error, so you need to close it.
Related commands worth knowing
The same command field accepts a few other entries that are closely related. They are optional, and their availability can depend on your system settings.
/iends the current session. If it is the only session, SAP GUI asks what to do next./ofollowed by a code can be combined with a code that has a parameter. Check how your system handles parameters before relying on it./hturns on the debugger. Do not use it unless you are asked to, because it changes how the system runs your transactions.
Summary of rules
- Plain code: only from the Easy Access screen.
/nplus code: switch in the same session./oplus code: start in a new session and keep the current one./nalone: return to the Easy Access menu./nex: close all sessions and log off at once. No save prompt.
Exercise
You are in the middle of editing data in one transaction and need to check a table in SE16 without losing your edits. Which entry do you type, and why is /nSE16 the wrong choice?
Show answer
Type /oSE16. It opens SE16 in a new session and leaves the first session unchanged. /nSE16 would end the current transaction in the same window, so your unsaved edits would be at risk. SAP GUI might ask whether to save, but you would have lost your place either way.
Exercise
A colleague types /nex while three sessions are open. One session holds an unsaved entry. What happens to that entry?
Show answer
It is lost. /nex closes all sessions of the logon and logs off immediately, without a save prompt.
Exercise
You are on the SAP Easy Access screen. Name two entries that start SU3, and say which one you would use from inside another transaction.
Show answer
SU3 and /nSU3 both start it from the Easy Access screen. Inside another transaction, use /nSU3, because the plain form does not work there. If you want to keep the current transaction, use /oSU3.