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 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 3x 2x 2x 2x 2x 2x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x 1x | const {cx_root} = await import("./cx_root.clas.mjs"); // zcl_abapgit_frontend_services.clas.abap class zcl_abapgit_frontend_services { static INTERNAL_TYPE = 'CLAS'; static INTERNAL_NAME = 'ZCL_ABAPGIT_FRONTEND_SERVICES'; static IMPLEMENTED_INTERFACES = ["ZIF_ABAPGIT_FRONTEND_SERVICES"]; static ATTRIBUTES = {"GV_INITIAL_FOLDER": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "I", "is_constant": " ", "is_class": "X"}}; static METHODS = {"GET_PATH_FROM_FULLNAME": {"visibility": "I", "parameters": {"RV_PATH": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_FULLNAME": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}}; #gv_initial_folder; constructor() { this.me = new abap.types.ABAPObject(); this.me.set(this); this.INTERNAL_ID = abap.internalIdCounter++; this.FRIENDS_ACCESS_INSTANCE = { "get_path_from_fullname": this.#get_path_from_fullname.bind(this), }; this.gv_initial_folder = zcl_abapgit_frontend_services.gv_initial_folder; } async constructor_(INPUT) { if (super.constructor_) { await super.constructor_(INPUT); } return this; } async #get_path_from_fullname(INPUT) { let rv_path = new abap.types.String({qualifiedName: "STRING"}); let iv_fullname = INPUT?.iv_fullname; if (iv_fullname?.getQualifiedName === undefined || iv_fullname.getQualifiedName() !== "STRING") { iv_fullname = undefined; } if (iv_fullname === undefined) { iv_fullname = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_fullname); } let lv_len = new abap.types.Integer({qualifiedName: "I"}); abap.statements.find(iv_fullname, {regex: abap.CharacterFactory.get(8, '^/(.*/)?'), first: true, length: lv_len}); if (abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { rv_path.set(iv_fullname.getOffset({length: lv_len})); } else { abap.statements.find(iv_fullname, {regex: abap.CharacterFactory.get(8, '^(.*\\\\)?'), first: true, length: lv_len}); if (abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { rv_path.set(iv_fullname.getOffset({length: lv_len})); } } return rv_path; } async zif_abapgit_frontend_services$clipboard_export(INPUT) { let iv_no_auth_check = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); if (INPUT && INPUT.iv_no_auth_check) {iv_no_auth_check.set(INPUT.iv_no_auth_check);} if (INPUT === undefined || INPUT.iv_no_auth_check === undefined) {iv_no_auth_check = abap.builtin.abap_false;} let it_data = INPUT?.it_data; let lv_rc = new abap.types.Integer({qualifiedName: "I"}); try { try { await abap.dynamicCallLookup(abap.Classes['CL_GUI_FRONTEND_SERVICES'], "clipboard_export")({no_auth_check: iv_no_auth_check,data: it_data,rc: lv_rc}) abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "CNTL_ERROR": abap.builtin.sy.get().subrc.set(1); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(2); break; case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(3); break; case "NO_AUTHORITY": abap.builtin.sy.get().subrc.set(4); break; default: abap.builtin.sy.get().subrc.set(5); break; } } else { throw e; } }; if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } } catch (e) { if ((abap.Classes['CX_SY_DYN_CALL_PARAM_MISSING'] && e instanceof abap.Classes['CX_SY_DYN_CALL_PARAM_MISSING'])) { try { await abap.Classes['CL_GUI_FRONTEND_SERVICES'].clipboard_export({data: it_data, rc: lv_rc}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "CNTL_ERROR": abap.builtin.sy.get().subrc.set(1); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(2); break; case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(3); break; case "NO_AUTHORITY": abap.builtin.sy.get().subrc.set(4); break; default: abap.builtin.sy.get().subrc.set(5); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } } else { throw e; } } } async zif_abapgit_frontend_services$directory_browse(INPUT) { let iv_window_title = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_window_title) {iv_window_title.set(INPUT.iv_window_title);} let iv_initial_folder = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_initial_folder) {iv_initial_folder.set(INPUT.iv_initial_folder);} let cv_selected_folder = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.cv_selected_folder) {cv_selected_folder = INPUT.cv_selected_folder;} if (abap.compare.initial(iv_initial_folder) === false) { zcl_abapgit_frontend_services.gv_initial_folder.set(iv_initial_folder); } try { await abap.Classes['CL_GUI_FRONTEND_SERVICES'].directory_browse({window_title: iv_window_title, initial_folder: zcl_abapgit_frontend_services.gv_initial_folder, selected_folder: cv_selected_folder}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "CNTL_ERROR": abap.builtin.sy.get().subrc.set(1); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(2); break; case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(3); break; default: abap.builtin.sy.get().subrc.set(4); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } zcl_abapgit_frontend_services.gv_initial_folder.set(cv_selected_folder); } async zif_abapgit_frontend_services$directory_create(INPUT) { let iv_directory = INPUT?.iv_directory; if (iv_directory?.getQualifiedName === undefined || iv_directory.getQualifiedName() !== "STRING") { iv_directory = undefined; } if (iv_directory === undefined) { iv_directory = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_directory); } let cv_rc = new abap.types.Integer({qualifiedName: "I"}); if (INPUT && INPUT.cv_rc) {cv_rc = INPUT.cv_rc;} try { await abap.Classes['CL_GUI_FRONTEND_SERVICES'].directory_create({directory: iv_directory, rc: cv_rc}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "DIRECTORY_CREATE_FAILED": abap.builtin.sy.get().subrc.set(1); break; case "CNTL_ERROR": abap.builtin.sy.get().subrc.set(2); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(3); break; case "DIRECTORY_ACCESS_DENIED": abap.builtin.sy.get().subrc.set(4); break; case "DIRECTORY_ALREADY_EXISTS": abap.builtin.sy.get().subrc.set(5); break; case "PATH_NOT_FOUND": abap.builtin.sy.get().subrc.set(6); break; case "UNKNOWN_ERROR": abap.builtin.sy.get().subrc.set(7); break; case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(8); break; case "WRONG_PARAMETER": abap.builtin.sy.get().subrc.set(9); break; default: abap.builtin.sy.get().subrc.set(10); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } } async zif_abapgit_frontend_services$directory_exist(INPUT) { let rv_exists = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); let iv_directory = INPUT?.iv_directory; if (iv_directory?.getQualifiedName === undefined || iv_directory.getQualifiedName() !== "STRING") { iv_directory = undefined; } if (iv_directory === undefined) { iv_directory = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_directory); } try { rv_exists.set(await abap.Classes['CL_GUI_FRONTEND_SERVICES'].directory_exist({directory: iv_directory})); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "CNTL_ERROR": abap.builtin.sy.get().subrc.set(1); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(2); break; case "WRONG_PARAMETER": abap.builtin.sy.get().subrc.set(3); break; case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(4); break; default: abap.builtin.sy.get().subrc.set(5); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } return rv_exists; } async zif_abapgit_frontend_services$execute(INPUT) { let iv_document = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_document) {iv_document.set(INPUT.iv_document);} let iv_application = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_application) {iv_application.set(INPUT.iv_application);} let iv_parameter = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_parameter) {iv_parameter.set(INPUT.iv_parameter);} let iv_default_directory = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_default_directory) {iv_default_directory.set(INPUT.iv_default_directory);} let iv_maximized = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_maximized) {iv_maximized.set(INPUT.iv_maximized);} let iv_minimized = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_minimized) {iv_minimized.set(INPUT.iv_minimized);} let iv_synchronous = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_synchronous) {iv_synchronous.set(INPUT.iv_synchronous);} let iv_operation = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_operation) {iv_operation.set(INPUT.iv_operation);} if (INPUT === undefined || INPUT.iv_operation === undefined) {iv_operation = abap.CharacterFactory.get(4, 'OPEN');} try { await abap.Classes['CL_GUI_FRONTEND_SERVICES'].execute({document: iv_document, application: iv_application, parameter: iv_parameter, default_directory: iv_default_directory, maximized: iv_maximized, minimized: iv_minimized, synchronous: iv_synchronous, operation: iv_operation}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "CNTL_ERROR": abap.builtin.sy.get().subrc.set(1); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(2); break; case "BAD_PARAMETER": abap.builtin.sy.get().subrc.set(3); break; case "FILE_NOT_FOUND": abap.builtin.sy.get().subrc.set(4); break; case "PATH_NOT_FOUND": abap.builtin.sy.get().subrc.set(5); break; case "FILE_EXTENSION_UNKNOWN": abap.builtin.sy.get().subrc.set(6); break; case "ERROR_EXECUTE_FAILED": abap.builtin.sy.get().subrc.set(7); break; case "SYNCHRONOUS_FAILED": abap.builtin.sy.get().subrc.set(8); break; case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(9); break; default: abap.builtin.sy.get().subrc.set(10); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } } async zif_abapgit_frontend_services$file_download(INPUT) { let iv_path = INPUT?.iv_path; if (iv_path?.getQualifiedName === undefined || iv_path.getQualifiedName() !== "STRING") { iv_path = undefined; } if (iv_path === undefined) { iv_path = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_path); } let iv_xstr = INPUT?.iv_xstr; if (iv_xstr?.getQualifiedName === undefined || iv_xstr.getQualifiedName() !== "XSTRING") { iv_xstr = undefined; } if (iv_xstr === undefined) { iv_xstr = new abap.types.XString({qualifiedName: "XSTRING"}).set(INPUT.iv_xstr); } let lt_rawdata = abap.types.TableFactory.construct(new abap.types.Hex({length: 200}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, ""); await abap.Classes['ZCL_ABAPGIT_CONVERT'].xstring_to_bintab({iv_xstr: iv_xstr, et_bintab: lt_rawdata}); try { await abap.Classes['CL_GUI_FRONTEND_SERVICES'].gui_download({bin_filesize: abap.builtin.xstrlen({val: iv_xstr}), filename: iv_path, filetype: abap.CharacterFactory.get(3, 'BIN'), data_tab: lt_rawdata}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "FILE_WRITE_ERROR": abap.builtin.sy.get().subrc.set(1); break; case "NO_BATCH": abap.builtin.sy.get().subrc.set(2); break; case "GUI_REFUSE_FILETRANSFER": abap.builtin.sy.get().subrc.set(3); break; case "INVALID_TYPE": abap.builtin.sy.get().subrc.set(4); break; case "NO_AUTHORITY": abap.builtin.sy.get().subrc.set(5); break; case "UNKNOWN_ERROR": abap.builtin.sy.get().subrc.set(6); break; case "HEADER_NOT_ALLOWED": abap.builtin.sy.get().subrc.set(7); break; case "SEPARATOR_NOT_ALLOWED": abap.builtin.sy.get().subrc.set(8); break; case "FILESIZE_NOT_ALLOWED": abap.builtin.sy.get().subrc.set(9); break; case "HEADER_TOO_LONG": abap.builtin.sy.get().subrc.set(10); break; case "DP_ERROR_CREATE": abap.builtin.sy.get().subrc.set(11); break; case "DP_ERROR_SEND": abap.builtin.sy.get().subrc.set(12); break; case "DP_ERROR_WRITE": abap.builtin.sy.get().subrc.set(13); break; case "UNKNOWN_DP_ERROR": abap.builtin.sy.get().subrc.set(14); break; case "ACCESS_DENIED": abap.builtin.sy.get().subrc.set(15); break; case "DP_OUT_OF_MEMORY": abap.builtin.sy.get().subrc.set(16); break; case "DISK_FULL": abap.builtin.sy.get().subrc.set(17); break; case "DP_TIMEOUT": abap.builtin.sy.get().subrc.set(18); break; case "FILE_NOT_FOUND": abap.builtin.sy.get().subrc.set(19); break; case "DATAPROVIDER_EXCEPTION": abap.builtin.sy.get().subrc.set(20); break; case "CONTROL_FLUSH_ERROR": abap.builtin.sy.get().subrc.set(21); break; case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(22); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(23); break; default: abap.builtin.sy.get().subrc.set(24); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } } async zif_abapgit_frontend_services$file_upload(INPUT) { let rv_xstr = new abap.types.XString({qualifiedName: "XSTRING"}); let iv_path = INPUT?.iv_path; if (iv_path?.getQualifiedName === undefined || iv_path.getQualifiedName() !== "STRING") { iv_path = undefined; } if (iv_path === undefined) { iv_path = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_path); } let lt_data = abap.types.TableFactory.construct(new abap.types.Hex({length: 255}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, ""); let lv_length = new abap.types.Integer({qualifiedName: "I"}); try { await abap.Classes['CL_GUI_FRONTEND_SERVICES'].gui_upload({filename: iv_path, filetype: abap.CharacterFactory.get(3, 'BIN'), filelength: lv_length, data_tab: lt_data}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "FILE_OPEN_ERROR": abap.builtin.sy.get().subrc.set(1); break; case "FILE_READ_ERROR": abap.builtin.sy.get().subrc.set(2); break; case "NO_BATCH": abap.builtin.sy.get().subrc.set(3); break; case "GUI_REFUSE_FILETRANSFER": abap.builtin.sy.get().subrc.set(4); break; case "INVALID_TYPE": abap.builtin.sy.get().subrc.set(5); break; case "NO_AUTHORITY": abap.builtin.sy.get().subrc.set(6); break; case "UNKNOWN_ERROR": abap.builtin.sy.get().subrc.set(7); break; case "BAD_DATA_FORMAT": abap.builtin.sy.get().subrc.set(8); break; case "HEADER_NOT_ALLOWED": abap.builtin.sy.get().subrc.set(9); break; case "SEPARATOR_NOT_ALLOWED": abap.builtin.sy.get().subrc.set(10); break; case "HEADER_TOO_LONG": abap.builtin.sy.get().subrc.set(11); break; case "UNKNOWN_DP_ERROR": abap.builtin.sy.get().subrc.set(12); break; case "ACCESS_DENIED": abap.builtin.sy.get().subrc.set(13); break; case "DP_OUT_OF_MEMORY": abap.builtin.sy.get().subrc.set(14); break; case "DISK_FULL": abap.builtin.sy.get().subrc.set(15); break; case "DP_TIMEOUT": abap.builtin.sy.get().subrc.set(16); break; case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(17); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(18); break; default: abap.builtin.sy.get().subrc.set(19); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } abap.statements.concatenate({source: [lt_data], target: rv_xstr, lines: true}); rv_xstr.set(rv_xstr.getOffset({length: lv_length})); return rv_xstr; } async zif_abapgit_frontend_services$get_file_separator(INPUT) { let cv_file_separator = new abap.types.Character(1, {"qualifiedName":"zif_abapgit_frontend_services=>ty_char1"}); if (INPUT && INPUT.cv_file_separator) {cv_file_separator = INPUT.cv_file_separator;} try { await abap.Classes['CL_GUI_FRONTEND_SERVICES'].get_file_separator({file_separator: cv_file_separator}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(1); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(2); break; case "CNTL_ERROR": abap.builtin.sy.get().subrc.set(3); break; default: abap.builtin.sy.get().subrc.set(4); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } } async zif_abapgit_frontend_services$get_gui_version(INPUT) { let ev_gui_release = INPUT?.ev_gui_release || new abap.types.Numc({length: 4, qualifiedName: "zif_abapgit_frontend_services=>ty_gui_release"}); let ev_gui_sp = INPUT?.ev_gui_sp || new abap.types.Numc({length: 2, qualifiedName: "zif_abapgit_frontend_services=>ty_gui_sp"}); let ev_gui_patch = INPUT?.ev_gui_patch || new abap.types.Numc({length: 2, qualifiedName: "zif_abapgit_frontend_services=>ty_gui_patch"}); let ev_gui_version_string = INPUT?.ev_gui_version_string || new abap.types.String({qualifiedName: "STRING"}); let lt_version_table = abap.types.TableFactory.construct(new abap.types.Structure({ "filename": new abap.types.Character(1024, {"description":"FILENAME"})}, "FILE_TABLE", "FILE_TABLE", {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "FILETABLE"); let lv_rc = new abap.types.Integer({qualifiedName: "I"}); let ls_version = new abap.types.Structure({ "filename": new abap.types.Character(1024, {"description":"FILENAME"})}, "FILE_TABLE", "FILE_TABLE", {}, {}); try { await abap.Classes['CL_GUI_FRONTEND_SERVICES'].get_gui_version({version_table: lt_version_table, rc: lv_rc}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "GET_GUI_VERSION_FAILED": abap.builtin.sy.get().subrc.set(1); break; case "CANT_WRITE_VERSION_TABLE": abap.builtin.sy.get().subrc.set(2); break; case "GUI_NO_VERSION": abap.builtin.sy.get().subrc.set(3); break; case "CNTL_ERROR": abap.builtin.sy.get().subrc.set(4); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(5); break; case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(6); break; default: abap.builtin.sy.get().subrc.set(7); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } abap.statements.readTable(lt_version_table,{index: abap.IntegerFactory.get(1), into: ls_version}); ev_gui_release.set(ls_version.get().filename); abap.statements.readTable(lt_version_table,{index: abap.IntegerFactory.get(2), into: ls_version}); ev_gui_sp.set(ls_version.get().filename); abap.statements.readTable(lt_version_table,{index: abap.IntegerFactory.get(3), into: ls_version}); ev_gui_patch.set(ls_version.get().filename); ev_gui_version_string.set(new abap.types.String().set(`${abap.templateFormatting(ev_gui_release)}.${abap.templateFormatting(abap.builtin.condense({val: ev_gui_sp}))}.${abap.templateFormatting(abap.builtin.condense({val: ev_gui_patch}))}`)); } async zif_abapgit_frontend_services$get_system_directory(INPUT) { let cv_system_directory = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.cv_system_directory) {cv_system_directory = INPUT.cv_system_directory;} try { await abap.Classes['CL_GUI_FRONTEND_SERVICES'].get_system_directory({system_directory: cv_system_directory}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "CNTL_ERROR": abap.builtin.sy.get().subrc.set(1); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(2); break; case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(3); break; default: abap.builtin.sy.get().subrc.set(4); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } } async zif_abapgit_frontend_services$gui_is_available() { let rv_gui_is_available = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); try { if (abap.FunctionModules['GUI_IS_AVAILABLE'] === undefined) { if (abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()] === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_FUNC not found"; } else { throw new abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()]();} } await abap.FunctionModules['GUI_IS_AVAILABLE']({importing: {return: rv_gui_is_available}}); } catch (e) { if ((abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'] && e instanceof abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'])) { return rv_gui_is_available; } else { throw e; } } return rv_gui_is_available; } async zif_abapgit_frontend_services$is_sapgui_for_java() { let rv_result = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); try { if (abap.FunctionModules['GUI_HAS_JAVABEANS'] === undefined) { if (abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()] === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_FUNC not found"; } else { throw new abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()]();} } await abap.FunctionModules['GUI_HAS_JAVABEANS']({importing: {return: rv_result}}); } catch (e) { if ((abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'] && e instanceof abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'])) { return rv_result; } else { throw e; } } return rv_result; } async zif_abapgit_frontend_services$is_sapgui_for_windows() { let rv_result = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); try { if (abap.FunctionModules['GUI_HAS_ACTIVEX'] === undefined) { if (abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()] === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_FUNC not found"; } else { throw new abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()]();} } await abap.FunctionModules['GUI_HAS_ACTIVEX']({importing: {return: rv_result}}); } catch (e) { if ((abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'] && e instanceof abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'])) { return rv_result; } else { throw e; } } return rv_result; } async zif_abapgit_frontend_services$is_webgui() { let rv_is_webgui = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); try { if (abap.FunctionModules['GUI_IS_ITS'] === undefined) { if (abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()] === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_FUNC not found"; } else { throw new abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()]();} } await abap.FunctionModules['GUI_IS_ITS']({importing: {return: rv_is_webgui}}); } catch (e) { if ((abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'] && e instanceof abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'])) { return rv_is_webgui; } else { throw e; } } return rv_is_webgui; } async zif_abapgit_frontend_services$open_ie_devtools() { let lv_system_directory = new abap.types.String({qualifiedName: "STRING"}); let lv_exe_full_path = new abap.types.String({qualifiedName: "STRING"}); if (abap.compare.eq((await this.zif_abapgit_frontend_services$is_sapgui_for_windows()), abap.builtin.abap_false)) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`IE DevTools not supported on frontend OS`)}); } await this.zif_abapgit_frontend_services$get_system_directory({cv_system_directory: lv_system_directory}); await abap.Classes['CL_GUI_CFW'].flush(); lv_exe_full_path.set(abap.operators.concat(lv_system_directory,new abap.types.String().set(`\\F12\\IEChooser.exe`))); await this.zif_abapgit_frontend_services$execute({iv_application: lv_exe_full_path}); } async zif_abapgit_frontend_services$show_file_open_dialog(INPUT) { let rv_path = new abap.types.String({qualifiedName: "STRING"}); let iv_title = INPUT?.iv_title; if (iv_title?.getQualifiedName === undefined || iv_title.getQualifiedName() !== "STRING") { iv_title = undefined; } if (iv_title === undefined) { iv_title = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_title); } let iv_extension = INPUT?.iv_extension; if (iv_extension?.getQualifiedName === undefined || iv_extension.getQualifiedName() !== "STRING") { iv_extension = undefined; } if (iv_extension === undefined) { iv_extension = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_extension); } let iv_default_filename = INPUT?.iv_default_filename; if (iv_default_filename?.getQualifiedName === undefined || iv_default_filename.getQualifiedName() !== "STRING") { iv_default_filename = undefined; } if (iv_default_filename === undefined) { iv_default_filename = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_default_filename); } let lt_file_table = abap.types.TableFactory.construct(new abap.types.Structure({ "filename": new abap.types.Character(1024, {"description":"FILENAME"})}, "FILE_TABLE", "FILE_TABLE", {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "FILETABLE"); let ls_file_table = new abap.types.Structure({ "filename": new abap.types.Character(1024, {"description":"FILENAME"})}, "FILE_TABLE", "FILE_TABLE", {}, {}); let lv_filter = new abap.types.String({qualifiedName: "STRING"}); let lv_action = new abap.types.Integer({qualifiedName: "I"}); let lv_rc = new abap.types.Integer({qualifiedName: "I"}); if (abap.compare.eq(iv_extension, abap.CharacterFactory.get(3, 'zip'))) { lv_filter.set(abap.operators.concat(abap.CharacterFactory.get(24, 'ZIP Files (*.zip)|*.zip|'),abap.Classes['CL_GUI_FRONTEND_SERVICES'].filetype_all)); } try { await abap.Classes['CL_GUI_FRONTEND_SERVICES'].file_open_dialog({window_title: iv_title, default_filename: iv_default_filename, file_filter: lv_filter, initial_directory: zcl_abapgit_frontend_services.gv_initial_folder, file_table: lt_file_table, rc: lv_rc, user_action: lv_action}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "FILE_OPEN_DIALOG_FAILED": abap.builtin.sy.get().subrc.set(1); break; case "CNTL_ERROR": abap.builtin.sy.get().subrc.set(2); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(3); break; case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(4); break; default: abap.builtin.sy.get().subrc.set(5); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } if (abap.compare.eq(lv_action, abap.Classes['CL_GUI_FRONTEND_SERVICES'].action_cancel)) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(9, 'Cancelled')}); } abap.statements.readTable(lt_file_table,{index: abap.IntegerFactory.get(1), into: ls_file_table}); abap.statements.assert(abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))); rv_path.set(ls_file_table.get().filename); zcl_abapgit_frontend_services.gv_initial_folder.set((await this.#get_path_from_fullname({iv_fullname: rv_path}))); return rv_path; } async zif_abapgit_frontend_services$show_file_save_dialog(INPUT) { let rv_path = new abap.types.String({qualifiedName: "STRING"}); let iv_title = INPUT?.iv_title; if (iv_title?.getQualifiedName === undefined || iv_title.getQualifiedName() !== "STRING") { iv_title = undefined; } if (iv_title === undefined) { iv_title = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_title); } let iv_extension = INPUT?.iv_extension; if (iv_extension?.getQualifiedName === undefined || iv_extension.getQualifiedName() !== "STRING") { iv_extension = undefined; } if (iv_extension === undefined) { iv_extension = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_extension); } let iv_default_filename = INPUT?.iv_default_filename; if (iv_default_filename?.getQualifiedName === undefined || iv_default_filename.getQualifiedName() !== "STRING") { iv_default_filename = undefined; } if (iv_default_filename === undefined) { iv_default_filename = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_default_filename); } let lv_action = new abap.types.Integer({qualifiedName: "I"}); let lv_filter = new abap.types.String({qualifiedName: "STRING"}); let lv_filename = new abap.types.String({qualifiedName: "STRING"}); let lv_path = new abap.types.String({qualifiedName: "STRING"}); if (abap.compare.eq(iv_extension, abap.CharacterFactory.get(3, 'zip'))) { lv_filter.set(abap.operators.concat(abap.CharacterFactory.get(24, 'ZIP Files (*.zip)|*.zip|'),abap.Classes['CL_GUI_FRONTEND_SERVICES'].filetype_all)); } try { await abap.Classes['CL_GUI_FRONTEND_SERVICES'].file_save_dialog({window_title: iv_title, default_extension: iv_extension, default_file_name: iv_default_filename, file_filter: lv_filter, initial_directory: zcl_abapgit_frontend_services.gv_initial_folder, filename: lv_filename, path: lv_path, fullpath: rv_path, user_action: lv_action}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "CNTL_ERROR": abap.builtin.sy.get().subrc.set(1); break; case "ERROR_NO_GUI": abap.builtin.sy.get().subrc.set(2); break; case "NOT_SUPPORTED_BY_GUI": abap.builtin.sy.get().subrc.set(3); break; default: abap.builtin.sy.get().subrc.set(4); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } if (abap.compare.eq(lv_action, abap.Classes['CL_GUI_FRONTEND_SERVICES'].action_cancel)) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(9, 'Cancelled')}); } zcl_abapgit_frontend_services.gv_initial_folder.set(lv_path); return rv_path; } } abap.Classes['ZCL_ABAPGIT_FRONTEND_SERVICES'] = zcl_abapgit_frontend_services; zcl_abapgit_frontend_services.gv_initial_folder = new abap.types.String({qualifiedName: "STRING"}); export {zcl_abapgit_frontend_services}; |