‎2009 Jan 06 10:02 AM
Hi,
I used function keys in one of my report program.
Now, if some check box is checked in the customization that function should be displayed, otherwise shouldnot be displayed.
I made use of "loop at screen" to make that application button invisible but i don't know the name of the button. I have given the name as same given while creating the button using "SSCRFIELDS".
Is there anyy other way to disable the button??
Regards,
Yadesh
‎2009 Jan 06 10:37 AM
hi,
i want to disable or inactive the application toolbar button not the button the selection screen depending on the customization....
i am not using any pf-status for that selection screen.
thanks
Yadesh
‎2009 Jan 06 10:05 AM
‎2009 Jan 06 10:20 AM
Hi,
Please refer this below program
report demo_sel_screen_pushbutton.
tables sscrfields.
data flag(1) type c.
selection-screen:
begin of screen 500 as window title tit,
begin of line,
pushbutton 2(10) but1 user-command cli1,
pushbutton 12(10) text-020 user-command cli2,
end of line,
begin of line,
pushbutton 2(10) but3 user-command cli3,
pushbutton 12(10) text-040 user-command cli4,
end of line,
end of screen 500.
at selection-screen.
message i888(sabapdocu) with text-001 sscrfields-ucomm.
case sscrfields-ucomm.
when 'CLI1'.
flag = '1'.
when 'CLI2'.
flag = '2'.
when 'CLI3'.
flag = '3'.
when 'CLI4'.
flag = '4'.
endcase.
start-of-selection.
tit = 'Four Buttons'.
but1 = 'Button 1'.
but3 = 'Button 3'.
call selection-screen 500 starting at 10 10.
case flag.
when '1'.
write / 'Button 1 was clicked'.
when '2'.
write / 'Button 2 was clicked'.
when '3'.
write / 'Button 3 was clicked'.
when '4'.
write / 'Button 4 was clicked'.
when others.
write / 'No Button was clicked'.
endcase.
Regards,
Jyothi CH.
Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 4:00 PM
‎2009 Jan 06 10:25 AM
Hi,
U would have given the name of the push botton whilw declaring right.
Just use that name.
Please revert if u have any doubts.
Cheers,
Kk.
‎2009 Jan 06 10:28 AM
Hi,
Just click F1 on that button and go to its technical settings, I hope you may get the function codes there or you can check GUI status for that selection screen by the menu button->system.
Regards,
Ameet
‎2009 Jan 06 10:29 AM
HI.
Refer this link.
http://diocio.wordpress.com/2007/02/12/sap-add-buttons-to-selection-screen/
Regards.
Jay
‎2009 Jan 06 10:31 AM
hi,
i am not using a button on the selection screen...
i am using the button on the application toolbar of a selection screen without using any PF-status on the selection screen.
SELECTION-SCREEN: FUNCTION KEY 1,
FUNCTION KEY 2.
‎2009 Jan 06 10:37 AM
hi,
i want to disable or inactive the application toolbar button not the button the selection screen depending on the customization....
i am not using any pf-status for that selection screen.
thanks
Yadesh
‎2009 Jan 06 11:34 AM
Hi,
Your requirement can be solved with two approaches:
1) simpler one is to use different GUI statuses depending on checkbox state
AT SELECTION-SCREEN OUTPUT.
refresh it_exclude.
if checkbox = 'X'.
append 'BUTTON_FCODE'.
endif.
"you in turn swith on/off your desired button
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = 'GUI_STATUS'
p_program = sy-repid
TABLES
p_exclude = it_exclude.
2) as SELECTION-SCREEN FUNCTION KEY n statement cannot be processed within PAI/PBO block you cannot set it dynamically like
AT SELECTION-SCREEN.
IF check = 'X' .
SELECTION-SCREEN FUNCTION KEY n.
ELSE.
"no selection button here
ENDIF.
Moreover you cannot change standard application toolbar of selection screen within Loop at screen statement (this will only affect selection screen parameters not toolbar).
The only way here is dynamically generate report's code. When checkbox is check what you do is
data: it_code type table of char72 with header line.
READ REPORT sy-repid INTO it_code.
Then looping through the code table you either remove entry having SELECTION-SCREEN FUNCTION KEY n. or add it to the table.
Finally you switch reports code with
INSERT REPORT sy-repid FROM it_code.
And execute new one with
SUBMIT (sy-repid).
This will ensure that new SELECTION-SCREEN parameters (or function keys in your case can be switched and report will be executed with new screen look).
Nevetherless be carefull! You need to ensure that submit will not create and endless loop. ABAP Memory will help you here (exchange flags within program indicating whether program is executed for the first time or another one).
Hope this will give you some idea how to solve it.
Regards
Marcin
‎2009 Jan 07 7:48 AM