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 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
*&---------------------------------------------------------------------* *& Report ZFIND_EXTENSION_BOBF *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT zfind_extension_bobf. TYPES: BEGIN OF gtys_report, bo_name TYPE /bobf/obm_bo-bo_name, category TYPE desc, name TYPE name4, description TYPE /bobf/obm_description, node_name TYPE /bobf/obm_node-node_name, END OF gtys_report. TYPES: gty_t_node_key TYPE SORTED TABLE OF /bobf/obm_node-node_key WITH UNIQUE DEFAULT KEY, gty_t_node_info TYPE SORTED TABLE OF /bobf/obm_node WITH NON-UNIQUE KEY node_key. DATA: gt_data TYPE TABLE OF gtys_report, go_alv TYPE REF TO cl_salv_table. PARAMETERS: p_bo TYPE /bobf/obm_name MEMORY ID bonm OBLIGATORY. START-OF-SELECTION. "super bo get SELECT SINGLE * FROM /bobf/obm_bo WHERE bo_name = @p_bo AND extension = @abap_false INTO @DATA(ls_bobf_super). IF sy-subrc <> 0. WRITE : / 'Нет данных по БО'. RETURN. ENDIF. "extension get SELECT * FROM /bobf/obm_bo WHERE super_bo_key = @ls_bobf_super-bo_key AND extension = @abap_true INTO TABLE @DATA(lt_extensions). IF sy-subrc <> 0. WRITE : / 'Нет расширений'. RETURN. ENDIF. "associations SELECT assoc~bo_key, assoc~assoc_name, assoc~source_node_key, text~description FROM /bobf/obm_assoc AS assoc LEFT JOIN /bobf/obm_assoct AS text ON text~langu = @sy-langu AND text~name = assoc~name AND text~extension = assoc~extension AND text~version = assoc~version AND text~assoc_key = assoc~assoc_key JOIN @lt_extensions AS key ON key~bo_key = assoc~bo_key INTO TABLE @DATA(lt_assoc). "determ SELECT determ~bo_key, determ~det_name, determ~node_key, text~description FROM /bobf/det_list AS determ LEFT JOIN /bobf/det_listt AS text ON text~langu = @sy-langu AND text~name = determ~name AND text~extension = determ~extension AND text~version = determ~version AND text~det_key = determ~det_key JOIN @lt_extensions AS key ON key~bo_key = determ~bo_key INTO TABLE @DATA(lt_determ). "actions SELECT action~bo_key, action~act_name, action~node_key, text~description FROM /bobf/act_list AS action LEFT JOIN /bobf/act_listt AS text ON text~langu = @sy-langu AND text~name = action~name AND text~extension = action~extension AND text~version = action~version AND text~act_key = action~act_key JOIN @lt_extensions AS key ON key~bo_key = action~bo_key INTO TABLE @DATA(lt_actions). "validations SELECT valid~bo_key, valid~val_name, valid~node_key, text~description FROM /bobf/val_list AS valid LEFT JOIN /bobf/val_listt AS text ON text~langu = @sy-langu AND text~name = valid~name AND text~extension = valid~extension AND text~version = valid~version AND text~val_key = valid~val_key JOIN @lt_extensions AS key ON key~bo_key = valid~bo_key INTO TABLE @DATA(lt_validations). "node info DATA(lt_node_key) = VALUE gty_t_node_key( ). DATA(lv_exit) = VALUE char4( ). DO. DATA(lv_index) = sy-index. READ TABLE lt_assoc INDEX lv_index ASSIGNING FIELD-SYMBOL(<ls_assoc>). IF sy-subrc = 0. INSERT <ls_assoc>-source_node_key INTO TABLE lt_node_key. ELSE. lv_exit(1) = abap_true. ENDIF. READ TABLE lt_determ INDEX lv_index ASSIGNING FIELD-SYMBOL(<ls_determ>). IF sy-subrc = 0. INSERT <ls_determ>-node_key INTO TABLE lt_node_key. ELSE. lv_exit+1(1) = abap_true. ENDIF. READ TABLE lt_validations INDEX lv_index ASSIGNING FIELD-SYMBOL(<ls_validations>). IF sy-subrc = 0. INSERT <ls_validations>-node_key INTO TABLE lt_node_key. ELSE. lv_exit+2(1) = abap_true. ENDIF. READ TABLE lt_actions INDEX lv_index ASSIGNING FIELD-SYMBOL(<ls_action>). IF sy-subrc = 0. INSERT <ls_action>-node_key INTO TABLE lt_node_key. ELSE. lv_exit+3(1) = abap_true. ENDIF. IF lv_exit = 'XXXX'. EXIT. ENDIF. ENDDO. DATA(lt_node_info) = VALUE gty_t_node_info( ). SELECT node~node_key, node~node_name FROM /bobf/obm_node AS node JOIN @lt_node_key AS key ON key~table_line = node~node_key INTO CORRESPONDING FIELDS OF TABLE @lt_node_info. "alv data SORT lt_extensions BY bo_name. LOOP AT lt_extensions ASSIGNING FIELD-SYMBOL(<ls_extension>). "Association LOOP AT lt_assoc ASSIGNING <ls_assoc> WHERE bo_key = <ls_extension>-bo_key. APPEND INITIAL LINE TO gt_data ASSIGNING FIELD-SYMBOL(<ls_line>). <ls_line>-bo_name = <ls_extension>-bo_name. <ls_line>-category = 'Association'. <ls_line>-name = <ls_assoc>-assoc_name. <ls_line>-description = <ls_assoc>-description. <ls_line>-node_name = VALUE #( lt_node_info[ node_key = <ls_assoc>-source_node_key ]-node_name OPTIONAL ). ENDLOOP. "actions LOOP AT lt_actions ASSIGNING <ls_action> WHERE bo_key = <ls_extension>-bo_key. APPEND INITIAL LINE TO gt_data ASSIGNING <ls_line>. <ls_line>-bo_name = <ls_extension>-bo_name. <ls_line>-category = 'Action'. <ls_line>-name = <ls_action>-act_name. <ls_line>-description = <ls_action>-description. <ls_line>-node_name = VALUE #( lt_node_info[ node_key = <ls_action>-node_key ]-node_name OPTIONAL ). ENDLOOP. "determ LOOP AT lt_determ ASSIGNING <ls_determ> WHERE bo_key = <ls_extension>-bo_key. APPEND INITIAL LINE TO gt_data ASSIGNING <ls_line>. <ls_line>-bo_name = <ls_extension>-bo_name. <ls_line>-category = 'Determination'. <ls_line>-name = <ls_determ>-det_name. <ls_line>-description = <ls_determ>-description. <ls_line>-node_name = VALUE #( lt_node_info[ node_key = <ls_determ>-node_key ]-node_name OPTIONAL ). ENDLOOP. "validations LOOP AT lt_validations ASSIGNING <ls_validations> WHERE bo_key = <ls_extension>-bo_key. APPEND INITIAL LINE TO gt_data ASSIGNING <ls_line>. <ls_line>-bo_name = <ls_extension>-bo_name. <ls_line>-category = 'Validation'. <ls_line>-name = <ls_validations>-val_name. <ls_line>-description = <ls_validations>-description. <ls_line>-node_name = VALUE #( lt_node_info[ node_key = <ls_validations>-node_key ]-node_name OPTIONAL ). ENDLOOP. ENDLOOP. TRY. cl_salv_table=>factory( IMPORTING r_salv_table = go_alv CHANGING t_table = gt_data ). DATA(lo_sel) = go_alv->get_selections( ). lo_sel->set_selection_mode( if_salv_c_selection_mode=>cell ). DATA(lp_fun) = go_alv->get_functions( ). lp_fun->set_default( abap_true ). DATA(lr_layout) = go_alv->get_layout( ). DATA ls_key TYPE salv_s_layout_key. ls_key-report = sy-repid. lr_layout->set_key( ls_key ). lr_layout->set_default( value = abap_true ). lr_layout->set_save_restriction( if_salv_c_layout=>restrict_none ). CATCH cx_salv_msg . MESSAGE 'Ошибка при создании ALV' TYPE 'E'. RETURN. ENDTRY. go_alv->display( ). |