‎2011 Nov 04 11:55 AM
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?
‎2011 Nov 04 12:09 PM
‎2011 Nov 04 12:30 PM
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
‎2011 Nov 04 1:45 PM
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
‎2011 Nov 15 7:31 AM
‎2013 Jun 25 8:13 AM
Please check this post, you will definitely get it..
http://theabap.blogspot.in/2013/06/changing-label-of-push-button.html