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

Viewed 1256

My goal is to generate some data with certain fields. My idea was to get all possible values from the field and then randomly pick values for my data.

So I want for example the possible values of a currency field : enter image description here

I need to access all the values from the first column

enter image description here

So I can move them to an internal table and randomly pick them.

How can I move the possible values of a field into an internal table?

I will need to do this multiple times from different tables, so a unified method would be great.

1 Answers

You can use F4IF_FIELD_VALUE_REQUEST function module for getting search help values. You can use this function for currency like below:

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.
Related