How to find summation inside a loop?

Hi Experts,
Please refer following code:
for (int i=0 ; i<wdContext.nodeWorklist().size() ; i++){
  wdContext.nodeWorklist().setLeadSelection(i);
  categoryElement = wdContext.createCategoriesElement();
  category_1Element = wdContext.createCategories_1Element();
  wbs = wdContext.currentWorklistElement().getReciever_Wbs_Element();
  sum_hrs = wdContext.currentWorklistElement().getSum_Hours();
  sum_hrs = sum_hrs.replaceAll(",",".");
  if( sum_hrs != null && sum_hrs.trim().length()>0)
  d = Double.parseDouble(sum_hrs) ;
  d1 = d + 0;
  categoryElement.setCategoryText(wbs);
  categoryElement.setSeries1Value(d);
  category_1Element.setSeries1Value(d1);
  wdContext.nodeCategories().addElement(categoryElement);
  wdContext.nodeCategories_1().addElement(category_1Element);
  wbs = "";
I have to find summation of sum_hrs. I don't know how to go about it. I have tried using following line. However it is not working.
  d1 = d + 0;
Suppose wdContext.nodeWorklist().size() = 4. In this case the loop will executed four times. Suppose in four cases sum_hrs are 2,3,5 and 2. I have to find the summation of 235+2 = 12.
Can you please help me in modifying the code in such a way that 235+2 = 12 operation is getting executed.
Thanks,
S

Hello,
Please check following code.
for (int i=0 ; i<wdContext.nodeWorklist().size() ; i++){
wdContext.nodeWorklist().setLeadSelection(i);
categoryElement = wdContext.createCategoriesElement();
double finalSum =0.0;
category_1Element = wdContext.createCategories_1Element();
wbs = wdContext.currentWorklistElement().getReciever_Wbs_Element();
sum_hrs = wdContext.currentWorklistElement().getSum_Hours();
sum_hrs = sum_hrs.replaceAll(",",".");
if( sum_hrs != null && sum_hrs.trim().length()>0)
d = Double.parseDouble(sum_hrs) ;
finalSum=finalSum+d;
categoryElement.setCategoryText(wbs);
categoryElement.setSeries1Value(d);
category_1Element.setSeries1Value(d1);
wdContext.nodeCategories().addElement(categoryElement);
wdContext.nodeCategories_1().addElement(category_1Element);
wbs = "";
Ashutosh

Similar Messages

  • [Mac OSX / JS] How to find images inside sub folders using getFiles?

    Hi,
    My script uses the variable myFolder to store the path for the images Folder. But when I try to use myFolder.getFiles() to retrieve images that are in sub folders the script fails. The result is null. What can I do to force myFolder.getFiles() to search inside all sub folders?
    var myFolder = Folder().selectDlg("Select images Folder");
    var myFiles = myFolder.getFiles();
    I will appreciate any help.
    Thanks,
    Candido

    Hi John,
    Thanks for your help.
    I'm rushing to my work  so I don't have enough time to sort it out at the moment.
    If I understand you correctly, it should be something like so:
    var files;
    var folder = Folder.selectDialog( "Select a folder with images" );
    if (folder != null) {
         files = GetImages(folder);
         if (files.length > 0) {
              alert("Found " + files.length + " image files");
         else {
              alert("Found no image files");
    function GetImages(theFolder) {
         var imageFiles = [],
         fileList = theFolder.getFiles(),
         i, file;
         for (i = 0; i < fileList.length; i++) {
              file = fileList[i];
              if (file instanceof Folder){
                   GetImages(file);
              else if (file instanceof File && file.name.match(/\.(jpg|psd|tiff|pdf|eps)$/i)) {
                   imageFiles.push(file);
         return imageFiles;
    But it doesn't work.
    Regards,
    Kasyan

  • How do we use if statement in labview?moreover can i use if statement inside for loop?

    how do we use if statement in labview?moreover can i use if statement inside for loop?

    The if statement in LabVIEW is the Case structure. You can find that on the Structures palette right next to the For Loop. If you're still on the same subject about terminating a for loop early, then what you do is enclose your functions inside the loop with a case statment and make one of the case's empty except for one or more constants that you might have to wire. Hopefully, the attached picture will explain what I mean. Also, as I mentioned in one of your other posts, I think this technique is not as good as using a while loop. The array in the attached example is the same size no matter what and you may have to handle stripping extra or invalid elements.
    Attachments:
    For_Loop_with_Case.jpg ‏21 KB

  • How can I make a control inside a loop in a subVI change value when the calling VI's control changes?

    Hi.
    I think this is a pretty basic LV question, but I have not been able to find a good solution.
    I am attaching VIs that show the problem I am having, but obviously, the real application is a lot complicated, which forces me to try to do it this way.
    The issue is: I have a subVI with a Boolean control inside a loop.  When the control is true I want some action to take place.  When the subVI is run on its own, it works fine, acting properly when I set the boolean control to true via the LV FPGA interface from the host.  However, when I use it as a subVI, in which the top-level VI calls several instances of the subVI, I have the Boolean controls in the top level VI.  What is happening is that the false Boolean value with which the top-level VI starts is passed into the subVIs, and not updated, even though the control is inside the loop.
    Can any one suggest a good solution?
    Thanks,
    AlejandroZ
    Attachments:
    CallingVI.vi ‏7 KB
    subVI.vi ‏8 KB

    Hi.
    I know the example I posted might seem silly, but it was just to illustrate the problem I am having.  In reality this is the application:
    I have some LV FPGA code which uses a few FPGA IO to implement a serial link to communicate with a device.  Most of the time we are getting data from the device, so the serial link is used to send a read command, read in the data and put it into a FIFO.  However, I also wanted the VI to support sending data to the device, so I added an array control to put the data you want to send, and a boolean control to tell it you want to send it.
    Since sending and receiving data are done using the same FPGA IO, they cannot be independent operations, because they would garble each other. Therefore, in the subVI I have a loop in which I first read data if there is any to read, then check the boolean write control to see if there is data to write.
    As I mentioned, this works perfectly for talking to a single device.  However, we run into the issue of this topic when trying to replicate this for several devices.
    One easy solution is to not have the loop in the subVI, and have it in the calling VI (I am favoring this simple solution right now).  The only reason why I have not done this yet, is that the subVI has more than one loop, so I am going to have to create several subVIs.  I just posted to see if there was an even simpler solution...
    There have been some other possibly good solutions proposed here, though I am not sure if they work in LV FPGA.
    Thanks for all your responses.
    AlejandroZ

  • How to find CR Request Number inside a package

    Hi Folks,
    how to find the CR Request Number list present inside one package.
    Reg,
    Hariharan

    Hi ,
    i had gone through the Transaction se03 Search for Object in Request/Task, in the selection screen no option for Package can you just breaf about the Selection Screen Step.
    Reg,
    Hari.

  • How to avoid data selection inside the loop?

    Hello Experts,
    I am working on one performance item and I have already applied some changes to the original version.
    Now, If I compare my new program with old program, I have good improvement in performance. I am checking if I can do anything on statements that are top on the below list. I think 40% for Modify statement is acceptable after my research (Below run is updating around 20M records which is real time volume for this application).
    As we can see 34% of run time to going for one SELECT query on custom table. Take a look at below high level flow of my program to understand above select query.
    1. Select data from ZABC
    2. Select data from Variant Table (Var1, Var2, Var3 etc.., 12 in real time)
    3. Loop Variant Table
    4. Select data from X, Y, Z table for Var<n>.
    5. Populate final internal table from ZABC, X, Y and Z table
    6. Modify ZTABLE with Final Internal table data
    7. End Loop on Variant Table
    As described in the flow of the program, ZABC table data is common for all the variants and need not to fetch multiple times. Hence I am doing it only once in my program. Below is that select query:
    select rrcty ryear rbukrs racct rcntr sum( amt1) as amt1  "Like I have 32 amount fields in original query
               from zabc
                into table i_zabc
                where ryear in r_year    " Two records in ranges with I and EQ
                and rvers = '001'
                and rrcty in r_rrcty        "Three records in ranges with I and EQ
                and rldnr = 'DT'
                group by rrcty ryear rbukrs racct rcntr
                order by rrcty ryear rbukrs racct rcntr.
    ZABC table is again having huge volume of data and we are fetching millions of records with above query. That is primary reason to take long time. May be that is okay as I am already using Indexes of this table. But, I am not comfortable with it as it can reach max. memory point and through run time error. Fetch Cursor is one reliable option that I can see here, but with that, I should move ZABC selection inside the variant loop which can cause fetching ZABC data 12 times (Let me know If I am missing anything here).
    Now, third statement in my trace results, with 10% of overall time is this:
    loop at i_abc assigning <fs_abc>. 
    loop at i_table assigning <fs_table> where low <= <fs_abc>-racct and high >= <fs_abc>-racct. 
    endloop. 
    endloop. 
    6 million executions with this complex WHERE condition is causing this statement to get 3rd position in trace results. I tried below two options which are, I think, taking even more time - (I am still monitoring these options)
    1) Removed WHERE condition on LOW, HIGH and applied filter inside the loop.
    2) Removed WHERE condition on HIGH only and applied filter inside the loop.
    Any suggestions on how to proceed with ZABC selection and I_TABLE loop.
    Let me know if you have any questions on above compose.

    Since I looked at this case before, let me try some quick suggestions:
    Is table ZABC related to table X, Y and/or Z and can the selection be limited by applying those 12 selection variants?
    If yes, try a join select involving these tables that could make your step 1 obsolete and replace steps 4 and 5.
    This might also get rid of the "loop inside loop" problem. Generally, make sure that the inner table is declared as a sorted table with a key that consists of the fields as used in the WHERE-condition of the inner loop. Use secondary keys for internal tables if your ABAP release permits and the task at hand warrants it.
    Finally, look at PACKAGE SIZE option for the (join) select to reduce memory consumption.
    Thomas

  • How to find infinite loop?

    Dear Oracle Gurus,
    I have one (some?) problem and no idea what to do.
    Our platform is IBM xSeries 234, RHEL3, 10g (version ...0.2). Database has only Oracle Application Repository shemas.
    Here is output from OS:
    #ps aux
    ... oracleandja (LOCAL=NO) -More then 200 lines
    ... /d2/oradb/andja/bin/emagent
    ... oracleandja (LOCAL=NO)
    ... ora_pmon_andja
    ... ora_mman_andja
    ... ora_dbw0_andja
    ... ora_lgwr_andja
    ... ora_ckpt_andja
    ... ora_smon_andja
    ... ora_reco_andja
    ... ora_cjq0_andja
    ... ora_d000_andja
    ... ora_s000_andja
    ... ora_qmnc_andja
    ... ora_mmnl_andja
    #top
    216 processes: 214 sleeping, 2 running, 0 zombie, 0 stopped
    1st CPU: 100%
    2nd CPU: 25%
    When I try to shutdown DB from SQL+, I got this:
    ORA-24324: service handle not initialized
    ORA-24323: value not allowed
    ORA-00020: maximum number of processes (%s) exceeded
    The most interesting error has written in .trc file:
    ORA-00600: internal error code, arguments: [kksfbc-reparse-infinite-loop], [], [], [], [], [], [], []
    Can you give me some advice how to find this infinite loop? And how to deal with this?
    Is there anything that I can do to solve this without reinstalling whole DB and AS?
    Regards

    If you cannot shut Oracle down using a shutdown immediate then you will need to get a new /nolog session and issue a "shutdown abort".
    From the error messages you listed it would appear you ran intot your maximum number of proceess limit and you will need to fix that.
    However the bug report for bug 3411348.8 makes it appear you would only get this error when performing DDL like alter table .. upgrade, ?
    What exactly was being done on your system when the problem started?
    HTH -- Mark D Powell --

  • How to use select a vi function inside a loop?

    I am modifying the notifier basics part 2.vi to send a notifier to each of 64 sub-vi's. How can you use the 'select a vi' function inside a loop for 64 iterations to access the individual filenames??
    Attachments:
    Notifier_BASICS_Part_2.vi ‏87 KB

    If all you are trying to do is send notifiers to each of these 64 subVIs, I would suggest not doing it in a loop, but rather just placing the 64 subVIs in your diagram.
    The alternative is of course to use the call by reference node and have an array of VI names. This is a little cleaner on the diagram, but 1) doesn't occur in parallel and 2) is a bit tricky. Additionally, you have to be sure that your array of filenames is correct, and that you NEVER move or rename those VIs. Of course, you could always put them in a directory and create an array by reading the directory contents.
    Either way, good luck, it doesn't sound like fun.

  • How to find loop in Supervisor Hirarchy.

    How to find loop in Supervisor Hirarchy.
    Employee - > supervisor 1 (Manager) ->supervisor 2 (Manager) -> Employee (Manager)
    Thanks

    Remember to always truncate the time portion when checking effective dates in HRMS. So the query should be rewritten as:
    SELECT
    a.business_group_id, a."PERSON_ID",a.assignment_id, a."EMPLOYEE_NUMBER", a."FULL_NAME",
    a."SUPERVISOR_ID", a."SUPERVISOR_EMP_NO", a."SUPERVISOR",
    a."ORGANIZATION_ID",a."POSITION",
    LEVEL level1,
    CONNECT_BY_ROOT supervisor_emp_no top_supervisor,
    CONNECT_BY_ISCYCLE loopback,
    CONNECT_BY_ROOT supervisor_id as top_supervisor_id,
    SYS_CONNECT_BY_PATH (supervisor_emp_no, '/') PATH
    FROM (SELECT
    papf.business_group_id,
    papf.person_id,
    paaf.assignment_id,
    papf.employee_number,
    papf.full_name,
    paaf.supervisor_id,
    papf1.employee_number supervisor_emp_no,
    papf1.full_name supervisor,
    paaf.organization_id,
    hr_general.DECODE_POSITION(paaf.position_id) position
    FROM per_all_people_f papf,
    per_all_assignments_f paaf,
    per_all_people_f papf1
    WHERE papf.person_id = paaf.person_id
    AND papf1.person_id = paaf.supervisor_id
    and papf.CURRENT_EMPLOYEE_FLAG = 'Y'
    AND paaf.primary_flag = 'Y'
    AND papf.business_group_id = paaf.business_group_id
    AND papf1.business_group_id = papf.business_group_id
    AND TRUNC(SYSDATE) BETWEEN papf.effective_start_date
    AND papf.effective_end_date
    AND TRUNC(SYSDATE) BETWEEN paaf.effective_start_date
    AND paaf.effective_end_date
    AND TRUNC(SYSDATE) BETWEEN papf1.effective_start_date
    AND papf1.effective_end_date
    ) a
    where CONNECT_BY_ISCYCLE > 0
    CONNECT BY NOCYCLE PRIOR a.person_id = a.supervisor_id
    ORDER SIBLINGS BY a.person_id

  • How to avoid the loop inside the loop? as it reduces the performance.

    hi masters,
    i have 2 internal tables having 1 same field. eg table itab having f1, f2, f3 fields and itab1 having f1, f4 and f5 fields. let us consider the data in the itab and itab1 is like below given
    itab-f1   itab-f2   itab-f3                 itab1-f1     itab1-f4   itab1-f5
    10        aa         11                      10             abc       456
    10        bb         15                      10             def        655
    10        ff           13                      10             ghi        456
    11        dd         16                      10             tre         455
    11        zz         24                      11             ftr          256
    11        ii           54                      11             kjh         556
    12        hh         24                      12             fjk          751
    now i want the result in final table like below
    f1         f2       f3         f4         f5
    10        aa      11      abc      456
    10        aa      11      def       655
    10        aa      11      ghi       456
    10        aa      11      tre       455
    10        bb      15      abc      456
    10        bb      15      def       655
    10        bb      15      ghi       456
    10        bb      15      tre       455
    10        ff        13      abc      456
    10        ff        13      def      655
    10        ff        13      ghi      456
    10        ff        13      tre       455
    11        dd      16      ftr        256
    11        dd      16      kjh      556
    11        zz      24      ftr       256
    11        zz      24      kjh      556
    11        ii        54      ftr       256
    11        ii        54      kjh      556
    12        hh      24      fjk       751
    i can get this result using the
    Loop at itab.
    loop at itab1 where f1 = itab-f1.
    process....
    endloop.
    endloop.
    but it is very slow. i want to avoid this loop inside the loop and i want to implement the same program using read table.. like below..
    Loop at itab.
    Read table itab1 with key ....
    process...
    endloop.
    Is it possible? to get multiple records from itab2 using read statement or with READ statement that using CASE Statement or IF statemetnt.
    Plz help me...

    hi,
    please try the following code
    TYPES:
      begin of ty_itab2,
       f1
       f2
       f3
       f4
       f5
      end of ty_itab2.
    DATA:
      lw_tab2tmp type ty_itab2,
      lt_tab2tmp type standard table of ty_itab2.
    sort it_itab by f1.
    loop at it_itab into lw_itab.
      at new f1.
        CLEAR lt_tab2tmp[].
        loop at it_itab1 into lw_itab1 where f1 = lw_itab-f1.
          CLEAR lw_tab2tmp.
          move-corresponding lw_itab1 to lw_tab2tmp.
          append lw_tab2tmp into lt_tab2tmp.
        end loop.
        "while there is no data with f1 in it_itab1
        if lt_tab2tmp is initial.
          lw_tab2tmp-f1 = lw_itab-f1.
          append lw_tab2tmp into lt_tab2tmp.
        endif.
      end at.
      CLEAR lw_tab2tmp.
      MOVE-CORRESPONDING lw_itab to lw_tab2tmp.
      modify lt_tab2tmp from lw_tab2tmp TRANSPORTING f2 f3 where not f1 is initial.
      append lines of lt_tab2tmp into lt_itab2.
    end loop.
    lt_itab2 is the final table.
    There may be some syntactically errors.
    I have not a system to test it now, please test it.

  • How to build an array inside a loop

    Hi everyone,
    I have a basic question about labview. I would like to create an array in a "for" loop in that way:
    inside the loop, if a condition named "A" is verified, then, i add a new value to the first column of the array.  Otherwise, i create a new column, and start to add values to this column when the condition "A" is verified, etc.
    I put an example of a VI where the condition "A" is "the increment of the loop + 1 is not divisible by 5" and the values of the arrays are the increment of the loop + 1. The loop stops when the increment = 25.
    In this example, i have a single column with the values [1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21 22 23 24]
    while I would like to have an array of 5 columns:
    1   6   11   16   21
    2   7   12   17   22
    3   8   13   18   23
    4   9   14    19   24
    Note than this is just an example. More generally, the array can contain columns of different lengths.
    Thanx for your answer
    Andrew
    Solved!
    Go to Solution.
    Attachments:
    build_array.vi ‏9 KB

    You can't have columns in an array have different lengths - you can dynamically increase the size of the array (e.g. build array) but it means you will get the default value of the array in the other columns up to the new size of the array (normally 0).
    You will need to either keep track of the last index you wrote to for each column so you can trim it later or put an array in a cluster and then create an array of those (an array of a cluster of an array) - that will allow your column data array to have different lengths and you'll just need to unbundle/bundle the array before adding new items.
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • Standard function module inside a loop.

    Hi Experts,
    I am trying to improve performance program that has a standard abap function module inside a loop. I am some what lost on what to do here. Here below is what the code looks like as of now. I have read that i need to try and not use the function module at all be it is a very complicated function module. Any suggestions will be appreciated.
    DATA: tl_retorno TYPE bapireturn1 OCCURS 0 WITH HEADER LINE. "Retorno
       DATA: wl_bukrs   LIKE acct_det_bf-comp_code,     "Empresa
             wl_process LIKE acct_det_bf-process,       "Chave
             wl_symko   LIKE hrpp_acct_det-symb_acct,   "Conta Simbólica
             wl_momag   LIKE hrpp_acct_det-eg_acct_det, "Agrupamento
             wl_razao   LIKE acct_det_bf-gl_account.    "Conta Razão
    *-->                  <--*
       SORT tg_rubcr BY bukrs lgart.
       LOOP AT tg_rubcr.
         CLEAR: wl_bukrs, wl_process, wl_symko, wl_momag, wl_razao.
         wl_bukrs   = tg_rubcr-bukrs.
         wl_process = tg_rubcr-process.
         wl_symko   = tg_rubcr-symko.
         CLEAR tg_aux.
         IF tg_rubcr-u_momag IS INITIAL. "A rubrica necessita de agrupamento?
           CLEAR wl_momag.
    * Busca Contas Razão sem Agrupamento de Empregados
           CALL FUNCTION 'HRPP_FI_ACCT_DET_HR'
             EXPORTING
               companycode              = wl_bukrs
               process                  = wl_process
               symb_acct                = wl_symko
               eg_acct_det              = wl_momag
               add_modif                = ' '
             IMPORTING
               gl_account_debit         = wl_razao
    *         GL_ACCOUNT_CREDIT        =
    *         POSTING_KEY_DEBIT        =
    *         POSTING_KEY_CREDIT       =
    *         ACCOUNT_TYPE             =
             TABLES
               return_tab               = tl_retorno.
           tg_rubcr-razao = wl_razao.
           tg_aux = tg_rubcr.
           APPEND tg_aux.
         ELSE.  "Não necessita de agrupamento de empregado?
           LOOP AT tg_t52em. "Para todos os agrupamentos
             CLEAR tg_aux.
             CLEAR tl_retorno.
             REFRESH tl_retorno.
             CLEAR wl_momag.
             wl_momag  = tg_t52em-momag.
    * Busca Contas Razão com Agrupamento de Empregados
             CALL FUNCTION 'HRPP_FI_ACCT_DET_HR'
               EXPORTING
                 companycode              = wl_bukrs
                 process                  = wl_process
                 symb_acct                = wl_symko
                 eg_acct_det              = wl_momag
                 add_modif                = ' '
               IMPORTING
                 gl_account_debit         = wl_razao
    *           GL_ACCOUNT_CREDIT        =
    *           POSTING_KEY_DEBIT        =
    *           POSTING_KEY_CREDIT       =
    *           ACCOUNT_TYPE             =
               TABLES
                 return_tab               = tl_retorno.
             tg_rubcr-razao = wl_razao.
             tg_aux = tg_rubcr.
             tg_aux-momag = tg_t52em-momag.
             APPEND tg_aux.
           ENDLOOP.
         ENDIF.
       ENDLOOP.
    * Limpa tabela com rubricas e move todo o conteúdo da auxiliar
       REFRESH tg_rubcr.
       CLEAR tg_rubcr.
       tg_rubcr[] = tg_aux[].
    ENDFORM.                    " busca_conta_razao

    Hi Patrick,
    If you do not want to use the function module then the other option that you can use is do selects from the tables that the FM 'HRPP_FI_ACCT_DET_HR' is using to get the importing "parameter  gl_account_debit         = wl_razao"  outside the loop.
    So steps will be:
    Debug FM 'HRPP_FI_ACCT_DET_HR'  to find out how it getting importing data using exporting parameters.
    Then before the loop is called do a select for all entries on table tg_rubcr. And id muliple tables are used Read statements to populate a final table with gl_account_debit         = wl_razao value.
    Then use the final table to get this value inside the loop.
    Please let me know if you need more details.

  • How to find total number of records in a BDoc?

    Dear all,
    I have replicated about BP 1088 records from ISU into CRM system with block size 100. Technically on SMW01, for each successfully processed BDoc, there will be 100 records (corresponds to 100 block size). But due to some failed BDocs, not all "successfully" BDocs will have 100 records each, some may have only 1 record inside...or 30...or 88 for example. So, may i know how to find or is there a report i can look into to find the total number of records clearly shown for each of the successfully processed green status BDocs???
    Please help and points will be rewards!!
    Thank You
    Best Regards,
    CK

    I am just showing this to show how to get the rowcount along with the cursor, if the program has so much gap of between verifying the count(*) and opening the cursor.
    Justin actually covered this, he said, oracle has to spend some resources to build this functionality. As it is not most often required, it does not makes much sence to see it as a built-in feature. However, if we must see the rowcount when we open the cursor, here is a way, but it is little bit expensive.
    SQL> create table emp_crap as select * from emp where 1 = 2;
    Table created.
    SQL> declare
      2   v_cnt     number := 0;
      3   zero_rows         exception;
      4  begin
      5    for rec in (select * from (select rownum rn, e.ename from emp_crap e) order by 1 desc)
      6     loop
      7        if v_cnt = 0 then
      8           v_cnt := rec.rn;
      9        end if;
    10     end loop;
    11     if v_cnt = 0 then
    12        raise zero_rows;
    13     end if;
    14   exception
    15    when zero_rows then
    16      dbms_output.put_line('No rows');
    17   end;
    18  /
    No rows
    PL/SQL procedure successfully completed.
    -- Now, let us use the table, which has the data
    SQL> declare
      2   v_cnt     number := 0;
      3   zero_rows         exception;
      4  begin
      5    for rec in (select * from
      6          (select rownum rn, e.ename from emp e)
      7          order by 1 desc)
      8     loop
      9        if v_cnt = 0 then
    10           v_cnt := rec.rn;
    11           dbms_output.put_line(v_cnt);
    12        end if;
    13     end loop;
    14     if v_cnt = 0 then
    15        raise zero_rows;
    16     end if;
    17   exception
    18    when zero_rows then
    19      dbms_output.put_line('No rows');
    20   end;
    21  /
    14
    PL/SQL procedure successfully completed.Thx,
    Sri

  • Smart form - loop inside a loop

    Dear Techies,
      I am new to smartforms. I have a query, in one of the code examples there is a context menu on the main window called "complex selection", but i dont find the same in my editor, what is the reason.
      I want this because i have data in two internal tables. Different tables are generated from secondary depending on the entries in first table. how do i achieve this on the main window.
    Similar to loop inside a loop, depending on my first table entries, all the entries belonging to that entry are to be put in table of second entry. i will have tables equal to the entries in first internal table. hope my question is clear.
    Please help.
    Regards
    imran.

    Hye..
      Loop in main area will fill only the current table, but i want several tables depending on entries in the first internal table.  The number of tables in the main window will be the number records in the first table.
    Regards
    imran.

  • How to find out the user-exits?

    hi.
    how to find out the user-exits?
    regards
    eswar.

    Hi,
    *& Report  ZEXITFINDER
    *report  zexitfinder.
    *& Enter the transaction code that you want to search through in order
    *& to find which Standard SAP User Exits exists.
    *& Tables
    tables : tstc, "SAP Transaction Codes
    tadir, "Directory of Repository Objects
    modsapt, "SAP Enhancements - Short Texts
    modact, "Modifications
    trdir, "System table TRDIR
    tfdir, "Function Module
    enlfdir, "Additional Attributes for Function Modules
    tstct. "Transaction Code Texts
    *& Variables
    data : jtab like tadir occurs 0 with header line.
    data : field1(30).
    data : v_devclass like tadir-devclass.
    *& Selection Screen Parameters
    selection-screen begin of block a01 with frame title text-001.
    selection-screen skip.
    parameters : p_tcode like tstc-tcode obligatory.
    selection-screen skip.
    selection-screen end of block a01.
    *& Start of main program
    start-of-selection.
    Validate Transaction Code
    select single * from tstc
    where tcode eq p_tcode.
    Find Repository Objects for transaction code
    if sy-subrc eq 0.
    select single * from tadir
    where pgmid = 'R3TR'
    and object = 'PROG'
    and obj_name = tstc-pgmna.
    move : tadir-devclass to v_devclass.
    if sy-subrc ne 0.
    select single * from trdir
    where name = tstc-pgmna.
    if trdir-subc eq 'F'.
    select single * from tfdir
    where pname = tstc-pgmna.
    select single * from enlfdir
    where funcname = tfdir-funcname.
    select single * from tadir
    where pgmid = 'R3TR'
    and object = 'FUGR'
    and obj_name = enlfdir-area.
    move : tadir-devclass to v_devclass.
    endif.
    endif.
    Find SAP Modifactions
    select * from tadir
    into table jtab
    where pgmid = 'R3TR'
    and object = 'SMOD'
    and devclass = v_devclass.
    select single * from tstct
    where sprsl eq sy-langu
    and tcode eq p_tcode.
    format color col_positive intensified off.
    write:/(19) 'Transaction Code - ',
    20(20) p_tcode,
    45(50) tstct-ttext.
    skip.
    if not jtab[] is initial.
    write:/(95) sy-uline.
    format color col_heading intensified on.
    write:/1 sy-vline,
    2 'Exit Name',
    21 sy-vline ,
    22 'Description',
    95 sy-vline.
    write:/(95) sy-uline.
    loop at jtab.
    select single * from modsapt
    where sprsl = sy-langu and
    name = jtab-obj_name.
    format color col_normal intensified off.
    write:/1 sy-vline,
    2 jtab-obj_name hotspot on,
    21 sy-vline ,
    22 modsapt-modtext,
    95 sy-vline.
    endloop.
    write:/(95) sy-uline.
    describe table jtab.
    skip.
    format color col_total intensified on.
    write:/ 'No of Exits:' , sy-tfill.
    else.
    format color col_negative intensified on.
    write:/(95) 'No User Exit exists'.
    endif.
    else.
    format color col_negative intensified on.
    write:/(95) 'Transaction Code Does Not Exist'.
    endif.
    Take the user to SMOD for the Exit that was selected.
    at line-selection.
    get cursor field field1.
    check field1(4) eq 'JTAB'.
    set parameter id 'MON' field sy-lisel+1(10).
    call transaction 'SMOD' and skip first screen.
    Regards

Maybe you are looking for

  • Multiple iPod Touch issues

    I received my iPod Touch last Thursday and then spent most of Friday just trying to get the blasted thing to accept my wireless password. Note: I have multiple wireless devices, (one router) all of which use the same password with no problems. Finall

  • 4:3 being cropped in Projects

    Hello, I have a full frame ( 4:3 ) video on my hard drive, when I import it into iMovie it is being stretched into 16:9, but when I add it to a project iMovie '09 it is being cropped. How do I get it into its correct aspect ratio? Cheers Message was

  • Help regarding report

    hai gurus, I am new to reporting, can any one tell me if there is a requirment, how can we come to know which fields to be taken in free chrcs, filters , rows n columns,, how we will come to know we need to create the variables, etccc plz help me out

  • How we will update data in datasources

    hi gurus, how we will update data in data sources say salesorder header data, delivery&billing data and how can we link all these. i think my question is not correct, but i am gettin doubt please  clear anybody it will helpful for me thanks in advanc

  • Where is AI Config, AI Start, AI Read, etc. in LabView 8.0

    When migrating from LabView 6.1 to LabView 8.0, uploading existing programs give multiple errors when dealing with hardware.  Starting at the basics, using a PXI 1000 chassis, MX-3 interface, 1102C thermocouple compensating card, LabView 8.0 indicate