如何将 F4 帮助的所有值放入内部 table?

How to get all values of F4 help into an internal table?

我的目标是生成一些具有特定字段的数据。我的想法是从字段中获取所有可能的值,然后为我的数据随机选择值。

所以我想要例如货币字段的可能值:

我需要访问第一列中的所有值

所以我可以将它们移动到内部 table 并随机选择它们。

如何将字段的可能值移动到内部 table?

我需要在不同的 table 中多次执行此操作,因此采用统一的方法会很棒。

您可以使用 F4IF_FIELD_VALUE_REQUEST 功能模块来获取搜索帮助值。您可以将此功能用于货币,如下所示:

call function 'F4IF_FIELD_VALUE_REQUEST'
exporting
  tabname = 'T001'
  fieldname = 'WAERS'
  suppress_recordlist = abap_true
tables
  return_tab = it_return
exceptions
  field_not_found = 1
  no_help_for_field = 2
  inconsistent_help = 3
  no_values_found = 4
  others = 5.