СП для значений внутренней таблицы
Удобный способ создать средство поиска по внутренней таблице — воспользоваться классом cl_reca_gui_f4_popup (обратите внимание, класс относится к пакету RE-FX):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
PARAMETERS: p_carrid TYPE s_carr_id. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_carrid. SELECT carrid, carrname FROM scarr INTO TABLE @DATA(lt_values). DATA(lo_f4) = cl_reca_gui_f4_popup=>factory_grid( id_key_field = 'CARRID' it_f4value = lt_values if_multi = abap_false id_title = 'Выбор значения' ). lo_f4->display( IMPORTING et_result = lt_values ef_cancelled = DATA(lv_cancelled) ). CHECK lv_cancelled = abap_false. p_carrid = VALUE #( lt_values[ 1 ]-carrid OPTIONAL ). |
Стандартный альтернативный вариант — использование ФМ: F4IF_INT_TABLE_VALUE_REQUEST
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 |
PARAMETERS: p_carrid TYPE spfli-carrid, p_cname TYPE scarr-carrname. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_carrid. TYPES: t_return_tab TYPE ddshretval. TYPES: BEGIN OF ty_line, carrid TYPE spfli-carrid, carrname TYPE scarr-carrname, END OF ty_line. DATA: it_list TYPE STANDARD TABLE OF ty_line, w_return_tab TYPE t_return_tab, i_return_tab TYPE STANDARD TABLE OF t_return_tab, v_repid TYPE sy-repid, v_dynnr TYPE sy-dynnr. DATA: it_map TYPE STANDARD TABLE OF dselc, wa_map TYPE dselc. v_repid = sy-repid. v_dynnr = sy-dynnr. SELECT carrid carrname FROM scarr INTO TABLE it_list. IF sy-subrc = 0. wa_map-fldname = 'F0001'. wa_map-dyfldname = 'P_CARRID'. APPEND wa_map TO it_map. wa_map-fldname = 'F0002'. wa_map-dyfldname = 'P_CNAME'. APPEND wa_map TO it_map. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'CARRID' dynpprog = v_repid dynpnr = v_dynnr dynprofield = 'P_CARRID' value_org = 'S' TABLES value_tab = it_list dynpfld_mapping = it_map EXCEPTIONS OTHERS = 0. ENDIF. |