Sub topic 3
Running a Transaction from the Command Field
This chapter assumes you have SAP GUI installed, a working logon, and a rough idea of what a transaction code is (a short name such as SU3 that stands for a screen or program). It also assumes you can find the window elements described in the previous chapter. Here you will learn how the command field works, what it accepts, and where it commonly goes wrong.
What the command field does
The command field is the small input box at the left of the standard toolbar, just below the menu bar. When you type a transaction code into it and press Enter, SAP starts that transaction in the current window. This is usually quicker than opening menu folders, because you skip the clicking and go straight to the screen.
The field is often collapsed. If you only see a small arrow at the left of the toolbar, click it to expand the field. Many installations show it permanently. If yours does not, you can turn it on in the SAP GUI options (look for the setting that keeps the command field visible).
The field is more than an input box for transaction codes. It also accepts:
- Transaction codes, such as
SU3. - Prefixed commands, such as
/nand/o, which change where the transaction runs. The next chapter covers these in depth, and this chapter introduces the basics. - A small set of system commands, such as
/nex. - Previously entered codes, which you can pick from the field's drop-down history.
Starting a transaction
Click in the command field, type the code, and press Enter. For example, to open your own user data and defaults, enter:
SU3Transaction codes are not case sensitive, so su3, Su3, and SU3 all work. SAP converts the entry for you.
You can only start a transaction this way from a screen that allows it. The plain form works from the SAP Easy Access menu, and it works from any screen that has no unsaved state it must protect. From inside another transaction it can fail, as the next section shows.
Why the plain form sometimes fails
Suppose you are in one transaction and you type SE16 without a prefix. In many cases SAP does not start it. Instead the system treats the entry as input for the screen you are on, or it shows a message that the entry is not valid there. The plain form is meant for the point where you have no transaction running, typically the Easy Access menu.
To leave the current transaction and start another, you add a prefix. The two you will use most are /n and /o.
| Entry | What happens | Current work |
|---|---|---|
| `SU3` | Starts SU3 from the Easy Access menu. From inside another transaction, it may be rejected or treated as screen input. | Not affected |
| `/nSE16` | Ends the current transaction in this session and starts SE16 in its place. | Ends in this session |
| `/oSE16` | Opens a new session and starts SE16 there. | Stays where it is |
| `/n` | Leaves the current transaction and returns to the Easy Access menu. | Ends in this session |
| `/nex` | Closes all sessions of the logon and logs off immediately. | Lost, with no save prompt |
Replacing the current transaction with /n
The /n prefix means "end what I am doing here, then start this". Enter:
/nSE16SE16 (the Data Browser) replaces the transaction in your current session. This works from inside another transaction too, which makes /n the safe default when you are not sure where you are.
There is one important caveat. If the current screen has unsaved changes, SAP may ask whether you want to save them before it leaves. Read that prompt. If there is no prompt, do not assume your data was saved. Some screens drop unsaved input when you leave, so save first if the work matters.
Entering /n on its own leaves the current transaction and returns you to the Easy Access menu:
/nKeeping the current transaction with /o
The /o prefix opens a new session and starts the transaction there:
/oSE16Your original session stays exactly where it was, with its data and screen intact. This is the right choice when you are in the middle of a task and need to look something up. You can then switch between the two windows and close the extra one when you are done. Sessions are covered in a later chapter, including the limit on how many you can have open (commonly six by default, though administrators can change it).
If you enter /o with no transaction code, SAP opens a new session on the Easy Access menu, or shows a session overview, depending on your system. Try it once on your own system to see which you get.
Logging off with /nex
The command /nex closes every session of the logon and logs you off at once:
/nexThere is no save prompt. Anything you have not saved in any open session is lost. Use it when you are certain nothing is pending. The related command /nend is similar but shows a confirmation dialog first, so it is safer when you are unsure. If you only want to close the current window, use the window's close button instead, which asks for confirmation as usual.
What happens when you press Enter
It helps to know the sequence, because most errors come from a failure at one of the steps.
Messages appear in the status bar at the bottom of the window, not in a pop-up. If nothing seems to happen after you press Enter, look there first.
Learning the code behind a screen
If you reached a screen through the menu and want its code, open the status dialog. Use the menu path:
System > StatusThe dialog shows the transaction code of the current screen, among other details such as the program name and screen number. This is a reliable way to learn a code you can later type into the command field. A later chapter covers other ways of finding codes.
Common errors and what they mean
The status bar message tells you what went wrong. These are the ones you will see most.
| Symptom | Likely cause | What to do |
|---|---|---|
| Message that the transaction does not exist | A typo, or the code is not present in this system. | Check the spelling. Codes are not case sensitive, but a letter `O` and a zero `0` are different characters. |
| Message that you have no authorisation | Your user lacks the permission for that transaction. | Do not retry. Ask your security administrator or the role owner. |
| Nothing happens, or the entry is read as screen input | You typed the plain form while inside another transaction. | Add `/n` or `/o` in front. |
| A prompt asks about saving | The current screen has unsaved changes. | Read it, then save or discard on purpose. |
| The command field is missing | It is collapsed or hidden. | Click the small arrow at the left of the toolbar, or enable it in the GUI options. |
Habits that save time
- Use
/nby default when switching between transactions. It works everywhere. - Use
/owhen you need a second view of something and do not want to lose your place. - Open the command field's drop-down to reuse earlier entries instead of retyping them.
- Press Enter once and wait. Repeated presses can queue extra actions.
- Note the code of any screen you visit often, and later add it to your Favourites.
Edge cases
Some details trip people up.
- Transaction codes can include digits and special characters, such as
/SAPAPO/MC62. These "namespaced" codes start with a slash. Entered after/n, the result looks like/n/SAPAPO/MC62. The extra slash is correct. - Some transactions cannot be started from the command field in certain contexts, such as when a modal dialog box is open. Close the dialog first.
- Entering a code you are not allowed to use does not change the current screen. You stay where you were and the status bar explains why.
- A code that works in one system may not exist in another, for example if a component is not installed. Development, test, and production systems can differ.
- The history in the drop-down is stored per user, per system. It does not follow you to a different system.
Practice
Try these in order on a test or training system. They are all safe because none of them changes data.
- Expand the command field if it is collapsed.
- From the Easy Access menu, enter
SU3and press Enter. Note the title of the screen. - Enter
/nSE16. Confirm that SU3 is gone and SE16 is on screen. - Enter
/oSU3. Confirm that you now have two windows and that SE16 is still open in the first. - Close the second window, then enter
/nin the first to return to the menu. - Open any screen through the menu, then use System > Status to read its transaction code.
Exercise
You are halfway through entering data in one transaction and need to look something up in SE16 without losing your input. Which entry do you type in the command field, and why not the alternatives?
Show answer
Type /oSE16. The /o prefix opens SE16 in a new session, so the original session and its unsaved input stay as they are. /nSE16 would end the current transaction in this session and risk losing the input. The plain SE16 may be rejected or treated as screen input because you are inside another transaction. /nex would log you off and lose all unsaved work.
Exercise
A colleague says that typing /nex is a quick way to close one extra session. What is wrong with that advice, and what would you do instead?
Show answer
/nex closes all sessions of the logon and logs off immediately, with no save prompt, so unsaved work in every session is lost. To close only the extra session, switch to it and use its window close button, which asks for confirmation. If you do want to log off but want a safety prompt, use /nend.