Application Development 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: 

Add pushbuttons on the tool bar of selection screen

Former Member
0 Kudos

Hi

I want to add pushbuttons on the selection screen. If i set PF status on at selection-screen output then i have to code for standard buttons also. is there any other way to add pushbuttons.

Regards

Aditya

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You can create up to five pushbuttons in the application toolbar on the selection screen. Function keys are automatically assigned to these pushbuttons. as

SELECTION-SCREEN FUNCTION KEY .

<i> must be between 1 and 5. You must use the FUNCTXT_0<i> components of structure SSCRFIELDS for the individual pushbutton texts. You must declare this structure as an interface work area using the TABLES statement.

Ex..

TABLES SSCRFIELDS.

DATA FLAG.

SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW TITLE TIT.

SELECTION-SCREEN FUNCTION KEY 1.

SELECTION-SCREEN FUNCTION KEY 2.

SELECTION-SCREEN END OF SCREEN 500.

AT SELECTION-SCREEN.

CASE SY-DYNNR.

WHEN '0500'.

IF SSCRFIELDS-UCOMM = 'FC01'.

FLAG = '1'.

ELSEIF SSCRFIELDS-UCOMM = 'FC02'.

FLAG = '2'.

ENDIF.

ENDCASE.

START-OF-SELECTION.

SSCRFIELDS-FUNCTXT_01 = 'Button 1'.

SSCRFIELDS-FUNCTXT_02 = 'Button 2'.

TIT = 'Buttons'.

CALL SELECTION-SCREEN 500 STARTING AT 10 10

ENDING AT 10 11.

IF FLAG = '1'.

WRITE / 'Button 1 was clicked'.

ELSEIF FLAG = '2'.

WRITE / 'Button 2 was clicked'.

ENDIF.

Edited by: swati gupta on Oct 15, 2008 6:56 AM

Edited by: swati gupta on Oct 15, 2008 6:58 AM

8 REPLIES 8

Former Member
0 Kudos

Hi,

If You need pushbuttons on Application Toolbar..you have to go like this only...

In case you need it in a Screen Area ..then you can use

SELECTION SCREEN PUSHBUTTON [/]<pos(len)> <push>

USER-COMMAND <ucom> [MODIF ID <key>].

http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dba81635c111d1829f0000e829fbfe/content.htm

Former Member
0 Kudos

hai,

TABLES sscrfields.

PARAMETERS: p_carrid TYPE s_carr_id,

p_cityfr TYPE s_from_cit.

SELECTION-SCREEN: FUNCTION KEY 1,

FUNCTION KEY 2.

INITIALIZATION.

sscrfields-functxt_01 = 'LH'.

sscrfields-functxt_02 = 'UA'.

AT SELECTION-SCREEN.

CASE sscrfields-ucomm.

WHEN'FC01'.

p_carrid = 'LH'.

p_cityfr = 'Frankfurt'.

WHEN 'FC02'.

p_carrid = 'UA'.

p_cityfr = 'Chicago'.

ENDCASE.

Edited by: shan palani on Oct 15, 2008 10:25 AM

Former Member
0 Kudos

Hi,

You can create up to five pushbuttons in the application toolbar on the selection screen. Function keys are automatically assigned to these pushbuttons. as

SELECTION-SCREEN FUNCTION KEY .

<i> must be between 1 and 5. You must use the FUNCTXT_0<i> components of structure SSCRFIELDS for the individual pushbutton texts. You must declare this structure as an interface work area using the TABLES statement.

Ex..

TABLES SSCRFIELDS.

DATA FLAG.

SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW TITLE TIT.

SELECTION-SCREEN FUNCTION KEY 1.

SELECTION-SCREEN FUNCTION KEY 2.

SELECTION-SCREEN END OF SCREEN 500.

AT SELECTION-SCREEN.

CASE SY-DYNNR.

WHEN '0500'.

IF SSCRFIELDS-UCOMM = 'FC01'.

FLAG = '1'.

ELSEIF SSCRFIELDS-UCOMM = 'FC02'.

FLAG = '2'.

ENDIF.

ENDCASE.

START-OF-SELECTION.

SSCRFIELDS-FUNCTXT_01 = 'Button 1'.

SSCRFIELDS-FUNCTXT_02 = 'Button 2'.

TIT = 'Buttons'.

CALL SELECTION-SCREEN 500 STARTING AT 10 10

ENDING AT 10 11.

IF FLAG = '1'.

WRITE / 'Button 1 was clicked'.

ELSEIF FLAG = '2'.

WRITE / 'Button 2 was clicked'.

ENDIF.

Edited by: swati gupta on Oct 15, 2008 6:56 AM

Edited by: swati gupta on Oct 15, 2008 6:58 AM

Former Member
0 Kudos

Hi,

Just refer the program 'DEMO_SEL_SCREEN_FUNCTION_KEY'.

Regards,

R.Nagarajan.

-


We can -


Former Member
0 Kudos

Hi,

Try in this way once.

1) goto------se51

enter the program name.and give the screen number as 1000 if it is your first selection screen in the program.

2) then open the graphical editor and whatever the buttons u want to add it.

3) write the code under PAI Event for that buttons.

i think it will work.Just try once.

Regards,

Venkat.

Former Member
0 Kudos

Hi Swati

i need to add Icon and text both in pushbutton. Can you tell me how to add it.

Regards

Aditya

0 Kudos

Hi Aditya,

To bring only icons we can do the following

SSCRFIELDS-FUNCTXT_01 = '@20@'.

where '@20@' is the character definition for that icon

Regards

Byju

0 Kudos

Hi,

here you can give only text to pushbutton .

for icon and text you should use pf-status.

The GUI status of a selection screen is generated by the system. The SET PF-STATUS statement in the PBO event of the selection screen has no effect on the standard GUI status. If you want to use your own GUI status for a selection screen or deactivate functions in the standard GUI status in exceptional cases, you can use one of the following function modules in the PBO event of the selection screen:

RS_SET_SELSCREEN_STATUS

Sets another GUI status defined in the same ABAP program, or deactivates functions of the standard GUI status.

RS_EXTERNAL_SELSCREEN_STATUS

Sets a GUI status defined in an external function group. You must use the SET PF-STATUS statement to set the status in a special function module in this function group. You must pass the name of the function module that sets the status as a parameter to the function module RS_EXTERNAL_SELSCREEN_STATUS