Posted: Sun Nov 04, 2007 4:51 pm Post subject: Using Subscreens on Report Selection Screens
Using Subscreens on Report Selection Screens
This report shows an example of how to have a tabbed selection screen as part of your report selection screen. This is done using subscreens, and is only available in the 4.X series (I have only tested it on 4.6 systems).
This example is the start of a BDC program, and separates the different selection criteria onto different pages.
Code:
report tabbed_sel_screen.
*-- Definitions to hold user command for subscreens
data:
ucomm1 like sy-ucomm,
ucomm2 like sy-ucomm,
ucomm3 like sy-ucomm.
*-- Macro to put checkbox on selection screen
*-- &1 - checbox parameter name
*-- &2 - text element (description)
*-- &3 - default value for checkbox
define make_checkbox.
selection-screen begin of line.
parameters: &1 as checkbox default &3.
selection-screen comment 3(60) &2.
selection-screen end of line.
end-of-definition.
*-- Macro to put radiobutton on selection screen
*-- &1 - radiobutton parameter name
*-- &2 - text element (description)
*-- &3 - radiobutton group
define make_radiobutton.
selection-screen begin of line.
parameters: &1 radiobutton group &3.
selection-screen comment 3(60) &2.
selection-screen end of line.
end-of-definition.
*-- Macro to put a parameter on selection screen
*-- &1 - parameter name
*-- &2 - text element (description)
*-- &3 - like data element
*-- &4 - default value
define make_parameter.
selection-screen begin of line.
selection-screen comment 1(30) &2.
selection-screen position pos_low.
parameters: &1 like &3 default &4.
selection-screen end of line.
end-of-definition.
*-- Macro to put a dropdown listbox on selection screen
*-- &1 - parameter name
*-- &2 - length of listbox
*-- &3 - default value
*-- &4 - text element (description)
define make_dropdown.
selection-screen begin of line.
selection-screen comment 1(30) &4.
selection-screen position pos_low.
parameters: &1 as listbox visible length &2 default &3 obligatory.
selection-screen end of line.
end-of-definition.
*-- Define subscreen for upload options
selection-screen begin of screen 1100 as subscreen.
selection-screen begin of block file_options with frame.
make_parameter p_filein fil_desc rlgrap-filename '/filename.txt'.
make_radiobutton rb_unix unx_desc src.
make_radiobutton rb_local dos_desc src.
make_parameter p_filety typ_desc rlgrap-filetype 'DAT'.
selection-screen end of block file_options.
selection-screen end of screen 1100.
*-- Define subscreen for BDC/CT Processing Options
selection-screen begin of screen 1200 as subscreen.
selection-screen begin of block bdc_options with frame.
make_radiobutton rb_callt ctr_desc typ.
make_radiobutton rb_bdc bdc_desc typ.
make_dropdown p_mode(1) 30 'N' mod_desc.
make_dropdown p_uptyp(1) 30 'S' upd_desc.
selection-screen end of block bdc_options.
selection-screen end of screen 1200.
*-- Define subscreen for Output Options
selection-screen begin of screen 1300 as subscreen.
selection-screen begin of block output_opts with frame.
make_checkbox c_detail det_desc ' '.
make_checkbox c_error err_desc 'X'.
make_checkbox c_stats sta_desc 'X'.
selection-screen end of block output_opts.
selection-screen end of screen 1300.
*-- Define Main Selection screen that will incorporate the subscreens
selection-screen begin of tabbed block tabs for 10 lines.
selection-screen tab (15) tabs1 user-command ucomm1
default screen 1100.
selection-screen tab (30) tabs2 user-command ucomm2
default screen 1200.
selection-screen tab (15) tabs3 user-command ucomm3
default screen 1300.
selection-screen end of block tabs.
*-- Fill the dropdown list boxes before displaying them
at selection-screen output.
perform fill_dropdown_list using 'P_MODE'.
perform fill_dropdown_list using 'P_UPTYP'.
at selection-screen on value-request for p_filein.
perform choose_filename using p_filein
changing p_filein.
initialization.
tabs1 = 'Upload Options'.
tabs2 = 'BDC/Call Transaction Options'.
tabs3 = 'Output Options'.
*-- Setup descriptions for Selection Screen items
err_desc = 'Show Errors (Call Transaction Only)'.
det_desc = 'Show details on records being processed'.
sta_desc = 'Show statistics on what has been processed'.
unx_desc = 'File is on App Server (unix)'.
dos_desc = 'File is on Presentation Server (pc)'.
typ_desc = 'File Type'..
fil_desc = 'Name of File'.
ctr_desc = 'Process in Call Transaction Mode'.
bdc_desc = 'Process in BDC Mode'.
mod_desc = 'Transaction Processing Mode'.
upd_desc = 'Update Type'.
start-of-selection.
*-- Open input file or Read data from database tables
end-of-selection.
*-- Loop at data, and create BDC/Call Transactions
*---------------------------------------------------------------------*
* FORM fill_dropdown_list *
*---------------------------------------------------------------------*
* Populate the dropdown list for the parameter provided *
*---------------------------------------------------------------------*
* --> VALUE(F_PARAMETER) *
*---------------------------------------------------------------------*
form fill_dropdown_list using value(f_parameter).
type-pools: vrm. " For parameter drop down lists
*-- Definitions for parameter drop down lists
data:
name type vrm_id,
list type vrm_values,
value like line of list.
name = f_parameter.
case f_parameter.
when 'P_MODE'.
value-key = 'N'. value-text = 'Do not display any screens'.
append value to list.
value-key = 'A'. value-text = 'Display ALL screens'.
append value to list.
value-key = 'E'. value-text = 'Only display screens in error'.
append value to list.
when 'P_UPTYP'.
value-key = 'S'. value-text = 'Update in Synchronous Mode'.
append value to list.
value-key = 'A'. value-text = 'Update in Asynchronous Mode'.
append value to list.
when others.
endcase.
call function 'VRM_SET_VALUES'
exporting
id = name
values = list.
endform." fill_dropdown_list
*---------------------------------------------------------------------*
* FORM choose_filename *
*---------------------------------------------------------------------*
* Select a filename. Only provied if a local file is selected *
* as the source of the input file. A *
* custom function or routine could be *
* written to provide the same functionality *
* for unix. *
*---------------------------------------------------------------------*
* --> F_FILENAME_IN *
* <F_FILENAME_OUT> F_REPID *
* --> F_DYNNR *
* --> VALUE(F_FIELDNAME_IN) *
* <-- F_FIELDNAME_OUT *
* <F_FIELDVALUE> F_FILENAME_OUT *
* --> DATA *
* --> : *
* --> L_FILENAME *
*---------------------------------------------------------------------*
form query_local_filename changing f_filename_out like rlgrap-filename.
data: l_filename like rlgrap-filename.
data: l_mask(80) type c.
* Build Filter
l_mask =
',All Files (*.*),*.*.'.
call function 'WS_FILENAME_GET'
exporting
def_filename = f_filename_out
def_path = 'c:\'
mask = l_mask
* mode = O or S
title = 'Choose input file'
importing
filename = l_filename
exceptions
inv_winsys = 01
no_batch = 02
selection_cancel = 03
selection_error = 04.
if sy-subrc = 0.
f_filename_out = l_filename.
endif.
endform.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.