Posted: Mon Mar 17, 2008 12:36 am Post subject: Example of tabs on selection screen
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 *
*---------------------------------------------------------------------*
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.
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.