2005 Sep 13 6:25 AM
Hi,
Last week i had to enhance a program that has a internal table with some records. I need to find populate a table with the records in the internal table. But before populating i must find out the difference in the records (i.e) the extra records in the internal table compared with the records in the database table and then i have to append those records in the internal table again and then insert the internal table records into database table. while doing it i need to create another internal table with records in database table and then loop at it to find the extra records and rest of the logic goes on.
At this point of time it clicked in my mind "WHY DON'T WE HAVE SET OPERATIONS ON TWO INTERNAL TABELS(UNION, INTERSECTION, MINUS)".
Now i am doing some study how to implemnt it. Before that i want to find out whether that functionality exists in ABAP or anybody of youo gurus have done similar work on it.
Pls help me in proceeding with my work.
Hi,
Last week i had to enhance a program that has a internal table with some records. I need to find populate a table with the records in the internal table. But before populating i must find out the difference in the records (i.e) the extra records in the internal table compared with the records in the database table and then i have to append those records in the internal table again and then insert the internal table records into database table. while doing it i need to create another internal table with records in database table and then loop at it to find the extra records and rest of the logic goes on.
At this point of time it clicked in my mind "WHY DON'T WE HAVE SET OPERATIONS ON TWO INTERNAL TABELS(UNION, INTERSECTION, MINUS)".
Now i am doing some study how to implemnt it. Before that i want to find out whether that functionality exists in ABAP or anybody of youo gurus have done similar work on it.
Pls help me in proceeding with my work.
2005 Sep 13 8:10 AM
Hi Arul,
There is no special aided SET operations upon internal tables in ABAP. Concerning your particular task I would say that you can try INSERT statement for each record in your internal table without preliminary comparing them with DB table. If there is a record in DB table with the same key then sy-subrc after INSERT will be non zero (actually 4) and no real insert would occur. So, only those records would be inserted which have no counterpart in DB table.
Best regards, Sergei