SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Tabed selection screen



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Sep 13, 2008 6:00 pm    Post subject: Tabed selection screen Reply with quote

Code:
REPORT ztabbed_sel_screen
       NO STANDARD PAGE HEADING
       MESSAGE-ID zbdc
       LINE-SIZE 150
       LINE-COUNT 60(3).

*--USING SUBSCREENS ON REPORT SELECTION 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.                    "read_value_from_screen
*---------------------------------------------------------------------*
*       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.                    "query_local_filename
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
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.