Thursday, 21 March 2013

Parallel Cursor Method

 SORTlt_vbpa BY kunnr,  "Sorting by key is very important
      lt_kna1 BY kunnr.  "Same key which is used for where condition is used here
LOOP AT lt_vbpa INTO wa_vbpa.
  READ lt_kna1 INTO wa_kna1     " This sets the sy-tabix
       WITH KEY kunnr wa_vbpa-kunnr
       BINARY SEARCH.
  IF sy-subrc 0.              "Does not enter the inner loop
    v_kna1_index sy-tabix.
    LOOP AT lt_kna1 INTO wa_kna1 FROM v_kna1_index"Avoiding Where clause
      IF wa_kna1-kunnr <> wa_vbpa-kunnr.  "This checks whether to exit out of loop
        EXIT.
      ENDIF.

****** Your Actual logic within inner loop ******

    ENDLOOP.                                                "KNA1 Loop
  ENDIF.
ENDLOOP.  " VBPA Loop 

No comments:

Post a Comment