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

Adding a Button on Selection Screen Tool Bar

Former Member
42,839

I have a selection screen defined as below.

When I execute it, I amgetting the execution button - F8 on top.

On hitting F8, my logic runs.

I want to add an extra button next to this F8.

Any idea?

The code is as below:



REPORT  ZSCD_TEST.

SELECTION-SCREEN BEGIN OF BLOCK promode WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
PARAMETERS : pr_back RADIOBUTTON GROUP mode ,   " Background Processing
             pr_fore RADIOBUTTON GROUP mode .   " Foreground Processing

SELECTION-SCREEN END OF BLOCK promode .


1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
16,883

hi,

check the program

DEMO_SEL_SCREEN_FUNCTION_KEY

thanks.

4 REPLIES 4
Read only

Former Member
0 Likes
16,884

hi,

check the program

DEMO_SEL_SCREEN_FUNCTION_KEY

thanks.

Read only

Former Member
16,883

HI,

Yes it is possible, Please refer the below code, THis code adds 2 pushbutton just after your execute button on selection screen.


TABLES: sscrfields.

DATA: d_butt1(4).

PARAMETERS: p_grpa1(10) MODIF ID A,
p_grpa2(10) MODIF ID A,
p_grpb1(10) MODIF ID B.

SELECTION-SCREEN FUNCTION KEY 1.
SELECTION-SCREEN FUNCTION KEY 2.

INITIALIZATION.
MOVE 'This is button 1' TO sscrfields-functxt_01.
MOVE 'Toggle 1' TO sscrfields-functxt_02.
d_butt1 = 'NO'.

AT SELECTION-SCREEN.
IF sy-ucomm = 'FC01'.
d_butt1 = 'YES'.
sscrfields-ucomm = 'ONLI'.
ELSEIF sy-ucomm = 'FC02'.
IF sscrfields-functxt_02 = 'Toggle 1'.
sscrfields-functxt_02 = 'Toggle 2'.
ELSE.
sscrfields-functxt_02 = 'Toggle 1'.
ENDIF.
ENDIF.

START-OF-SELECTION.
WRITE d_butt1.

Thanks

Saurabh

Read only

Former Member
0 Likes
16,883

Hi

try this code

types: begin of t_tab,
       matnr type mara-matnr,
      end of t_tab.
data: it_tab type STANDARD TABLE OF t_tab,
      wa_tab type t_tab.

select matnr
  from mara
  into table it_tab
  where matnr LIKE 'COMPUTER'.

TABLES: SSCRFIELDS, MARA.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: ONE RADIOBUTTON GROUP GP1 DEFAULT 'X',
            TWO RADIOBUTTON GROUP GP1,
            CHK AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN SKIP 5.
SELECTION-SCREEN PUSHBUTTON 15(10) BUT2 USER-COMMAND ABC.

SELECTION-SCREEN BEGIN OF SCREEN 1100.
 SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
   PARAMETERS: CK AS CHECKBOX .
   SELECT-OPTIONS S_MAT FOR MARA-MATNR NO INTERVALS NO-EXTENSION.
 SELECTION-SCREEN END OF BLOCK B2.

SELECTION-SCREEN PUSHBUTTON 15(10) BUT1 USER-COMMAND DEF.

SELECTION-SCREEN END OF SCREEN 1100.

AT SELECTION-SCREEN OUTPUT.
BUT2 = 'PRESS'.
BUT1 = 'HELLO'.

AT SELECTION-SCREEN.
  CASE SSCRFIELDS.
    WHEN 'ABC'.
CALL SELECTION-SCREEN 1100.
WHEN 'DEF'.
SY-UCOMM = 'F08'.
ENDCASE.

START-OF-SELECTION.
  IF ONE = 'X'.
    WRITE: / 'ITS ONE'.
  ELSEIF TWO = 'X'.
    WRITE: / 'ITS TWO'.
  ENDIF.
  IF CHK = 'X'.
    WRITE:/ 'ITS CHK'.
  ENDIF.
  IF CK = 'X'.
    WRITE:/ 'ITS CK'.
  ENDIF.
select matnr
  from mara
  into table it_tab
  where matnr LIKE 'COMPUTER'.
  LOOP AT IT_TAB INTO WA_TAB.
    WRITE:/ WA_TAB.
  ENDLOOP.

Regards

Anshul

Read only

nikhil_kalawade
Explorer
0 Likes
16,883

Hi,

write SET PF-STATUS <status name> and double click the you will get add button in toolbar option and define Function code for the same

Write event AT USER-COMMAND.


below this event write your logic


CASE SY-UCOMM.

WHEN ' <your defined function code>

     <your logic>

ENDCASE.

Regards,

Nikhil