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: 

CL_GUI_ALV_GRID Shortcut "Find Function"

hsynylmz32
Explorer
0 Kudos

Hello everyone

How can I assign "CTRL + F" as a shortcut to the "Find" button in "CL_GUI_ALV_GRID".

Thanks for your answers in advance

1 ACCEPTED SOLUTION

hsynylmz32
Explorer

'CTRL + F ' was not assigned as a shortcut key in the 'FIND(SEARCH' button in the standard

toolbar of 'CL_GUI_ALV_GRID' and I actually wanted to ask how to assign it.As a solution,I activated

the 'FIND' button in 'GUI-PF-STATUS' and assigned the shortcut 'CTRL + F' .Then in 'PAI' where it was

triggered,I ran the standard '%SC' in the 'SET_FUNCTION_CODE' method of 'CL_GUL_ALV_GRID'.Sorry in advance for the translation. :).

MODULE user_command_0100 INPUT.

IF sy-ucomm ='FIND'.

DATA(fcode)= CONV syucomm('%SC').


go_grid->set_function_code(CHANGING c_ucomm = fcode).

ENDIF.

ENDMODULE.
9 REPLIES 9

dukejib5
Participant
0 Kudos

CTRL+F is default for "SEARCH" , as far as i know, it can't be used in custom buttons etc.

However, it searches values from your ALV.

Sandra_Rossi
Active Contributor
0 Kudos

As Ctrl+F is part of standard Dynpro GUI Status, maybe you can define it in the GUI Status and call the method FIND of your ALV Grid when it's pressed?

hsynylmz32
Explorer

Thanks For Your Answers Guys....

Sandra Rossi,as you said,enable 'FIND' button in 'GUI' and then in 'PAI'

DATA(fcode) = CONV syucomm( '%SC' ).
go_grid->set_function_code( c_ucomm = CHANGING fcode). 

Sandra_Rossi
Active Contributor
0 Kudos

hsynylmz32 Thanks for the feedback, it was just a guess from me, could you convert your comment into an answer please? (note that the ABAP code you have posted has currently an invalid syntax, so you should fix it; also maybe clarify a little bit, I don't understand very well how your code intercepts Ctrl+F of the GUI Status, and how you run the method FIND = your solution is completely different from the one I was thinking)

hsynylmz32
Explorer
0 Kudos

Hi Sandra Rossi....

'CTRL + F ' was not assigned as a shortcut key in the 'FIND(SEARCH' button in the standard

toolbar of 'CL_GUI_ALV_GRID' and I actually wanted to ask how to assign it.As a solution,I activated

the 'FIND' button in 'GUI-PF-STATUS' and assigned the shortcut 'CTRL + F' .Then in 'PAI' where it was

triggered,I ran the standard '%SC' in the 'SET_FUNCTION_CODE' method of 'CL_GUL_ALV_GRID'.

Sorry in advance for the translation. :).

Sandra_Rossi
Active Contributor

Nice, I understand now, thank you for the clarification. Could you convert your comment into an answer please? (or post an answer with same text if you prefer).

hsynylmz32
Explorer

'CTRL + F ' was not assigned as a shortcut key in the 'FIND(SEARCH' button in the standard

toolbar of 'CL_GUI_ALV_GRID' and I actually wanted to ask how to assign it.As a solution,I activated

the 'FIND' button in 'GUI-PF-STATUS' and assigned the shortcut 'CTRL + F' .Then in 'PAI' where it was

triggered,I ran the standard '%SC' in the 'SET_FUNCTION_CODE' method of 'CL_GUL_ALV_GRID'.Sorry in advance for the translation. :).

MODULE user_command_0100 INPUT.

IF sy-ucomm ='FIND'.

DATA(fcode)= CONV syucomm('%SC').


go_grid->set_function_code(CHANGING c_ucomm = fcode).

ENDIF.

ENDMODULE.

Just adding the code of your original comment (with more context). You may also edit your answer to embed it.

MODULE user_command_0100 INPUT.
  IF sy-ucomm = 'FIND'.
    DATA(fcode) = CONV syucomm( '%SC' ).
    go_grid->set_function_code( CHANGING c_ucomm = fcode). 
  ENDIF.
ENDMODULE.

NB: you may click on Accept on your answer.