In case of both internal table lines are unpredictable...
Add this piece of code just before the code suggested by Philip..
ITAB1 and ITAB2 are table used in Philips code.. itab_1 and itab_2 is your internal tables.
if lines(itab_1) >= lines(itab_2).
ITAB1 = itab_2.
ITAB2 = itab_1.
else.
ITAB1 = itab_1.
ITAB2 = itab_2.
endif.
Regards
Sreekanth