表维护工具

来源:互联网 发布:关键词排列组合软件 编辑:程序博客网 时间:2024/05/01 22:04
FUNCTION Z_SE16N_INTERFACE.
*"--------------------------------------------------------------------
*"*"局部接口:
*"  IMPORTING
*"     VALUE(I_TAB) TYPE  SE16N_TAB
*"     VALUE(I_EDIT) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_SAPEDIT) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_NO_TXT) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_MAX_LINES) TYPE  SYTABIX DEFAULT 500
*"     VALUE(I_LINE_DET) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_DISPLAY) TYPE  CHAR1 DEFAULT 'X'
*"     VALUE(I_CLNT_SPEZ) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_CLNT_DEP) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_VARIANT) TYPE  SLIS_VARI DEFAULT ' '
*"     VALUE(I_OLD_ALV) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_CHECKKEY) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_TECH_NAMES) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_CWIDTH_OPT_OFF) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_SCROLL) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_NO_CONVEXIT) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_LAYOUT_GET) TYPE  CHAR1 DEFAULT ' '
*"     VALUE(I_ADD_FIELD) TYPE  CHAR40 OPTIONAL
*"     VALUE(I_ADD_FIELDS_ON) TYPE  CHAR1 OPTIONAL
*"     VALUE(I_UNAME) TYPE  SY-UNAME OPTIONAL
*"     VALUE(I_HANA_ACTIVE) TYPE  CHAR1 DEFAULT SPACE
*"     VALUE(I_DBCON) TYPE  DBCON_NAME DEFAULT SPACE
*"     VALUE(I_OJKEY) TYPE  TSWAPPL DEFAULT SPACE
*"     VALUE(I_DISPLAY_ALL) TYPE  CHAR1 DEFAULT ' '
*"  EXPORTING
*"     VALUE(E_LINE_NR) TYPE  SYTABIX
*"     VALUE(E_DREF)
*"     VALUE(ET_FIELDCAT) TYPE  LVC_T_FCAT
*"  TABLES
*"      IT_SELFIELDS STRUCTURE  SE16N_SELTAB OPTIONAL
*"      IT_OUTPUT_FIELDS STRUCTURE  SE16N_OUTPUT OPTIONAL
*"      IT_OR_SELFIELDS TYPE  SE16N_OR_T OPTIONAL
*"      IT_CALLBACK_EVENTS TYPE  SE16N_EVENTS OPTIONAL
*"      IT_ADD_UP_CURR_FIELDS STRUCTURE  SE16N_OUTPUT OPTIONAL
*"      IT_ADD_UP_QUAN_FIELDS STRUCTURE  SE16N_OUTPUT OPTIONAL
*"      IT_SUM_UP_FIELDS STRUCTURE  SE16N_OUTPUT OPTIONAL
*"      IT_GROUP_BY_FIELDS STRUCTURE  SE16N_OUTPUT OPTIONAL
*"      IT_ORDER_BY_FIELDS STRUCTURE  SE16N_OUTPUT OPTIONAL
*"      IT_AGGREGATE_FIELDS STRUCTURE  SE16N_SELTAB OPTIONAL
*"      IT_TOPLOW_FIELDS STRUCTURE  SE16N_SELTAB OPTIONAL
*"      IT_SORTORDER_FIELDS STRUCTURE  SE16N_SELTAB OPTIONAL
*"  CHANGING
*"     VALUE(IT_AND_SELFIELDS) TYPE  SE16N_AND_T OPTIONAL
*"  EXCEPTIONS
*"      NO_VALUES
*"--------------------------------------------------------------------
datalt_where   type se16n_where_132 occurs with header line.
datald_subrc   like sy-subrc.
datald_txt_tab type DD08V-TABNAME.
datald_partial(1).
datald_tabclass like dd02l-tabclass.
datald_no_txt(1).

*..If only line number -> no texts
   ld_no_txt i_no_txt.
   if i_line_det true.
      ld_no_txt true.
   endif.
   gd-no_txt i_no_txt.

   if i_hana_active             true    or
      i_dbcon                  <> space   or
      not it_sum_up_fields[]   is initial or
      not it_group_by_fields[] is initial.
      cleari_editi_sapedit.
   endif.

*..In batch or extern call, these are not filled before
   gd-tab         i_tab.
   gd-max_lines   i_max_lines.
   gd-variant     i_variant.
   gd-edit        i_edit.
   gd-sapedit     i_sapedit.
   gd-checkkey    i_checkkey.
   gd-scroll      i_scroll.
   gd-no_convexit i_no_convexit.
   gd-layout_get  i_layout_get.
   gd-add_field   i_add_field.
   gd-add_fields_on i_add_fields_on.
   gd-dbcon         i_dbcon.
   gd-ojkey         i_ojkey.
   gd-tech_names    i_tech_names.
   gd-no_txt        i_no_txt.
   gd-clnt_spez     i_clnt_spez.
   gd-clnt_dep      i_clnt_dep.
   if i_uname space.
      gd-uname sy-uname.
   else.
      gd-uname i_uname.
   endif.

*..set data aging temperature
   perform set_temperature.

*..fill global event table
   refreshgt_callback_events.
   gt_callback_events[] it_callback_events[].
*.........................................................
   select from se16n_exit into table gt_cb_events
               where tab gd-tab.
*..special logic for some events, because of *-entries
   perform read_exit_data using c_event_add_fields.
*..be compatible to new exit logic
*..caller can either hand over it_callback_events
*..or table SE16N_EXIT is permanently filled with exit
*.........................................................
   loop at gt_callback_events into gs_callback_events.
      move-corresponding gs_callback_events to gs_cb_events.
      gs_cb_events-tab i_tab.
      append gs_cb_events to gt_cb_events.
   endloop.

*..fill global add-up tables
   refreshgt_add_up_curr_fields.
   gt_add_up_curr_fields[] it_add_up_curr_fields[].
   refreshgt_add_up_quan_fields.
   gt_add_up_quan_fields[] it_add_up_quan_fields[].

*..Hana-mode tables
   refreshgt_sum_up_fields.
   gt_sum_up_fields[] it_sum_up_fields[].
*..map grouping order according sequence
   perform map_grouping_order tables it_group_by_fields
                                     it_sortorder_fields.
   refreshgt_group_by_fields.
   gt_group_by_fields[] it_group_by_fields[].
*..map sort order on sort table
   perform map_sort_order tables it_order_by_fields
                                 it_sortorder_fields.
   refreshgt_order_by_fields.
   gt_order_by_fields[] it_order_by_fields[].
   refreshgt_toplow_fields.
   gt_toplow_fields[] it_toplow_fields[].
   refreshgt_sortorder_fields.
   gt_sortorder_fields[] it_sortorder_fields[].
   refreshgt_aggregate_fields.
   gt_aggregate_fields[] it_aggregate_fields[].
   refreshgt_or_selfields.
   gt_or_selfields[] it_or_selfields[].
   refreshgt_and_selfields.
   gt_and_selfields[] it_and_selfields[].
   refreshgt_navigation.
   gd_curr_level 1.

*..check if table is a pool-table
   select single tabclass from dd02l into ld_tabclass
                     where tabname i_tab.
   if sy-subrc and
      ld_tabclass 'POOL'.
      gd-pool true.
   else.
      clear gd-pool.
   endif.

*..If back to first screen, delete all modifcations
   cleargt_mod.
   refreshgt_mod.

*..Check the authority of the user
*   perform authority_check using    i_tab
*                                    'F'
*                           changing i_edit.

*..First get time for display of runtime
   perform get_time changing gd-start_time
                             gd-start_date.

*..Check if there is a corresponding text table
   perform get_text_table using    i_tab
                          changing ld_txt_tab.
   gd-txt_tab ld_txt_tab.

*..runtime analysis
   perform progress using '1'.

*..Now create a fieldcatalog of the table I have to display. After this
*..GT_FIELDCAT is filled and <ALL_TABLE> is created and defined
   perform create_fieldcat_standard tables   it_output_fields
                                    using    i_tab
                                             i_edit
                                             i_tech_names
                                             ld_no_txt
                                             i_clnt_spez
                                             i_clnt_dep
                                             ld_txt_tab.

*..delete adjacent duplicates out of selection table
   perform delete_duplicates tables it_or_selfields.

*..runtime analysis
   perform progress using '2'.

*..find out if too many selection criteria are used
*..if so, do the partial select
   clear ld_partial.
*..Check if no multi select took place.
*..Then no partial select is possible.
   describe table it_or_selfields lines sy-tabix.
   if sy-tabix 1.
      gt_or[] it_or_selfields[].
      perform scan_selfields using    i_tab
                                      i_max_lines
                                      i_line_det
                                      i_display_all
                                      i_clnt_spez
                             changing ld_subrc
                                      ld_partial.
   endif.

*..if not, do the normal select
   if ld_partial <> true.
*.....Create selection table out of input selfields
      perform create_seltab tables lt_where
                                   it_selfields
                                   it_or_selfields
                            changing it_and_selfields.

*..Now do the select on one table with the created selection criteria
      perform select_standard tables   lt_where
                              using    i_tab
                                       i_max_lines
                                       i_line_det
                                       i_display_all
                                       i_clnt_spez
                              changing ld_subrc.
   endif.

*..Give number of found entries back to caller
   e_line_nr gd-number.

*..If nothing has been found, exit
*..In case of edit -> Show empty table, because of insert
   if ld_subrc <> and i_edit <> true and
      gd-number 1.
      message e002(wuslraising no_values.
   endif.

*..Select the texts
   if ld_no_txt <> true.
      perform select_text_table using  ld_txt_tab
                                       i_clnt_spez.
   endif.

*..outer join selects
   if gd-ojkey <> space.
*     perform ojkey_select.
      perform ojkey_select_new.
   endif.

*..Now display the results in a fullscreen ALV-Grid
   if i_line_det <> true.
      if i_display true.
         perform display_standard using i_old_alv
                                        i_cwidth_opt_off.
      else.
         e_dref gd_dref.
         et_fieldcat[] gt_fieldcat[].
      endif.
   else.
      perform display_line_nr.
   endif.


ENDFUNCTION.
0 0
原创粉丝点击