Skip to main content

Parallel Cursor Technique

AdvancedPerformance⏱ 20 min

Task

Process two sorted internal tables efficiently without nested loops by applying theparallel cursor technique.

Write Your ABAP Code

ABAP Editor
Loading...
💡 Hint

Sort both tables by key and track the index of the second table using sy-tabix.

✅ View Reference Solution
SORT lt_a BY key.
SORT lt_b BY key.

DATA(lv_idx) = 1.

LOOP AT lt_a INTO ls_a.
  READ TABLE lt_b INTO ls_b
    WITH KEY key = ls_a-key
    INDEX lv_idx.
  IF sy-subrc = 0.
    lv_idx = sy-tabix.
  ENDIF.
ENDLOOP.