Thanks for looking this. It is really difficult for me to explain. I will try.
This is related to 'Account Receivable' application.
We are pulling the BSAD table from SAP using the CPUDT (Entered Date) as mentioned in my opening thread.
BSAD contains Partially Paid documents and Fully closed Documents .
But, some of document are deleted from BSAD table in SAP and moved to BSID table (This table contains only Open Items). For example, The data updated into our QVD on last week based on CPUDT. But, today, document removed it from SAP and moved to BSID table.
In our QVD, those documents are still available and doesn't match with SAP.
The business comparing the data from QV and SAP using the transaction FBL5n.
What i was thinking, Load the full documents (Field; BELNR) from BSAD, and using the where exist condition.
Due to huge data, It is taking around 2 hours.
Attached the sample data with actual fields. I thought, if someone implemented for their application, i can use it.
So, this all doesn't seem to bad... this is just looking to incrementally delete rows based on deletion of record in the database.... what you need is a unique key to determine which rows where deleted. I couldn't find a unique key, but do you have one? If you do... then you might have to just pull the unique key from the database for all the records (should be faster because it will be a single field) and right join into your table... this will drop all the columns which are not in the database anymore.