Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *&---------------------------------------------------------------------*
- *& Report YECC_BC_CHECK_05
- *& Аудит использования функциональных модулей
- *&---------------------------------------------------------------------*
- *& http://entropii.net/?p=2158
- *&---------------------------------------------------------------------*
- report yecc_bc_check_05.
- data: begin of gs_report,
- devclass type tadir-devclass,
- fgroup type rs38l_area,
- funcname type tfdir-funcname,
- fmode type tfdir-fmode,
- pname type tfdir-pname,
- genflag type tadir-genflag,
- masterlang type tadir-masterlang,
- stext type tftit-stext,
- progname type cross-include,
- shlpname type dd30l-shlpname,
- othername type char120,
- end of gs_report.
- selection-screen begin of block bl0 with frame title text-001.
- select-options: s_fname for gs_report-funcname.
- select-options: s_fgroup for gs_report-fgroup.
- select-options: s_devcl for gs_report-devclass.
- selection-screen end of block bl0.
- data: gt_report like standard table of gs_report with header line.
- data: gr_table type ref to cl_salv_table.
- initialization.
- s_fname-option = 'CP'.
- s_fname-sign = 'I'.
- s_fname-low = 'Z*'.
- s_fname-high = ''.
- append s_fname.
- s_fgroup-option = 'CP'.
- s_fgroup-sign = 'I'.
- s_fgroup-low = 'Z*'.
- s_fgroup-high = ''.
- append s_fgroup.
- s_devcl-option = 'CP'.
- s_devcl-sign = 'I'.
- s_devcl-low = 'Z*'.
- s_devcl-high = ''.
- append s_devcl.
- start-of-selection.
- perform select_data.
- perform show_alv.
- end-of-selection.
- *&---------------------------------------------------------------------*
- *& Form select_data
- *&---------------------------------------------------------------------*
- * text
- *----------------------------------------------------------------------*
- form select_data.
- data: lt_bte type standard table of char20 with header line.
- refresh lt_bte.
- lt_bte = 'TBE31'. append lt_bte. "Publish&Subscribe-СБО: SAP-расширение
- lt_bte = 'TBE32'. append lt_bte. "Publish&Subscribe-СБО: расширения партнеро
- lt_bte = 'TBE34'. append lt_bte. "Publish&Subscribe-СБО: расширения клиентов
- lt_bte = 'TPS31'. append lt_bte. "СБО процесса: альтернативные ФМ SAP
- lt_bte = 'TPS32'. append lt_bte. "СБО процесса: расширения партнера
- lt_bte = 'TPS34'. append lt_bte. "СБО процесса: расширения клиента
- ranges: r_pname for tfdir-pname.
- refresh r_pname.
- loop at s_fgroup.
- r_pname-option = s_fgroup-option.
- r_pname-sign = s_fgroup-sign.
- r_pname-low = s_fgroup-low.
- r_pname-high = s_fgroup-high.
- if r_pname-low ne space.
- concatenate 'SAPL' r_pname-low into r_pname-low.
- endif.
- if r_pname-high ne space.
- concatenate 'SAPL' r_pname-high into r_pname-high.
- endif.
- append r_pname.
- endloop.
- select * from tfdir
- into corresponding fields of table gt_report
- where funcname in s_fname
- and pname in r_pname.
- loop at gt_report.
- if gt_report-pname(4) = 'SAPL'.
- gt_report-fgroup = gt_report-pname+4(26).
- data: ls_tadir type tadir.
- select single * from tadir into ls_tadir
- where pgmid = 'R3TR' and object = 'FUGR' and obj_name = gt_report-fgroup.
- if sy-subrc = 0.
- if ls_tadir-devclass in s_devcl.
- gt_report-devclass = ls_tadir-devclass.
- gt_report-masterlang = ls_tadir-masterlang.
- gt_report-genflag = ls_tadir-genflag.
- else.
- delete gt_report.
- continue.
- endif.
- endif.
- endif.
- * Тексты
- select single stext into gt_report-stext from tftit
- where funcname = gt_report-funcname
- and spras = sy-langu.
- if ( sy-subrc ne 0 or gt_report-stext = space ) and gt_report-masterlang ne space and gt_report-masterlang ne sy-langu.
- select single stext into gt_report-stext from tftit
- where funcname = gt_report-funcname
- and spras = gt_report-masterlang. "[TODO] Приоритет английскому языку над немецким: Вход - Рус - Англ - Ориг
- endif.
- * Обычное использование в программах
- data: lt_cross type standard table of cross with header line.
- refresh lt_cross.
- select * from cross into table lt_cross
- where type = 'F'
- and name = gt_report-funcname.
- loop at lt_cross.
- if lt_cross-include+28(4) = '==FT'.
- delete lt_cross.
- endif.
- endloop.
- if lines( lt_cross ) = 0.
- elseif lines( lt_cross ) = 1.
- read table lt_cross index 1.
- gt_report-progname = lt_cross-include.
- else.
- gt_report-progname = '*'.
- endif.
- * Средства поиска SE11
- data: lt_dd30l type standard table of dd30l with header line.
- refresh lt_dd30l.
- select * from dd30l
- into table lt_dd30l
- where selmexit = gt_report-funcname and as4local = 'A'.
- if lines( lt_dd30l ) = 0.
- elseif lines( lt_dd30l ) = 1.
- read table lt_dd30l index 1.
- gt_report-shlpname = lt_dd30l-shlpname.
- else.
- gt_report-shlpname = '*'.
- endif.
- * Open-FI / FIBF
- data: lv_event type tbe34-event.
- loop at lt_bte.
- case lt_bte(3).
- when 'TPS'. select single procs from (lt_bte) client specified into lv_event where funct = gt_report-funcname.
- when others. select single event from (lt_bte) client specified into lv_event where funct = gt_report-funcname.
- endcase.
- if sy-subrc = 0.
- concatenate gt_report-othername '+' lt_bte '(' lv_event ')' into gt_report-othername.
- endif.
- endloop.
- * Деривация ФМ / FMDERIVE
- data: lt_tabadrs type standard table of tabadrs with header line.
- refresh lt_tabadrs.
- select * from tabadrs client specified
- into table lt_tabadrs
- where method = 'FUNC' and param_1 = gt_report-funcname.
- sort lt_tabadrs by abadrenv. delete adjacent duplicates from lt_tabadrs comparing abadrenv.
- loop at lt_tabadrs.
- concatenate gt_report-othername '+' 'DERIVE' '(' lt_tabadrs-abadrenv ')' into gt_report-othername.
- endloop.
- *Источники данных / RSA3
- data: lt_roosource type standard table of roosource with header line.
- refresh lt_roosource.
- select * from roosource into table lt_roosource
- where ( exmethod = 'F1' or exmethod = 'F2' or exmethod = 'FS' )
- and extractor = gt_report-funcname.
- loop at lt_roosource.
- concatenate gt_report-othername '+' 'BW' '(' lt_roosource-oltpsource ')' into gt_report-othername.
- endloop.
- *События бизнес-партнёров / BUBI
- data: lt_tbz1f type standard table of tbz1f with header line.
- refresh lt_tbz1f.
- select * from tbz1f client specified
- into table lt_tbz1f
- where fname = gt_report-funcname.
- sort lt_tbz1f by ztpkt. delete adjacent duplicates from lt_tbz1f comparing ztpkt.
- loop at lt_tbz1f.
- concatenate gt_report-othername '+' 'BP' '(' lt_tbz1f-ztpkt ')' into gt_report-othername.
- endloop.
- data: lt_texc_fld_c type standard table of texc_fld_c with header line.
- refresh lt_texc_fld_c.
- select * from texc_fld_c client specified
- into table lt_texc_fld_c
- where funcmodule = gt_report-funcname.
- sort lt_texc_fld_c by fieldname. delete adjacent duplicates from lt_texc_fld_c comparing fieldname.
- loop at lt_texc_fld_c.
- concatenate gt_report-othername '+' 'SCASE' '(' lt_texc_fld_c-fieldname ')' into gt_report-othername.
- endloop.
- "[QUES][TODO] В анализе настроек перейти от настроек к списку ФМ, в целях улучшения производительности
- modify gt_report.
- endloop.
- sort gt_report by devclass fgroup funcname.
- endform. "select_data
- *----------------------------------------------------------------------*
- * CLASS lcl_handle_events DEFINITION
- *----------------------------------------------------------------------*
- *
- *----------------------------------------------------------------------*
- class lcl_handle_events definition.
- public section.
- methods:
- on_double_click for event double_click of cl_salv_events_table
- importing row column.
- endclass. "lcl_handle_events DEFINITION
- *----------------------------------------------------------------------*
- * CLASS lcl_handle_events IMPLEMENTATION
- *----------------------------------------------------------------------*
- *
- *----------------------------------------------------------------------*
- class lcl_handle_events implementation.
- method on_double_click.
- perform show_cell_info using row column.
- endmethod. "on_double_click
- endclass. "lcl_handle_events IMPLEMENTATION
- *&---------------------------------------------------------------------*
- *& Form show_cell_info
- *&---------------------------------------------------------------------*
- * text
- *----------------------------------------------------------------------*
- * -->I_ROW text
- * -->I_COLUMN text
- *----------------------------------------------------------------------*
- form show_cell_info using i_row type i
- i_column type lvc_fname.
- read table gt_report index i_row.
- check sy-subrc = 0.
- perform open_fm using gt_report-funcname.
- endform. " show_cell_info
- *&---------------------------------------------------------------------*
- *& Form show_alv
- *&---------------------------------------------------------------------*
- * text
- *----------------------------------------------------------------------*
- form show_alv.
- call method cl_salv_table=>factory
- importing
- r_salv_table = gr_table
- changing
- t_table = gt_report[].
- data: lo_columns type ref to cl_salv_columns_table.
- lo_columns = gr_table->get_columns( ).
- lo_columns->set_optimize( 'X' ).
- data: lo_column type ref to cl_salv_column_table.
- lo_column ?= lo_columns->get_column( 'PNAME' ). lo_column->set_visible( ' ' ).
- lo_column ?= lo_columns->get_column( 'PNAME' ). lo_column->set_long_text( 'Пул функций' ).
- lo_column ?= lo_columns->get_column( 'OTHERNAME' ). lo_column->set_long_text( 'Другое использование' ).
- data: lo_functions type ref to cl_salv_functions_list.
- lo_functions = gr_table->get_functions( ).
- lo_functions->set_all( abap_true ).
- data: lo_layout type ref to cl_salv_layout.
- data: ls_key type salv_s_layout_key.
- lo_layout = gr_table->get_layout( ).
- ls_key-report = sy-repid.
- lo_layout->set_key( ls_key ).
- lo_layout->set_save_restriction( cl_salv_layout=>restrict_none ).
- data: gr_events_imp type ref to lcl_handle_events.
- data: lr_events_table type ref to cl_salv_events_table.
- lr_events_table = gr_table->get_event( ).
- create object gr_events_imp.
- set handler gr_events_imp->on_double_click for lr_events_table.
- gr_table->display( ).
- endform. "show_alv
- *&---------------------------------------------------------------------*
- *& Form open_fm
- *&---------------------------------------------------------------------*
- * text
- *----------------------------------------------------------------------*
- form open_fm using iv_funcname.
- * data: begin of bdcdata occurs 0.
- * include structure bdcdata.
- * data: end of bdcdata.
- *
- * clear bdcdata.
- * bdcdata-program = 'SAPLSFUNCTION_BUILDER'.
- * bdcdata-dynpro = '1008'.
- * bdcdata-dynbegin = 'X'.
- * append bdcdata.
- *
- * clear bdcdata.
- * bdcdata-fnam = 'BDC_OKCODE'.
- * bdcdata-fval = '=WB_DISPLAY'.
- * append bdcdata.
- *
- * clear bdcdata.
- * bdcdata-fnam = 'RS38L-NAME'.
- * bdcdata-fval = iv_funcname.
- * append bdcdata.
- *
- * data: gs_bdc_params type ctu_params.
- * gs_bdc_params-dismode = 'E'.
- * gs_bdc_params-nobinpt ='X'.
- * gs_bdc_params-nobiend = 'X'.
- * call transaction 'SE37' using bdcdata options from gs_bdc_params.
- * "странно работает потом
- set parameter id 'LIB' field iv_funcname.
- call transaction 'SE37'.
- endform. "open_fm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement