06-05-2009 2:31 PM
I created three buttons at selection screen and gave the following code at user-command:
But the execute/create buttons are not working.
Can anyone tell what could be the reason?
REPORT XXXXX
************************************************************************
S E L E C T I O N - S C E E N *
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: SA FOR XXX-SA NO-EXTENSION NO INTERVALS,
SB FOR XXX-SB NO-EXTENSION NO INTERVALS,
SC FOR XXX-SC NO-EXTENSION NO INTERVALS.
SELECTION-SCREEN END OF BLOCK B1.
************************************************************************
INITIALIZATION *
************************************************************************
INITIALIZATION.
SET PF-STATUS C_S.
************************************************************************
AT SELECTION-SCREEN *
************************************************************************
AT SELECTION-SCREEN.
************************************************************************
AT USER-COMMAND *
************************************************************************
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN C_FCODE_CREATE.
PERFORM CREATE.
WHEN C_FCODE_ALL_OBJECTS.
PERFORM show.
WHEN C_FCODE_BACK.
LEAVE PROGRAM.
ENDCASE.
&----
*& Form CREATE
&----
FORM CREATE .
DATA:LT_DYNPREAD LIKE DYNPREAD OCCURS 0 WITH HEADER LINE,
L_CURSORFIELD(30),
L_OK.
GET CURSOR FIELD L_CURSORFIELD.
CASE L_CURSORFIELD.
IF SA IS NOT INITIAL.
PERFORM CREATE1.
ENDIF.
ENDFORM. " CREATE
06-05-2009 2:42 PM
AT USER-COMMAND. is an event processed in LIST, not in SELECTION-SCREEN,
use AT SELECTION-SCREEN.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN c_fcode_create.
PERFORM create.
WHEN c_fcode_all_objects.
PERFORM show.
WHEN c_fcode_back.
LEAVE PROGRAM.
ENDCASE.
Look at [Selection Screen Processing|http://help.sap.com/saphelp_nw04/helpdata/EN/56/1eb6c705ad11d2952f0000e8353423/frameset.htm] and [List Events in an ABAP Program|http://help.sap.com/saphelp_nw04/Helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/frameset.htm]
Regards,
Raymond
06-05-2009 2:36 PM
You need to create a GUI Status to have your own buttons on the Selection Screen.
See the help on the SELECTION-SCREEN FUNCTION KEY n.
Regards,
Naimesh Patel
06-05-2009 2:38 PM
06-05-2009 2:47 PM
Hi,
Check this demo program demo_sel_screen_function_key to have buttons on the Selection screen Application toolbar
06-05-2009 2:41 PM
Hi,
Put a break point at selection-screen event and debug the code.
Find the value of sy-ucomm and chk whether the right function code is contained in sy-ucomm or not.
Also,no need of using AT USER-COMMAND event .The event AT SELECTION-SCREEN itself takes care.
AT SELECTION-SCREEN
CASE SY-UCOMM.
WHEN ' '
UR CODING
ENDCASE
Also check GUI status once whether its activated or not.
Regards,
lakshman.
06-05-2009 2:42 PM
AT USER-COMMAND. is an event processed in LIST, not in SELECTION-SCREEN,
use AT SELECTION-SCREEN.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN c_fcode_create.
PERFORM create.
WHEN c_fcode_all_objects.
PERFORM show.
WHEN c_fcode_back.
LEAVE PROGRAM.
ENDCASE.
Look at [Selection Screen Processing|http://help.sap.com/saphelp_nw04/helpdata/EN/56/1eb6c705ad11d2952f0000e8353423/frameset.htm] and [List Events in an ABAP Program|http://help.sap.com/saphelp_nw04/Helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/frameset.htm]
Regards,
Raymond
06-05-2009 3:09 PM
Hi,
This will not work as the PF_STATUS of selection screen is generated automatically during the generation of the program.
In order to change the PF-STATUS of the selection screen you can use the FM RS_SET_SELSCREEN_STATUS or RS_EXTERNAL_SELSCREEN_STATUS.
However I suggest that for your requirment you can create buttons on the selection screen as follows:-
selection-screen : begin of line.
selection-screen : pushbutton 25(21) y_p_upld user-command load
visible length 25.
selection-screen : end of line.
Incase you want the button on the application toolbar of the selection screen then please use the option
SELECTION-SCREEN FUNCTION KEY n .
On the selection screen toolbar you can assign upto 5 buttons.
These buttons are already present but they are inactive.
You can make them active by
SELECTION-SCREEN: FUNCTION KEY 1,
FUNCTION KEY 2.
Please see the F1 help on selection-screen for more details.
Regards,
Ankur Parab