Hi all,
I have a scenario where I need to filter a dynamic table (say, a data table) based on another ID table (say, key table). Is this possible?
The following code snippet is an example of what I am trying to do.
DATA: lt_flight TYPE STANDARD TABLE OF sflight,
lt_carr TYPE STANDARD TABLE OF scarr,
lt_data TYPE REF TO DATA.
FIELD-SYMBOLS: <lt_data> TYPE ANY TABLE.
SELECT * FROM sflight INTO TABLE lt_flight.
SELECT * FROM scarr INTO TABLE lt_carr.
CREATE DATA lt_data TYPE sfligt.
ASSIGN lt_data->* TO <lt_data>.
MOVE-CORRESPONDING lt_flight TO lt_data.
DATA(lt_temp_data) = FILTER #( <lt_data> IN mt_carr WHERE ('CARRID') = carrid ).
<lt_data> can take any table data and the filtering needs to be done on the same. Also please note that 'lt_data' is also another generic table.
Right now, I am getting a syntax error: "The type or field "%_ANY_TABLE" is generic. The access types "ANY TABLE" or "INDEX TABLE" can only be used for parameters" pointing to the last line.
Is there anyway we can make this filtering possible?