Под катом отчёт показывающий все возможные пути по коду стандартной транзакции
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 |
REPORT ZNEWPATH. TYPES: BEGIN OF ty_menu, parent TYPE MENU_NUM_5, children TYPE MENU_NUM_5, LEVEL TYPE MENU_NUM_2, END OF ty_menu. DATA: lt_mencu TYPE STANDARD TABLE OF SMENCUSNEW, ls_mencu TYPE SMENCUSNEW, lt_menu TYPE STANDARD TABLE OF ty_menu, ls_menu TYPE ty_menu, lv_parent TYPE MENU_NUM_5. FIELD-SYMBOLS: <fs_mencu> TYPE SMENCUSNEW, <fs_menu> TYPE ty_menu. PARAMETERS: TRANS LIKE TSTC-TCODE OBLIGATORY. START-OF-SELECTION. SELECT * FROM SMENCUSNEW INTO CORRESPONDING FIELDS OF TABLE lt_mencu WHERE REPORT = TRANS AND CUSTOMIZED = 'S'. IF sy-subrc NE 0. MESSAGE 'Транзакции не существует' TYPE 'S'. EXIT. ENDIF. LOOP AT lt_mencu ASSIGNING <fs_mencu>. CLEAR ls_menu. ls_menu-parent = <fs_mencu>-object_id. ls_menu-LEVEL = <fs_mencu>-menu_level. APPEND ls_menu TO lt_menu. lv_parent = <fs_mencu>-parent_id. CLEAR sy-subrc. WHILE sy-subrc EQ 0. SELECT SINGLE * FROM SMENCUSNEW INTO ls_mencu WHERE OBJECT_ID EQ lv_parent AND CUSTOMIZED = 'S'. IF sy-subrc EQ 0. ls_menu-children = ls_mencu-object_id. ls_menu-LEVEL = ls_mencu-menu_level. APPEND ls_menu TO lt_menu. lv_parent = ls_mencu-parent_id. CLEAR ls_mencu. ENDIF. ENDWHILE. ENDLOOP. SORT lt_menu BY parent children LEVEL. LOOP AT lt_menu ASSIGNING <fs_menu> WHERE children IS INITIAL. WRITE: /(30) 'Главное меню' COLOR 2. LOOP AT lt_menu INTO ls_menu WHERE parent EQ <fs_menu>-parent AND children IS NOT INITIAL. PERFORM GET_MENUTEXT USING ls_menu-children ls_menu-LEVEL. ENDLOOP. PERFORM GET_MENUTEXT USING <fs_menu>-parent <fs_menu>-LEVEL. ULINE. ENDLOOP. * Запуск транзакции AT LINE-SELECTION. IF NOT TRANS IS INITIAL. CALL TRANSACTION TRANS. ENDIF. FORM GET_MENUTEXT USING objectid TYPE MENU_NUM_5 LEVEL TYPE MENU_NUM_2. DATA: lv_title TYPE SSM_TITLE, lvl TYPE MENU_NUM_2. lvl = LEVEL + 1. SELECT SINGLE TEXT FROM SMENCUST INTO lv_title WHERE OBJECT_ID EQ objectid AND SPRAS EQ sy-langu. WRITE: /lvl(140) lv_title COLOR 2. ENDFORM. |