Using Menus 

Menus can be directly accessed in the 3.1G version of the SAP Automation GUI software.

However, directly accessing a menu is usually not the most efficient method for accessing menu functionality, as menu traversal involves several round trips to the application server.

Several alternatives are available. These techniques are also required to access menu entries in SAP Automation GUI software prior to 3.1G.

Every menu choice is assigned to an OK code within the SAP Menu Painter software. Sending the OK code associated with the menu choice has the same affect as selecting the menu entry.

To determine the OK code for a menu entry within the current R/3 screen:

  1. Get the program name and GUI status for the current screen from the System Status dialog box.
  2. Go to the Menu Painter (transaction SE41).
  3. Enter the program name and GUI status in the text entry boxes and choose the Display button.
  4. The menu bar is displayed at the top of the screen. Double click on the menu bar entries and submenu entries until you see the menu entry you are looking for. The OK code is the 4-letter code in the "Func" column to the left of the menu entry.

The effect of many menu entries can be simulated without going to the Menu Painter. Menu entries that go to other transactions can be simulated using It_GetTransaction in the C API, or the Transaction method in the OLE Automation Server. These methods add the "/n" prefix before the transaction code argument and set the OK code to the resulting value.

Note that when an OK Code for another transaction is set in an event using the "/n" prefix, other event settings are generally ignored. If the current transaction needs to be finished before moving to the next transaction, first send one event to finish the current transaction. Then get the returned event and send a second event to set the OK Code for the next transaction.

Some menu paths duplicate function key entries. In this case, the appropriate function key can be sent in order to move to the appropriate screen. Function keys also have OK codes associated with them, so sending the function key has the same effect as manually sending the OK code.