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

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

  • 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

  • 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.

  • 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

  • What is Parallel NAT under Network?

    In the network preference, I found a Parallel NAT was on with green light. I just wonder what is that mean? but, i've clicked the icon "-" which the Parallel NAT was deleted immediately. What is Parallel NAT?

    Its is a virtual LAN connection which Parallels uses for shared networking.
    If you've just dragged the parallels folder to the trash its not fully uninstalled.
    Leaves loads of preference files, Kext (hidden files) and folders everywhere!
    If you have thrown away the original disc image, recommend you revisit Parallels site re-download and run the uninstaller program on the image now.
    You might then want to try again.

  • What is parallel vs. bootcamp

    is parallel program same as bootcamp

    Parallels is a virtualization application that lets you run Microsoft Windows (or any other OS) on a Mac.  Parallels allows you to have a Microsoft Windows or any other OS environment running in a window on your Mac Desktop as if it were an App on Osx.
    Bootcamp allows you to have a Microsoft Windows installation running on Apple hardware, completely independent of the Mac OS that is running on it also.
    With Parallels , Windows shares the resources with the Osx at the same time, so some general performance may be lost.
    With Bootcamp, both Operating Systems are independent, and use all the hardware resources available on the computer as their own.   When one Os runs, the other does not. And Rebooting the computer is necessary to switch between Operating systems.

  • What is implicit and explicit cursor ?

    I need to know what is implicit cursor and what is Explict one with a sample source.
    Also what is the difference between these two?
    Thank you

    Check this:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#sthref1274

  • What does the "AUTO" in PARALLEL(AUTO) do?

    What does the "AUTO" in PARALLEL(AUTO) do?  I know what the PARALLEL hint does.  Usually, you would either not include something in the parentheses following the hint or you would include a number in order to set the DOP.  What happens when you use AUTO instead of a number for the DOP?  I can't find an article online that explains this.
    Thank you.

    Comments
    "PARALLEL (AUTO): The database computes the degree of parallelism, which can be 1 or greater. If the computed degree of parallelism is 1, then the statement runs serially."

  • What is MTS & Parallel Server?

    Hi! its Mohammad, I am am student, I'm really new to Oracle, would you please tell me what is Multi-Thread Server & what is Parallel Server? Thanks & Regards.

    There is no "iOS Server" as such. If you mean OS X Server, in addition to the Wikipedia article see also:
    http://www.apple.com/osx/server/
    Regards.

  • 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

  • Using a strongly typed ref cursor doesn't enforce data type

    I am trying to enforce the datatypes of the fields coming back from an oracle reference cursor by making it strongly typed. However, there seems to be no warning at compile time on the oracle side or exception in ODP.NET if the datatype coming back in the cursor does not match. For example here is my cursor and proc
    create or replace
    PACKAGE THIRDPARTY AS
    type pricing_record is record
    BaseIndexRate     number(6,5),
    BaseIndexRateType     VARCHAR2(1 BYTE)
    type cur_pricing2 IS ref CURSOR return pricing_record;
    PROCEDURE getpricingbyappidtest(appid IN application.intid%TYPE, pricing OUT cur_pricing2);
    END THIRDPARTY;
    create or replace
    PACKAGE BODY THIRDPARTY AS
    PROCEDURE getpricingbyappidtest(appid IN application.appid%TYPE, pricing OUT cur_pricing2)
    AS
    BEGIN
         OPEN pricing FOR
         SELECT      somevarcharfield, someothervarcharfield
    FROM application
    WHERE A.appid = appid;
    END getpricingbyappidtest;
    I would expect this wouldn't compile since i am putting a varchar into a number field. But it does. Also if i check the datatype in the reader on the .net side it also is a string. So odp doesn't seem to care what type the cursor is
    here is that code and output
    var schemaTable = reader.GetSchemaTable();
    using (var file = new System.IO.StreamWriter("c:\\_DefinitionMap_" + cursorName + ".txt"))
    file.WriteLine("COLUMN" + "\t" + "DATATYPE");
    foreach (DataRow myField in schemaTable.Rows)
    file.WriteLine(myField["ColumnName"] + "\t" + myField["DataType"]);
    COLUMN     DATATYPE
    BaseIndexRate     System.String
    BaseIndexRateType     System.String
    Does anyone have an approach for enforcing datatypes in a ref cursor? Am I doing something wrong when defining the ref cursor?

    Hello,
    By using a ref cursor you are really using a pointer to a cursor. There is no way I know of to make a compile check of the cursor check unless you want to create a SQL type and cast the cursor to this type and even this wouldn't work in all cases. For instance, I could have function call within my cursor select which could return a varchar (with a number always in the varchar) which would be horribly sloppy but legal and you would expect Oracle to compile it.
    If you are worried about this I would suggest not using ref cursors and go to UDT instead, where there will be more checking (because of a C# equivalence generated object). Oh and BTW, yes the cursor will throw an exception if the data is incorrect, but only at runtime - just like normal Oracle PLSQL.
    Cheers
    Rob.
    http://www.scnet.com.au

  • 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

Maybe you are looking for

  • Ipod not recognized by windows or itunes

    OK here's a humdinger: my ipod used to be recognized by my computer (meaning Windows XP), but then abruptly stopped in a catastrophic meltdown that completely wiped my ipod of everything -- didn't even show the menu. Fastforward, ipod is replaced. Wi

  • Can't open project file

    I bought a book form Adobe 'Adobe Premiere Pro Classroom in a book'. I copied all the lessons to my hard drive and when I try to open the Lesson1.prproj, I've got an error message: 'File format not supported'. Can anybody please tell me what is going

  • Doc Save As and Trusted Function

    I have been reading over the forum and the adobe help files regarding this. I think I am close but since I need to get my IT department to assist in placing the js files where they have to go, I thought I might ask the forum if I am on the right trac

  • Crystal Report to PDF change fonts, cut text and change lines

    Post Author: jzwanziger CA Forum: Exporting Hello all, I am using Crystal Reports v10 and I created my report. The report works fine and the export function works fine in some particular servers. We were developing under Windows Server 2003 Service P

  • Process the output with dispatch time 3

    Dear experts! Thank you for your attention! I ues output type BA00 to print order confirmation and set the dispatch time 3 after i save the order, where can i process the output? as in delivery output, we can use VL71 to process outbound delivery. wh