Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Reserved Function Keys

Former Member
0 Likes
9,342

Hi all,

Can we use Reserved Function Keys in our status in Menu painter?

if yes than how can i?

Thanks in advance

24 REPLIES 24
Read only

Former Member
0 Likes
4,161

Hi dhwani,

While creating a button , it will ask for the function key for that button, you can assign the function key to that button , have you tried that

Read only

0 Likes
4,161

But when i can create button?

on Function key?

Read only

Former Member
0 Likes
4,161

Hi..

You cannot add the function code to a reserved function key... Like F3..

It shows a list of possible function keys that u can assign to a function code when u r creating it through Menu Painter...

But if u want to assign it through any AT PF <nn> event , then it wont work .. its reserved funtionality u cannot change ....

hope u understood..

reward if it helps u...

sai ramesh

Read only

0 Likes
4,160

Thanks for ur help

Ya i understand little bit, but can u tell me in reserved function keys, for FIND its %SC so if i am creating icon in standard toolbar for FIND, i have taken %SC asits Function code but still its not working...

I want to activate FIND icon but i dont know its coding for its proper workin

can u help me?

Read only

Former Member
0 Likes
4,160

Hi......

no we can not use Reserved Function Keys (like F1 F3 F4) in our status in Menu painter.

Reward points if useful......

Suresh......

Read only

Former Member
0 Likes
4,160

Hi,

We can assign Reserved Function Keys (F1, F3, F4 ) to PUSH BUTTONS.

I did this in one of my requirement. You need to do the following procedure:

1. Create the push buttons.

2. Assign the function codes.

3. Double click on the PF-STATUS.

4. Now click on the Utilities.

5. choose F key consistences.

6. Here assign the function code to your desired function keys.

Note : Some times for the F1 function key your function code for that won't get activated and doesn't work properly. If you face such problem assign the function code for some other function key and activate it. Now again reassign this function code to the F1 a message will pop-up do want to re active the function key press enter and again activate it.

Br,

Laxmi.

Read only

0 Likes
4,160

Hi thanks for ur help

But can u explain little bit in detail..

Create push button means?

And i want to activate FIND Button

Canu plz help me

Read only

0 Likes
4,160

U need to create a PF-STATUS for the current screen..

for that u need to user MENU painter.. ( tcode SE41 )

.

or in ur program u need to write SET PF-STATUS <'STATUS'>..

and double click on this .. it will take u to the menu painter screen...

There u can find three options..

Menu bar..

Application bar..

Function keys...

Open the function keys ...

Here u can add 32 function codes to the current screen..

These 32 u can create in the form of push buttons...

first go through the Help for MENU PAINTER ... read that..

then u can under stand !! okk..

<b>For the FIND button to get activated first u need to know what is the funciton code o f the find button on that particular list or screen.. first know that by selecting it and pressing F1 and then F9... and then give this function code the MENU PAINTER for a particular push button...</b>

reward if it is helpful..

sai ramesh

Read only

0 Likes
4,160

Hi,

If you trying to do this in the Module pool. Create the push buttons on the screens. If you are doing in the report then give the name of the buttons. But let me now where you want to place this functionality either in a report or in a module pool.

Report:

1. write the statement SET PF-STATUS 'ABCD'.

2. Double click on the ABCD.

3. Click on the application tool bar.

4. Items 1-35. Anywhere give 4letter word in capital say for example 'FIND' this will be your function code for the push button.

5. Give the short text for the pushbutton

6.Click on the utilities --> F key consistences --> give the function code FIND to any function key for example F1.

7. save

8. Activate it.

IF you trying to do this in the module pool. Go with the earlier mentioned procedure.

Br,

Laxmi.

Br,

Laxmi.

Read only

0 Likes
4,160

Thanks for ur help

I made that button and it is displaying on screen also but for its working i have to write some code right?

Read only

0 Likes
4,160

Hi.....

yes, u need to write some code in <b>USER-COMMAND</b> Event....

You have to write the code like this:............

AT USER-COMMAND.

CASE SY-UCOMM.

WHEN 'FIND'.

  • Write your code.

ENDCASE.

Reward points if useful.......

Suresh......

Read only

0 Likes
4,160

AT USER-COMMAND.

CASE SY-UCOMM.

WHEN 'FIND'.

  • Write your code.

ENDCASE.

i dont know code for FIND. I am asking that code

Read only

0 Likes
4,160

Hi,

Yes you need to create code for that pushbutton to work accordingly.

Br,

Laxmi

Read only

0 Likes
4,160

Hi,

you need to write in the

At USer-command event if it is a report .

If it is a Module pool then you need to write in PAI.

Br,

Laxmi.

Read only

0 Likes
4,160

do u know any source of coding?

Read only

0 Likes
4,160

Hi,

what action you want to place for that push button.

Br,

Laxmi

Read only

0 Likes
4,160

Hi,

If your program is for ALV / report. When ever a find button is pressed then immediately show the pop up screen. That screen should contain the Mandatory column as fields then based on that check on interanal table.

For example: If you report contains material, material description, quantitiy and soon. so when a find is pressed show the pop screen containing the MATNR as a parameter. now when is pressed. take that value and search in the ALV grid internal table and when you find the row by index of the internal table . show this on the screen.

Br,

Laxmi

Read only

0 Likes
4,160

Hi

Thanks for ur help but can u give me some code for this?

And i am using screen for output so do u know what to do for finding in screen..

Thanks

Read only

0 Likes
4,160

Hi,

Let me in the screen what you are values and how your are display.

Br,

Laxmi

Read only

0 Likes
4,160

Sorry

but i cant understand ur question...

I am using screen for out put and as we have FIND option(that binocular) in ALV or in all screen of SAP, i want FIND option in my screen as button in function key.

But i don't know what is code for it,which i have to write in

CASE SY-UCOMM.

WHEN 'FIND'.

?

ENDCASE.

Read only

0 Likes
4,160

Hi,

In the screen where you kept FIND button . In that screen what values you are display say like internal table containing data from any database table. or you have multiple fields .

Br,

Laxmi

Read only

0 Likes
4,160

from internal table it is coming on a screen

Read only

0 Likes
4,160

Hi,

I guess you got the solution for this. If it is alot points to helpful answers and close this thread.

Br,

Laxmi

Read only

Former Member
0 Likes
4,160

Using GUI Statuses

Kontextmenüs

Kontextmenüs

A GUI status is an independent component of an ABAP program. You create them in the ABAP Workbench using the Menu Painter. The relevant documentation provides comprehensive information about creating GUI statuses and their elements. The most important details are contained below.

GUI Status

The function of a GUI status is to provide the user with a range of functions on a screen. Each function has an associated function code, and when the user chooses a function, the PAI event is triggered. In each PAI event, the function code, as long as it is not empty, is placed in the system field SYST-UCOMM (SY-UCOMM) and assigned to the OK_CODE field. Empty function codes are placed in neither the SY-UCOMM field nor the OK_CODE field. Before you can work with the OK_CODE field, you must assign a name to it in the Screen Painter. For further information, refer to Reading Function Codes.

All function codes in an ABAP program, apart from those only assigned to pushbuttons on screens, are defined and adminstered in the Menu Painter.

When you define a function code in the Menu Painter, you assign it to a menu entry in a menu bar, and possibly also to a freely-assigned function key on the keyboard. Function codes that are assigned to a function key can also be assigned to an icon in the standard toolbar or a pushbutton in the application toolbar. A GUI status consists of a menu bar, a standard toolbar, an application toolbar, and a function key setting. For each function code, there is a static or dynamic function text. Dynamic function texts allow you to use context-sensitive texts in your ABAP program.

The user interface is a visualization of all possible functions, and is meant to make programs easier to use. From a technical point of view, you could just enter the function code in the command field and trigger the PAI event by pressing ENTER. However, a GUI status should contain all possible function codes as menu entries. The most important functions should also be assigned to function keys, and the most important of these should also be assigned to icons in the standard toolbar or the application toolbar.

In the Menu Painter, the functions that you assign to the icons in the standard toolbar must also be assigned to particular function keys. You cannot assign them freely. Instead, the system automatically assigns them to the corresponding function key when you assign the function code to an icon. You should always activate at least one of the Back (F3), Exit (shift+F3), and Cancel (F12) functions, so that the user can always leave the screen in the normal fashion. The assignment of function keys to pushbuttons in the application toolbar is not fixed.

Whenever you assign function codes to interface elements, you should refer to the ergonomic guidelines in the SAP Style Guide. The Menu Painter provides you with help in this respect, since you can use the Display standards function and corresponding checks.

As well as the function codes for Normal application functions, which trigger the PAI event, you can also create function codes in the Menu Painter with other functions, for example, to call another transaction or trigger a system functions. You can also create special function codes for pushbuttons on screens, but you must assign another function type to the function code in either the Menu Painter or the Screen Painter.

You can also use the Menu Painter to create area menus. An area menu is a user interface that does not belong to an ABAP program and may therefore not trigger any PAI events. It may only contain function codes that call transactions or system functions. Examples of area menus are the initial screen of the R/3 System (S000) and the initial screen of the ABAP Workbench (S001).

Special Function Keys and Function Codes

Some keys and function codes have special functions. This section deals with the special functions on screens. There are also special functions that apply to lists.

Reserved Function Keys

The following function keys do not trigger the PAI event, but are reserved for other functions:

F1 calls the field help

F4 calls the input help

F10 places the cursor in the menu bar

Function Keys for the Standard Toolbar

The following function keys are firmly assigned to icons in the standard toolbar. The function code that you assign and the corresponding ABAP coding should reflect the sense of the icon.

Function key

Icon

Purpose

Ctrl+S or F11

Save

F3

Back

Shift+F3

Exit

Esc or F12

Cancel

Ctrl+P

Print

Ctrl+F

Find

Ctrl+G

Find next

Ctrl+PgUp

First page

PgUp

Previous page

PgDn

Next page

Ctrl+PgDn

Last page

The ENTER Key

The ENTER key belongs to the icon in the standard toolbar, and is always active, even if no function is assigned to it in the GUI status, or there is no GUI status set at all. The PAI event is always triggered when the user chooses ENTER. The following function codes can be passed to SY-UCOMM or the OK_CODE field:

Any entry in the command field when the user presses ENTER

If there is no entry in the command field, any function code assigned to the ENTER key in the Menu Painter.

If the command field does not contain an entry and no function code is assigned to the ENTER key in the Menu Painter, the function code is empty and therefore not passed to SY-UCOMM or the OK_CODE field.

The F2 Key

The F2 key is always linked to a mouse double-click. If a function code in the GUI status is assigned to the F2 key, the PAI event can be triggered either when the user chooses F2 or when he or she double-clicks a screen element. In both cases, the corresponding function code is passed to SY-UCOMM and the OK_CODE field. If you need to use the cursor position to control what happens next, you must find it out yourself using the GET CURSOR statement.

Setting the GUI Status

To assign a GUI status to a screen, use the ABAP statement

SET PF-STATUS parameters. To display an ampersand character ‘&’, repeat it in the title ‘&&’.

You should set the GUI title for a screen in the PBO event.

GUI status and screen

PROGRAM DEMO_DYNPRO_GUI_STATUS.

DATA: OK_CODE LIKE SY-UCOMM,

SAVE_OK LIKE OK_CODE,

OUTPUT LIKE OK_CODE.

CALL SCREEN 100.

MODULE INIT_SCREEN_0100 OUTPUT.

SET PF-STATUS 'STATUS_100'.

SET TITLEBAR '100'.

ENDMODULE.

MODULE USER_COMMAND_0100 INPUT.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK.

WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.

LEAVE PROGRAM.

WHEN OTHERS.

OUTPUT = SAVE_OK.

ENDCASE.

ENDMODULE.

The next screen (statically defined) for screen 100 is itself. It has the following layout:

The part of the element list relevant for the screen fields is as follows:

Name

Type

Format

OUTPUT

I/O

CHAR

OK_CODE

OK

OK

The input option for the screen field OUTPUT has been switched off in the Screen Painter.

The screen flow logic is as follows:

PROCESS BEFORE OUTPUT.

MODULE INIT_SCREEN_0100.

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100.

The PBO module INIT_SCREEN_100 sets the GUI status STATUS_100 and a title 100. The GUI status was created using the Menu Painter as follows:

Menu bar

Menu Demo:

Function code

Text

SAVE

Save

PRINT

Print

DELETE

Delete

EXIT

Exit

Menu Edit:

Function code

Text

MARK

Select

SELE

Choose

SEARCH

Find

SEARCH+

Find next

TOP

First page

PAGE_UP

Previous page

PAGE_DOWN

Next page

BOTTOM

Last page

CANCEL

Cancel

Menu Goto:

Function code

Text

BACK

Back

Menu Extras:

Function code

Text

FUNCT_F5

Function 1

FUNCT_F6

Function 2

FUNCT_F7

Function 3

FUNCT_F8

Function 4

Menu Environment:

Function code

Text

MENU_1

Menu 1

MENU_2

Menu 2

MENU_3

Menu 3

Standard toolbar

Icon

Function code

Text

SAVE

Save

BACK

Back

EXIT

Exit

CANCEL

Cancel

PRINT

Print

SEARCH

Find

SEARCH+

Find next

PAGE_UP

Previous page

PAGE_DOWN

Next page

BOTTOM

Last page

CANCEL

Cancel

Application toolbar

Position

Function code

Text

1

SELE

2

MARK

3

DELETE

4

FUNCT_F5

Function 1

5

FUNCT_F6

Function 2

function keys

Key

Function code

Text

Icon

F2

SELE

Choose

F9

MARK

Select

Shift+F2

DELETE

Delete

F5

FUNCT_F5

Function 1

F6

FUNCT_F6

Function 2

F7

FUNCT_F7

Function 3

F8

FUNCT_F8

Function 4

All function codes exist as menu entries, but not all of them are assigned to function keys. The function codes in the standard toolbar activate the icons and are automatically assigned to their function keys. Some of the additional function keys are assigned to the application toolbar.

In the module USER_COMMAND_100, the contents of the OK_CODE field are copied to the auxiliary variable SAVE_OK code, and OK_CODE is initialized. You should always do this, since it ensures that the screen field OK_CODE has always been initialized before the PBO event and can therefore not unintentionally contain an incorrect value. The function code of the function chosen by the user is then assigned to the OUTPUT field and displayed in the corresponding screen field (but not if the user chose BACK, EXIT, or CANCEL, in which cases, the program ends).

The function code SELE can be passed to the ABAP program in the following ways:

When you choose Choose in the Edit menu

When you choose the pushbutton in the application toolbar

When you choose the F2 key on the keyboard

When you click the right-hand mouse button and then choose Choose.

When you double-click the screen field OUTPUT

When you enter SELE in the command field and press ENTER.

The other function codes are passed according to their definition, but without the double-click function.

i hope that this helps u about gui status.