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: 

Adding a button in selection screen of report ?

Former Member
0 Kudos

Hi,

My requirement is to add a Push Button to the selection screen of a report program.

The button has to be position near the 'Variant' button which is already present.

How to do this.

Regards.

5 REPLIES 5

naimesh_patel
Active Contributor
0 Kudos

Check help on SELECTION-SCREEN FUNCTION KEY.

Regards,

Naimesh Patel

former_member181966
Active Contributor
0 Kudos

FYI

 

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. 
  ... 

^Saquib

0 Kudos

Another way is to create a pf-status of your own, where you can insert your button(s). However, this way you will have to reinsert all the buttons/function codes of all the standard buttons you need.

It's easy but will give you a 10 munites of work. Only have to see any standard pf-status and copy buttons and ok_codes. Example: F8 button must have 'ONLI' ok_code.

Regards.

Valter Oliveira.

0 Kudos

Valter,

I think this would be a preferred approach.

Could you give me any particular example.

I dont really know how to set pf status and stuff.

0 Kudos

First of all, in initialization event, declare your own status like:


INITIALIZATION.
  SET PF-STATUS '0100'. "for example - nº doesn't matter

After that, declare the function codes, in at selection screen event, like:


AT SELECTION-SCREEN.
CASE sy-ucomm.
*** When user press your button
  WHEN 'YOUR_BUTTON_OK_CODE'. "use a small name
*   ... since you respect other okcodes, don't need to code them
*** When user press those standard buttons
  WHEN 'BACK' OR 'CANCEL' OR 'RETURN'.
    LEAVE PROGRAM.
ENDCASE.

And for your report that's it!!! (again, if in your status you respect all the other status names like F8, PRINT, etc etc ...)

Now, just need to create the status:

1 - double click '0100' of PF-STATUS instruction

2 - in the status, button bar, insert your button (write it's ok_code - 'YOUR_BUTTON_OK_CODE', choose a icon) and F8 button too (don't forget this!), ok_code ONLI and icon ICON_EXECUTE_OBJECT.

3 - In the function keys, insert BACK, RETURN, CANCEL and PRINT in respective icon places.

It's simpler than it looks!

Regards,

Valter Oliveira.