允许ALV网格单元格中的自由文本与下拉列表

时间:2017-09-04 09:40:45

标签: sap abap

我为ALV网格单元设置了一个下拉列表。 dropdow工作正常,但它只允许从下拉列表值中输入值。是否可以允许单元格中的自由文本输入?

我的ABAP代码是:

创建价值表:

<local:ucLabel Grid.Row="1" UCText="{Binding WinText, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window } }"/>

填写字段目录:

DATA: lt_dropdown TYPE lvc_t_dral,
      ls_dropdown TYPE lvc_s_dral.
data: ls_taba TYPE dd07v,
      lt_taba TYPE STANDARD TABLE OF dd07v,
      lt_tabb TYPE STANDARD TABLE OF dd07v.

CALL FUNCTION 'DD_DOMA_GET'
  EXPORTING
    DOMAIN_NAME         = 'ZBC_TRADE_NETWORK'
    LANGU               = SY-LANGU
    WITHTEXT            = 'X'
 TABLES
    DD07V_TAB_A         = lt_taba
    DD07V_TAB_N         = lt_tabb
 EXCEPTIONS
    ILLEGAL_VALUE       = 1
    OP_FAILURE          = 2
    OTHERS              = 3
        .

 IF SY-SUBRC <> 0.
   return.
 ENDIF.

loop at lt_taba into ls_taba.
  ls_dropdown-handle = '1'.
  ls_dropdown-int_value = ls_taba-domvalue_l.
  ls_dropdown-value = ls_taba-ddtext.
  APPEND ls_dropdown TO lt_dropdown.
endloop.

*method to display the dropdown in ALV
CALL METHOD go_grid->set_drop_down_table
  EXPORTING
    IT_DROP_DOWN_ALIAS = lt_dropdown.

设置ALV网格以显示

data: ls_fcat type lvc_s_fcat,
      lt_fcat type lvc_t_fcat.

field-symbols: <lfs_fcat> type ls_fcat.

call function 'LVC_FIELDCATALOG_MERGE'
    exporting
      i_structure_name = gc_struct_name
    changing
      ct_fieldcat      = lt_fcat
    exceptions
      others           = 1.

loop at lt_fcat assigning <lfs_fcat>.
  case <lfs_fcat>-fieldname.  
    when 'NETWORK'.
      <lfs_fcat>-drdn_hndl = '1'.
      <lfs_fcat>-drdn_alias = 'X'.
      <lfs_fcat>-edit = abap_on.
  endcase.
endloop.

1 个答案:

答案 0 :(得分:2)

没有。下拉字段表示固定值集。如果要同时拥有值目录和文本编辑工具,请使用值帮助(F4帮助)来实现目录访问。