‎2012 Mar 20 11:30 AM
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
‎2012 Mar 20 12:11 PM
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
‎2012 Mar 20 11:53 AM
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.
‎2012 Mar 20 12:11 PM
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
‎2012 Mar 20 12:21 PM
Hi,
Can you tell us what is your exact requirement. so that we can help you.
Many Thanks,
Regards,
Kiran
‎2012 Mar 20 2:21 PM
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)