Skip to end of metadata
Go to start of metadata

SAP Screen Personas

Using Function Codes in OK Field as "shortcuts"

SAP SCREEN PERSONAS KNOWLEDGE BASE - by Sushant Priyadarshi , Tamas Hoznek , Regina Sheynblat


This document will show you how to use Function Codes in the OK Field command to perform some of the actions in a particular transaction/screen.


Every program associated with a transaction has a list of functions (function codes) which can be triggered from OK field command. The list of function codes which can be used for a program can be found in transaction SE41. You can use these function codes in OK Field field directly to perform their assigned action.

Example used in this document : In ME21N, there are 3 expand/collapse containers. We will use function codes to expand the Header Container and add it as onLoad script.

So will these "shortcuts" increase a bit of performance? May be yes for some use cases. For example, to complete a certain step in your script, you have to press 2 buttons. If the same step can be done using the function code, it will certainly help boost the performance.

Steps to expand/collapse containers in ME21N

  1. Goto transaction ME21N and find out the Program Name. Copy the highlighted program Name as shown below.
  2. Goto transaction SE41, put the program name and click on the radio "Function List". Display
  3. In the resulting screen, make a note of the function codes used for the Header, Overview and Item sections for expanding and collapsing, for instance we will be using the expand function for the Header section - METOGGON1

  4. In Scripting, you can put something like as shown below. In our example, I will put this script as onLoad screen event so that Header section is always expanded when the user launches this flavor

    ok code field
    session.findById("wnd[0]/tbar[0]/okcd").text = "METOGGON1";

Related Search Terms:

SAP Screen Personas Scripting