1

我正在寻找一个选择屏幕,我必须在其中输入表名,然后根据选择的表,我必须询问一些参数。

我尝试使用POPUP_TO_GET_VALUE / POPUP_GET_VALUES但它没有帮助,因为我需要使用选择选项而不仅仅是值。

4

1 回答 1

2

对于动态选择选项,您可以使用自由选择。写了一个小示例程序来演示用法。您可以查看 FM 的文档和 FM 的参数以获得更多自定义行为。

TYPE-POOLS: rsds.

DATA: ls_field  TYPE rsdsfields,
      lt_field  TYPE STANDARD TABLE OF rsdsfields,
      l_selid   TYPE dynselid,
      l_repid   TYPE sy-repid,
      ls_pfkey  TYPE rsdspfkey,
      lt_trange TYPE rsds_trange.

START-OF-SELECTION.

  ls_field-tablename = 'T001'.
  ls_field-fieldname = 'BUKRS'.
  ls_field-type = 'S'.
  APPEND ls_field TO lt_field.

  CALL FUNCTION 'FREE_SELECTIONS_INIT'
    EXPORTING
      kind         = 'F'
    IMPORTING
      selection_id = l_selid
    TABLES
      fields_tab   = lt_field[].

  ls_pfkey-program = sy-repid.

  CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
    EXPORTING
      selection_id    = l_selid
      title           = 'Select Company'
      as_window       = 'X'
      pfkey           = ls_pfkey
      tree_visible    = ''
    IMPORTING
      field_ranges    = lt_trange
    TABLES
      fields_tab      = lt_field[]
    EXCEPTIONS
      internal_error  = 1
      no_action       = 2
      selid_not_found = 3
      illegal_status  = 4
      OTHERS          = 5.

用户选择可以在 中找到lt_trange

于 2017-04-24T11:36:53.827 回答