I think the best solution would be to use package size.
When you use package size n with the select query, you select n rows at a time.
START-OF-SELECTION.
SELECT vbeln erdat FROM vbak INTO TABLElt_gty_vendormain PACKAGE SIZE 500.
SELECT knumh kopos kbetr loevm_ko INTO TABLE lt_gty_amount
FROM konp FOR ALL ENTRIES IN lt_gty_vendormain
WHERE knumh = lt_gty_vendormain-knumh
AND loevm_ko NE 'X'.
IF sy-subrc = 0.
* Now you have the two internal tables.
After processing the data, clear the tables and then continue with the next set of 500 in the first internal table. This is a loop between select and end select.
ENDIF.
ENDSELECT.