Skip to Content
0
Jun 01, 2009 at 11:59 AM

Filtering data in internal table based on select-option inputs

2212 Views

Dear forumers,

I'm in the midst of coding a rather complex data retrieval logics for an ALV report.

In the report, I have 10 select-options (all are with ranges). At one point, I would like to filter the data in an internal table based on the select-option inputs there. All the other data retrievals from this point forward will be based on the filtered internal table (i.e i_tab4 in the codes below).

I've coded this segment in such a way, but there seems to be problems with the read statement here (I think it's rather impossible to code it this way as well because the compiler complained on a syntax error at the IN word used).

if i_tab3 is not initial.

  read i_tab3 into w_wa_3
  with key bukrs IN s_bukrs and
           anln1 IN s_anln1 and
           invnr IN s_invnr and 
           deakt IN s_deakt and 
           prctr IN s_prctr and 
                ...
           matnr IN s_matnr.

  if sy-subrc = 0.
    " Codes for moving the contents in w_wa_3 to w_wa_4 and finally to i_tab4
  endif.

endif.

Are there any better ways to filter data in an internal table? Please help (as I'm still a newbie). I'd really appreciate any inputs here at all.

Thanks.