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

How to create pushbutton with dynamic function?

tomas_balcar4
Explorer
0 Likes
2,563

Hi, all!

I am solving the following problem.

I have a one field and a few buttons (pushbuttons). I need a dynamic buttons. This means - in case I click on a button, the button copy its contents into field directly.

Thx for your help! 😉

1 ACCEPTED SOLUTION
Read only

bertrand_delvallee
Active Participant
0 Likes
2,103

Hello,

You should have a look in SE80 on package SABAPDEMOS. You will find there a lot of useful samples. For example programs DEMO_DYNPRO_PUSH_BUTTON, DEMO_SEL_SCREEN_FUNCTION_KEY or DEMO_SEL_SCREEN_PUSHBUTTON.

On a selection screen you could do something like that :

PARAMETERS p_fill(10).
SELECTION-SCREEN :
BEGIN OF BLOCK b1 WITH FRAME,
   BEGIN OF LINE,
      PUSHBUTTON 2(10) butd USER-COMMAND del1,
      PUSHBUTTON 15(10) but1 USER-COMMAND p1,
      END OF LINE,
      END  OF BLOCK b1.

AT SELECTION-SCREEN.
  CASE sy-ucomm.
    WHEN 'DEL1'.
      CLEAR p_fill.
    WHEN 'P1'.
      CONCATENATE p_fill '1' INTO p_fill.
  ENDCASE.

Best regards

Bertrand

6 REPLIES 6
Read only

Former Member
0 Likes
2,103

Report screen, Dialog or ALV ?

Are yo talking about the buttons text ?

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
2,103

What is the contents of a button?

Read only

tomas_balcar4
Explorer
0 Likes
2,103

Report screen.

Read only

bertrand_delvallee
Active Participant
0 Likes
2,104

Hello,

You should have a look in SE80 on package SABAPDEMOS. You will find there a lot of useful samples. For example programs DEMO_DYNPRO_PUSH_BUTTON, DEMO_SEL_SCREEN_FUNCTION_KEY or DEMO_SEL_SCREEN_PUSHBUTTON.

On a selection screen you could do something like that :

PARAMETERS p_fill(10).
SELECTION-SCREEN :
BEGIN OF BLOCK b1 WITH FRAME,
   BEGIN OF LINE,
      PUSHBUTTON 2(10) butd USER-COMMAND del1,
      PUSHBUTTON 15(10) but1 USER-COMMAND p1,
      END OF LINE,
      END  OF BLOCK b1.

AT SELECTION-SCREEN.
  CASE sy-ucomm.
    WHEN 'DEL1'.
      CLEAR p_fill.
    WHEN 'P1'.
      CONCATENATE p_fill '1' INTO p_fill.
  ENDCASE.

Best regards

Bertrand

Read only

tomas_balcar4
Explorer
0 Likes
2,103

Problem was solved. Thx 😉

Read only

0 Likes
2,103

how did you do it ?!