├── APO BAPIs Class ├── NUGG_APO_BAPI_CLASS.nugg └── README.md ├── BDC Class ├── NUGG_BDC_CLASS └── README.md ├── Performance-Examples ├── NUGG_ABAPZOMBIE_PERFORMANCE_EXAMPLES.NUGG └── README.md ├── README.md └── Screen-Examples ├── NUGG_ZOMBIE_SCREEN_EXAMPLES.nugg └── README.md /APO BAPIs Class/NUGG_APO_BAPI_CLASS.nugg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abapzombie/ABAP-Toolbox/5544205b1a66df642a5f404a1efd191838b101d5/APO BAPIs Class/NUGG_APO_BAPI_CLASS.nugg -------------------------------------------------------------------------------- /APO BAPIs Class/README.md: -------------------------------------------------------------------------------- 1 | Classes to help with APO BAPIs. Consistent data accesses in APO are usually made by BAPIs that are in sync with APO's Live Cache and they are all called using the same basic code structure. These classes cover basic data retrieving and document deletion. 2 | 3 | BAPI List: 4 | 5 | BAPI_MOSRVAPS_DELEMULTI 6 | BAPI_MOSRVAPS_GETLIST2 7 | BAPI_PDSSRVAPS_GETLIST 8 | BAPI_POSRVAPS_GETLIST3 9 | BAPI_POSRVAPS_REMOVEITEMS 10 | BAPI_PRDSRVAPS_SAVEMULTI2 11 | BAPI_PROCRELATION_DELETEMULTI2 12 | BAPI_PROCRELATION_GETLIST2 13 | BAPI_QTASRVAPS_DELMULTI 14 | BAPI_QTASRVAPS_GETLIST2 15 | BAPI_SLSRVAPS_DELMULTI 16 | BAPI_SLSRVAPS_GETLIST2 17 | 18 | 19 | You can add the parameters as you want for each BAPI Method, just remember to set them as Opitional parameters, so you won't break any other development that is already using the class. -------------------------------------------------------------------------------- /BDC Class/NUGG_BDC_CLASS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abapzombie/ABAP-Toolbox/5544205b1a66df642a5f404a1efd191838b101d5/BDC Class/NUGG_BDC_CLASS -------------------------------------------------------------------------------- /BDC Class/README.md: -------------------------------------------------------------------------------- 1 | Class abstractions to improve readability of BDC recipes. -------------------------------------------------------------------------------- /Performance-Examples/NUGG_ABAPZOMBIE_PERFORMANCE_EXAMPLES.NUGG: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *----------------------------------------------------------------------* 10 | * === ABAP ZOMBIE PRESENTS === * 11 | *----------------------------------------------------------------------* 12 | * Selection Screen Examples * 13 | *----------------------------------------------------------------------* 14 | * Description -> Compare different code snipets and check wich one is * 15 | * faster! * 16 | * Date -> Dez 13, 2011 * 17 | * SAP Version -> 6.0 * 18 | *----------------------------------------------------------------------* 19 | * ABAP Zombie Staff: Mauricio Roberto Cruz * 20 | * Mauro Cesar Laranjeira * 21 | * Priscila Silva 22 | *----------------------------------------------------------------------* 23 | * Please, visit us at http://abapzombie.com/ and drop a Comment! * 24 | *----------------------------------------------------------------------* 25 | REPORT zombie_performance_examples. 26 | 27 | 28 | *--------------------------------------------------------------------* 29 | * Report Main Screen 30 | *--------------------------------------------------------------------* 31 | SELECTION-SCREEN BEGIN OF BLOCK bl01 WITH FRAME TITLE text-001. 32 | 33 | PARAMETERS: p_both RADIOBUTTON GROUP rb01, 34 | p_test1 RADIOBUTTON GROUP rb01, 35 | p_test2 RADIOBUTTON GROUP rb01. 36 | 37 | SELECTION-SCREEN END OF BLOCK bl01. 38 | 39 | SELECTION-SCREEN BEGIN OF BLOCK bl02 WITH FRAME TITLE text-002. 40 | 41 | PARAMETERS: p_01 RADIOBUTTON GROUP rb02, 42 | p_02 RADIOBUTTON GROUP rb02, 43 | p_03 RADIOBUTTON GROUP rb02, 44 | p_04 RADIOBUTTON GROUP rb02, 45 | p_05 RADIOBUTTON GROUP rb02, 46 | p_06 RADIOBUTTON GROUP rb02, 47 | p_07 RADIOBUTTON GROUP rb02, 48 | p_08 RADIOBUTTON GROUP rb02, 49 | p_09 RADIOBUTTON GROUP rb02, 50 | p_10 RADIOBUTTON GROUP rb02, 51 | p_11 RADIOBUTTON GROUP rb02, 52 | p_12 RADIOBUTTON GROUP rb02, 53 | p_13 RADIOBUTTON GROUP rb02, 54 | p_14 RADIOBUTTON GROUP rb02. 55 | 56 | SELECTION-SCREEN END OF BLOCK bl02. 57 | *--------------------------------------------------------------------* 58 | * Class - Examples Handler 59 | *--------------------------------------------------------------------* 60 | CLASS lcl_compare DEFINITION. 61 | 62 | PUBLIC SECTION. 63 | METHODS constructor IMPORTING comptype TYPE char5. 64 | METHODS compare_command IMPORTING compnum TYPE char2. 65 | 66 | PRIVATE SECTION. 67 | TYPES: BEGIN OF ty_sbook, 68 | carrid TYPE sbook-carrid, 69 | connid TYPE sbook-connid, 70 | fldate TYPE sbook-fldate, 71 | bookid TYPE sbook-bookid, 72 | passname TYPE sbook-passname, 73 | END OF ty_sbook. 74 | 75 | TYPES: BEGIN OF ty_sflight, 76 | carrid TYPE sflight-carrid, 77 | connid TYPE sflight-connid, 78 | END OF ty_sflight. 79 | 80 | DATA: v_test1 TYPE char1, 81 | v_test2 TYPE char1. 82 | 83 | DATA: t_sflight TYPE TABLE OF ty_sflight, 84 | t_sbook TYPE TABLE OF ty_sbook, 85 | t_sbook_aux TYPE TABLE OF ty_sbook, 86 | lwa_sflight LIKE LINE OF t_sflight, 87 | lwa_sbook LIKE LINE OF t_sbook. 88 | 89 | METHODS command_01 IMPORTING test1 TYPE char1 OPTIONAL 90 | test2 TYPE char1 OPTIONAL. 91 | METHODS command_02 IMPORTING test1 TYPE char1 OPTIONAL 92 | test2 TYPE char1 OPTIONAL. 93 | METHODS command_03 IMPORTING test1 TYPE char1 OPTIONAL 94 | test2 TYPE char1 OPTIONAL. 95 | METHODS command_04 IMPORTING test1 TYPE char1 OPTIONAL 96 | test2 TYPE char1 OPTIONAL. 97 | METHODS command_05 IMPORTING test1 TYPE char1 OPTIONAL 98 | test2 TYPE char1 OPTIONAL. 99 | METHODS command_06 IMPORTING test1 TYPE char1 OPTIONAL 100 | test2 TYPE char1 OPTIONAL. 101 | METHODS command_07 IMPORTING test1 TYPE char1 OPTIONAL 102 | test2 TYPE char1 OPTIONAL. 103 | METHODS command_08 IMPORTING test1 TYPE char1 OPTIONAL 104 | test2 TYPE char1 OPTIONAL. 105 | METHODS command_09 IMPORTING test1 TYPE char1 OPTIONAL 106 | test2 TYPE char1 OPTIONAL. 107 | METHODS command_10 IMPORTING test1 TYPE char1 OPTIONAL 108 | test2 TYPE char1 OPTIONAL. 109 | METHODS command_11 IMPORTING test1 TYPE char1 OPTIONAL 110 | test2 TYPE char1 OPTIONAL. 111 | METHODS command_12 IMPORTING test1 TYPE char1 OPTIONAL 112 | test2 TYPE char1 OPTIONAL. 113 | METHODS command_13 IMPORTING test1 TYPE char1 OPTIONAL 114 | test2 TYPE char1 OPTIONAL. 115 | METHODS command_14 IMPORTING test1 TYPE char1 OPTIONAL 116 | test2 TYPE char1 OPTIONAL. 117 | 118 | ENDCLASS. "lcl_compare DEFINITION 119 | 120 | *----------------------------------------------------------------------* 121 | * CLASS lcl_compare IMPLEMENTATION 122 | *----------------------------------------------------------------------* 123 | * 124 | *----------------------------------------------------------------------* 125 | CLASS lcl_compare IMPLEMENTATION. 126 | 127 | METHOD constructor. 128 | 129 | CASE comptype. 130 | WHEN 'TEST1'. 131 | me->v_test1 = 'X'. 132 | WHEN 'TEST2'. 133 | me->v_test2 = 'X'. 134 | WHEN 'BOTH'. 135 | me->v_test1 = 'X'. 136 | me->v_test2 = 'X'. 137 | ENDCASE. 138 | 139 | ENDMETHOD. "constructor 140 | 141 | METHOD compare_command. 142 | 143 | DATA: l_methname TYPE string. 144 | 145 | DATA: l_before TYPE timestampl, 146 | l_after TYPE timestampl, 147 | l_result TYPE timestampl. 148 | 149 | CONCATENATE 'COMMAND_' compnum INTO l_methname. 150 | 151 | IF me->v_test1 = 'X'. 152 | SKIP 1. 153 | GET TIME STAMP FIELD l_before. 154 | CALL METHOD me->(l_methname) 155 | EXPORTING 156 | test1 = 'X'. 157 | GET TIME STAMP FIELD l_after. 158 | l_result = l_after - l_before. 159 | WRITE: 'Test 1 Duration: ' COLOR COL_GROUP, 160 | 50 l_result. 161 | SKIP 1. 162 | ENDIF. 163 | 164 | CLEAR: l_result, l_after, l_before. 165 | 166 | IF me->v_test2 = 'X'. 167 | GET TIME STAMP FIELD l_before. 168 | CALL METHOD me->(l_methname) 169 | EXPORTING 170 | test2 = 'X'. 171 | GET TIME STAMP FIELD l_after. 172 | l_result = l_after - l_before. 173 | WRITE: 'Test 2 Duration: ' COLOR COL_POSITIVE, 174 | 50 l_result. 175 | ENDIF. 176 | 177 | ENDMETHOD. "compare_command 178 | 179 | METHOD command_01. 180 | *--------------------------------------------------------------------* 181 | * Select..EndSelect vs. Array Fetch 182 | *--------------------------------------------------------------------* 183 | CASE 'X'. 184 | 185 | * SELECT...ENDSELECT 186 | WHEN test1. 187 | 188 | SELECT carrid 189 | connid 190 | fldate 191 | bookid 192 | FROM sbook 193 | UP TO 30000 ROWS 194 | INTO lwa_sbook. 195 | APPEND lwa_sbook TO t_sbook. 196 | ENDSELECT. 197 | 198 | 199 | * ARRAY FETCH 200 | WHEN test2. 201 | 202 | SELECT carrid 203 | connid 204 | fldate 205 | bookid 206 | FROM sbook 207 | INTO TABLE t_sbook 208 | UP TO 30000 ROWS. 209 | 210 | ENDCASE. 211 | 212 | ENDMETHOD. "command_01 213 | 214 | METHOD command_02. 215 | *--------------------------------------------------------------------* 216 | * RANGEs - CAUTION! 217 | *--------------------------------------------------------------------* 218 | DATA: rg_carrid TYPE RANGE OF sbook-carrid, 219 | lwa_carrid LIKE LINE OF rg_carrid. 220 | 221 | CASE 'X'. 222 | 223 | * Not Equal! Caution! 224 | WHEN test1. 225 | 226 | lwa_carrid-low = 'JP'. 227 | lwa_carrid-option = 'NE'. 228 | lwa_carrid-sign = 'I'. 229 | APPEND lwa_carrid TO rg_carrid. 230 | 231 | * Equal - OK 232 | WHEN test2. 233 | 234 | lwa_carrid-low = 'JP'. 235 | lwa_carrid-option = 'EQ'. 236 | lwa_carrid-sign = 'I'. 237 | APPEND lwa_carrid TO rg_carrid. 238 | 239 | ENDCASE. 240 | 241 | SELECT carrid 242 | connid 243 | fldate 244 | bookid 245 | FROM sbook 246 | INTO TABLE t_sbook 247 | UP TO 50000 ROWS 248 | WHERE carrid IN rg_carrid. 249 | 250 | ENDMETHOD. "command_02 251 | 252 | METHOD command_03. 253 | *--------------------------------------------------------------------* 254 | * FOR ALL ENTRIES vs. INNER JOIN 255 | *--------------------------------------------------------------------* 256 | CASE 'X'. 257 | 258 | * FOR ALL ENTRIES 259 | WHEN test1. 260 | 261 | SELECT carrid 262 | connid 263 | FROM sflight 264 | INTO TABLE t_sflight 265 | WHERE carrid = 'AA'. 266 | 267 | DELETE ADJACENT DUPLICATES FROM t_sflight 268 | COMPARING carrid connid. 269 | 270 | SELECT carrid 271 | connid 272 | fldate 273 | bookid 274 | FROM sbook 275 | INTO TABLE t_sbook 276 | UP TO 10000 ROWS 277 | FOR ALL ENTRIES IN t_sflight 278 | WHERE carrid = t_sflight-carrid 279 | AND connid = t_sflight-connid. 280 | 281 | * INNER JOIN 282 | WHEN test2. 283 | 284 | SELECT a~carrid 285 | a~connid 286 | b~fldate 287 | b~bookid 288 | FROM sflight AS a INNER JOIN sbook AS b 289 | ON a~carrid = b~carrid AND 290 | a~connid = b~connid 291 | INTO TABLE t_sbook 292 | UP TO 10000 ROWS 293 | WHERE a~carrid = 'AA'. 294 | 295 | 296 | ENDCASE. 297 | 298 | ENDMETHOD. "command_03 299 | 300 | METHOD command_04. 301 | *--------------------------------------------------------------------* 302 | * READ TABLE WITHOUT BINARY SEARCH 303 | *--------------------------------------------------------------------* 304 | SELECT carrid 305 | connid 306 | FROM sflight 307 | INTO TABLE t_sflight 308 | WHERE carrid = 'AA'. 309 | 310 | SELECT carrid 311 | connid 312 | fldate 313 | bookid 314 | FROM sbook 315 | INTO TABLE t_sbook 316 | UP TO 500000 ROWS 317 | WHERE carrid = 'AA'. 318 | 319 | CASE 'X'. 320 | 321 | * READ TABLE 322 | WHEN test1. 323 | LOOP AT t_sbook INTO lwa_sbook. 324 | READ TABLE t_sflight INTO lwa_sflight WITH KEY 325 | carrid = lwa_sbook-carrid 326 | connid = lwa_sbook-connid. 327 | ENDLOOP. 328 | 329 | * READ TABLE BINARY SEARCH 330 | WHEN test2. 331 | * Do not forget to SORT the table before BINARY SEARCH 332 | LOOP AT t_sbook INTO lwa_sbook. 333 | READ TABLE t_sflight INTO lwa_sflight WITH KEY 334 | carrid = lwa_sbook-carrid 335 | connid = lwa_sbook-connid 336 | BINARY SEARCH. 337 | ENDLOOP. 338 | ENDCASE. 339 | 340 | ENDMETHOD. "command_04 341 | 342 | METHOD command_05. 343 | *--------------------------------------------------------------------* 344 | * Select inside LOOP Statement 345 | *--------------------------------------------------------------------* 346 | SELECT carrid 347 | connid 348 | fldate 349 | bookid 350 | FROM sbook 351 | INTO TABLE t_sbook 352 | UP TO 200000 ROWS 353 | WHERE carrid = 'AA'. 354 | 355 | CASE 'X'. 356 | 357 | * SELECT inside LOOPs 358 | WHEN test1. 359 | 360 | LOOP AT t_sbook INTO lwa_sbook. 361 | SELECT SINGLE carrid 362 | connid 363 | FROM sflight 364 | INTO lwa_sflight 365 | WHERE carrid = lwa_sbook-carrid 366 | AND connid = lwa_sbook-connid. 367 | 368 | ENDLOOP. 369 | 370 | * SELECT without LOOPs 371 | WHEN test2. 372 | 373 | t_sbook_aux[] = t_sbook[]. 374 | SORT t_sbook_aux BY carrid connid. 375 | DELETE ADJACENT DUPLICATES FROM t_sbook_aux 376 | COMPARING carrid 377 | connid. 378 | 379 | SELECT carrid 380 | connid 381 | FROM sflight 382 | INTO TABLE t_sflight 383 | FOR ALL ENTRIES IN t_sbook_aux 384 | WHERE carrid = t_sbook_aux-carrid 385 | AND connid = t_sbook_aux-connid. 386 | 387 | LOOP AT t_sbook INTO lwa_sbook. 388 | READ TABLE t_sflight INTO lwa_sflight WITH KEY 389 | carrid = lwa_sbook-carrid 390 | connid = lwa_sbook-connid 391 | BINARY SEARCH. 392 | ENDLOOP. 393 | 394 | ENDCASE. 395 | 396 | ENDMETHOD. "command_05 397 | 398 | METHOD command_06. 399 | *--------------------------------------------------------------------* 400 | * Massive Update to DB Tables 401 | * The same concept can be applied to INSERT, DELETE and UPDATE 402 | *--------------------------------------------------------------------* 403 | 404 | DATA: t_sbook TYPE TABLE OF sbook, 405 | lwa_sbook LIKE LINE OF t_sbook. 406 | 407 | SELECT * 408 | FROM sbook 409 | INTO TABLE t_sbook 410 | UP TO 100000 ROWS 411 | WHERE carrid = 'AA'. 412 | 413 | * MODIFY inside LOOPs 414 | CASE 'X'. 415 | WHEN test1. 416 | LOOP AT t_sbook INTO lwa_sbook. 417 | MODIFY sbook FROM lwa_sbook. 418 | ENDLOOP. 419 | 420 | * MODIFY From Table 421 | WHEN test2. 422 | MODIFY sbook FROM TABLE t_sbook. 423 | 424 | ENDCASE. 425 | 426 | ENDMETHOD. "command_06 427 | 428 | METHOD command_07. 429 | *--------------------------------------------------------------------* 430 | * SELECT INTO CORRESPODING FIELDS 431 | *--------------------------------------------------------------------* 432 | CASE 'X'. 433 | 434 | * SELECT INTO CORRESPONDING FIELDS 435 | WHEN test1. 436 | SELECT * 437 | FROM sbook 438 | INTO CORRESPONDING FIELDS OF TABLE t_sbook 439 | UP TO 100000 ROWS. 440 | 441 | * SELECT ARRAY FETCH 442 | WHEN test2. 443 | SELECT carrid 444 | connid 445 | fldate 446 | bookid 447 | FROM sbook 448 | INTO TABLE t_sbook 449 | UP TO 100000 ROWS. 450 | 451 | ENDCASE. 452 | 453 | ENDMETHOD. "command_07 454 | 455 | METHOD command_08. 456 | *--------------------------------------------------------------------* 457 | * LOOP WHERE vs. LOOP with BINARY SEARCH 458 | *--------------------------------------------------------------------* 459 | SELECT carrid 460 | connid 461 | fldate 462 | bookid 463 | FROM sbook 464 | INTO TABLE t_sbook 465 | UP TO 100000 ROWS. 466 | 467 | CASE 'X'. 468 | 469 | * LOOP WHERE 470 | WHEN test1. 471 | LOOP AT t_sbook INTO lwa_sbook WHERE carrid = 'AA'. 472 | ENDLOOP. 473 | 474 | * LOOP BINARY SEARCH 475 | WHEN test2. 476 | SORT t_sbook BY carrid. 477 | READ TABLE t_sbook INTO lwa_sbook WITH KEY 478 | carrid = 'AA' 479 | BINARY SEARCH. 480 | 481 | LOOP AT t_sbook INTO lwa_sbook FROM sy-tabix. 482 | IF lwa_sbook-carrid <> 'AA'. 483 | EXIT. 484 | ENDIF. 485 | ENDLOOP. 486 | 487 | ENDCASE. 488 | 489 | ENDMETHOD. "command_08 490 | 491 | METHOD command_09. 492 | *--------------------------------------------------------------------* 493 | * MOVE CORRESPONDING 494 | *--------------------------------------------------------------------* 495 | 496 | DATA: t_sbook TYPE TABLE OF sbook, 497 | lwa_sbook TYPE sbook. 498 | 499 | SELECT * 500 | FROM sbook 501 | INTO TABLE t_sbook 502 | UP TO 200000 ROWS. 503 | 504 | * MOVE CORRESPODING 505 | CASE 'X'. 506 | WHEN test1. 507 | 508 | LOOP AT t_sbook INTO lwa_sbook. 509 | MOVE-CORRESPONDING lwa_sbook TO lwa_sflight. 510 | ENDLOOP. 511 | 512 | * MOVE SPECIFYING FIELDS 513 | WHEN test2. 514 | 515 | LOOP AT t_sbook INTO lwa_sbook. 516 | lwa_sflight-carrid = lwa_sbook-carrid. 517 | lwa_sflight-connid = lwa_sbook-connid. 518 | ENDLOOP. 519 | ENDCASE. 520 | 521 | 522 | ENDMETHOD. "command_09 523 | 524 | METHOD command_10. 525 | *--------------------------------------------------------------------* 526 | * INDEX EXAMPLES 527 | *--------------------------------------------------------------------* 528 | 529 | DATA: rg_buspart TYPE RANGE OF s_buspanum, 530 | lwa_buspart LIKE LINE OF rg_buspart. 531 | 532 | lwa_buspart-sign = 'I'. 533 | lwa_buspart-option = 'EQ'. 534 | lwa_buspart-low = '00003640'. 535 | APPEND lwa_buspart TO rg_buspart. 536 | 537 | CASE 'X'. 538 | 539 | * INDEX USAGE EXAMPLE 540 | WHEN test1. 541 | 542 | SELECT carrid 543 | connid 544 | fldate 545 | bookid 546 | FROM sbook 547 | INTO TABLE t_sbook 548 | UP TO 200000 ROWS 549 | WHERE agencynum IN rg_buspart. 550 | 551 | * ANOTHER INDEX USAGE EXAMPLE 552 | WHEN test2. 553 | 554 | SELECT carrid 555 | connid 556 | fldate 557 | bookid 558 | FROM sbook 559 | INTO TABLE t_sbook 560 | UP TO 200000 ROWS 561 | WHERE customid IN rg_buspart. 562 | 563 | ENDCASE. 564 | 565 | ENDMETHOD. "command_10 566 | 567 | METHOD command_11. 568 | 569 | *--------------------------------------------------------------------* 570 | * INNER JOIN PARTIAL KEY vs INNER JOIN FULL PRIMARY KEY 571 | *--------------------------------------------------------------------* 572 | 573 | CASE 'X'. 574 | 575 | * INNER JOIN PARTIAL KEY 576 | WHEN test1. 577 | 578 | SELECT a~carrid 579 | a~connid 580 | b~fldate 581 | b~bookid 582 | FROM sflight AS a INNER JOIN sbook AS b 583 | ON a~carrid = b~carrid" AND 584 | * a~connid = b~connid 585 | INTO TABLE t_sbook 586 | UP TO 100000 ROWS 587 | WHERE a~carrid = 'AA'. 588 | 589 | * INNER JOIN FULL PRIMARY KEY 590 | WHEN test2. 591 | 592 | SELECT a~carrid 593 | a~connid 594 | b~fldate 595 | b~bookid 596 | FROM sflight AS a INNER JOIN sbook AS b 597 | ON a~carrid = b~carrid AND 598 | a~connid = b~connid 599 | INTO TABLE t_sbook 600 | UP TO 100000 ROWS 601 | WHERE a~carrid = 'AA'. 602 | 603 | 604 | 605 | ENDCASE. 606 | 607 | ENDMETHOD. "command_11 608 | 609 | METHOD command_12. 610 | 611 | *--------------------------------------------------------------------* 612 | * LOOP ASSIGNING 613 | *--------------------------------------------------------------------* 614 | 615 | DATA: lwa_sbook LIKE LINE OF t_sbook. 616 | 617 | FIELD-SYMBOLS: <fs_sbook> LIKE LINE OF t_sbook. 618 | 619 | SELECT a~carrid 620 | a~connid 621 | b~fldate 622 | b~bookid 623 | FROM sflight AS a INNER JOIN sbook AS b 624 | ON a~carrid = b~carrid AND 625 | a~connid = b~connid 626 | INTO TABLE t_sbook 627 | UP TO 200000 ROWS 628 | WHERE a~carrid = 'AA'. 629 | 630 | CASE 'X'. 631 | 632 | * TEST 1 633 | WHEN test1. 634 | 635 | LOOP AT t_sbook INTO lwa_sbook. 636 | lwa_sbook-carrid = 'BB'. 637 | MODIFY t_sbook FROM lwa_sbook INDEX sy-tabix. 638 | ENDLOOP. 639 | 640 | * TEST 2 641 | WHEN test2. 642 | 643 | LOOP AT t_sbook ASSIGNING <fs_sbook>. 644 | <fs_sbook>-carrid = 'BB'. 645 | ENDLOOP. 646 | 647 | ENDCASE. 648 | 649 | ENDMETHOD. "command_12 650 | 651 | METHOD command_13. 652 | *--------------------------------------------------------------------* 653 | * SubQuery 654 | *--------------------------------------------------------------------* 655 | CASE 'X'. 656 | 657 | * TEST 1 658 | WHEN test1. 659 | 660 | SELECT carrid 661 | connid 662 | FROM sflight 663 | INTO TABLE t_sflight 664 | WHERE carrid = 'AA'. 665 | 666 | DELETE ADJACENT DUPLICATES FROM t_sflight 667 | COMPARING carrid connid. 668 | 669 | SELECT carrid 670 | connid 671 | fldate 672 | bookid 673 | FROM sbook 674 | INTO TABLE t_sbook 675 | UP TO 10000 ROWS 676 | FOR ALL ENTRIES IN t_sflight 677 | WHERE carrid = t_sflight-carrid 678 | AND connid = t_sflight-connid. 679 | 680 | * TEST 2 681 | WHEN test2. 682 | 683 | SELECT carrid 684 | connid 685 | fldate 686 | bookid 687 | FROM sbook 688 | INTO TABLE t_sbook 689 | UP TO 10000 ROWS 690 | WHERE EXISTS ( SELECT * 691 | FROM sflight 692 | WHERE carrid = 'AA' 693 | AND connid = sbook~connid ). 694 | ENDCASE. 695 | 696 | 697 | ENDMETHOD. "command_13 698 | 699 | METHOD command_14. 700 | *--------------------------------------------------------------------* 701 | * New Test 702 | *--------------------------------------------------------------------* 703 | CASE 'X'. 704 | 705 | * TEST 1 706 | WHEN test1. 707 | 708 | 709 | * TEST 2 710 | WHEN test2. 711 | 712 | ENDCASE. 713 | 714 | 715 | ENDMETHOD. "command_14 716 | 717 | ENDCLASS. "lcl_compare IMPLEMENTATION 718 | 719 | DATA: o_comp TYPE REF TO lcl_compare. 720 | DATA: v_comm TYPE char2. 721 | 722 | *--------------------------------------------------------------------* 723 | * Event INITIALIZATION 724 | *--------------------------------------------------------------------* 725 | INITIALIZATION. 726 | 727 | PERFORM f_create_texts. 728 | 729 | *&---------------------------------------------------------------------* 730 | *& Form F_CREATE_TEXTS 731 | *&---------------------------------------------------------------------* 732 | FORM f_create_texts . 733 | %_p_both_%_app_%-text = 'Run Both Examples'. 734 | %_p_test1_%_app_%-text = 'Run Test 1'. 735 | %_p_test2_%_app_%-text = 'Run Test 2'. 736 | %_p_01_%_app_%-text = '01: SELECT... ENDSELECT'. 737 | %_p_02_%_app_%-text = '02: RANGEs'. 738 | %_p_03_%_app_%-text = '03: F.A.E. vs INNER JOIN'. 739 | %_p_04_%_app_%-text = '04: READ TABLE Binary Search'. 740 | %_p_05_%_app_%-text = '05: SELECT inside LOOPs'. 741 | %_p_06_%_app_%-text = '06: Massive Update to DB '. 742 | %_p_07_%_app_%-text = '07: SELECT Into Corresponding F.'. 743 | %_p_08_%_app_%-text = '08: LOOP WHERE vs BINARY LOOP'. 744 | %_p_09_%_app_%-text = '09: MOVE-CORRESPONDING'. 745 | %_p_10_%_app_%-text = '10: Usage of Indexes'. 746 | %_p_11_%_app_%-text = '11: Inner Join Full vs Partial'. 747 | %_p_12_%_app_%-text = '12: Loop Assigning'. 748 | %_p_13_%_app_%-text = '13: Subquery'. 749 | %_p_14_%_app_%-text = '14: Place your test HERE!'. 750 | ENDFORM. " F_CREATE_TEXTS 751 | 752 | *--------------------------------------------------------------------* 753 | * Event Start-Of-Selection 754 | *--------------------------------------------------------------------* 755 | START-OF-SELECTION. 756 | 757 | CASE 'X'. 758 | WHEN p_test1. 759 | CREATE OBJECT o_comp 760 | EXPORTING 761 | comptype = 'TEST1'. 762 | WHEN p_test2. 763 | CREATE OBJECT o_comp 764 | EXPORTING 765 | comptype = 'TEST2'. 766 | WHEN p_both. 767 | CREATE OBJECT o_comp 768 | EXPORTING 769 | comptype = 'BOTH'. 770 | ENDCASE. 771 | 772 | CASE 'X'. 773 | WHEN p_01. 774 | v_comm = '01'. 775 | WHEN p_02. 776 | v_comm = '02'. 777 | WHEN p_03. 778 | v_comm = '03'. 779 | WHEN p_04. 780 | v_comm = '04'. 781 | WHEN p_05. 782 | v_comm = '05'. 783 | WHEN p_06. 784 | v_comm = '06'. 785 | WHEN p_07. 786 | v_comm = '07'. 787 | WHEN p_08. 788 | v_comm = '08'. 789 | WHEN p_09. 790 | v_comm = '09'. 791 | WHEN p_10. 792 | v_comm = '10'. 793 | WHEN p_11. 794 | v_comm = '11'. 795 | WHEN p_12. 796 | v_comm = '12'. 797 | WHEN p_13. 798 | v_comm = '13'. 799 | WHEN p_14. 800 | v_comm = '14'. 801 | ENDCASE. 802 | 803 | o_comp->compare_command( v_comm ). 804 | *----------------------------------------------------------------------* 805 | * === DISCLAIMER === * 806 | *----------------------------------------------------------------------* 807 | * This code is made only for study and reference purposes. It was not * 808 | * copied from any running program and it does not make references * 809 | * to any functional requirement. All code here was created based on * 810 | * the authors experience and creativity! Enjoy! * 811 | *----------------------------------------------------------------------* 812 | 813 | 814 | -------------------------------------------------------------------------------- /Performance-Examples/README.md: -------------------------------------------------------------------------------- 1 | :warning: _The way an ABAPer should deal with performance in his projects changed drastically since HANA came into play. Keep in mind that these comparisons were useful in the past (and might help you tackling performance problems in old systems) but are completely out of date for mordern ABAP developments (try checking out Horst Keller's content for some cool new ways of dealing with performance issues - https://people.sap.com/horst.keller)_ 2 | 3 | --- 4 | 5 | Originally published @ ABAPZombie - http://www.abapzombie.com/dicas-abap/2011/12/22/performance-comparacao-de-trechos-de-codigo/ 6 | 7 | ----- 8 | 9 | This small program was made as a support material for an ABAP Performance Tunning Course. It has 13 perform comparisons between different code techniques and is prepared to receive custom ones. 10 | 11 | Default Comparisons List: 12 | 13 | * Select… EndSelect 14 | * Ranges 15 | * For All Entries vs Inner Join 16 | * Read Table with Binary Search 17 | * Select inside Loops 18 | * Massive Update to DB Tables 19 | * SELECT Into Corresponding Fields 20 | * Loop Where vs "Binary" Loop (Loop + Read Binary Search) 21 | * Move-Corresponding 22 | * Usage of DB Indexes 23 | * Inner Join Full Key vs Partial Key 24 | * Loop Assigning 25 | * Subquery 26 | 27 | --- 28 | 29 | If you want to create your own comparison, do the following: 30 | 31 | Using PARAMETER_14 32 | 33 | * Add a description to parameters P_14 34 | * Search for "METHOD command_14" 35 | * Add the first code inside "WHEN test1", and the Second one inside "WHEN test2". 36 | * Run the program and choose Parameter 14 to test you code snippets. 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | :warning: _These codes were created 10+ years ago and are being kept here for reference purposes (tons of legacy code out there, right?). If you want to tackle any of these problems, you should first try looking for modern APIs on newer ABAP versions ([this](https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm) is a good start)._ 2 | 3 | NUGG Files, SAPLink and ABAPGit 4 | =============================== 5 | 6 | SAPLINK was one of the biggest open source projects from the ABAP community. Back then it was the only way a developer could copy whole ABAP projects from one system to another without involving a BASIS guy. You can check our SAPLINK's legacy on their website: http://saplink.org . 7 | 8 | However, since a few years back the ABAP community has turned its attention to a better way of sharing code between systems: **ABAPGit** https://github.com/larshp/abapGit . You should definitely use ABAPGit instead of SAPLINK whenever possible (aka the SAP infrascture guys didn't get in your way). 9 | 10 | I'm not working with ABAP anymore, so I have no access to a SAP system to convert the libraries here from .NUGG files to the ABAPGit structure. Therefore, if you want to use any of the codes here you'll have to use SAPLink to port them to your SAP system. 11 | -------------------------------------------------------------------------------- /Screen-Examples/NUGG_ZOMBIE_SCREEN_EXAMPLES.nugg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Screen-Examples/README.md: -------------------------------------------------------------------------------- 1 | Originally published @ ABAPZombie - http://www.abapzombie.com/codigos-e-exemplos/abap-zombie-screen-examples-a-tela-de-selecao-turbo/ 2 | 3 | --- 4 | 5 | Many selection-screen examples. Try this out before choosing to create a new Module-Pool - sometimes a report is all you need! 6 | 7 | * Buttons 8 | * TabStrip 9 | * Hide Elements 10 | * SubScreens 11 | * Listbox 12 | * Comments 13 | * Menu Buttons 14 | * Lines 15 | * Spaces 16 | * Elements in SubScreens 17 | --------------------------------------------------------------------------------