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 data from internal tables

Former Member
0 Likes
2,119

Hi,

I have some common data in three internal tables. The fields in the 3 internal tables are same. It contains some common data and also some different data. Now i need to filter out the commom data among these three tables.

Based on one internal table data need to filter the common data from the remaining tables and disply them in the output list.

Let me know how we can do this.

Regards,

Ram.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,098

Hi

You can loop on one internal table, read the other two internal tables with the values, if found, remove those records from respective internal tables.

See that you keep track of index of the records while removing.

Regards,

Raj

6 REPLIES 6
Read only

Former Member
0 Likes
1,099

Hi

You can loop on one internal table, read the other two internal tables with the values, if found, remove those records from respective internal tables.

See that you keep track of index of the records while removing.

Regards,

Raj

Read only

0 Likes
1,098

Hi,

I have below internal tables.

<b>Advance_list1</b>

and the fields are:

Installation_Number

Installation_name

Lloyds_number

Country_of_operation

Superior_fun_location

Project_name

Responsible_unit

Status

and <b>Advance_list2</b> and <b>Advance_list3</b> with the same above fields. But the data will be different in all the three tables and contains some common data. Need to filter based on <b>Advance_list1</b> internal table.If there is no common data then should not disply anything in the output list.

Pls give me some input on this.

Regards,

Ram

Read only

Former Member
0 Likes
1,098

for this,

a final table can be taken with structure of all required fields which has to be displayed in output list.

read one by one internal tables by checking condition and move the data to final table, so that what ever fields are duplicate in these internal tables need not be taken, and fields will be displayed once only.

Read only

Former Member
0 Likes
1,098

Hi,

you can,

loop thru itab2.

read itab1 with key fields = itab2-fields.

if itab1 = itab2.

delete itab2 index lv_tabix.

endif.

endloop.

do the same for itab3.

Read only

Former Member
0 Likes
1,098

Loop at advance_list1.

read table advance_list2 with key (all fields).

if sy-subrc = 0.

flag2 = 'X'.

endif.

read table advance_list3 with key (all fields).

if sy-subrc = 0.

flag3 = 'X'.

endif.

check flag2 = 'X' and flag3 = 'X'.

*Please note you can use OR instead of AND if it matches one

write required data.

endloop.

Message was edited by: Anurag Bankley

Read only

Former Member
0 Likes
1,098

Hi,

Before carry out the exercise adv by the other forum mates why dont u do the following 1st if it is possible to do so.

delete adjacent duplicates from itab1 comparing all fields.

delete adjacent duplicates from itab2 comparing all fields.

delete adjacent duplicates from itab2 comparing all fields.

Cheers...

NB. Reward if it makes sense.