Home Sample Code ABAP Reports Using Subscreens on Report Selection Screens
|
|
|
|
Using Subscreens on Report Selection Screens |
|
|
|
|
Written by Anon.
|
|
Wednesday, 31 January 2007 |
|
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.
Source Code Listing 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 * *---------------------------------------------------------------------* form choose_filename using f_filename_in changing f_filename_out. data: lc_fieldname like dynpread-fieldname, lc_fieldvalue like dynpread-fieldvalue. *-- Get the value of p_local perform read_value_from_screen using sy-repid sy-dynnr 'RB_LOCAL' changing lc_fieldname lc_fieldvalue. if lc_fieldvalue = 'X'. " User chose a local file perform query_local_filename changing f_filename_out. endif.
endform." get_filename *---------------------------------------------------------------------* * FORM READ_VALUE_FROM_SCREEN * *---------------------------------------------------------------------* * ........ * *---------------------------------------------------------------------* * --> F_REPID * * --> F_DYNNR * * --> VALUE(F_FIELDNAME_IN) * * <-- F_FIELDNAME_OUT * * <-- F_FIELDVALUE * *---------------------------------------------------------------------* form read_value_from_screen using f_repid f_dynnr value(f_fieldname_in) changing f_fieldname_out f_fieldvalue. data: ltab_fields like dynpread occurs 0 with header line. data: lc_dyname like sy-repid. data: lc_dynumb like sy-dynnr. data: lc_dummy(1) type c. *-- Read the screen to see if the user has entered a value for WERKS ltab_fields-fieldname = f_fieldname_in. append ltab_fields. lc_dyname = f_repid. lc_dynumb = f_dynnr. call function 'DYNP_VALUES_READ' exporting dyname = lc_dyname dynumb = lc_dynumb tables dynpfields = ltab_fields exceptions others = 01. read table ltab_fields index 1. *-- Return the value from the screen if sy-subrc eq 0. split ltab_fields-fieldname at '-' into lc_dummy f_fieldname_out. f_fieldvalue = ltab_fields-fieldvalue. endif. endform. *---------------------------------------------------------------------* * FORM query_filename * *---------------------------------------------------------------------* * ........ * *---------------------------------------------------------------------* * --> 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.
Related Items:
|
|