Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | CLASS zcl_abapgit_tadir DEFINITION PUBLIC FINAL CREATE PRIVATE GLOBAL FRIENDS zcl_abapgit_factory . PUBLIC SECTION. INTERFACES zif_abapgit_tadir . PROTECTED SECTION. PRIVATE SECTION. METHODS check_exists IMPORTING !it_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt RETURNING VALUE(rt_tadir) TYPE zif_abapgit_definitions=>ty_tadir_tt RAISING zcx_abapgit_exception . METHODS build IMPORTING !iv_package TYPE tadir-devclass !io_dot TYPE REF TO zcl_abapgit_dot_abapgit !iv_ignore_subpackages TYPE abap_bool DEFAULT abap_false !iv_only_local_objects TYPE abap_bool DEFAULT abap_false RETURNING VALUE(rt_tadir) TYPE zif_abapgit_definitions=>ty_tadir_tt RAISING zcx_abapgit_exception . METHODS select_objects IMPORTING !iv_package TYPE tadir-devclass !iv_ignore_subpackages TYPE abap_bool DEFAULT abap_false !iv_only_local_objects TYPE abap_bool EXPORTING !et_packages TYPE zif_abapgit_sap_package=>ty_devclass_tt !et_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt RAISING zcx_abapgit_exception . METHODS add_local_packages IMPORTING !it_packages TYPE zif_abapgit_sap_package=>ty_devclass_tt CHANGING !ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt RAISING zcx_abapgit_exception . METHODS add_namespaces IMPORTING !iv_package TYPE devclass CHANGING !ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt RAISING zcx_abapgit_exception . METHODS add_namespace IMPORTING !iv_package TYPE devclass !iv_object TYPE csequence CHANGING !ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt !ct_tadir_nspc TYPE zif_abapgit_definitions=>ty_tadir_tt RAISING zcx_abapgit_exception . METHODS determine_path IMPORTING !iv_package TYPE tadir-devclass !io_dot TYPE REF TO zcl_abapgit_dot_abapgit CHANGING !ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt RAISING zcx_abapgit_exception . ENDCLASS. CLASS zcl_abapgit_tadir IMPLEMENTATION. METHOD add_local_packages. FIELD-SYMBOLS: <lv_package> LIKE LINE OF it_packages, <ls_tadir> LIKE LINE OF ct_tadir. LOOP AT it_packages ASSIGNING <lv_package>. " Local packages are not in TADIR, only in TDEVC, act as if they were IF <lv_package> CP '$*'. " OR <package> CP 'T*' ). APPEND INITIAL LINE TO ct_tadir ASSIGNING <ls_tadir>. <ls_tadir>-pgmid = 'R3TR'. <ls_tadir>-object = 'DEVC'. <ls_tadir>-obj_name = <lv_package>. <ls_tadir>-devclass = <lv_package>. <ls_tadir>-srcsystem = sy-sysid. <ls_tadir>-masterlang = sy-langu. ENDIF. ENDLOOP. ENDMETHOD. METHOD add_namespace. DATA ls_tadir TYPE zif_abapgit_definitions=>ty_tadir. DATA ls_obj_with_namespace TYPE zif_abapgit_definitions=>ty_obj_namespace. TRY. ls_obj_with_namespace = zcl_abapgit_factory=>get_sap_namespace( )->split_by_name( iv_object ). CATCH zcx_abapgit_exception. "Ignore the exception like before the replacement of the FM RS_NAME_SPLIT_NAMESPACE RETURN. ENDTRY. IF ls_obj_with_namespace-namespace IS NOT INITIAL. READ TABLE ct_tadir_nspc TRANSPORTING NO FIELDS WITH KEY pgmid = 'R3TR' object = 'NSPC' obj_name = ls_obj_with_namespace-namespace. IF sy-subrc <> 0. ls_tadir-pgmid = 'R3TR'. ls_tadir-object = 'NSPC'. ls_tadir-obj_name = ls_obj_with_namespace-namespace. ls_tadir-devclass = iv_package. ls_tadir-srcsystem = sy-sysid. ls_tadir-masterlang = sy-langu. INSERT ls_tadir INTO TABLE ct_tadir. INSERT ls_tadir INTO TABLE ct_tadir_nspc. ENDIF. ENDIF. ENDMETHOD. METHOD add_namespaces. DATA lt_tadir_nspc TYPE zif_abapgit_definitions=>ty_tadir_tt. FIELD-SYMBOLS <ls_tadir> LIKE LINE OF ct_tadir. " Namespaces are not in TADIR, but are necessary for creating objects in transportable packages LOOP AT ct_tadir ASSIGNING <ls_tadir> WHERE obj_name(1) = '/'. add_namespace( EXPORTING iv_package = iv_package iv_object = <ls_tadir>-obj_name CHANGING ct_tadir = ct_tadir ct_tadir_nspc = lt_tadir_nspc ). ENDLOOP. " Root package of repo might not exist yet but needs to be considered, too IF iv_package CP '/*'. add_namespace( EXPORTING iv_package = iv_package iv_object = iv_package CHANGING ct_tadir = ct_tadir ct_tadir_nspc = lt_tadir_nspc ). ENDIF. ENDMETHOD. METHOD build. DATA lt_packages TYPE zif_abapgit_sap_package=>ty_devclass_tt. select_objects( EXPORTING iv_package = iv_package iv_ignore_subpackages = iv_ignore_subpackages iv_only_local_objects = iv_only_local_objects IMPORTING et_tadir = rt_tadir et_packages = lt_packages ). add_local_packages( EXPORTING it_packages = lt_packages CHANGING ct_tadir = rt_tadir ). add_namespaces( EXPORTING iv_package = iv_package CHANGING ct_tadir = rt_tadir ). determine_path( EXPORTING iv_package = iv_package io_dot = io_dot CHANGING ct_tadir = rt_tadir ). ENDMETHOD. METHOD check_exists. DATA: li_progress TYPE REF TO zif_abapgit_progress, ls_item TYPE zif_abapgit_definitions=>ty_item. FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF it_tadir. li_progress = zcl_abapgit_progress=>get_instance( lines( it_tadir ) ). * rows from database table TADIR are not removed for * transportable objects until the transport is released LOOP AT it_tadir ASSIGNING <ls_tadir>. IF sy-tabix MOD 200 = 0. li_progress->show( iv_current = sy-tabix iv_text = |Check object exists { <ls_tadir>-object } { <ls_tadir>-obj_name }| ). ENDIF. ls_item-obj_type = <ls_tadir>-object. ls_item-obj_name = <ls_tadir>-obj_name. ls_item-devclass = <ls_tadir>-devclass. IF zcl_abapgit_objects=>exists( ls_item ) = abap_true. APPEND <ls_tadir> TO rt_tadir. ENDIF. ENDLOOP. li_progress->off( ). ENDMETHOD. METHOD determine_path. DATA: lv_path TYPE string, lo_folder_logic TYPE REF TO zcl_abapgit_folder_logic, lv_last_package TYPE devclass VALUE cl_abap_char_utilities=>horizontal_tab. FIELD-SYMBOLS <ls_tadir> LIKE LINE OF ct_tadir. lo_folder_logic = zcl_abapgit_folder_logic=>get_instance( ). LOOP AT ct_tadir ASSIGNING <ls_tadir>. IF lv_last_package <> <ls_tadir>-devclass. "Change in Package lv_last_package = <ls_tadir>-devclass. IF NOT io_dot IS INITIAL. lv_path = lo_folder_logic->package_to_path( iv_top = iv_package io_dot = io_dot iv_package = <ls_tadir>-devclass ). ENDIF. ENDIF. <ls_tadir>-path = lv_path. <ls_tadir>-korrnum = ''. ENDLOOP. ENDMETHOD. METHOD select_objects. DATA: lt_excludes TYPE RANGE OF trobjtype, ls_exclude LIKE LINE OF lt_excludes, lt_srcsystem TYPE RANGE OF tadir-srcsystem, ls_srcsystem LIKE LINE OF lt_srcsystem. " Determine packages to read IF iv_ignore_subpackages = abap_false. et_packages = zcl_abapgit_factory=>get_sap_package( iv_package )->list_subpackages( ). ENDIF. INSERT iv_package INTO et_packages INDEX 1. " Exclude object types with tadir entries that are included elsewhere ls_exclude-sign = 'I'. ls_exclude-option = 'EQ'. ls_exclude-low = 'SOTR'. " automatically created for SAP packages (DEVC) APPEND ls_exclude TO lt_excludes. ls_exclude-low = 'SOTS'. " automatically created for SAP packages (DEVC) APPEND ls_exclude TO lt_excludes. ls_exclude-low = 'SFB1'. " covered by business function sets (SFBS) APPEND ls_exclude TO lt_excludes. ls_exclude-low = 'SFB2'. " covered by business functions (SFBF) APPEND ls_exclude TO lt_excludes. ls_exclude-low = 'STOB'. " auto generated by core data services (DDLS) APPEND ls_exclude TO lt_excludes. " Limit to objects belonging to this system IF iv_only_local_objects = abap_true. ls_srcsystem-sign = 'I'. ls_srcsystem-option = 'EQ'. ls_srcsystem-low = sy-sysid. APPEND ls_srcsystem TO lt_srcsystem. ENDIF. IF et_packages IS NOT INITIAL. SELECT * FROM tadir INTO CORRESPONDING FIELDS OF TABLE et_tadir FOR ALL ENTRIES IN et_packages WHERE devclass = et_packages-table_line AND pgmid = 'R3TR' AND object NOT IN lt_excludes AND delflag = abap_false AND srcsystem IN lt_srcsystem ORDER BY PRIMARY KEY ##TOO_MANY_ITAB_FIELDS. "#EC CI_GENBUFF "#EC CI_SUBRC ENDIF. SORT et_tadir BY devclass pgmid object obj_name. ENDMETHOD. METHOD zif_abapgit_tadir~get_object_package. DATA: ls_tadir TYPE zif_abapgit_definitions=>ty_tadir, ls_item TYPE zif_abapgit_definitions=>ty_item. ls_tadir = zif_abapgit_tadir~read_single( iv_pgmid = iv_pgmid iv_object = iv_object iv_obj_name = iv_obj_name ). IF ls_tadir-delflag = abap_true. RETURN. "Mark for deletion -> return nothing ENDIF. ls_item-obj_type = ls_tadir-object. ls_item-obj_name = ls_tadir-obj_name. ls_item-devclass = ls_tadir-devclass. IF zcl_abapgit_objects=>exists( ls_item ) = abap_false. RETURN. ENDIF. rv_devclass = ls_tadir-devclass. ENDMETHOD. METHOD zif_abapgit_tadir~read. DATA li_exit TYPE REF TO zif_abapgit_exit. DATA lr_tadir TYPE REF TO zif_abapgit_definitions=>ty_tadir. DATA lt_filter TYPE zif_abapgit_definitions=>ty_tadir_tt. DATA ls_dot_data TYPE zif_abapgit_dot_abapgit=>ty_dot_abapgit. ASSERT iv_package IS NOT INITIAL. " Start recursion " hmm, some problems here, should TADIR also build path? rt_tadir = build( iv_package = iv_package io_dot = io_dot iv_ignore_subpackages = iv_ignore_subpackages iv_only_local_objects = iv_only_local_objects ). IF io_dot IS NOT INITIAL. ls_dot_data = io_dot->get_data( ). ENDIF. li_exit = zcl_abapgit_exit=>get_instance( ). li_exit->change_tadir( EXPORTING iv_package = iv_package ii_log = ii_log is_dot_abapgit = ls_dot_data iv_ignore_subpackages = iv_ignore_subpackages iv_only_local_objects = iv_only_local_objects CHANGING ct_tadir = rt_tadir ). IF it_filter IS NOT INITIAL. "Apply filter manually instead of calling zcl_abapgit_repo_filter->apply, "so that we can execute a unit test. The method applies addition filtering "and does therefore additional selects lt_filter = it_filter. SORT lt_filter BY object obj_name. LOOP AT rt_tadir REFERENCE INTO lr_tadir. READ TABLE lt_filter TRANSPORTING NO FIELDS WITH KEY object = lr_tadir->object obj_name = lr_tadir->obj_name BINARY SEARCH. IF sy-subrc <> 0. DELETE rt_tadir. ENDIF. ENDLOOP. ENDIF. IF iv_check_exists = abap_true. rt_tadir = check_exists( rt_tadir ). ENDIF. ENDMETHOD. METHOD zif_abapgit_tadir~read_single. SELECT SINGLE * FROM tadir INTO CORRESPONDING FIELDS OF rs_tadir WHERE pgmid = iv_pgmid AND object = iv_object AND obj_name = iv_obj_name. "#EC CI_SUBRC CLEAR rs_tadir-korrnum. ENDMETHOD. ENDCLASS. |