代码一:
1 *&--------------------------------------------------------------------&* 2 *& Report: zdamon_004 (V9) &* 3 *& PJA Consultancy Services (www.pjas.com) &* 4 *&--------------------------------------------------------------------&* 5 *& This report attmpts to find Enhancements, Program-Exits, BADIs &* 6 *& and Business Transaction Events in a particular program/tcode. &* 7 *& Last updated: 09 May 2007 &* 8 *&--------------------------------------------------------------------&* 9 *& Selection Texts: 10 *& P_ALV ALV format 11 *& P_AUTH Include authority-check search 12 *& P_BADI Display BADIs 13 *& P_BTE Display business trans events 14 *& P_DEVC Show development class exits 15 *& P_EXIT Display user exits 16 *& P_FUNC Show function modules 17 *& P_LIMIT Limit no. of submits to search 18 *& P_LST Standard list format 19 *& P_PNAME Program name 20 *& P_PROG Display program exits 21 *& P_SUBM Show submits 22 *& P_TCODE Transaction code 23 *& P_TEXT Search for text 24 *& P_WFLOW Display workflow links 25 *&--------------------------------------------------------------------&* 26 *& Text symbols: 27 *& M01 Enter TCode or program 28 *& M02 Enter at least one scope criteria 29 *& S01 Selection data (TCode takes precedence over program name) 30 *& S02 Scope criteria 31 *& S03 Display criteria 32 *&--------------------------------------------------------------------&* 33 REPORT zbc4_tool_004 NO STANDARD PAGE HEADING 34 LINE-SIZE 201. 35 36 TABLES: sxs_attr, 37 tobjt, 38 tstct, "TCode texts 39 trdirt, "Program texts 40 sxc_exit. "BADI exits 41 42 TYPE-POOLS: slis. "Globale Typen fьr generische Listbausteine 43 44 DATA: tabix LIKE sy-tabix, 45 w_linnum TYPE i, 46 w_off TYPE i, 47 w_index LIKE sy-tabix, 48 w_include LIKE trdir-name, 49 w_prog LIKE trdir-name, 50 w_incl LIKE trdir-name, 51 w_area LIKE rs38l-area, 52 w_level, 53 w_str(50) TYPE c, 54 w_cnt(2) TYPE c, 55 w_funcname LIKE tfdir-funcname, 56 w_fsel LIKE sy-ucomm, " Determination of screen field 57 w_gridtxt(70) TYPE c. "ALV grid title 58 59 CONSTANTS: c_fmod(40) TYPE c VALUE 'Function modules searched: ', 60 c_subm(40) TYPE c VALUE 'Submit programs searched: ', 61 c_devc(60) TYPE c VALUE 'User-exits from development classes in function modules', 62 c_col1(12) TYPE c VALUE 'Enhanmt Type', 63 c_col2(40) TYPE c VALUE 'Enhancement', 64 c_col3(30) TYPE c VALUE 'Program/Include', 65 c_col4(20) TYPE c VALUE 'Enhancement Name', 66 c_col5(40) TYPE c VALUE 'Enhancement Description', 67 c_col6(8) TYPE c VALUE 'Project', 68 c_col7(1) TYPE c VALUE 'S', 69 c_col8(12) TYPE c VALUE 'ChangeName', 70 c_col9(10) TYPE c VALUE 'ChangeDate', 71 c_x TYPE c VALUE 'X'. 72 73 * Work Areas: ABAP Workbench 74 DATA: BEGIN OF wa_d010inc. 75 DATA: master TYPE d010inc-master. 76 DATA: END OF wa_d010inc. 77 78 DATA: BEGIN OF wa_tfdir. 79 DATA: funcname TYPE tfdir-funcname, 80 pname TYPE tfdir-pname, 81 include TYPE tfdir-include. 82 DATA: END OF wa_tfdir. 83 84 DATA: BEGIN OF wa_tadir. 85 DATA: devclass TYPE tadir-devclass. 86 DATA: END OF wa_tadir. 87 88 DATA: BEGIN OF wa_tstc. 89 DATA: pgmna TYPE tstc-pgmna. 90 DATA: END OF wa_tstc. 91 92 DATA: BEGIN OF wa_tstcp. 93 DATA: param TYPE tstcp-param. 94 DATA: END OF wa_tstcp. 95 96 DATA: BEGIN OF wa_enlfdir. 97 DATA: area TYPE enlfdir-area. 98 DATA: END OF wa_enlfdir. 99 100 * Work Areas: BADIs 101 DATA: BEGIN OF wa_sxs_attr. 102 DATA: exit_name TYPE sxs_attr-exit_name. 103 DATA: END OF wa_sxs_attr. 104 105 DATA: BEGIN OF wa_sxs_attrt. 106 DATA: text TYPE sxs_attrt-text. 107 DATA: END OF wa_sxs_attrt. 108 109 * Work Areas: Enhancements 110 DATA: BEGIN OF wa_modsap. 111 DATA: member TYPE modsap-member. 112 DATA: END OF wa_modsap. 113 114 DATA: BEGIN OF wa_modsapa. 115 DATA: name TYPE modsapa-name. 116 DATA: END OF wa_modsapa. 117 118 DATA: BEGIN OF wa_modsapt. 119 DATA: modtext TYPE modsapt-modtext. 120 DATA: END OF wa_modsapt. 121 122 * Work Areas: Business Transaction Events 123 DATA: BEGIN OF wa_tbe01t. 124 DATA: text1 TYPE tbe01t-text1. 125 DATA: END OF wa_tbe01t. 126 127 DATA: BEGIN OF wa_tps01t. 128 DATA: text1 TYPE tps01t-text1. 129 DATA: END OF wa_tps01t. 130 131 * user-exits 132 TYPES: BEGIN OF ty_mod, 133 member LIKE modact-member, 134 name LIKE modact-name, 135 status LIKE modattr-status, 136 anam LIKE modattr-anam, 137 adat LIKE modattr-adat, 138 END OF ty_mod. 139 DATA: w_mod TYPE ty_mod. 140 141 TYPES: BEGIN OF t_userexit, 142 type(12) TYPE c, 143 pname LIKE trdir-name, 144 txt(300), 145 level TYPE c, 146 modname(30) TYPE c, 147 modtext(60) TYPE c, 148 modattr TYPE ty_mod, 149 colour(4) TYPE c, 150 END OF t_userexit. 151 DATA: i_userexit TYPE STANDARD TABLE OF t_userexit WITH HEADER LINE. 152 153 * Function module developmnet classes 154 TYPES: BEGIN OF t_devclass, 155 clas LIKE trdir-clas, 156 END OF t_devclass. 157 DATA: i_devclass TYPE STANDARD TABLE OF t_devclass WITH HEADER LINE. 158 159 * Submit programs 160 TYPES: BEGIN OF t_submit, 161 pname LIKE trdir-name, 162 level, 163 done, 164 END OF t_submit. 165 DATA: i_submit TYPE STANDARD TABLE OF t_submit WITH HEADER LINE. 166 167 * Source code 168 TYPES: BEGIN OF t_sourcetab, "#EC * (SLIN lьgt!) 169 line(200), "#EC * (SLIN lьgt!) 170 END OF t_sourcetab. "#EC * (SLIN lьgt!) 171 DATA: sourcetab TYPE STANDARD TABLE OF t_sourcetab WITH HEADER LINE. 172 DATA c_overflow(30000) TYPE c. 173 174 * Description of an ABAP/4 source analysis token 175 DATA: i_stoken TYPE STANDARD TABLE OF stokex WITH HEADER LINE. 176 DATA wa_stoken LIKE i_stoken. 177 178 * Description of an ABAP/4 source analysis statement 179 DATA: i_sstmnt TYPE STANDARD TABLE OF sstmnt WITH HEADER LINE. "#EC NEEDED 180 181 * keywords for searching ABAP code 182 TYPES: BEGIN OF t_keywords, 183 word(30), 184 END OF t_keywords. 185 DATA: keywords TYPE STANDARD TABLE OF t_keywords WITH HEADER LINE. 186 187 * function modules within program 188 TYPES: BEGIN OF t_fmodule, 189 name LIKE rs38l-name, 190 pname LIKE trdir-name, 191 pname2 LIKE trdir-name, 192 level, 193 bapi, 194 done, 195 END OF t_fmodule. 196 DATA: i_fmodule TYPE STANDARD TABLE OF t_fmodule WITH HEADER LINE. 197 198 * ALV definitions 199 DATA i_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE. 200 DATA i_layout TYPE slis_layout_alv. 201 DATA i_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE. 202 203 *&--------------------------------------------------------------------&* 204 *& Selection Options &* 205 *&--------------------------------------------------------------------&* 206 SELECTION-SCREEN BEGIN OF BLOCK selscr1 WITH FRAME TITLE text-s01. 207 PARAMETER: p_pname LIKE trdir-name, 208 p_tcode LIKE syst-tcode, 209 p_limit(4) TYPE n DEFAULT 500. 210 SELECTION-SCREEN SKIP. 211 SELECTION-SCREEN END OF BLOCK selscr1. 212 213 SELECTION-SCREEN BEGIN OF BLOCK selscr2 WITH FRAME TITLE text-s02. 214 PARAMETER: p_badi AS CHECKBOX DEFAULT c_x, 215 p_bte AS CHECKBOX DEFAULT c_x, 216 p_exit AS CHECKBOX DEFAULT c_x, 217 p_prog AS CHECKBOX DEFAULT c_x, 218 p_wflow AS CHECKBOX, 219 p_auth AS CHECKBOX. 220 SELECTION-SCREEN SKIP. 221 PARAMETER: p_text(40) TYPE c. 222 SELECTION-SCREEN END OF BLOCK selscr2. 223 224 SELECTION-SCREEN BEGIN OF BLOCK selscr3 WITH FRAME TITLE text-s03. 225 PARAMETER: p_alv RADIOBUTTON GROUP rad1 DEFAULT 'X', 226 p_lst RADIOBUTTON GROUP rad1. 227 SELECTION-SCREEN SKIP. 228 PARAMETER: p_devc LIKE rihea-dy_ofn DEFAULT ' ' MODIF ID a01, 229 p_func LIKE rihea-dy_ofn DEFAULT ' ' MODIF ID a01, 230 p_subm LIKE rihea-dy_ofn DEFAULT ' ' MODIF ID a01. 231 SELECTION-SCREEN END OF BLOCK selscr3. 232 233 *&--------------------------------------------------------------------&* 234 *& START-OF-SELECTION &* 235 *&--------------------------------------------------------------------&* 236 START-OF-SELECTION. 237 238 IF p_pname IS INITIAL AND p_tcode IS INITIAL. 239 MESSAGE i000(g01) WITH text-m01. 240 STOP. 241 ENDIF. 242 243 IF p_badi IS INITIAL AND 244 p_exit IS INITIAL AND 245 p_bte IS INITIAL AND 246 p_wflow IS INITIAL AND 247 p_auth IS INITIAL AND 248 p_prog IS INITIAL. 249 MESSAGE i000(g01) WITH text-m02. 250 STOP. 251 ENDIF. 252 253 * ensure P_LIMIT is not zero. 254 IF p_limit = 0. 255 p_limit = 1. 256 ENDIF. 257 258 PERFORM data_select. 259 PERFORM get_submit_data. 260 PERFORM get_fm_data. 261 PERFORM get_additional_data. 262 PERFORM data_display. 263 264 *&--------------------------------------------------------------------&* 265 *& Form DATA_SELECT &* 266 *&--------------------------------------------------------------------&* 267 *& &* 268 *&--------------------------------------------------------------------&* 269 FORM data_select. 270 271 * data selection message to sap gui 272 CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' 273 DESTINATION 'SAPGUI' 274 KEEPING LOGICAL UNIT OF WORK 275 EXPORTING 276 text = 'Get programs/includes' "#EC NOTEXT 277 EXCEPTIONS 278 system_failure 279 communication_failure 280 . "#EC * 281 282 * get TCode name for ALV grid title 283 CLEAR w_gridtxt. 284 IF NOT p_tcode IS INITIAL. 285 SELECT SINGLE * FROM tstct WHERE tcode = p_tcode 286 AND sprsl = sy-langu. 287 CONCATENATE 'TCode:' p_tcode tstct-ttext INTO w_gridtxt 288 SEPARATED BY space. 289 ENDIF. 290 * get program name for ALV grid title 291 IF NOT p_pname IS INITIAL. 292 SELECT SINGLE * FROM trdirt WHERE name = p_pname 293 AND sprsl = sy-langu. 294 CONCATENATE 'Program:' p_pname tstct-ttext INTO w_gridtxt 295 SEPARATED BY space. 296 ENDIF. 297 298 * determine search words 299 keywords-word = 'CALL'. 300 APPEND keywords. 301 keywords-word = 'FORM'. 302 APPEND keywords. 303 keywords-word = 'PERFORM'. 304 APPEND keywords. 305 keywords-word = 'SUBMIT'. 306 APPEND keywords. 307 keywords-word = 'INCLUDE'. 308 APPEND keywords. 309 keywords-word = 'AUTHORITY-CHECK'. 310 APPEND keywords. 311 312 IF NOT p_tcode IS INITIAL. 313 * get program name from TCode 314 SELECT SINGLE pgmna FROM tstc INTO wa_tstc-pgmna 315 WHERE tcode EQ p_tcode. 316 IF NOT wa_tstc-pgmna IS INITIAL. 317 p_pname = wa_tstc-pgmna. 318 * TCode does not include program name, but does have reference TCode 319 ELSE. 320 SELECT SINGLE param FROM tstcp INTO wa_tstcp-param 321 WHERE tcode EQ p_tcode. 322 IF sy-subrc = 0. 323 CHECK wa_tstcp-param(1) = '/'. 324 CHECK wa_tstcp-param+1(1) = '*'. 325 IF wa_tstcp-param CA ' '. 326 ENDIF. 327 w_off = sy-fdpos + 1. 328 SUBTRACT 2 FROM sy-fdpos. 329 IF sy-fdpos GT 0. 330 p_tcode = wa_tstcp-param+2(sy-fdpos). 331 ENDIF. 332 SELECT SINGLE pgmna FROM tstc INTO wa_tstc-pgmna 333 WHERE tcode EQ p_tcode. 334 p_pname = wa_tstc-pgmna. 335 IF sy-subrc <> 0. 336 MESSAGE s110(/saptrx/asc) WITH 'No program found for: ' p_tcode. "#EC NOTEXT 337 STOP. 338 ENDIF. 339 ELSE. 340 MESSAGE s110(/saptrx/asc) WITH 'No program found for: ' p_tcode. "#EC NOTEXT 341 STOP. 342 ENDIF. 343 344 ENDIF. 345 ENDIF. 346 347 * Call customer-function aus Program coding 348 READ REPORT p_pname INTO sourcetab. 349 IF sy-subrc > 0. 350 MESSAGE e017(enhancement) WITH p_pname RAISING no_program. "#EC * 351 ENDIF. 352 353 SCAN ABAP-SOURCE sourcetab TOKENS INTO i_stoken STATEMENTS INTO i_sstmnt KEYWORDS FROM keywords OVERFLOW INTO c_overflow WITH INCLUDES WITH ANALYSIS. "#EC 354 IF sy-subrc > 0. "keine/syntakt. falsche Ablauflog./Fehler im Skanner 355 MESSAGE e130(enhancement) RAISING syntax_error. "#EC 356 ENDIF. 357 358 * check I_STOKEN for entries 359 CLEAR w_linnum. 360 DESCRIBE TABLE i_stoken LINES w_linnum. 361 IF w_linnum GT 0. 362 w_level = '0'. 363 w_prog = ''. 364 w_incl = ''. 365 PERFORM data_search TABLES i_stoken USING w_level w_prog w_incl. 366 ENDIF. 367 368 ENDFORM. "DATA_SELECT 369 370 *&--------------------------------------------------------------------&* 371 *& Form GET_FM_DATA ? &* 372 *&--------------------------------------------------------------------&* 373 *& &* 374 *&--------------------------------------------------------------------&* 375 FORM get_fm_data. 376 377 * data selection message to sap gui 378 CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' 379 DESTINATION 'SAPGUI' 380 KEEPING LOGICAL UNIT OF WORK 381 EXPORTING 382 text = 'Get function module data' "#EC NOTEXT 383 EXCEPTIONS 384 system_failure 385 communication_failure 386 . "#EC * 387 388 * Function module data 389 SORT i_fmodule BY name. 390 DELETE ADJACENT DUPLICATES FROM i_fmodule COMPARING name. 391 392 LOOP AT i_fmodule WHERE done NE c_x. 393 394 CLEAR: i_stoken, i_sstmnt, sourcetab, wa_tfdir, w_include . 395 REFRESH: i_stoken, i_sstmnt, sourcetab. 396 397 CLEAR wa_tfdir. 398 SELECT SINGLE funcname pname include FROM tfdir INTO wa_tfdir 399 WHERE funcname = i_fmodule-name. 400 CHECK sy-subrc = 0. 401 402 CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT' 403 EXPORTING 404 program = wa_tfdir-pname 405 IMPORTING 406 group = w_area. 407 408 CONCATENATE 'L' w_area 'U' wa_tfdir-include INTO w_include. 409 i_fmodule-pname = w_include. 410 i_fmodule-pname2 = wa_tfdir-pname. 411 MODIFY i_fmodule. 412 413 READ REPORT i_fmodule-pname INTO sourcetab. 414 IF sy-subrc = 0. 415 416 SCAN ABAP-SOURCE sourcetab TOKENS INTO i_stoken 417 STATEMENTS INTO i_sstmnt 418 KEYWORDS FROM keywords 419 WITH INCLUDES WITH ANALYSIS. 420 IF sy-subrc > 0. 421 MESSAGE e130(enhancement) RAISING syntax_error. 422 ENDIF. 423 424 * check i_stoken for entries 425 CLEAR w_linnum. 426 DESCRIBE TABLE i_stoken LINES w_linnum. 427 IF w_linnum GT 0. 428 w_level = '1'. 429 w_prog = i_fmodule-pname2. 430 w_incl = i_fmodule-pname. 431 PERFORM data_search TABLES i_stoken USING w_level w_prog w_incl. 432 ENDIF. 433 ENDIF. 434 435 ENDLOOP. 436 437 * store development classes 438 IF p_devc = c_x. 439 LOOP AT i_fmodule. 440 CLEAR: wa_tadir, wa_enlfdir. 441 442 SELECT SINGLE area FROM enlfdir INTO wa_enlfdir-area 443 WHERE funcname = i_fmodule-name. 444 CHECK NOT wa_enlfdir-area IS INITIAL. 445 446 SELECT SINGLE devclass INTO wa_tadir-devclass 447 FROM tadir WHERE pgmid = 'R3TR' 448 AND object = 'FUGR' 449 AND obj_name = wa_enlfdir-area. 450 CHECK NOT wa_tadir-devclass IS INITIAL. 451 MOVE wa_tadir-devclass TO i_devclass-clas. 452 APPEND i_devclass. 453 i_fmodule-done = c_x. 454 MODIFY i_fmodule. 455 ENDLOOP. 456 457 SORT i_devclass. 458 DELETE ADJACENT DUPLICATES FROM i_devclass. 459 ENDIF. 460 461 ENDFORM. "GET_FM_DATA 462 *&--------------------------------------------------------------------&* 463 *& Form GET_SUBMIT_DATA &* 464 *&--------------------------------------------------------------------&* 465 *& &* 466 *&--------------------------------------------------------------------&* 467 FORM get_submit_data. 468 469 * data selection message to sap gui 470 CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' 471 DESTINATION 'SAPGUI' 472 KEEPING LOGICAL UNIT OF WORK 473 EXPORTING 474 text = 'Get submit data' "#EC NOTEXT 475 EXCEPTIONS 476 system_failure 477 communication_failure 478 . "#EC * 479 480 SORT i_submit. 481 DELETE ADJACENT DUPLICATES FROM i_submit COMPARING pname. 482 w_level = '0'. 483 484 LOOP AT i_submit WHERE done NE c_x. 485 486 CLEAR: i_stoken, i_sstmnt, sourcetab. 487 REFRESH: i_stoken, i_sstmnt, sourcetab. 488 489 READ REPORT i_submit-pname INTO sourcetab. 490 IF sy-subrc = 0. 491 492 SCAN ABAP-SOURCE sourcetab TOKENS INTO i_stoken 493 STATEMENTS INTO i_sstmnt 494 KEYWORDS FROM keywords 495 WITH INCLUDES WITH ANALYSIS. 496 IF sy-subrc > 0. 497 * message e130(enhancement) raising syntax_error. 498 CONTINUE. 499 ENDIF. 500 501 * check i_stoken for entries 502 CLEAR w_linnum. 503 DESCRIBE TABLE i_stoken LINES w_linnum. 504 IF w_linnum GT 0. 505 w_prog = i_submit-pname. 506 w_incl = ''. 507 PERFORM data_search TABLES i_stoken USING w_level w_prog w_incl. 508 ENDIF. 509 ENDIF. 510 511 * restrict number of submit program selected for processing 512 DESCRIBE TABLE i_submit LINES w_linnum. 513 IF w_linnum GE p_limit. 514 w_level = '1'. 515 ENDIF. 516 i_submit-done = c_x. 517 MODIFY i_submit. 518 ENDLOOP. 519 520 ENDFORM. "GET_SUBMIT_DATA 521 522 *&--------------------------------------------------------------------&* 523 *& Form DATA_SEARCH &* 524 *&--------------------------------------------------------------------&* 525 *& &* 526 *&--------------------------------------------------------------------&* 527 FORM data_search TABLES p_stoken STRUCTURE stoken 528 USING p_level l_prog l_incl. 529 530 LOOP AT p_stoken. 531 532 CLEAR i_userexit. 533 534 * Workflow 535 IF p_wflow = c_x. 536 IF p_level EQ '1'. " do not perform for function modules (2nd pass) 537 IF p_stoken-str+1(16) CS 'SWE_EVENT_CREATE'. 538 REPLACE ALL OCCURRENCES OF '''' IN p_stoken-str WITH ''. 539 i_userexit-type = 'WorkFlow'. 540 i_userexit-txt = p_stoken-str. 541 CONCATENATE l_prog '/' l_incl INTO i_userexit-pname. 542 APPEND i_userexit. 543 ENDIF. 544 ENDIF. 545 ENDIF. 546 547 tabix = sy-tabix + 1. 548 i_userexit-level = p_level. 549 IF i_userexit-level = '0'. 550 IF l_incl IS INITIAL. 551 i_userexit-pname = p_pname. 552 ELSE. 553 CONCATENATE p_pname '-' l_incl INTO i_userexit-pname. 554 ENDIF. 555 ELSE. 556 IF l_incl IS INITIAL. 557 i_userexit-pname = l_prog. 558 ELSE. 559 CONCATENATE l_prog '-' l_incl INTO i_userexit-pname. 560 ENDIF. 561 ENDIF. 562 563 * AUTHORITY-CHECKS 564 IF p_auth = c_x. 565 IF p_stoken-str EQ 'AUTHORITY-CHECK'. 566 CHECK p_level EQ '0'. " do not perform for function modules (2nd pass) 567 w_index = sy-tabix + 2. 568 READ TABLE p_stoken INDEX w_index INTO wa_stoken. 569 CHECK NOT wa_stoken-str CS 'STRUCTURE'. 570 CHECK NOT wa_stoken-str CS 'SYMBOL'. 571 READ TABLE i_submit WITH KEY pname = wa_stoken-str. 572 IF sy-subrc <> 0. 573 i_userexit-pname = i_submit-pname. 574 i_userexit-type = 'AuthCheck'. 575 i_userexit-txt = wa_stoken-str. 576 REPLACE ALL OCCURRENCES OF '''' IN i_userexit-txt WITH space. 577 CLEAR tobjt. 578 SELECT SINGLE * FROM tobjt WHERE object = i_userexit-txt 579 AND langu = sy-langu. 580 i_userexit-modname = 'AUTHORITY-CHECK'. 581 i_userexit-modtext = tobjt-ttext. 582 APPEND i_userexit. 583 ENDIF. 584 ENDIF. 585 ENDIF. 586 587 * Text searches 588 IF NOT p_text IS INITIAL. 589 IF p_stoken-str CS p_text. 590 i_userexit-pname = i_submit-pname. 591 i_userexit-type = 'TextSearch'. 592 i_userexit-txt = wa_stoken-str. 593 i_userexit-modname = 'Text Search'. 594 i_userexit-modtext = p_stoken-str. 595 APPEND i_userexit. 596 ENDIF. 597 ENDIF. 598 599 * Include (SE38) 600 IF p_stoken-str EQ 'INCLUDE'. 601 CHECK p_level EQ '0'. " do not perform for function modules (2nd pass) 602 w_index = sy-tabix + 1. 603 READ TABLE p_stoken INDEX w_index INTO wa_stoken. 604 CHECK NOT wa_stoken-str CS 'STRUCTURE'. 605 CHECK NOT wa_stoken-str CS 'SYMBOL'. 606 READ TABLE i_submit WITH KEY pname = wa_stoken-str. 607 IF sy-subrc <> 0. 608 i_submit-pname = wa_stoken-str. 609 i_submit-level = p_level. 610 APPEND i_submit. 611 ENDIF. 612 ENDIF. 613 614 * Enhancements (SMOD) 615 IF p_exit = c_x. 616 IF p_stoken-str EQ 'CUSTOMER-FUNCTION'. 617 CLEAR w_funcname. 618 READ TABLE p_stoken INDEX tabix. 619 TRANSLATE p_stoken-str USING ''' '. 620 CONDENSE p_stoken-str. 621 IF l_prog IS INITIAL. 622 CONCATENATE 'EXIT' p_pname p_stoken-str INTO w_funcname 623 SEPARATED BY '_'. 624 ELSE. 625 CONCATENATE 'EXIT' l_prog p_stoken-str INTO w_funcname 626 SEPARATED BY '_'. 627 ENDIF. 628 SELECT SINGLE member FROM modsap INTO wa_modsap-member 629 WHERE member = w_funcname. 630 IF sy-subrc = 0. " check for valid enhancement 631 i_userexit-type = 'Enhancement'. 632 i_userexit-txt = w_funcname. 633 APPEND i_userexit. 634 ELSE. 635 CLEAR wa_d010inc. 636 SELECT SINGLE master INTO wa_d010inc-master 637 FROM d010inc 638 WHERE include = l_prog. 639 CONCATENATE 'EXIT' wa_d010inc-master p_stoken-str INTO w_funcname 640 SEPARATED BY '_'. 641 i_userexit-type = 'Enhancement'. 642 i_userexit-txt = w_funcname. 643 ENDIF. 644 ENDIF. 645 ENDIF. 646 647 * BADIs (SE18) 648 IF p_badi = c_x. 649 IF p_stoken-str CS 'cl_exithandler='. 650 w_index = sy-tabix + 4. 651 READ TABLE p_stoken INDEX w_index INTO wa_stoken. 652 i_userexit-txt = wa_stoken-str. 653 REPLACE ALL OCCURRENCES OF '''' IN i_userexit-txt WITH space. 654 i_userexit-type = 'BADI'. 655 CLEAR sxs_attr. " ensure a real BADI 656 SELECT SINGLE * FROM sxs_attr WHERE exit_name = i_userexit-txt. 657 IF sy-subrc = 0. 658 APPEND i_userexit. 659 ENDIF. 660 ENDIF. 661 ENDIF. 662 663 * Business transaction events (FIBF) 664 IF p_bte = c_x. 665 IF p_stoken-str CS 'OPEN_FI_PERFORM'. 666 i_userexit-type = 'BusTrEvent'. 667 i_userexit-txt = p_stoken-str. 668 REPLACE ALL OCCURRENCES OF '''' IN i_userexit-txt WITH space. 669 i_userexit-modname = i_userexit-txt+16(8). 670 CASE i_userexit-txt+25(1). 671 WHEN 'E'. 672 CLEAR wa_tbe01t. 673 SELECT SINGLE text1 INTO wa_tbe01t-text1 FROM tbe01t 674 WHERE event = i_userexit-txt+16(8) 675 AND spras = sy-langu. 676 IF wa_tbe01t-text1 IS INITIAL. 677 i_userexit-modtext = '<Not active>'. "#EC NOTEXT 678 ELSE. 679 i_userexit-modtext = wa_tbe01t-text1. 680 ENDIF. 681 i_userexit-modname+8 = '/P&S'. "#EC NOTEXT 682 WHEN 'P'. 683 CLEAR wa_tps01t. 684 SELECT SINGLE text1 INTO wa_tps01t-text1 FROM tps01t 685 WHERE procs = i_userexit-txt+16(8) 686 AND spras = sy-langu. 687 i_userexit-modtext = wa_tps01t-text1. 688 i_userexit-modname+8 = '/Process'. 689 ENDCASE. 690 691 APPEND i_userexit. 692 ENDIF. 693 ENDIF. 694 695 * Program exits (SE38) 696 IF p_prog = c_x. 697 IF p_stoken-str CS 'USEREXIT_'. 698 CHECK NOT p_stoken-str CS '-'. " ensure not USEREXIT_XX-XXX 699 CHECK NOT p_stoken-str CS '('. " ensure not SUBMIT_XX(X) 700 i_userexit-type = 'Program Exit'. 701 i_userexit-txt = p_stoken-str. 702 REPLACE ALL OCCURRENCES OF '''' IN i_userexit-txt WITH space. 703 APPEND i_userexit. 704 ENDIF. 705 ENDIF. 706 707 * Submit programs (SE38) 708 IF p_stoken-str CS 'SUBMIT'. 709 CHECK p_level EQ '0'. " do not perform for function modules (2nd pass) 710 CHECK NOT p_stoken-str CS '_'. " ensure not SUBMIT_XXX 711 w_index = sy-tabix + 1. 712 READ TABLE p_stoken INDEX w_index INTO wa_stoken. 713 CHECK NOT wa_stoken-str CS '_'. " ensure not SUBMIT_XXX 714 REPLACE ALL OCCURRENCES OF '''' IN wa_stoken-str WITH space. 715 READ TABLE i_submit WITH KEY pname = wa_stoken-str. 716 IF sy-subrc <> 0. 717 i_submit-pname = wa_stoken-str. 718 i_submit-level = p_level. 719 APPEND i_submit. 720 ENDIF. 721 ENDIF. 722 723 * Perform routines (which reference external programs) 724 IF p_stoken-str CS 'PERFORM'. 725 CHECK p_level EQ '0'. " do not perform for function modules (2nd pass) 726 w_index = sy-tabix + 1. 727 READ TABLE p_stoken INDEX w_index INTO wa_stoken. 728 IF NOT wa_stoken-ovfl IS INITIAL. 729 w_off = wa_stoken-off1 + 10. 730 w_str = c_overflow+w_off(30). 731 FIND ')' IN w_str MATCH OFFSET w_off. 732 IF sy-subrc = 0. 733 w_off = w_off + 1. 734 wa_stoken-str = w_str(w_off). 735 ENDIF. 736 ENDIF. 737 738 CHECK wa_stoken-str CS '('. 739 w_off = 0. 740 WHILE sy-subrc = 0. 741 IF wa_stoken-str+w_off(1) EQ '('. 742 REPLACE SECTION OFFSET w_off LENGTH 1 OF wa_stoken-str WITH ''. 743 REPLACE ALL OCCURRENCES OF ')' IN wa_stoken-str WITH space. 744 READ TABLE i_submit WITH KEY pname = wa_stoken-str. 745 IF sy-subrc <> 0. 746 i_submit-pname = wa_stoken-str. 747 APPEND i_submit. 748 ENDIF. 749 EXIT. 750 ELSE. 751 REPLACE SECTION OFFSET w_off LENGTH 1 OF wa_stoken-str WITH ''. 752 SHIFT wa_stoken-str LEFT DELETING LEADING space. 753 ENDIF. 754 ENDWHILE. 755 ENDIF. 756 757 * Function modules (SE37) 758 IF p_stoken-str CS 'FUNCTION'. 759 760 CLEAR i_fmodule. 761 IF p_level EQ '0'. " do not perform for function modules (2nd pass) 762 w_index = sy-tabix + 1. 763 READ TABLE p_stoken INDEX w_index INTO wa_stoken. 764 765 IF wa_stoken-str CS 'BAPI'. 766 i_fmodule-bapi = c_x. 767 ENDIF. 768 769 REPLACE FIRST OCCURRENCE OF '''' IN wa_stoken-str WITH space. 770 REPLACE FIRST OCCURRENCE OF '''' IN wa_stoken-str WITH space. 771 IF sy-subrc = 4. " didn't find 2nd quote (ie name truncated) 772 CLEAR wa_tfdir. 773 CONCATENATE wa_stoken-str '%' INTO wa_stoken-str. 774 SELECT SINGLE funcname INTO wa_tfdir-funcname FROM tfdir 775 WHERE funcname LIKE wa_stoken-str. 776 IF sy-subrc = 0. 777 i_fmodule-name = wa_tfdir-funcname. 778 ELSE. 779 CONTINUE. 780 ENDIF. 781 ELSE. 782 i_fmodule-name = wa_stoken-str. 783 ENDIF. 784 i_fmodule-level = p_level. 785 APPEND i_fmodule. 786 ENDIF. 787 ENDIF. 788 789 ENDLOOP. 790 791 ENDFORM. "DATA_SEARCH 792 *&--------------------------------------------------------------------&* 793 *& Form GET_ADDITIONAL_DATA &* 794 *&--------------------------------------------------------------------&* 795 *& &* 796 *&--------------------------------------------------------------------&* 797 FORM get_additional_data. 798 799 * data selection message to sap gui 800 CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' 801 DESTINATION 'SAPGUI' 802 KEEPING LOGICAL UNIT OF WORK 803 EXPORTING 804 text = 'Get additional data' "#EC NOTEXT 805 EXCEPTIONS 806 system_failure 807 communication_failure 808 . "#EC * 809 810 LOOP AT i_userexit. 811 812 * Workflow 813 IF i_userexit-type EQ 'WorkFlow'. 814 CONTINUE. 815 ENDIF. 816 817 818 819 * Enhancement data 820 IF i_userexit-type CS 'Enh'. 821 CLEAR: wa_modsapa. 822 SELECT SINGLE name INTO wa_modsapa-name FROM modsap 823 WHERE member = i_userexit-txt. 824 CHECK sy-subrc = 0. 825 i_userexit-modname = wa_modsapa-name. 826 827 CLEAR wa_modsapt. 828 SELECT SINGLE modtext INTO wa_modsapt-modtext FROM modsapt 829 WHERE name = wa_modsapa-name 830 AND sprsl = sy-langu. 831 i_userexit-modtext = wa_modsapt-modtext. 832 833 * Get the CMOD project name 834 CLEAR w_mod. 835 SELECT SINGLE modact~member modact~name modattr~status 836 modattr~anam modattr~adat 837 INTO w_mod 838 FROM modact 839 INNER JOIN modattr 840 ON modattr~name = modact~name 841 WHERE modact~member = wa_modsapa-name 842 AND modact~typ = space. 843 IF sy-subrc = 0. 844 i_userexit-modattr = w_mod. 845 ENDIF. 846 ENDIF. 847 848 849 * BADI data 850 IF i_userexit-type EQ 'BADI'. 851 CLEAR wa_sxs_attr. 852 SELECT SINGLE exit_name INTO wa_sxs_attr-exit_name FROM sxs_attr 853 WHERE exit_name = i_userexit-txt. 854 IF sy-subrc = 0. 855 i_userexit-modname = i_userexit-txt. 856 ELSE. 857 i_userexit-modname = 'Dynamic call'. "#EC NOTEXT 858 ENDIF. 859 CLEAR wa_sxs_attrt. 860 SELECT SINGLE text INTO wa_sxs_attrt-text FROM sxs_attrt 861 WHERE exit_name = wa_sxs_attr-exit_name 862 AND sprsl = sy-langu. 863 i_userexit-modtext = wa_sxs_attrt-text. 864 ENDIF. 865 866 * BADI Implementation 867 IF i_userexit-type EQ 'BADI'. 868 CLEAR sxc_exit. 869 SELECT COUNT( * ) FROM sxc_exit WHERE exit_name = i_userexit-txt. 870 w_cnt = sy-dbcnt. 871 * determine id BADI is for interal or external use 872 CLEAR sxs_attr. 873 SELECT SINGLE * FROM sxs_attr WHERE exit_name = i_userexit-txt. 874 IF sxs_attr-internal = 'X'. 875 wa_sxs_attrt-text = 'SAP '. 876 ELSE. 877 wa_sxs_attrt-text = 'CUST'. 878 ENDIF. 879 * concatenate wa_sxs_attrt-text w_cnt into i_userexit-modattr-name 880 * separated by space. 881 WRITE wa_sxs_attrt-text TO i_userexit-modattr-name. 882 WRITE w_cnt TO i_userexit-modattr-name+5. 883 ENDIF. 884 885 MODIFY i_userexit. 886 ENDLOOP. 887 888 * get enhancements via program package 889 CLEAR wa_tadir. 890 SELECT SINGLE devclass INTO wa_tadir-devclass FROM tadir 891 WHERE pgmid = 'R3TR' 892 AND object = 'PROG' 893 AND obj_name = p_pname. 894 IF sy-subrc = 0. 895 CLEAR: wa_modsapa, wa_modsapt. 896 SELECT name FROM modsapa INTO wa_modsapa-name 897 WHERE devclass = wa_tadir-devclass. 898 SELECT SINGLE modtext FROM modsapt INTO wa_modsapt-modtext 899 WHERE name = wa_modsapa-name 900 AND sprsl = sy-langu. 901 902 CLEAR i_userexit. 903 READ TABLE i_userexit WITH KEY modname = wa_modsapa-name. 904 IF sy-subrc <> 0. 905 i_userexit-modtext = wa_modsapt-modtext. 906 i_userexit-type = 'Enhancement'. "#EC NOTEXT 907 i_userexit-modname = wa_modsapa-name. 908 i_userexit-txt = 'Determined from program DevClass'. "#EC NOTEXT 909 i_userexit-pname = 'Unknown'. "#EC NOTEXT 910 APPEND i_userexit. 911 ENDIF. 912 ENDSELECT. 913 ENDIF. 914 915 * set row colour. 916 LOOP AT i_userexit. 917 CASE i_userexit-type. 918 WHEN 'BADI'. 919 i_userexit-colour = 'C601'. 920 WHEN 'Enhancement'. 921 i_userexit-colour = 'C501'. 922 WHEN 'Program Exit'. 923 i_userexit-colour = 'C401'. 924 WHEN 'WorkFlow'. 925 i_userexit-colour = 'C301'. 926 WHEN 'BusTrEvent'. 927 i_userexit-colour = 'C201'. 928 ENDCASE. 929 MODIFY i_userexit. 930 ENDLOOP. 931 932 ENDFORM. "GET_ADDITIONAL_DATA 933 934 *&--------------------------------------------------------------------&* 935 *& Form DATA_DISPLAY &* 936 *&--------------------------------------------------------------------&* 937 *& &* 938 *&--------------------------------------------------------------------&* 939 FORM data_display. 940 941 * data selection message to sap gui 942 CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' 943 DESTINATION 'SAPGUI' 944 KEEPING LOGICAL UNIT OF WORK 945 EXPORTING 946 text = 'Prepare screen for display' "#EC NOTEXT 947 EXCEPTIONS 948 system_failure 949 communication_failure 950 . "#EC * 951 952 SORT i_userexit BY type txt modname. 953 DELETE ADJACENT DUPLICATES FROM i_userexit COMPARING txt pname modname. 954 955 * ensure records selected. 956 DESCRIBE TABLE i_userexit LINES w_linnum. 957 IF w_linnum = 0. 958 MESSAGE s003(g00). "No data records were selected 959 EXIT. 960 ENDIF. 961 962 IF p_alv = ' '. 963 964 * format headings 965 WRITE: 'Enhancements from main program: ', p_pname. 966 WRITE: 'Enhancements from TCode: ', p_tcode. 967 WRITE: 201''. 968 ULINE. 969 FORMAT COLOR COL_HEADING. 970 WRITE: / sy-vline, 971 (12) c_col1, "Enhanmt Type 972 sy-vline, 973 (40) c_col2, "Enhancement 974 sy-vline, 975 (30) c_col3, "Program/Include 976 sy-vline, 977 (20) c_col4, "Enhancement name 978 sy-vline, 979 (40) c_col5, "Enhancement description 980 sy-vline, 981 (8) c_col6, "Project 982 sy-vline, 983 (1) c_col7, "S 984 sy-vline, 985 (12) c_col8, "ChangeName 986 sy-vline, 987 (10) c_col9, "ChangeDate 988 sy-vline. 989 FORMAT RESET. 990 ULINE. 991 992 * format lines 993 LOOP AT i_userexit. 994 * set line colour 995 CASE i_userexit-type. 996 WHEN 'Enhancement'. 997 FORMAT COLOR 3 INTENSIFIED OFF. 998 WHEN 'BADI'. 999 FORMAT COLOR 4 INTENSIFIED OFF. 1000 WHEN 'BusTrEvent'. 1001 FORMAT COLOR 5 INTENSIFIED OFF. 1002 WHEN 'Program Exit'. 1003 FORMAT COLOR 6 INTENSIFIED OFF. 1004 WHEN OTHERS. 1005 FORMAT RESET. 1006 ENDCASE. 1007 WRITE: / sy-vline, 1008 i_userexit-type, 1009 sy-vline, 1010 i_userexit-txt(40), 1011 sy-vline, 1012 i_userexit-pname(30), 1013 sy-vline, 1014 i_userexit-modname(20), 1015 sy-vline, 1016 i_userexit-modtext(40), 1017 sy-vline. 1018 1019 WRITE: i_userexit-modattr-name, 1020 sy-vline, 1021 i_userexit-modattr-status, 1022 sy-vline, 1023 i_userexit-modattr-anam, 1024 sy-vline, 1025 i_userexit-modattr-adat NO-ZERO, 1026 sy-vline. 1027 HIDE: i_userexit-modname, i_userexit-type, i_userexit-modattr-name. 1028 1029 ENDLOOP. 1030 FORMAT RESET. 1031 ULINE. 1032 1033 * user-exits from development class of function modules 1034 IF p_devc = c_x. 1035 WRITE: /. 1036 WRITE: / c_devc. 1037 WRITE: 201''. 1038 ULINE (90). 1039 WRITE: 201''. 1040 1041 LOOP AT i_devclass. 1042 CLEAR wa_modsapa. 1043 SELECT name FROM modsapa INTO wa_modsapa 1044 WHERE devclass = i_devclass-clas. 1045 SELECT SINGLE name modtext INTO CORRESPONDING FIELDS OF wa_modsapt 1046 FROM modsapt 1047 WHERE name = wa_modsapa-name 1048 AND sprsl = sy-langu. 1049 FORMAT COLOR 3 INTENSIFIED OFF. 1050 WRITE: / sy-vline, 1051 (12) 'Enhancement', 1052 sy-vline, 1053 wa_modsapa-name, 1054 sy-vline, 1055 wa_modsapt-modtext, 1056 sy-vline. 1057 ENDSELECT. 1058 ENDLOOP. 1059 WRITE: 201''. 1060 ULINE (90). 1061 FORMAT RESET. 1062 ENDIF. 1063 1064 * display fuction modules used in program 1065 WRITE /. 1066 DESCRIBE TABLE i_fmodule LINES w_linnum. 1067 WRITE: / c_fmod , AT 35 w_linnum. "#EC NOTEXT 1068 WRITE: 201''. 1069 1070 IF p_func = c_x. 1071 ULINE (38). 1072 WRITE: 201''. 1073 LOOP AT i_fmodule. 1074 WRITE: sy-vline, 1075 i_fmodule-name, 1076 sy-vline, 1077 i_fmodule-bapi, 1078 sy-vline. 1079 WRITE: 201''. 1080 ENDLOOP. 1081 WRITE: 201''. 1082 ULINE (38). 1083 ENDIF. 1084 1085 * display submit programs used in program 1086 WRITE /. 1087 DESCRIBE TABLE i_submit LINES w_linnum. 1088 WRITE: / c_subm , AT 35 w_linnum. "#EC NOTEXT 1089 WRITE: 201''. 1090 IF p_subm = c_x. 1091 ULINE (44). 1092 WRITE: 201''. 1093 LOOP AT i_submit. 1094 WRITE: sy-vline, 1095 i_submit-pname, 1096 sy-vline. 1097 WRITE: 201''. 1098 ENDLOOP. 1099 WRITE: 201''. 1100 ULINE (44). 1101 ENDIF. 1102 1103 * issue message with number of user-exits displayed 1104 DESCRIBE TABLE i_userexit LINES w_linnum. 1105 MESSAGE s697(56) WITH w_linnum. 1106 1107 ELSE. " Show in alv format 1108 1109 * issue message with number of user-exits displayed 1110 DESCRIBE TABLE i_userexit LINES w_linnum. 1111 MESSAGE s697(56) WITH w_linnum. 1112 1113 * Create field catalog 1114 PERFORM create_field_catalog USING 'TYPE' 'T_USEREXIT' ' ' 'Type'. 1115 PERFORM create_field_catalog USING 'PNAME' 'T_USEREXIT' ' ' 'Program name'. 1116 PERFORM create_field_catalog USING 'TXT' 'T_USEREXIT' ' ' 'Enhancement'. 1117 PERFORM create_field_catalog USING 'LEVEL' 'T_USEREXIT' c_x 'Level'. 1118 PERFORM create_field_catalog USING 'MODNAME' 'T_USEREXIT' ' ' 'Enhancement name'. 1119 PERFORM create_field_catalog USING 'MODTEXT' 'T_USEREXIT' ' ' 'Enhancement text'. 1120 PERFORM create_field_catalog USING 'MODATTR-MEMBER' 'T_USEREXIT' c_x 'Member'. 1121 PERFORM create_field_catalog USING 'MODATTR-NAME' 'T_USEREXIT' ' ' 'Project'. 1122 PERFORM create_field_catalog USING 'MODATTR-STATUS' 'T_USEREXIT' ' ' 'Status'. 1123 PERFORM create_field_catalog USING 'MODATTR-ANAM' 'T_USEREXIT' ' ' 'Changed by'. 1124 PERFORM create_field_catalog USING 'MODATTR-ADAT' 'T_USEREXIT' ' ' 'Change date'. 1125 1126 * Layout 1127 CLEAR i_layout. 1128 i_layout-colwidth_optimize = c_x. 1129 i_layout-info_fieldname = 'COLOUR'. 1130 1131 * Sort 1132 CLEAR i_sort. 1133 i_sort-fieldname = 'TYPE'. 1134 i_sort-tabname = 'T_USEREXIT'. 1135 i_sort-up = c_x. 1136 APPEND i_sort. 1137 1138 CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 1139 EXPORTING 1140 i_callback_program = sy-cprog 1141 i_callback_user_command = 'USER_COMMAND' 1142 is_layout = i_layout 1143 it_fieldcat = i_fieldcat[] 1144 it_sort = i_sort[] 1145 i_default = c_x 1146 i_save = 'A' 1147 i_grid_title = w_gridtxt 1148 TABLES 1149 t_outtab = i_userexit. 1150 1151 ENDIF. 1152 1153 * issue message with number of user-exits displayed 1154 DESCRIBE TABLE i_userexit LINES w_linnum. 1155 MESSAGE s697(56) WITH w_linnum. 1156 1157 ENDFORM. "DATA_DISPLAY 1158 1159 *&---------------------------------------------------------------------&* 1160 *& Form CREATE_FIELD_CATALOG &* 1161 *&---------------------------------------------------------------------&* 1162 FORM create_field_catalog USING p_fieldname 1163 p_tabname 1164 p_hide 1165 p_text. 1166 1167 i_fieldcat-fieldname = p_fieldname. 1168 i_fieldcat-tabname = p_tabname. 1169 i_fieldcat-no_out = p_hide. 1170 i_fieldcat-seltext_l = p_text. 1171 1172 APPEND i_fieldcat. 1173 1174 ENDFORM. " CREATE_FIELD_CATALOG 1175 1176 *&---------------------------------------------------------------------&* 1177 *& Form CREATE_FIELD_CATALOG &* 1178 *&---------------------------------------------------------------------&* 1179 FORM user_command USING r_ucomm LIKE sy-ucomm 1180 rs_selfield TYPE slis_selfield. 1181 READ TABLE i_userexit INDEX rs_selfield-tabindex. 1182 CHECK sy-subrc = 0. 1183 CASE r_ucomm. 1184 WHEN '&IC1'. 1185 CASE rs_selfield-sel_tab_field. 1186 WHEN 'T_USEREXIT-MODNAME'. 1187 READ TABLE i_userexit INDEX rs_selfield-tabindex. 1188 CASE i_userexit-type. 1189 WHEN 'Enhancement'. 1190 SET PARAMETER ID 'MON' FIELD i_userexit-modname. 1191 CALL TRANSACTION 'SMOD'. 1192 WHEN 'BADI'. 1193 SET PARAMETER ID 'EXN' FIELD i_userexit-modname. 1194 CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN. 1195 WHEN 'BusTrEvent'. 1196 SUBMIT rfopfi00 WITH event = i_userexit-modname(8) AND RETURN. 1197 WHEN OTHERS. 1198 MESSAGE s030(cj). "Navigation not possible 1199 ENDCASE. 1200 WHEN 'T_USEREXIT-MODATTR-NAME'. 1201 IF NOT i_userexit-modattr-name IS INITIAL. 1202 SET PARAMETER ID 'MON_KUN' FIELD i_userexit-modattr-name. 1203 CALL TRANSACTION 'CMOD'. 1204 ELSE. 1205 MESSAGE s030(cj)."Navigation not possible 1206 ENDIF. 1207 WHEN OTHERS. 1208 MESSAGE s030(cj)."Navigation not possible 1209 ENDCASE. 1210 ENDCASE. 1211 1212 ENDFORM. "user_command 1213 1214 *&--------------------------------------------------------------------&* 1215 *& AT LINE-SELECTION ?* 1216 *&--------------------------------------------------------------------&* 1217 AT LINE-SELECTION. 1218 1219 GET CURSOR FIELD w_fsel. 1220 1221 CASE w_fsel. 1222 1223 WHEN 'I_USEREXIT-MODNAME'. 1224 CASE i_userexit-type. 1225 WHEN 'Enhancement'. 1226 SET PARAMETER ID 'MON' FIELD i_userexit-modname. 1227 CALL TRANSACTION 'SMOD'. 1228 WHEN 'BADI'. 1229 SET PARAMETER ID 'EXN' FIELD i_userexit-modname. 1230 CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN. 1231 WHEN 'BusTrEvent'. 1232 SUBMIT rfopfi00 WITH event = i_userexit-modname(8) AND RETURN. 1233 WHEN OTHERS. 1234 MESSAGE s030(cj)."Navigation not possible 1235 ENDCASE. 1236 1237 WHEN 'I_USEREXIT-MODATTR-NAME'. 1238 IF NOT i_userexit-modattr-name IS INITIAL. 1239 SET PARAMETER ID 'MON_KUN' FIELD i_userexit-modattr-name. 1240 CALL TRANSACTION 'CMOD'. 1241 ELSE. 1242 MESSAGE s030(cj)."Navigation not possible 1243 ENDIF. 1244 1245 WHEN OTHERS. 1246 MESSAGE s030(cj)."Navigation not possible 1247 1248 ENDCASE. 1249 1250 *&--------------------------------------------------------------------&* 1251 *& AT SELECTION-SCREEN &* 1252 *&--------------------------------------------------------------------&* 1253 AT SELECTION-SCREEN ON RADIOBUTTON GROUP rad1. 1254 1255 * grey-out checkboxes if ALV selected 1256 AT SELECTION-SCREEN OUTPUT. 1257 LOOP AT SCREEN. 1258 IF p_alv = c_x. 1259 IF screen-group1 = 'A01'. 1260 screen-input = '0'. 1261 MODIFY SCREEN. 1262 ENDIF. 1263 ELSE. 1264 IF screen-group1 = 'A01'. 1265 screen-input = '1'. 1266 MODIFY SCREEN. 1267 ENDIF. 1268 ENDIF. 1269 ENDLOOP.
代码二:
1 *&---------------------------------------------------------------------* 2 *& Report ZTCODE1 3 *& 4 *&---------------------------------------------------------------------* 5 *& 6 *& 7 *&---------------------------------------------------------------------* 8 9 REPORT zbc4_tool_001 NO STANDARD PAGE HEADING . 10 TABLES:tstc,tadir,modsapt,modact,trdir,tfdir,enlfdir,sxs_attrt,tstct. 11 DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE. 12 DATA : field1(30). 13 DATA : v_devclass LIKE tadir-devclass. 14 PARAMETERS : p_tcode LIKE tstc-tcode, 15 p_pgmna LIKE tstc-pgmna . 16 DATA wa_tadir TYPE tadir. 17 18 START-OF-SELECTION. 19 IF NOT p_tcode IS INITIAL. 20 SELECT SINGLE * FROM tstc WHERE tcode EQ p_tcode. 21 ELSEIF NOT p_pgmna IS INITIAL. 22 tstc-pgmna = p_pgmna. 23 ENDIF. 24 IF sy-subrc EQ 0. 25 SELECT SINGLE * FROM tadir 26 WHERE pgmid = 'R3TR' 27 AND object = 'PROG' 28 AND obj_name = tstc-pgmna. 29 MOVE : tadir-devclass TO v_devclass. 30 IF sy-subrc NE 0. 31 SELECT SINGLE * FROM trdir 32 WHERE name = tstc-pgmna. 33 IF trdir-subc EQ 'F'. 34 SELECT SINGLE * FROM tfdir 35 WHERE pname = tstc-pgmna. 36 SELECT SINGLE * FROM enlfdir 37 WHERE funcname = tfdir-funcname. 38 SELECT SINGLE * FROM tadir 39 WHERE pgmid = 'R3TR' 40 AND object = 'FUGR' 41 AND obj_name EQ enlfdir-area. 42 MOVE : tadir-devclass TO v_devclass. 43 ENDIF. 44 ENDIF. 45 SELECT * FROM tadir INTO TABLE jtab WHERE pgmid = 'R3TR' AND 46 object IN ('SMOD', 'SXSD') AND 47 devclass = v_devclass. 48 SELECT SINGLE * FROM tstct WHERE sprsl EQ sy-langu AND 49 tcode EQ p_tcode. 50 FORMAT COLOR COL_POSITIVE INTENSIFIED OFF. 51 WRITE:/(19) 'Transaction Code - ', 52 20(20) p_tcode, 53 45(50) tstct-ttext. 54 SKIP. 55 IF NOT jtab[] IS INITIAL. 56 WRITE:/(105) sy-uline. 57 FORMAT COLOR COL_HEADING INTENSIFIED ON. 58 SORT jtab BY object. 59 DATA : wf_txt(60) TYPE c, 60 wf_smod TYPE i , 61 wf_badi TYPE i , 62 wf_object2(30) TYPE c. 63 CLEAR : wf_smod, wf_badi , wf_object2. 64 LOOP AT jtab INTO wa_tadir. 65 AT FIRST. 66 FORMAT COLOR COL_HEADING INTENSIFIED ON. 67 WRITE:/1 sy-vline, 68 2 'Enhancement/ Business Add-in', 69 41 sy-vline , 70 42 'Description', 71 105 sy-vline. 72 WRITE:/(105) sy-uline. 73 ENDAT. 74 CLEAR wf_txt. 75 AT NEW object. 76 IF wa_tadir-object = 'SMOD'. 77 wf_object2 = 'Enhancement' . 78 ELSEIF wa_tadir-object = 'SXSD'. 79 wf_object2 = ' Business Add-in'. 80 ENDIF. 81 FORMAT COLOR COL_GROUP INTENSIFIED ON. 82 WRITE:/1 sy-vline, 83 2 wf_object2, 84 105 sy-vline. 85 ENDAT. 86 CASE wa_tadir-object. 87 WHEN 'SMOD'. 88 wf_smod = wf_smod + 1. 89 SELECT SINGLE modtext INTO wf_txt 90 FROM modsapt 91 WHERE sprsl = sy-langu 92 AND name = wa_tadir-obj_name. 93 FORMAT COLOR COL_NORMAL INTENSIFIED OFF. 94 WHEN 'SXSD'. 95 * For BADis 96 wf_badi = wf_badi + 1 . 97 SELECT SINGLE text INTO wf_txt 98 FROM sxs_attrt 99 WHERE sprsl = sy-langu 100 AND exit_name = wa_tadir-obj_name. 101 FORMAT COLOR COL_NORMAL INTENSIFIED ON. 102 ENDCASE. 103 WRITE:/1 sy-vline, 104 2 wa_tadir-obj_name HOTSPOT ON, 105 41 sy-vline , 106 42 wf_txt, 107 105 sy-vline. 108 AT END OF object. 109 WRITE : /(105) sy-uline. 110 ENDAT. 111 ENDLOOP. 112 WRITE:/(105) sy-uline. 113 SKIP. 114 FORMAT COLOR COL_TOTAL INTENSIFIED ON. 115 WRITE:/ 'No.of Exits:' , wf_smod. 116 WRITE:/ 'No.of BADis:' , wf_badi. 117 ELSE. 118 FORMAT COLOR COL_NEGATIVE INTENSIFIED ON. 119 WRITE:/(105) 'No userexits or BADis exist'. 120 ENDIF. 121 ELSE. 122 FORMAT COLOR COL_NEGATIVE INTENSIFIED ON. 123 WRITE:/(105) 'Transaction does not exist'. 124 ENDIF. 125 126 AT LINE-SELECTION. 127 DATA : wf_object TYPE tadir-object. 128 CLEAR wf_object. 129 GET CURSOR FIELD field1. 130 CHECK field1(8) EQ 'WA_TADIR'. 131 READ TABLE jtab WITH KEY obj_name = sy-lisel+1(20). 132 MOVE jtab-object TO wf_object. 133 CASE wf_object. 134 WHEN 'SMOD'. 135 SET PARAMETER ID 'MON' FIELD sy-lisel+1(10). 136 CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN. 137 WHEN 'SXSD'. 138 SET PARAMETER ID 'EXN' FIELD sy-lisel+1(20). 139 CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN. 140 ENDCASE.