Parallel Cursor Technique

Hello,
         Can some one give me a description in detail as to what exactly Parallel cursor method is and how it works.
          Also, what are the Performance Tuning Techniques that we can follow during ABAP Development?
Thanks and Regards,
Venkat

actually, I would not recommend the parallel cursor technique! First name is actually incorrect internal tables have no cursor only indexes, only parallel
index would make sense.
Performance improvement:
If costs for sort are taken into account, then parallel index is not faster than loop with loop on sorted table.
or with standard table
loop
    read ...  binary search
    index = sy-tabix   
    loop ... from index
       if  ( condition is not fulfilled )
          exit
       endif.
    endloop
endloop
The full parallel index technique should find all deviations between 2 tables, additional lines in Tab1, additional lines in tab2, changes.
Feel free to find a complete solution. We can compare results, it is not worth the effort!
Siegfried

Similar Messages

  • What is parallel cursor technique.

    what is parallel cursor technique. Please give an example
    thanx in advance

    Suppose u got data in two internal table itab1 and itab2 from header and from item table
    u have to take cobine the values into one table
    so normally what we do is that we write loop .(item table -itab2 ) inside antother loop (header table-itab1) . but it will affect the performance
    So go for Parallel cursor method
    Regards,
    Nikhil

  • What is meant by parallel cursor

    hi
    what is meant by parallel cursor

    Hi,
      Parallel cursor is the technique to increase the perforamance of the program. For example if we use nested select in our program instead of For all entries addition, then definetly performance going down. In the same way the if we use nested loops in the program it will also leads to down the performance.
      I will give you one example like take billing document header details in one table and item details in other table let say the header table have 1000 records and the item table have 1 lakh records. If you want to make an output then you need to put nested loops first loop at header table then next loop at item table. For each entry of header record the item table loops 1 lakh times. calculate the total. so instead of we develop parallel cursor technique,, see the belwo code..
    Loop at header.
    read table item with key number = header-number.
    if sy-subrc = 0.
    loop at item from sy-tabix.
    if item-number <> header-number.
    exit.
    else.
    do some process here.
    endif.
    endloop.
    endif.
    endloop.
    First the item table is read using the read table statement for getting the exact index number where the document number reside. if found then loop through the item table from that index upto item- number <> header-number.
    Rgds,
    Bujji
    Edited by: Bujji on Jun 26, 2008 12:48 PM

  • Parallel cursor

    hi experts,
    can i use more than one parallel cursor , when i looping thru different internal tables,
    i used once it in my current prog as i need multiple Grn no(ekbe-belnr) , with respect to single po(ekpo-ebeln).
    but in my current prog. i also need multiple (konv-kposn) vaue with respect to sigle po no,
    to display multiple tax calculation!
    plz help , i badly needed this answer in no time

    Hi,
    Have a look at the code below. The select the entries from KONV based on the requirement. Better not to use the select *, instead select the required fields from the tables.
    TABLES : ekko, ekpo, ekbe, konv.
    DATA: it_ekpo TYPE TABLE OF ekpo WITH HEADER LINE,
          it_ekbe TYPE TABLE OF ekbe WITH HEADER LINE,
          it_konv TYPE TABLE OF konv WITH HEADER LINE.
    DATA: l_index1 TYPE sytabix,
          l_index2 TYPE sytabix.
    SELECT-OPTIONS s_ebeln FOR ekko-ebeln.
    SELECT-OPTIONS s_knumv FOR konv-knumv.
    SELECT * FROM ekpo INTO TABLE it_ekpo WHERE ebeln IN s_ebeln.
    IF NOT it_ekpo[] IS INITIAL.
      SELECT * FROM ekbe INTO TABLE it_ekbe
        FOR ALL ENTRIES IN it_ekpo
        WHERE ebeln = it_ekpo-ebeln
          AND ebelp = it_ekpo-ebelp.
    ENDIF.
    SELECT * FROM konv INTO TABLE it_konv
                  WHERE knumv = s_knumv.
    SORT it_ekpo BY ebeln ebelp.
    SORT it_ekbe BY ebeln ebelp.
    SORT it_konv BY knumv.
    LOOP AT it_ekpo.
      LOOP AT it_ekbe FROM l_index1.
        if ( it_ekbe-ebeln ne it_ekpo-ebeln )
              and ( it_ekbe-ebelp ne it_ekpo-ebelp ).
          exit.
        else. 
        l_index1 = sy-tabix.
    *do the necessary calculations
        endif.
        LOOP AT it_konv FROM l_index2.
    write the necessary if condition so that it would exit from the loop
      if (.......)
    else.
    fill the required fields and do the necessary calculations
          l_index2 = sy-tabix.
        ENDLOOP.
      ENDLOOP.
    ENDLOOP.
    The loop of the konv table has to be placed as required based on whether it has to be in the loop of EKBE or out of EKBE.

  • What is parallel cursor

    what is parallel cursor

    Hi,
    Here is the sample program which use the parallel cursor,
    *              Performance Tuning using parallel cursor
    * Extracts from program ZFAL2002
    * START-OF-SELECTION
      SELECT *
      INTO TABLE I_KEPH FROM KEPH
      WHERE KADKY <= SY-DATUM
        AND TVERS = '01'
        AND KALKA IN ('01','Z1','Z2')
        AND BWVAR IN ('Z01','Z02','Z03','Z04','Z07')
        AND KKZST = ' '
        AND KKZMA = ' '
        AND KKZMM = ' '
        AND KEART = 'H'
        AND PATNR = 0.
    * Table must be sorted to ensure all required records are together
      SORT I_KEPH BY KALNR KALKA BWVAR KADKY.
    * Perform actual processing
      Perform get_cost_values.
    FORM GET_COST_VALUES.
    * Determine start position and then process all records for given key
    * from that starting point
    * i_keph is sorted on kalnr kalka bwvar kadky.
      READ TABLE I_KEPH WITH KEY KALNR = W_KEKO-KALNR
                                 KALKA = W_KEKO-KALKA
                                 BWVAR = W_KEKO-BWVAR
                                 KADKY = W_KEKO-KADKY BINARY SEARCH.
      IF SY-SUBRC = 0.
    * Loop at itab from first record found (sy-tabix) until record
    * no-longer matches your criteria.
        LOOP AT I_KEPH FROM SY-TABIX.
          IF  I_KEPH-KALNR = W_KEKO-KALNR AND I_KEPH-KALKA = W_KEKO-KALKA
          AND I_KEPH-BWVAR = W_KEKO-BWVAR AND I_KEPH-KADKY = W_KEKO-KADKY.
    *       Key match
            D_MAT_COST = D_MAT_COST + I_KEPH-KST001.
            D_LAB_COST = D_LAB_COST + I_KEPH-KST004.
            D_OVER_HEAD = D_OVER_HEAD + I_KEPH-KST010.
            D_EXT_PURCH = D_EXT_PURCH + I_KEPH-KST014.
            D_MISC_COST = D_MISC_COST + I_KEPH-KST002 + I_KEPH-KST003
                        + I_KEPH-KST005 + I_KEPH-KST006 + I_KEPH-KST007
                        + I_KEPH-KST008 + I_KEPH-KST009 + I_KEPH-KST011
                        + I_KEPH-KST012 + I_KEPH-KST013 + I_KEPH-KST015
                        + I_KEPH-KST016 + I_KEPH-KST017 + I_KEPH-KST018
                        + I_KEPH-KST019 + I_KEPH-KST020 + I_KEPH-KST021
                        + I_KEPH-KST022 + I_KEPH-KST023 + I_KEPH-KST024
                        + I_KEPH-KST025 + I_KEPH-KST026 + I_KEPH-KST027
                        + I_KEPH-KST028 + I_KEPH-KST029 + I_KEPH-KST030
                        + I_KEPH-KST031 + I_KEPH-KST032 + I_KEPH-KST033
                        + I_KEPH-KST034 + I_KEPH-KST035 + I_KEPH-KST036
                        + I_KEPH-KST037 + I_KEPH-KST038 + I_KEPH-KST039
                        + I_KEPH-KST040.
          ELSE.
    *       Key greater - can't be less
            EXIT.                                               " Exit loop
          ENDIF.
        ENDLOOP.
      ENDIF.
      D_MAT_COST  = D_MAT_COST  / W_KEKO-LOSGR.
      D_LAB_COST  = D_LAB_COST  / W_KEKO-LOSGR.
      D_OVER_HEAD = D_OVER_HEAD / W_KEKO-LOSGR.
      D_EXT_PURCH = D_EXT_PURCH / W_KEKO-LOSGR.
      D_MISC_COST = D_MISC_COST / W_KEKO-LOSGR.
    ENDFORM.                               " GET_COST_VALUES

  • Using parallel cursor

    Hi Experts,
    In my program using nested loop. I want avoid that using parallel cursor. But In two nested loops, using
    I done, but where has three nested loops how ? plz tell me or send code?
    Ex: my Requirment is like this
    Loop at i_tab1 into wa_tab1.
      loop at  s_tab into wa_tab2.
    end loop.
          loop at k_tab into wa_tab3
    end loop.
    end loop.
    plz send code using parallel cursor, if u get more points.
    thanx
    srinu

    HI,
    Check this Code .....
    REPORT  zparallel_cursor.
    TABLES:
      likp,
      lips.
    DATA:
      t_likp  TYPE TABLE OF likp,
      t_lips  TYPE TABLE OF lips.
    DATA:
      w_runtime1 TYPE i,
      w_runtime2 TYPE i,
      w_index LIKE sy-index.
    START-OF-SELECTION.
      SELECT *
        FROM likp
        INTO TABLE t_likp.
      SELECT *
        FROM lips
        INTO TABLE t_lips.
      GET RUN TIME FIELD w_runtime1.
      SORT t_likp BY vbeln.
      SORT t_lips BY vbeln.
      LOOP AT t_likp INTO likp.
        LOOP AT t_lips INTO lips FROM w_index.
          IF likp-vbeln NE lips-vbeln.
            w_index = sy-tabix.
            EXIT.
          ENDIF.
        ENDLOOP.
      ENDLOOP.
      GET RUN TIME FIELD w_runtime2.
      w_runtime2 = w_runtime2 - w_runtime1.
      WRITE w_runtime2.
    Either you can use the above code ..or ucan replace the inside loops with read statement of lopp with where clause depending on requirement
    Edited by: avinash kodarapu on Nov 30, 2008 4:04 PM

  • Parallel Cursor method

    Dear Experts,
    I am using parallel cursor method for a nested loop by using this method the report got very fast
    but the data from the loop where I used Parallel cursor method is not coimng after 7000 records.
    Say when I am running the report from 1st jan to 30 jan  total records are 48,000 but data from parallel cursor method 's loop is cumin till 7th of jan (7000 records) after that all values are coming zero.
    When I am running it from 7th of jan to 30 th Jan data from that loop is cumin till 15th of jan(7000 records) after that values are cumin zero.
    Below I am writing the code I used for parallel cursor method loop
    paralele cursor method
    data : v_index type sy-tabix.
    read TABLE i_konv  into wa_konv   with key  knumv  = wa_vbrk-knumv
                                                kposn = wa_vbrp-posnr  binary search.
         if sy-subrc = 0.
          v_index = sy-tabix.
       loop at  i_konv into wa_konv FROM v_index.  "FROM v_index.
         if wa_konv-knumv = wa_vbrk-knumv.
           if wa_konv-kposn <> wa_vbrp-posnr.
             exit.
             endif.
           else.
             exit.
         endif.
    Thanks and Regards,
    Vikas Patel

    Hi Vikas,
    First check there are records available completely in you Internal table...
    and Here is a very simple example for parallel cusor..
    REPORT  zparallel_cursor.
    TABLES:
      likp,
      lips.
    DATA:
      t_likp  TYPE TABLE OF likp,
      t_lips  TYPE TABLE OF lips.
    DATA:
      w_runtime1 TYPE i,
      w_runtime2 TYPE i,
      w_index LIKE sy-index.
    START-OF-SELECTION.
      SELECT *
        FROM likp
        INTO TABLE t_likp.
      SELECT *
        FROM lips
        INTO TABLE t_lips.
      GET RUN TIME FIELD w_runtime1.
      SORT t_likp BY vbeln.
      SORT t_lips BY vbeln.
      LOOP AT t_likp INTO likp.
        LOOP AT t_lips INTO lips FROM w_index.
          IF likp-vbeln NE lips-vbeln.
            w_index = sy-tabix.
            EXIT.
          ENDIF.
        ENDLOOP.
      ENDLOOP.
    compare the difference.
    Thanks & regards,
    Dileep .C

  • SY-TABIX value of a loop in other loop in other loop.

    Hello Gurus,
    I have a problem i want to modify some columns in final internal table and it is possible by using Transporting and Index but when i see SY-TABIX value it is not really giving particular loop iteration value. Because my present loop is in another loop and it is in another loop. Please gurus help me out
    or
    How to Insert particular filed columns  and how to use where clause in insert..
    Thanks.

    Hi !
    Here are things you could do:
    1. You can use nested loops with the WHERE statement on the inner loop. But this can be slow.
         This will look like this
                   loop at i_tab1 into wa1
                   loop at i_tab2 into wa2 where cond1 = wa1-cond1....
                     (   move wa2-field3 to wa1-field3.....)
                        modify i_tab1.
                   endloop.
                   endloop.
    2. You can use the parallel cursor technique as suggested above.
         This technique speeds up processing of data significantly. Here it is:
         data lv_tabix type i.
              sort i_tab1 by field1 ascending.
              sort i_tab2 by field1 ascending.
              loop at i_tab1 into wa1
              read table i_tab2 transporting no fields with key cond1 = wa1-cond1 binary search.
              lv_tabix = sy-tabix.
                   loop at i_tab2 into wa2 from lv_tabix.
                        if wa2-cond1 <> wa1-cond1.
                                   exit.       
                         endif.
                   ( move wa2-field3 to wa1-field3.....)
                        modify i_tab1.
                    endloop.
              endloop.
    Please let me know if you want more explanation

  • Hello experts read table statement is not working properly

    Hello Experts.
    my code is like this.
    sort it_matnr by matnr.
    loop at itab_result.
    read table it_matnr with key matnr = itab_result-matnr  binary search.
    endloop.
    there are nearly 2000 records in it_matnr . The records which satisfy the above condition is there here in this internal table. But it is unable to read the record which matches the condition. One thing is that , there are more than one record with the same material. ie mblnr is different but material is the same. In it_matnr table i have only 1 field ie matnr ,so i need to compare only with the matnr.I also tried by sorting it_result by matnr but of no use. Then finally I used loop at where matnr = it_result-matnr , it is working fine. But due to performance reasons we should not use this. so please tell me what to do and correct the code.

    1. Make sure that the table IT_MATNR is not getting updated inside the loop. Because it will then destroy the sorting.
    2. Secondly, if there are multiple records in IT_MATNR for the same material then it will search for the first record encountered in binary algo. So it is advisable that you may provide further filter criteria if possible. check if ITAB_RESULT & IT_MATNR have any other matching field that can be put in filter criteria.
    3.Thirdly, check if your requirement can be achieved by STABLE SORT.
    <b>SORT <itab> ... STABLE BY <f1>[ASCENDING/DESCENDING].</b>
    It will allows you to perform a stable sort, that is, the relative sequence of lines that are unchanged by the sort is not changed. If you do not use the STABLE option, the sort sequence is not preserved. If you sort a table several times by the same key, the sequence of the table entries will change in each sort. However, a stable sort takes longer than an unstable sort.
    4. Lastly, you can use parallel cursor technique of multiple loops which is given below:
    LOOP AT itab_result.
      READ TABLE it_matnr
        WITH KEY matnr = itab_result-matnr
        BINARY SEARCH.
    Process record
      LOOP AT it_matnr FROM sy-tabix.
        IF it_matnr <> itab_result-matnr.
          EXIT.
        ENDIF.
    Process record based on yuor condition
      ENDLOOP.
    ENDLOOP.

  • Nesting of two tables

    Hey,
    Is it possible to nest two tables?

    Suhas Saha wrote:
    >
    > What Yuri is suggesting is the old "Parallel Cursor" technique
    >
    > Imho nested LOOPs can be handled easily (& elegantly) using SORTED / HASHED tables. Read the SAP documentation on the optimization of the WHERE condition in LOOPs for further details.
    >
    > BR,
    > Suhas
    I explicitly did not advise to sort the table with report source code to avoid possible destroy of the coding lines order. Not because I forgot about loops on sorted tables

  • BPM - Parallel Looping - numberOfCompletedIterations.

    Hi,
    In the human activity when using parallel looping, two local attributes are generated automatically currentCollectionItem and numberOfCompletedIterations. I need the value in the numberOfCompletedIterations to my webdynpro java component. I mapped the attribute to the string attribute with function String(/numberOfCompletedIterations), irrespective of the number of iterations completed I am getting the value as 0.
    Any help will be really appreciated.
    Best Wishes
    Idhaya R

    hi,
    hope this link will help u to know about parallel cursor ie using loops inside loops
    [http://www.****************/Tutorials/ABAP/ParallelCursor.htm]
    regards,
    priya

  • How to use parrallel cursor in this code

    hi can anyone expalin me how to use parallel cursor for this code ... 
    loop at itabkpf.
          read table ibsegpar_fu with key
                     belnr = itabkpf-belnr
                     gjahr = itabkpf-gjahr
                     bschl = '25' .
    Start insert by Pradeep 20082008
          sort: itabkpf by belnr,
                itabsegpar by belnr.
    End insert by Pradeep 20082008
          if sy-subrc = 0. "Deleted by pradeep 20082008
            select bukrs belnr gjahr bschl koart lifnr wrbtr
                   wskto pswbt zfbdt augbl augdt sgtxt rebzg rebzj
                   into corresponding
                   fields of table ibsegpar_fu_1 from bseg
                   where bukrs = itabkpf-bukrs and
                   belnr = itabkpf-belnr and
                   gjahr = itabkpf-gjahr and
                   augbl <> itabkpf-belnr and
                   rebzg <> space and
                   bschl = '25'.
            loop at ibsegpar_fu_1.
    Start insert by Pradeep 20082008
              sort ibsegpar_fu_1 by belnr.
    End insert by Pradeep 20082008
              move-corresponding ibsegpar_fu_1 to itabseg.
              move ibsegpar_fu_1-belnr to itabseg-augbl.
              move ibsegpar_fu_1-rebzg to itabseg-belnr.
              move ibsegpar_fu_1-rebzj to itabseg-gjahr.
    *********to include code to pick the description for partical payment
              select single * from bseg where
                  bukrs = ibsegpar_fu_1-bukrs and
                  belnr = ibsegpar_fu_1-belnr and
                  gjahr = ibsegpar_fu_1-gjahr and
                  augbl <> ibsegpar_fu_1-belnr and
                  rebzg = space and
                  bschl <> '25'.
              move bseg-sgtxt to itabseg-sgtxt.
              clear bseg.
    *********end of code
              itabseg-wrbtr = itabseg-wrbtr * -1.
              itabseg-pswbt = itabseg-pswbt * -1.
              select single budat into lsdat from
                   bkpf where bukrs = ibsegpar_fu_1-bukrs and
                   belnr = ibsegpar_fu_1-rebzg and
                   gjahr = ibsegpar_fu_1-rebzj.
              if sy-subrc = 0.
                move lsdat to itabseg-zfbdt.
              endif.
              append itabseg.
            endloop.
          endif. "Deleted by Pradeep 20082008
        endloop.
        loop at ibsegpar_fu.
          sort ibsegpar_fu by belnr. " insert by pradeep
          move-corresponding ibsegpar_fu to itabseg.
          select bukrs belnr gjahr bschl koart lifnr wrbtr
                 rebzg rebzj sgtxt into corresponding
                 fields of table ibsegpar_fu_1 from bseg
                 where  bukrs = ibsegpar_fu-bukrs and
                 gjahr = ibsegpar_fu-gjahr and
                 augbl = ibsegpar_fu-belnr and  " Pradeep 20082008 Delete
                augbl <> ibsegpar_fu-belnr and " Pradeep 20082008 Insert
                 rebzg = space and
                 bschl = '25'.
          if sy-subrc = 0.
            loop at ibsegpar_fu_1.
              move ibsegpar_fu_1-rebzg to itabseg-rebzg.
              move ibsegpar_fu_1-rebzj to itabseg-rebzj.
            endloop.
            move ibsegpar_fu-belnr to itabseg-augbl.
            move itabseg-rebzg to itabseg-belnr.
            move itabseg-rebzj to itabseg-gjahr.
            itabseg-wrbtr = itabseg-wrbtr * -1.
            itabseg-pswbt = itabseg-pswbt * -1.
            select single budat into lsdat from
                 bkpf where bukrs = ibsegpar_fu-bukrs and
                 belnr = itabseg-rebzj and
                 gjahr = itabseg-rebzj.
            if sy-subrc = 0.
              move lsdat to itabseg-zfbdt.
            endif.
            append itabseg.
            read table itabseg with key
                 belnr = itabseg-rebzg
                 gjahr = itabseg-rebzj
                 bschl = '31' .
            if sy-subrc = 0.
             delete itabseg index sy-tabix. "Deleted by Pradeep 20082108
            endif.
          endif.
        endloop.
    Start insert by Pradeep 20082008
         loop at itabseg.
          if itabseg-belnr = itabseg-augbl.
            delete itabseg.
          elseif itabseg-belnr = ' '.
            delete itabseg.
          endif.
        endloop.
    End insert by Pradeep 20082008

    hi can anyone expalin me how to use parallel cursor for this code ... 
    loop at itabkpf.
          read table ibsegpar_fu with key
                     belnr = itabkpf-belnr
                     gjahr = itabkpf-gjahr
                     bschl = '25' .
    Start insert by Pradeep 20082008
          sort: itabkpf by belnr,
                itabsegpar by belnr.
    End insert by Pradeep 20082008
          if sy-subrc = 0. "Deleted by pradeep 20082008
            select bukrs belnr gjahr bschl koart lifnr wrbtr
                   wskto pswbt zfbdt augbl augdt sgtxt rebzg rebzj
                   into corresponding
                   fields of table ibsegpar_fu_1 from bseg
                   where bukrs = itabkpf-bukrs and
                   belnr = itabkpf-belnr and
                   gjahr = itabkpf-gjahr and
                   augbl <> itabkpf-belnr and
                   rebzg <> space and
                   bschl = '25'.
            loop at ibsegpar_fu_1.
    Start insert by Pradeep 20082008
              sort ibsegpar_fu_1 by belnr.
    End insert by Pradeep 20082008
              move-corresponding ibsegpar_fu_1 to itabseg.
              move ibsegpar_fu_1-belnr to itabseg-augbl.
              move ibsegpar_fu_1-rebzg to itabseg-belnr.
              move ibsegpar_fu_1-rebzj to itabseg-gjahr.
    *********to include code to pick the description for partical payment
              select single * from bseg where
                  bukrs = ibsegpar_fu_1-bukrs and
                  belnr = ibsegpar_fu_1-belnr and
                  gjahr = ibsegpar_fu_1-gjahr and
                  augbl <> ibsegpar_fu_1-belnr and
                  rebzg = space and
                  bschl <> '25'.
              move bseg-sgtxt to itabseg-sgtxt.
              clear bseg.
    *********end of code
              itabseg-wrbtr = itabseg-wrbtr * -1.
              itabseg-pswbt = itabseg-pswbt * -1.
              select single budat into lsdat from
                   bkpf where bukrs = ibsegpar_fu_1-bukrs and
                   belnr = ibsegpar_fu_1-rebzg and
                   gjahr = ibsegpar_fu_1-rebzj.
              if sy-subrc = 0.
                move lsdat to itabseg-zfbdt.
              endif.
              append itabseg.
            endloop.
          endif. "Deleted by Pradeep 20082008
        endloop.
        loop at ibsegpar_fu.
          sort ibsegpar_fu by belnr. " insert by pradeep
          move-corresponding ibsegpar_fu to itabseg.
          select bukrs belnr gjahr bschl koart lifnr wrbtr
                 rebzg rebzj sgtxt into corresponding
                 fields of table ibsegpar_fu_1 from bseg
                 where  bukrs = ibsegpar_fu-bukrs and
                 gjahr = ibsegpar_fu-gjahr and
                 augbl = ibsegpar_fu-belnr and  " Pradeep 20082008 Delete
                augbl <> ibsegpar_fu-belnr and " Pradeep 20082008 Insert
                 rebzg = space and
                 bschl = '25'.
          if sy-subrc = 0.
            loop at ibsegpar_fu_1.
              move ibsegpar_fu_1-rebzg to itabseg-rebzg.
              move ibsegpar_fu_1-rebzj to itabseg-rebzj.
            endloop.
            move ibsegpar_fu-belnr to itabseg-augbl.
            move itabseg-rebzg to itabseg-belnr.
            move itabseg-rebzj to itabseg-gjahr.
            itabseg-wrbtr = itabseg-wrbtr * -1.
            itabseg-pswbt = itabseg-pswbt * -1.
            select single budat into lsdat from
                 bkpf where bukrs = ibsegpar_fu-bukrs and
                 belnr = itabseg-rebzj and
                 gjahr = itabseg-rebzj.
            if sy-subrc = 0.
              move lsdat to itabseg-zfbdt.
            endif.
            append itabseg.
            read table itabseg with key
                 belnr = itabseg-rebzg
                 gjahr = itabseg-rebzj
                 bschl = '31' .
            if sy-subrc = 0.
             delete itabseg index sy-tabix. "Deleted by Pradeep 20082108
            endif.
          endif.
        endloop.
    Start insert by Pradeep 20082008
         loop at itabseg.
          if itabseg-belnr = itabseg-augbl.
            delete itabseg.
          elseif itabseg-belnr = ' '.
            delete itabseg.
          endif.
        endloop.
    End insert by Pradeep 20082008

  • Parallel Looping

    Hi,
    How does parallel looping works?
    I need to get every entry from afko-plnbez for every crhd-arbpl...
    Now for every crhd-arbpl and afko-plnbez,,, I have to get the mseg-menge where mseg-bwart = 101 and 102...Then,
    Add the values where mseg-bwart is 101 and subtract from that the summation of values where mseg-bwart is 102...
    I have the code below:
       REFRESH i_crhd.
       SELECT a~kostl
              b~objid
              b~vgwts
              b~arbpl
         FROM crco AS a INNER JOIN crhd AS b
           ON aobjid = bobjid
           INTO TABLE i_crhd
           WHERE b~arbpl IN s_arbpl.
       REFRESH i_mseg.
       SELECT a~mblnr
              a~bwart
              a~matnr
              a~werks
              a~dmbtr
              a~menge
              a~meins
              a~aufnr
              a~kostl
              b~budat
              FROM mseg AS a INNER JOIN mkpf AS b
              ON amblnr = bmblnr
              INTO TABLE i_mseg
                WHERE a~werks = p_werks
                  AND b~budat IN s_dates.
    IF i_mseg[] IS NOT INITIAL.
           REFRESH i_afko.
           SELECT aufnr
                  plnbez
                  aufpl
                  rsnum
             FROM afko INTO TABLE i_afko
             FOR ALL ENTRIES IN i_mseg
             WHERE aufnr = i_mseg-aufnr.
    endif.

    hi,
    hope this link will help u to know about parallel cursor ie using loops inside loops
    [http://www.****************/Tutorials/ABAP/ParallelCursor.htm]
    regards,
    priya

  • Double cursor read of database

    Hi,
    What is meant by double cursor read select statements.
    Can u please provide specific examples?

    Are you sure you don't mean "parallel cursor read of internal tables?"
    Rob

  • Performace optimization using Fetch  cursor

    Hi All,
    I  want to optimize this code
    IF NOT i_package_data IS INITIAL.
      REFRESH: i_gbfi150000.
      SELECT  *
              FROM /bic/agbfi150000
                      INTO TABLE i_gbfi150000
                      FOR ALL ENTRIES IN i_package_data
                      WHERE  /bic/gsrccocd = i_package_data-/bic/gsrccocd AND
                             /bic/gsrcpctr = i_package_data-/bic/gsrcpctr AND
                             /bic/gsrcjvnd = i_package_data-/bic/gsrcjvnd AND
                             /bic/gsrctpun = i_package_data-/bic/gsrctpun AND
                             /bic/gsrcacct = i_package_data-/bic/gsrcacct AND
                             /bic/gsrcmtyp = i_package_data-/bic/gsrcmtyp AND
                             /bic/gsrcactv = i_package_data-/bic/gsrcactv AND
                             /bic/gsrcfact = i_package_data-/bic/gsrcfact AND
                             /bic/gsrcpcat = i_package_data-/bic/gsrcpcat AND
                             /bic/gsrcf1   = i_package_data-/bic/gsrcf1   AND
                             /bic/gsrcf2   = i_package_data-/bic/gsrcf2   AND
                             /bic/gsrcf3   = i_package_data-/bic/gsrcf3   AND
                             /bic/gsrcf4   = i_package_data-/bic/gsrcf4   AND
                             /bic/gsrcf5   = i_package_data-/bic/gsrcf5   AND
                             /bic/gsrcf6   = i_package_data-/bic/gsrcf6   AND
                             /bic/gsrcf7   = i_package_data-/bic/gsrcf7   AND
                             /bic/gsrcf8   = i_package_data-/bic/gsrcf8   AND
                             /bic/gsrcf9   = i_package_data-/bic/gsrcf9   AND
                             /bic/gsrcf10  = i_package_data-/bic/gsrcf10.
    the internal table i_package data is having 5000 entries so  whn i  am using for all  entries it is taking a lot of time to execute.
    i  am thinking of  fetch cursor technique but am not able to  implement it.kindly help
    regards,
    Sharad

    Moderator message - Please see Please Read before Posting in the Performance and Tuning Forum before posting in the performance and tuning forum
    I don't see how using a cursor would help here at all
    Rob

Maybe you are looking for