in first select, take BELNR BUKRS GJAHR BUZEI.
SORT LT_BELNR by above fields.
if IT_BELNR[] is not initial.
SELECT statement 2
ENDIF.
I assume, IM_KUNRR is parameter.
Check first select is returning value or not?
BELNR like '12%' (document number range in BSEG is same)