Hi Guys,
Kindly help me with this issue..
I need to count the number of records in a database table comparing on another internal table containing more than 5000 records. This database table contains more than 2000000 records in development client itself. Please let me know which of the following alternatives is best. Thank you
1)
Loop at ITAB1.
Select count(*) from DBTAB into a variable where field1 = ITAB1-field1.
Endloop.
OR OR OR OR
2)
Select * from DBTAB into ITAB2
for all entries in ITAB1 where field1 = ITAB1-field1.
Loop at ITAB1.
Loop at ITAB2 where field1 = ITAB1-field1.
count = count + 1.
Endloop.
Endloop.
The 1) (first) option is getting executed correctly but the database access is 75% on SE30 (Run time analysis) in Dev client, still the program needs to be moved to Production
I tried with 2nd option too but it takes long time and i stopped the execution as i could not wait longer. Do not know whether this works or not. The first option is working but my main concern is SELECT within a LOOP.
In the 2nd option, when i try to move 2000000 records into ITAB2 i am not sure whether ITAB2 is capable of holding those many records at a time or not. The program execution does not stop even after waiting for 4 or 5 mintues. ITAB2 is popluated with all the records but when i look at it in DEBUG mode the record number after 100000 record is starting with a * on left side.
Awaiting your reply, Thanks...