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: 

GUI Status Function Key doesn't t react

techy
Explorer
0 Kudos

Hello,

i defined in the initialization event a own gui status.

PARAMETERS: p_name TYPE string.

INITIALIZATION.

SET PF-STATUS 'ZMC'.


I defined a function key(F5). If the user clicks on it the it should write 'hello'.  Although one can click on this buttion it doesn't anything. I tried to acces the function with AT PF05 and with

AT USER-COMMAND.

    CASE sy-ucomm.

      WHEN 'TEST' .WRITE 'OK'.

      WHEN OTHERS.

    ENDCASE.


Nothing appears. What did I wrong?

1 ACCEPTED SOLUTION

techy
Explorer
0 Kudos

So it isnt possible to set pf status to to the selection screen? I tried with

'RS_SET_SELSCREEN_STATUS' but the function key doesnt react.

3 REPLIES 3

Former Member
0 Kudos

First of all setting PF-STATUS position is wrong. as it will try to set the PF-STATUS on the selection screen, which you don't want. Set it in START-OF-SELECTION or END-OF-SELECTION. Also make sure you GUI Status is active and you are at least printing something in the screen i order to GUI status to be active,

I tried the following code and it works fine for me.

PARAMETERS: p_name TYPE string.

START-OF-SELECTION.

SET PF-STATUS 'ZMC'.

write 'Hello'.

AT USER-COMMAND.

     CASE sy-ucomm.

       WHEN 'TEST' .WRITE 'OK'.

       WHEN OTHERS.

     ENDCASE.



Output



techy
Explorer
0 Kudos

So it isnt possible to set pf status to to the selection screen? I tried with

'RS_SET_SELSCREEN_STATUS' but the function key doesnt react.

Former Member
0 Kudos

It is possible but not sure what you want to achieve as the Event handling should be done in AT-SELECTION SCREEN event and you have limited option there.

Please see below the code.

SELECTION-SCREEN FUNCTION KEY 5.

PARAMETERS: p_name TYPE string.

data : lt_exclude type TABLE OF mara.

INITIALIZATION.

CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'

   EXPORTING

     p_status        = 'ZMC'

*   P_PROGRAM       = ' '

   tables

     p_exclude       = lt_exclude

           .

AT SELECTION-SCREEN.

   BREAK-POINT.

   if sy-ucomm NE 'TEST'.

     LEAVE PROGRAM.

   else.

     Message s398(00) with 'F5 pressed'.

   endif.