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: 

BUTTON ON THE APPLICATION TOOL BAR

Former Member
0 Kudos

HI ALL,

HOW TO ADD AN BUTTON ON THE APPLICATION TOOL BAR IN THE SELECTION SCREEN.

SELECTON SCREEN IS GOT THROUGH SELECT-OPTIONS

THANKS IN ADVANCE

7 REPLIES 7

abdulazeez12
Active Contributor
0 Kudos

SELECTION-SCREEN FUNCTION KEY n [ldb_additions].

Effect:

In the GUI status of the selection screen set by the system, the application toolbar contains five inactive pushbuttons, to which the function codes FC01 to FC05 are assigned. This statement activates the pushbutton of the function code FC0n, whereby a value between 1 and 5 must be entered for n.

To enable use of the pushbuttons, the statement TABLES must be used to declare an interface work area of the structure SSCRFIELDS from the ABAP Dictionary.

If a text is assigned to the component functxt_0n of the interface area sscrfields before the selection screen is called, this text is displayed on the relevant pushbutton. Otherwise, the pushbutton does not contain any text.

When the user chooses a pushbutton in the application toolbar, the runtime environment triggers the event AT SELECTION-SCREEN and the corresponding function code is transferred to the component comm of the interface work area sscrfields.

The additions ldb_additions can only be used in the selection include of a logical database.

Notes:

To assign icons, Quickinfo, and appropriate text to the pushbuttons, a data object can be defined of the structured type SMP_DYNTXT from the ABAP dictionary. The ID of the icon, a quickinfo, and the corresponding text must be assigned to the components of this data object. The content of the whole structure must then be assigned to the component functxt_0n of the interface work area sscrfields.

After the event block after AT SELECTION-SCREEN is processed, the system returns to the display of the selection screen. To exit selection screen processing or to continue by executing the program, the user can only choose Execute or Cancel. Pushbuttons on selection screens can therefore normally be used for dynamic modifications to the selection screen rather than for program control.

If the content of the component ucomm is set to a function code used in the GUI status during selection screen processing, then the selection screen processing is influenced accordingly.

Example:

Activation of two pushbuttons with icons and quick info in the application toolbar (pushbutton toolbar) of the standard selection screen of an executable program. Selecting one of these buttons preassigns different values to the input fields.

REPORT demo_sel_screen_function_key.

TYPE-POOLS icon.

TABLES sscrfields.

DATA functxt TYPE smp_dyntxt.

PARAMETERS: p_carrid TYPE s_carr_id,

p_cityfr TYPE s_from_cit.

SELECTION-SCREEN: FUNCTION KEY 1,

FUNCTION KEY 2.

INITIALIZATION.

functxt-icon_id = icon_ws_plane.

functxt-quickinfo = 'Preselected Carrier'.

functxt-icon_text = 'LH'.

sscrfields-functxt_01 = functxt.

functxt-icon_text = 'UA'.

sscrfields-functxt_02 = functxt.

AT SELECTION-SCREEN.

CASE sscrfields-ucomm.

WHEN 'FC01'.

p_carrid = 'LH'.

p_cityfr = 'Frankfurt'.

WHEN 'FC02'.

p_carrid = 'UA'.

p_cityfr = 'Chicago'.

WHEN OTHERS.

...

ENDCASE.

START-OF-SELECTION.

...

Former Member
0 Kudos

You can use

SELECTION-SCREEN: FUNCTION KEY 1,

FUNCTION KEY 2.

*for buttons on selection screen.

*And you can use it inthe following manner

AT SELECTION-SCREEN .

CASE SSCRFIELDS-UCOMM.

WHEN 'FC01'.

<Code>

WHEN 'FC02'.

<Code>

ENDCASE.

************************************************

Firs add reference to screen fields

TABLES: SSCRFIELDS.

You can activate 1-4 function keys by

SELECTION-SCREEN FUNCTION KEY 1.

Then describe the function keys in LOAD-OF-PROGRAM or INITIALIZATION

DATA smp_dyntxt TYPE smp_dyntxt.

CLEAR smp_dyntxt.

smp_dyntxt-text = text-t01.

smp_dyntxt-icon_id = '@GX@'.

smp_dyntxt-icon_text = text-i01.

smp_dyntxt-quickinfo = text-q01.

smp_dyntxt-path = 'T'.

sscrfields-functxt_01 = smp_dyntxt.

An then you check usage in

AT SELECTION-SCREEN.

CASE SSCRFIELDS-UCOMM.

WHEN 'FC01'.

*********************************************************

chk this

*& Adds buttons to application toolbar of selection screen. *

&----


REPORT zsscrappbut NO STANDARD PAGE HEADING.

TABLES: t030, skat, sscrfields.

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME

TITLE text-001.

SELECT-OPTIONS: p_ktopl FOR t030-ktopl,

p_komok FOR t030-komok,

p_ktosl FOR t030-ktosl.

SELECTION-SCREEN SKIP.

  • Add button to application toolbar

SELECTION-SCREEN FUNCTION KEY 1. "Will have a function code of 'FC01'

SELECTION-SCREEN FUNCTION KEY 2. "Will have a function code of 'FC02'

  • .....

SELECTION-SCREEN END OF BLOCK block1.

************************************************************************

*INITIALIZATION.

INITIALIZATION.

  • Add displayed text string to buttons

MOVE 'Application button' to SSCRFIELDS-FUNCTXT_01.

MOVE 'Excecute report ????' to SSCRFIELDS-FUNCTXT_02.

  • .....

************************************************************************

*AT SELECTION-SCREEN.

AT SELECTION-SCREEN.

if sscrfields-ucomm = 'FC01'.

break-point.

elseif sscrfields-ucomm = 'FC02'.

break-point.

endif.

Former Member
0 Kudos

hi frd

im sending the code use in SE38

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.

START-OF-SELECTION.

WRITE / 'START-OF-SELECTION'.

reward point if its useful ...

pari

Former Member
0 Kudos

Hi

with the use of menu painter you create the button on the tool bar

http://www.sapdevelopment.co.uk/enhance/mod_sapmenu.htm

and after start-of-selection

set pf-status 'status name'.

<b>Reward if usefull<b></b></b>

former_member200338
Active Contributor
0 Kudos

Hi,

You can create a PF status and assign the PF status at initialization event.

Former Member
0 Kudos

Hi

hi..

TABLES sscrfields.

TYPE-POOLS icon.

SELECTION-SCREEN:

BEGIN OF SCREEN 500 AS WINDOW TITLE title,

PUSHBUTTON 2(10) but1 USER-COMMAND cli1,

PUSHBUTTON 12(30) but2 USER-COMMAND cli2

VISIBLE LENGTH 10,

END OF SCREEN 500.

AT SELECTION-SCREEN.

CASE sscrfields.

WHEN 'CLI1'.

...

WHEN 'CLI2'.

...

ENDCASE.

START-OF-SELECTION.

title = 'Push button'.

but1 = 'Button 1'.

CALL FUNCTION 'ICON_CREATE'

EXPORTING

name = icon_information

text = 'Button 2'

info = 'My Quickinfo'

IMPORTING

RESULT = but2

EXCEPTIONS

OTHERS = 0.

CALL SELECTION-SCREEN '0500' STARTING AT 10 10.

check this link

http://www.planetsap.com/howdo_a.htm#PBUTTON

Reward points if useful

Former Member
0 Kudos

HI,

TRY USING SET PF-STATUS 'SURESH1' -> DOUBLE CLICK ON SRESH1 -> IT NAVIGATES YOU TO MENU PAINTER. THER U CREATE WAT BUTTONS YOU WANT.

IF HELPFUL REWARD SOME POINTS.

WITH REGARDS,

SURESH ALURI.