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

Change Text dynamically on a pushbutton in Module Pool Program

Former Member
0 Likes
2,630

Hello Everyone,

I want to change the pushbutton text dynamically (ie., Button display text) in module pool program depending on the output i get. Can anyone tell me how to do that?

5 REPLIES 5
Read only

Former Member
0 Likes
1,324

Hi,

Please refer the link

Regards,

Dhina..

Read only

MarcinPciak
Active Contributor
0 Likes
1,324

Like this?


TYPE-POOLS icon.

PERFORM set_button USING text-dsp icon_abap pa_disp.
PERFORM set_button USING text-sav icon_system_save pa_save.

FORM set_button USING ip_text
                      ip_icon
             CHANGING cp_button.
  CALL FUNCTION 'ICON_CREATE'
    EXPORTING
      name                  = ip_icon
      text                  = ip_text
    IMPORTING
      RESULT                = cp_button
    EXCEPTIONS
      icon_not_found        = 1
      outputfield_too_short = 2
      OTHERS                = 3.

ENDFORM.                    "set_button

I used it on selection screen for parameter buttons PA_DISP , and PA_SAVE , but I think this should be the same for dialog button. Put this code in PBO.

Regards

Marcin

Read only

rahul_mahajan
Active Participant
0 Likes
1,324

Hi Suruchi,

Please follow below steps :

1) In PF STATUS, define button function code and duoble click.

2) Select a "Dynamic text" option and click OK.

3) It will ask for field name. Give the name, lets say I_FUNCTION_KEY_LINE.Click OK and SAVE activate it.

4) Before calling the screen on which this dynamic button will be coming ; write below code

*Setup the button
  IF  i_function_key_line IS INITIAL.
    i_function_key_line-icon_id = icon_display.
    i_function_key_line-icon_text = 'ABC'.
  ENDIF.

5) Now when user click that button ; Write in PAI below code


  IF  i_function_key_line-icon_text = 'ABC'.
    i_function_key_line-icon_text = 'PQR'.
  ELSE.
    i_function_key_line-icon_text = 'ABC'.
  ENDIF.

I hope this will help you.

You can make necessary changes if required.

Regards,

Rahul Mahajan

Read only

Former Member
0 Likes
1,324

I did it by my own...

Read only

Former Member
0 Likes
1,324

Please check this post, you will definitely get it..

http://theabap.blogspot.in/2013/06/changing-label-of-push-button.html