Hi Experts,
I am facing high application server usage issues in my development. I'm told it is due to high memory usage by ABAP code.
I have two internal tables.
both the tables are sorted on different keys. Itab2[] is sorted on the fields on which the where clause is applied.
CURRENT APPROACH:
----------------------------------
lv_index = 1.
Loop at itab1[] into wa_itab1.
Loop at itab2[] into wa_itab2
from lv_index
where field 1 = wa_itab1-field1
field 2 = wa_itab2-field2.
IF lv_field 1 NE wa_itab2-field 1.
lv_field 1 = wa_itab1-field 1.
lv_index = sy-tabix.
ENDIF.
"do some processing | ||
ENDLOOP.
ENDLOOP.
THOUGHT APPROACH:
-----------------------------------
Loop at itab1[] into wa_itab1.
Read table itab2 into wa_itab2_temp with key field 1 = wa_itab1-field1
field 2 = wa_itab1-field2.
IF sy-subrc EQ 0.
lv_index = sy-index.
Loop at itab2[] into wa_itab2
from lv_index.
if wa_itab2-field 1 EQ wa_itab1-field1 and wa_itab2-field 2 EQ wa_itab2-field 2.
"do some processing
ELSE.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.