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 enable/disable button on application tool based on some condition

bikash_bansal
Product and Topic Expert
Product and Topic Expert
0 Likes
4,464

Hi,

I added an item to the application tool bar.

Its like a button which is displayed when the screen is called.

Now i want to enable and disable the button(item) based on some condition.

How to do that ???

Regards,

Bikash.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,450

hi

you didnt specified report / module pool...

to enable/disable buttons on the application tool bar, use SET PF-STATUS.

Syntax

SET PF-STATUS status [OF PROGRAM prog] [EXCLUDING fcode].

at the starting of the program u might have specified a pf status.

say if u clik on a icon/button to disable it.. if its in the same program.

use command like

set pf-status 'ZSTATUS' excluding 'FCODE'.

if ur using PF status of some other program. specify the [OF PROGRAM prog]

set pf-status 'ZSTATUS' OF PROGRAM 'ZPRG' excluding 'FCODE'.

thanks

6 REPLIES 6
Read only

JozsefSzikszai
Active Contributor
0 Likes
2,450

hi Bikash,

you should do something like this:

IF condition is true

LOOP AT screen.

IF screen-name EQ button.

screen-active = 0.

MODIFY screen.

ENDIF.

ENDLOOP.

ENDIF.

hope this helps

ec

Read only

Former Member
0 Likes
2,450

to disable buttons in tool bar, check out option 'EXCLUDING' for ABAP command SET PF-STATUS.

If in a report, you can do something like:

SET PF-STATUS 'BASIC' EXCLUDING 'PICK' IMMEDIATELY.

In a dynpro screen:

DATA fcode TYPE TABLE OF sy-ucomm.

...

MODULE status_0100 OUTPUT. 
  APPEND 'CHANGE'  TO fcode. 
  APPEND 'SAVE' TO fcode. 
  SET PF-STATUS 'STATUS_0100' EXCLUDING fcode. 
ENDMODULE.

Andrew

Read only

Former Member
0 Likes
2,451

hi

you didnt specified report / module pool...

to enable/disable buttons on the application tool bar, use SET PF-STATUS.

Syntax

SET PF-STATUS status [OF PROGRAM prog] [EXCLUDING fcode].

at the starting of the program u might have specified a pf status.

say if u clik on a icon/button to disable it.. if its in the same program.

use command like

set pf-status 'ZSTATUS' excluding 'FCODE'.

if ur using PF status of some other program. specify the [OF PROGRAM prog]

set pf-status 'ZSTATUS' OF PROGRAM 'ZPRG' excluding 'FCODE'.

thanks

Read only

bikash_bansal
Product and Topic Expert
Product and Topic Expert
0 Likes
2,450

Hi,

Using excluding is making it invisible. Its disappearing altogether.

I want it to be seen but being disabled.

My exact use case is :

I have a tree displayed and a action_button on the toolbar.

Whenever the root of the tree is selected i want to disable the action_button

and when a child of the tree is selected the action should be disabled.

How i added this button on the toolbar is :

module STATUS_0200 output.

SET PF-STATUS 'STATUS_0200' .

SET TITLEBAR 'TITLE_0200'.

endmodule.

After double clicking on 'STATUS_0200' i added a button on application tool bar.

Read only

sharat_chandra
Product and Topic Expert
Product and Topic Expert
0 Likes
2,450

Hi,

You need to use a standard setting which specifies if you want to make visible a disabled button. Do as below :

In the GUI status screen, goto the the menu " GOTO"-> "ATTRIBUTES" ->"PUSHBUTTON ASSIGNMENT". In that you find the choices for disabled buttons: You need to choose "Display All".

Doing this, you will be able to see the disabled buttons also in an inactive state which are otherwise invisible.

Regards,

Sharat

Read only

cesarscheck
Participant
0 Likes
2,450

This message was moderated.