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

Function Keys on Dynpro

michael_teran
Participant
0 Likes
2,566

Hi,

I have a Dynpro in this Dynpro there's a Button ... I would like to assing a Function Key on that Button for example

If I create a Exit Button . When I press F3 (Function Key) the program should exit .

I hope your help please!!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,565

Hello,

it is pretty easy....

on you screen PBO create an status and asignn the key you would like to your button....

then on your PAI....write exit program when sy.ucomm = 'your key'

on your screen process....

PROCESS BEFORE OUTPUT.

MODULE status_0100. -> write this and double click

*

PROCESS AFTER INPUT.

MODULE user_command_0100. -> write this and double click

MODULE status_0100 OUTPUT.

SET PF-STATUS 'STAT'. ->write this and double click AND CREATE THE BUTTON

SET TITLEBAR 'CALC'.

ENDMODULE. " STATUS_0100 OUTPUT

MODULE user_command_0100 INPUT.

CASE sy-ucomm.

WHEN 'SAVE'.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

WHEN OTHERS.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

CHEERS BYE!!

7 REPLIES 7
Read only

Former Member
0 Likes
1,566

Hello,

it is pretty easy....

on you screen PBO create an status and asignn the key you would like to your button....

then on your PAI....write exit program when sy.ucomm = 'your key'

on your screen process....

PROCESS BEFORE OUTPUT.

MODULE status_0100. -> write this and double click

*

PROCESS AFTER INPUT.

MODULE user_command_0100. -> write this and double click

MODULE status_0100 OUTPUT.

SET PF-STATUS 'STAT'. ->write this and double click AND CREATE THE BUTTON

SET TITLEBAR 'CALC'.

ENDMODULE. " STATUS_0100 OUTPUT

MODULE user_command_0100 INPUT.

CASE sy-ucomm.

WHEN 'SAVE'.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

WHEN OTHERS.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

CHEERS BYE!!

Read only

Former Member
0 Likes
1,564

Hi ,

You can try this code in Module user_command_<screen_no> of PAI -


MODULE user_command_0100 INPUT.
  CASE sy-ucomm.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0 .
    when 'F_code'
.............................
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

Regards

Pinaki

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,564

Hi,

When you build a dialog program and set a pf-status (which take F3 for BACK functionality by defualt ).

So you can assign any other function key as the shortcut key.

We genrally use AT EXIT COMMAND for buttons with function type E coz if user wishes to exit the application without entering value for mandatory fields.

So suppose that you create a button 'EXIT' with finction code '&EXT' and function type 'E'.

Now use code:-


PROCESS AFTER INPUT.
  MODULE zexit AT EXIT COMMAND.

In PAI:-


MODULE zexit.
  CASE sy-ucomm.
    WHEN '&EXT'.
      LEAVE PROGRAM.
  ENDCASE.
ENDMODULE.

Now when you press this shorcut, simply the above code will be executed and program will be terminated.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Edited by: Tarun Gambhir on Feb 12, 2009 10:06 AM

Read only

Former Member
0 Likes
1,564

Hi,

Try the following logic.

PROCESS BEFORE OUTPUT.

 MODULE STATUS_0500.

On double clicking you will get something like this.

module STATUS_0500 output.
  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.

endmodule.                 " STATUS_0500  OUTPUT

On double clicking the 'xxxxx' , you will be taken to manu painter. There you can assign the toolbar of your choice. Save and activate it.

In your PAI,

case sy-ucomm.

when 'EXIT'. "name given by you

  LEAVE PROGRAM.
endcase.

Hope this helps.

Regards,

Deepthi.

Edited by: Deepthi S on Feb 12, 2009 10:16 AM

Read only

michael_teran
Participant
0 Likes
1,564

Thanks, But my problem is : i have to create a button inside the dynpro , NOT IN STATUS BAR, after that I can't use the mouse for that reasen I have to press a F-key to activate the button for example

My Dynpro

-


Status BAR

-



EXIT F3


-


Exit F3 is the button which It works when I press F3-key. so that i want to assign F3-key with my button

Read only

michael_teran
Participant
0 Likes
1,564

Another thing! When I Said Assign F3-key for exit button ... It was an example .... I want to know a general way to make a relation between a Function Key and A button which It was created inside the dynpro.

Thanks for all

Read only

0 Likes
1,564

In the button attributes, assign "EXIT" user command value (in the PAI, you'll test it with IF sy-ucomm = 'EXIT'). In the gui status, assign EXIT to keyboard function key F3.