ZREQ_OF_DEVCLASS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
*&---------------------------------------------------------------------* *& Report ZREQ_OF_DEVCLASS *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT zreq_of_devclass. INCLUDE zreq_of_devclass_top. INCLUDE zreq_of_devclass_cl01. INCLUDE zreq_of_devclass_sscr. INCLUDE zreq_of_devclass_f01. INCLUDE zreq_of_devclass_f02. START-OF-SELECTION. DATA(lv_success) = abap_true. PERFORM select_data CHANGING lv_success. CHECK lv_success = abap_true. CALL SCREEN 0100. |
ZREQ_OF_DEVCLASS_TOP
ABAP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
TYPES: BEGIN OF gty_s_data, complex TYPE flag, trkorr TYPE e070-trkorr, as4text TYPE as4text, as4user TYPE e070-as4user, as4user_text TYPE dd07v-ddtext, trfunction TYPE e070-trfunction, trfunction_text TYPE dd07v-ddtext, trstatus TYPE e070-trstatus, trstatus_text TYPE dd07v-ddtext, END OF gty_s_data. CLASS lcl_handler DEFINITION DEFERRED. DATA: gt_data TYPE TABLE OF gty_s_data. DATA: gv_ok TYPE sy-ucomm. DATA: go_grid TYPE REF TO cl_gui_alv_grid, go_handler TYPE REF TO lcl_handler, go_cont TYPE REF TO cl_gui_custom_container, gt_fieldcat TYPE lvc_t_fcat. |
ZREQ_OF_DEVCLASS_CL01
ABAP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
CLASS lcl_handler DEFINITION. PUBLIC SECTION. METHODS: on_double_click FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row e_column es_row_no. ENDCLASS. CLASS lcl_handler IMPLEMENTATION. METHOD on_double_click. CASE e_column. WHEN 'TRKORR'. READ TABLE gt_data INDEX es_row_no-row_id ASSIGNING FIELD-SYMBOL(<ls_line>). CHECK sy-subrc = 0. SET PARAMETER ID 'KOR' FIELD <ls_line>-trkorr. CALL FUNCTION 'TR_PRESENT_REQUEST' EXPORTING iv_trkorr = <ls_line>-trkorr iv_highlight = abap_true. ENDCASE. ENDMETHOD. ENDCLASS. |
ZREQ_OF_DEVCLASS_SSCR
ABAP
1 |
PARAMETERS: p_clas TYPE tadir-devclass OBLIGATORY MEMORY ID pck. |
ZREQ_OF_DEVCLASS_F01
ABAP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
FORM dom_val_get USING iv_dname TYPE dd07l-domname iv_dval TYPE dd07v-domvalue_l CHANGING cv_value TYPE dd07v-ddtext. CLEAR cv_value. CALL FUNCTION 'DOMAIN_VALUE_GET' EXPORTING i_domname = iv_dname i_domvalue = iv_dval IMPORTING e_ddtext = cv_value EXCEPTIONS not_exist = 1 OTHERS = 2. ENDFORM. *&---------------------------------------------------------------------* *& Form SELECT_DATA *&---------------------------------------------------------------------* *& Выборка данных *&---------------------------------------------------------------------* FORM select_data CHANGING cv_success TYPE abap_bool. SELECT object, obj_name INTO TABLE @DATA(lt_objects) FROM tadir WHERE devclass = @p_clas. IF sy-subrc <> 0. WRITE : / 'Объекты не найдены'. cv_success = abap_false. RETURN. ENDIF. "Получаем список запросов, в которые были включены объекты из пакета SELECT DISTINCT e070_self~trkorr, e070_self~trfunction, e070_self~as4user, e070_self~trstatus FROM e070 JOIN e070 AS e070_self ON e070_self~trkorr = e070~strkorr JOIN e071 ON e071~trkorr = e070~trkorr JOIN @lt_objects AS obj ON obj~object = e071~object AND obj~obj_name = e071~obj_name INTO CORRESPONDING FIELDS OF TABLE @gt_data[]. IF sy-subrc = 0. "запросы, которые включают объекты из других пакетов SELECT DISTINCT e071~trkorr FROM e071 JOIN tadir ON tadir~object = e071~object AND tadir~obj_name = e071~obj_name FOR ALL ENTRIES IN @gt_data WHERE e071~trkorr = @gt_data-trkorr AND tadir~devclass <> @p_clas INTO TABLE @DATA(lt_complex_reqs). IF sy-subrc = 0. SORT lt_complex_reqs STABLE BY trkorr ASCENDING. ENDIF. ENDIF. DELETE gt_data[] WHERE trfunction <> 'K'. "Удаляем задачи IF gt_data[] IS INITIAL. WRITE : / 'Запросы не найдены'. cv_success = abap_false. RETURN. ENDIF. SORT gt_data BY trkorr ASCENDING. LOOP AT gt_data ASSIGNING FIELD-SYMBOL(<ls_line>). DATA(lv_domval) = CONV dd07v-domvalue_l( <ls_line>-trfunction ). PERFORM dom_val_get USING 'TRFUNCTION' lv_domval CHANGING <ls_line>-trfunction_text. lv_domval = CONV dd07v-domvalue_l( <ls_line>-trstatus ). PERFORM dom_val_get USING 'TRSTATUS' lv_domval CHANGING <ls_line>-trstatus_text. DATA(ls_adr) = VALUE bapiaddr3( ). DATA(lt_return) = VALUE bapirettab( ). CALL FUNCTION 'BAPI_USER_GET_DETAIL' EXPORTING username = <ls_line>-as4user IMPORTING address = ls_adr TABLES return = lt_return. IF ls_adr IS NOT INITIAL. <ls_line>-as4user_text = |{ ls_adr-lastname } { ls_adr-firstname }|. ENDIF. DATA(ls_e07t) = VALUE e07t_old( ). CALL FUNCTION 'GET_E07T_ENTRY' EXPORTING korrnum = CONV e07t_old-trkorr( <ls_line>-trkorr ) langu = sy-langu IMPORTING e07t_entry = ls_e07t EXCEPTIONS no_entry_found = 1 OTHERS = 2. IF sy-subrc = 0. <ls_line>-as4text = ls_e07t-as4text. ENDIF. "Если запрос комплексный (включает объекты из других разработок), поставим чекбокс READ TABLE lt_complex_reqs TRANSPORTING NO FIELDS WITH KEY trkorr = <ls_line>-trkorr BINARY SEARCH. IF sy-subrc = 0. <ls_line>-complex = abap_true. ENDIF. ENDLOOP. ENDFORM. FORM show_grid . DATA: ls_alv_layout TYPE lvc_s_layo, ls_variant TYPE disvariant. CREATE OBJECT go_cont EXPORTING container_name = 'CONT1' EXCEPTIONS cntl_error = 1 cntl_system_error = 2 create_error = 3 lifetime_error = 4 lifetime_dynpro_dynpro_link = 5 OTHERS = 6. CREATE OBJECT go_grid EXPORTING i_parent = go_cont. ls_alv_layout-cwidth_opt = 'X'. ls_alv_layout-zebra = 'X'. ls_alv_layout-sel_mode = 'A'. ls_alv_layout-excp_led = 'X'. ls_alv_layout-no_rowmove = 'X'. ls_alv_layout-no_rowins = 'X'. IF go_handler IS NOT BOUND. go_handler = NEW #( ). ENDIF. SET HANDLER go_handler->on_double_click FOR go_grid. ls_variant-report = sy-repid. PERFORM create_fcat. CALL METHOD go_grid->set_table_for_first_display EXPORTING is_layout = ls_alv_layout is_variant = ls_variant i_save = 'A' CHANGING it_fieldcatalog = gt_fieldcat it_outtab = gt_data[]. ENDFORM. FORM create_fcat. DATA lo_table TYPE REF TO data. TRY. CREATE DATA lo_table LIKE gt_data. ASSIGN lo_table->* TO FIELD-SYMBOL(<lt_table>). cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_salv_table) CHANGING t_table = <lt_table> ). gt_fieldcat = cl_salv_controller_metadata=>get_lvc_fieldcatalog( r_columns = lo_salv_table->get_columns( ) r_aggregations = lo_salv_table->get_aggregations( ) ). CATCH cx_root. ENDTRY. LOOP AT gt_fieldcat ASSIGNING FIELD-SYMBOL(<ls_fcat>). CASE <ls_fcat>-fieldname. WHEN 'COMPLEX'. <ls_fcat>-checkbox = abap_true. <ls_fcat>-scrtext_l = <ls_fcat>-scrtext_m = <ls_fcat>-scrtext_s = <ls_fcat>-reptext = 'Комплексный'. WHEN 'TRKORR'. <ls_fcat>-key = abap_true. <ls_fcat>-seltext = abap_true. WHEN 'TRFUNCTION' OR 'TRSTATUS'. <ls_fcat>-tech = abap_true. ENDCASE. ENDLOOP. ENDFORM. |
ZREQ_OF_DEVCLASS_F02
ABAP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
MODULE status_0100 OUTPUT. SET PF-STATUS 'MAIN_STATUS'. SET TITLEBAR 'MAIN_HEADER'. PERFORM show_grid. ENDMODULE. MODULE user_command_0100 INPUT. CASE gv_ok. WHEN 'BACK'. LEAVE TO SCREEN 0. WHEN 'UP'. LEAVE PROGRAM. ENDCASE. ENDMODULE. |