Sort the 2 tables based on key fields.
Loop over the 1st table.
Use a table operation or READ TABLE on the 2nd table based on the key fields of the 1st table’s work area or field symbol.
This would provide the sy-tabix value.
Loop over the 2nd table based on this sy-tabix.
Advantage: We would be processing only the relevant entries from the 2nd table.