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 gui status button dynamically

Former Member
0 Likes
11,598

hi,

i have a button in gui status called validate.. if i need to change the button name to success how can i do that ... i tried many coding from net ..can anyone help me on dis.. with some useful codes..

regards

kaushik

10 REPLIES 10
Read only

Former Member
0 Likes
6,052

Hi,

For this understand the following example....

In Menu painter, create a function. When asked for the text type, pick 'dynamic' (default is 'static') then press <Green_Tick(TM)>.

This will now open an additional field asking for the placeholder field for the dynamic attributes. Put in a field name (this will then be added by you to the calling ABAP). This field must be of structure SMP_DYNTXT.

In the example below I put in function 'DYN' and fieldname 'DYNAMIC'.

Note, the GUI status will not work with just dynamic functions, so include some statics as well, i.e. 'BACK', 'CANCEL', etc.

 

This example adds a button to the app toolbar. Each time you click it it cycles through another of 5 options. On options 2 & 4 it removes the icon.

You could change the icon if you wanted to.

report zrps .

data: dynamic type smp_dyntxt.

include <icon>.

initialization.

dynamic-text = 'DynOpt1'.

dynamic-icon_id = icon_check.

dynamic-icon_text = dynamic-text.

dynamic-quickinfo = 'Dynamic option 1'.

start-of-selection.

set pf-status 'LIST'.

write: 'List started...'.

at user-command.

if sy-ucomm = 'DYN'.

translate dynamic-text using '1223344551'.

translate dynamic-quickinfo using '1223344551'.

dynamic-icon_text = dynamic-text.

dynamic-icon_id = icon_check.

if dynamic-text ca '24'.

clear dynamic-icon_id.

endif.

endif.

Read only

0 Likes
6,052

hi sudheer,

                i tried all these it does work.

i have a button name validate and i have given name temp . when i press validate button it does all the validation i.e calculation and other stuffs and when all these things are done . i want the button shud appear as confirm.

pls can u write a logic if possible.

regards

kaushik

Read only

0 Likes
6,052

could you post a snapshot of your current screen which is having the buttons, so that i can understand your requirement properly....

Read only

rosenberg_eitan
Active Contributor
6,052

Hi,

You need to define your button as dynamic.

Define as global :

DATA: st_funckey_1 TYPE smp_dyntxt .
DATA: g_status TYPE abap_bool .

In your PBO:

IF g_status EQ abap_true .
    st_funckey_1-icon_id = icon_checked .
    st_funckey_1-text = text-i01 .
    st_funckey_1-icon_text = text-i01 .
  ELSE .
    st_funckey_1-icon_id = icon_incomplete .
    st_funckey_1-text = text-i02 .
    st_funckey_1-icon_text = text-i02 .
  ENDIF .

Result

Read only

0 Likes
6,052

hi eitan,

    what is that abap_b001.. m not able to understand that...

regards

kaushik

Read only

0 Likes
6,052

Hi

Add:

TYPE-POOLS: abap .

It is ABAP_BOOL .

regards.

Read only

0 Likes
6,052

thanks a lot eitan

Read only

0 Likes
6,052

hi eitan,

          what is this icon_check and complete i am getting some error in that.

regards

kaushik

Read only

0 Likes
6,052

pushbutton doesnt show any name it is having ????????

Read only

eyup_aksoy
Explorer
0 Likes
6,052

Hi,

Define two gui status,  and give the name.

You can run wanted.

Example;

In alv :

i_callback_pf_status_set = w_status

if sy-ucomm = 'FIRSTBUTTON'.

w_status = 'FIRSTSTATUS'.


elseif sy-ucomm = 'SECONDBUTTON'.

w_status = 'SECONDSTATUS'.


endif.

or you can write in initilazion.