Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Filtering internal table

Former Member
0 Likes
1,035

Hello everyone,

I want to apply a filter in codes to an internal table. Is there any function that allow me to do that easily or should I write it by myself?

Thank you.

Moderator message : Vague question, discussion locked.

Message was edited by: Vinod Kumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
904

Hi,

Are you taking about applying a filter to the data in the internal table?

If Yes below is the procedure:

1.You can take data in a internal table using select statements.

2.Use the data you got in the 1st internal table as a filter to get some another data from some another table using concept of "FOR ALL ENTRIES".

Below is a small eg:


"fetching data from bkpf table as per posting date and company code and filling i_bkpf
    select bukrs
           belnr
           xblnr
           waers
           budat from bkpf into table i_bkpf
                 where   budat in s_pos and bukrs in s_ccode .

  "fetching data from bseg table as per the data available in i_bkpf and company code.
  select bukrs
         menge
         dmbtr
         meins
         matnr
         ebeln
         lifnr
         shkzg  from bseg into table  i_bseg for all entries in i_bkpf
              where bukrs = i_bkpf-bukrs and lifnr in  s_vendno and shkzg in s_dc.

In short you are applying filter for data that is present in i_bkpf internal table and getting i_bkpf table.

Thanks,

Vikas

4 REPLIES 4
Read only

Former Member
0 Likes
904

Hi,

you mean filtering data from a internal table 1. at time or 2. in loop processing .

1. first case use delete command with condition.

2. use check or if condition with continue and exit and modify table.

please don't mind if i understood your question wrongly.

Read only

Former Member
0 Likes
905

Hi,

Are you taking about applying a filter to the data in the internal table?

If Yes below is the procedure:

1.You can take data in a internal table using select statements.

2.Use the data you got in the 1st internal table as a filter to get some another data from some another table using concept of "FOR ALL ENTRIES".

Below is a small eg:


"fetching data from bkpf table as per posting date and company code and filling i_bkpf
    select bukrs
           belnr
           xblnr
           waers
           budat from bkpf into table i_bkpf
                 where   budat in s_pos and bukrs in s_ccode .

  "fetching data from bseg table as per the data available in i_bkpf and company code.
  select bukrs
         menge
         dmbtr
         meins
         matnr
         ebeln
         lifnr
         shkzg  from bseg into table  i_bseg for all entries in i_bkpf
              where bukrs = i_bkpf-bukrs and lifnr in  s_vendno and shkzg in s_dc.

In short you are applying filter for data that is present in i_bkpf internal table and getting i_bkpf table.

Thanks,

Vikas

Read only

Former Member
0 Likes
904

Hi,

Can you tell us what is your exact requirement. so that we can help you.

Many Thanks,

Regards,

Kiran

Read only

Former Member
0 Likes
904

Actually I am trying to imitate ALV filtering in my abap code. In my program, I am submitting another program and getting its output data to send as excel attachment. While doing so, I am extracting layout data (also filtering options of ALV) and applying these to the output internal table. For example; I need to use below data to my raw data in ABAP codes;

Filter data of ALV: (lr_handle)