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 |
*&---------------------------------------------------------------------* *& Report ZT16X_REPORT *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT zt16x_report. TABLES: t162, t162x. DATA: lr_mfs TYPE REF TO cl_mfs_mm. SELECT-OPTIONS s_flref FOR t162-flref DEFAULT 'AKTA'. SELECT-OPTIONS s_faugr FOR t162x-faugr MEMORY ID grp. SELECTION-SCREEN SKIP. SELECT-OPTIONS: s_faubs FOR t162x-faubs NO-EXTENSION NO INTERVALS, s_fauan FOR t162x-fauan NO-EXTENSION NO INTERVALS, s_faukt FOR t162x-faukt NO-EXTENSION NO INTERVALS, s_faulp FOR t162x-faulp NO-EXTENSION NO INTERVALS, s_fauba FOR t162x-fauba NO-EXTENSION NO INTERVALS. TYPES: BEGIN OF gty_s_data, bstyp TYPE t162-bstyp, flref TYPE t162-flref, flrtx TYPE t162t-flrtx, pos TYPE position_i, field_tech TYPE fieldname, field TYPE fieldname, status TYPE status_d, descr TYPE descr40, faubs TYPE t162x-faubs, fauan TYPE t162x-fauan, faukt TYPE t162x-faukt, faulp TYPE t162x-faulp, fauba TYPE t162x-fauba, END OF gty_s_data. TYPES: BEGIN OF lty_s_fau_key, faus1 TYPE t162-faus1, faus2 TYPE t162-faus2, faus3 TYPE t162-faus3, faus4 TYPE t162-faus4, faus5 TYPE t162-faus5, faus6 TYPE t162-faus6, faus7 TYPE t162-faus7, END OF lty_s_fau_key. DATA: gt_data TYPE TABLE OF gty_s_data, go_alv TYPE REF TO cl_salv_table. AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_faugr-low. PERFORM faugr_f4. AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_faugr-high. PERFORM faugr_f4. START-OF-SELECTION. SELECT t162~*, t162t~flrtx FROM t162 JOIN t162t ON t162t~flref = t162~flref AND t162t~spras = @sy-langu INTO TABLE @DATA(lt_t162) WHERE t162~flref IN @s_flref. SELECT * FROM t162x INTO TABLE @DATA(lt_props) WHERE spras = @sy-langu AND fautb IN ( '1', '3' ) AND faugr IN @s_faugr AND faubs IN @s_faubs AND fauan IN @s_fauan AND faukt IN @s_faukt AND faulp IN @s_faulp AND fauba IN @s_fauba. lr_mfs = cl_mfs_mm=>get_instance( ). lr_mfs->register( EXPORTING im_application = if_bapi_mereq=>fs_appl EXCEPTIONS already_registered = 1 failure = 2 ). lr_mfs->create_fs_maps( EXPORTING im_application = if_bapi_mereq=>fs_appl im_tabname = 'MEREQ_ITEM' IMPORTING ex_metafield_map = DATA(lt_mapping) ). LOOP AT lt_props ASSIGNING FIELD-SYMBOL(<ls_t162x>). LOOP AT lt_t162 ASSIGNING FIELD-SYMBOL(<ls_t162>). DATA(ls_line) = VALUE gty_s_data( ). ls_line-bstyp = <ls_t162>-t162-bstyp. ls_line-flref = <ls_t162>-t162-flref. ls_line-flrtx = <ls_t162>-flrtx. DATA(ls_fau_key) = VALUE lty_s_fau_key( ). ls_fau_key-faus1 = <ls_t162>-t162-faus1. ls_fau_key-faus2 = <ls_t162>-t162-faus2. ls_fau_key-faus3 = <ls_t162>-t162-faus3. ls_fau_key-faus4 = <ls_t162>-t162-faus4. ls_fau_key-faus5 = <ls_t162>-t162-faus5. ls_fau_key-faus6 = <ls_t162>-t162-faus6. ls_fau_key-faus7 = <ls_t162>-t162-faus7. ls_line-field = <ls_t162x>-fautx. ls_line-pos = <ls_t162x>-faunr. IF <ls_t162x>-fauba = abap_true. READ TABLE lt_mapping ASSIGNING FIELD-SYMBOL(<ls_ftech>) WITH KEY modif = <ls_t162x>-faunr. IF sy-subrc = 0. ls_line-field_tech = <ls_ftech>-fieldname. ENDIF. ENDIF. DATA(lv_bias) = CONV i( <ls_t162x>-faunr - 1 ). ls_line-status = ls_fau_key+lv_bias(1). CASE ls_line-status. WHEN '.'. ls_line-descr = 'Optional'. WHEN '+'. ls_line-descr = 'Required'. WHEN '*'. ls_line-descr = 'Display'. WHEN '-'. ls_line-descr = 'Hidden'. WHEN OTHERS. ls_line-descr = 'Undefined'. ENDCASE. ls_line-faubs = <ls_t162x>-faubs. ls_line-fauan = <ls_t162x>-fauan. ls_line-faukt = <ls_t162x>-faukt. ls_line-faulp = <ls_t162x>-faulp. ls_line-fauba = <ls_t162x>-fauba. APPEND ls_line TO gt_data. ENDLOOP. ENDLOOP. DELETE gt_data WHERE faubs IS INITIAL AND fauan IS INITIAL AND faukt IS INITIAL AND faulp IS INITIAL AND fauba IS INITIAL. TRY. cl_salv_table=>factory( IMPORTING r_salv_table = go_alv CHANGING t_table = gt_data ). DATA(lo_sel) = go_alv->get_selections( ). lo_sel->set_selection_mode( if_salv_c_selection_mode=>cell ). DATA(lp_fun) = go_alv->get_functions( ). lp_fun->set_default( abap_true ). DATA(lr_layout) = go_alv->get_layout( ). DATA ls_key TYPE salv_s_layout_key. ls_key-report = sy-repid. lr_layout->set_key( ls_key ). lr_layout->set_default( value = abap_true ). lr_layout->set_save_restriction( if_salv_c_layout=>restrict_none ). go_alv->set_screen_status( EXPORTING report = sy-repid pfstatus = 'MAIN_STATUS' set_functions = go_alv->c_functions_all ). CATCH cx_salv_msg . MESSAGE 'Ошибка при создании ALV' TYPE 'E'. ENDTRY. go_alv->display( ). FORM faugr_f4. SELECT faugr, faugt INTO TABLE @DATA(lt_data) FROM t162y WHERE spras = @sy-langu. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'FAUGR' dynprofield = 'P_FAUGR' dynpprog = sy-cprog dynpnr = sy-dynnr value_org = 'S' TABLES value_tab = lt_data. ENDFORM. |