Application Development 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: 

Howto define own function keys in ALV Grid control in 4.7

0 Kudos

Hi,

I want to use function keys in the ALV coming with SAP 4.7 (Enterprise).

In SAP 4.5 I had defined a new PFKEY STATUS and all available function keys had been visible by a right mouseclick in the grid.

And now I don't know what to do.

Any hints?

Thanks,

Dieter

4 REPLIES 4

Former Member
0 Kudos

By function keys if you mean F1, F2... on the keyboard, I am not really aware how to do that but if you need to just put your own buttons in ALV grid , there is a class CL_ALV_EVENT_TOOLBAR_SET available which would allow you to put buttons in toolbar.

PF-Status as far as I know can be still used with ALV in SAP 4.7 .

In 4.5 did you use function modules to show ALV grid or did you use classes to show an ALV grid ?

Let me know if this was helpful.

Subramanian

0 Kudos

Hi,

have a look for example at the Report RSEIDOC2.

You have global bottons for e.g. refresh and to these a function key is defined n the normal way by set-pf-status 'xxxx' and assignment of the pf-key in the menu painter.

I know how to define buttons in the OO-ALV - as you wrote - via class CL_ALV_EVENT_TOOLBAR_SET:

DATA: ls_toolbar TYPE stb_button.

MOVE 'IDOC' TO ls_toolbar-function.

MOVE icon_idoc TO ls_toolbar-icon.

MOVE text-001 TO ls_toolbar-quickinfo. "IDoc-Anzeige

MOVE text-002 TO ls_toolbar-text. "IDoc

MOVE ' ' TO ls_toolbar-disabled.

APPEND ls_toolbar TO e_object->mt_toolbar.

where e_object is of type CL_ALV_EVENT_TOOLBAR_SET.

But I found no way to assing a function key to the command 'IDOC'.

Hope this makes it more understandable what I want.

Thanks,

Dieter

0 Kudos

I think it is impossible to bind function keys directly to ALV grid, because there's no fkey-press event within ABAP objects context. If there was some kind of dictonary class with such event, it would be easy to capture it by event method. But to my knowledge, there isn't one.

You can workaround this by defining a method FKEY_PRESS (possibly in inheried ALV grid) which would be called from "AT PFn" in main prog. From this method you can raise event USER_COMMAND of ALV grid or whatever.

Kind regards,

Igor Barbaric

former_member183804
Active Contributor
0 Kudos

Hello Dieter,

Transaction SE83 (Reuse Library) contains some samples, e.g


* ALV Grid Control      ( BCALV_GRID_05 .. 8 )
* ALV Tree Context Menu ( BCALV_TREE_03 )
* ALV Tree Menu Bar     ( BCALV_TREE_04 ) 

Kind Regards

Klaus

PS: for context menus you may use CL_CtMenu to access the definition of a old fashioned Gui-Status.