No. of Rows in Internal Table for Particular Record

Hi all,
    I'm having an Internal Table with the Following Datas,
Date                Value
12.03.2008        8
13.03.2008        7
13.03.2008        4
14.03.2008        5
14.03.2008        6
I want to find out how many records are there for the Paricular Date.And i have to add those values.The Result should be
Date                Value
12.03.2008        8
13.03.2008        11
14.03.2008        11
In that Internal Table,Date is not the Key Field.So we cant go for Collect Statement.
Regards,
Padmam.

hi,
pls check this code . in this code i ristic the multiple entries in a single day for Diesel Consumed Diesel add in genset.
follow the code and apply in your program ............
sort it by swerk idate equnr ascending vlcod descending recdv ascending . "cntrr ascending.
loop at it.
  at new idate.
   check = it-idate.
   flag = 0.
  endat.
or
send the whole code.............
reward point if helpful...........
regards,
pankaj
  on change of it-equnr.
    flag = 0.
  endon.
  if check = it-idate.
      if it-vlcod = 'OPEN' and flag = 0.
        it2 = it.
        append it2.
        flag = 1.
        count = count + 1.
     elseif flag = 0 and count = 0.
       count = 1.
      elseif it-vlcod = 'CLOS'.
       if flag = 0 and count = 0.
         count = 1.
       endif.
        it2-vlcod_cl = it-vlcod.
        it2-itime_cl = it-itime.
        it2-recdv_cl = it-recdv.
        if count = 0.
        else.
          modify it2 index count transporting vlcod_cl itime_cl recdv_cl.
        endif.
     elseif it-vlcod = ''.
       it2 = it.
       append it2.
       count = count + 1.
      elseif it-atinn = '0000000151'.  " Diesel Consumed
         it2-di_con = it-recdv.
         it2-sum_con = it2-sum_con + it2-di_con.
         if count = 0.
        else.
           modify it2 index count transporting di_con sum_con.
        endif.
        modify it2 index count transporting di_con sum_con.
      elseif it-atinn = '0000000152'.  " Diesel added
         it2-di_add = it-recdv.
         it2-sum_add = it2-sum_add + it2-di_add.
        if count = 0.
        else.
             modify it2  index count transporting di_add sum_add.
        endif.
        modify it2  index count transporting di_add sum_add.
      endif.
  endif.
endloop.
clear it.
clear it[].
it[] = it2[].

Similar Messages

  • How to append  row in internal table for perticular condition

    Hi,
    I have 4 records in my internal table and i want to append row
    after second row when condition will match.
    please guide me.
    thanks in advancs
    regards
    SND

    hi,
    using key word INDEX u can insert a record in aspecified position as
    if internal table is with header line.
    INSERT <internaltable> index SY_INDEX [or index no if u  know where to insert]
    with out header line.
    INSERT <internaltable> FROM <workarea> index SY_INDEX [or index no if u  know where to insert]
    if condition is true.
    insert itab index 2.
    endif.
    if helpful reward some points.
    with regards,
    Suresh.A

  • With in the internal table can I READ the same internal table for a record?

    With in the internal table can I READ the same internal table?
    For Suppose
    LOOP AT itab.
    can I do as below
    READ TABLE itab with key bukrs = itab-bukrs
                       belnr = itab-belnr.
    *and I have to compare
    IF itab-shkzg = itab-shkzg_ia.
    ENDIF.
    ENDLOOP.

    Hi,
    Yes..But use work area to differentiate..
    EX.
    DATA: WA LIKE ITAB.
    DATA: WA_READ LIKE ITAB.
    LOOP AT itab <b>INTO WA</b>.
    can I do as below
    READ TABLE itab <b>INTO WA_READ</b>
               with key bukrs = itab-bukrs
    belnr = itab-belnr.
    *and I have to compare
    IF <b>WA</b>-shkzg = <b>WA_READ</b>-shkzg_ia.
    ENDIF.
    ENDLOOP.
    Please reward for helpful answers.
    Thanks,
    Naren

  • Grouping of two rows of internal table

    Hi all,
    I am having a requirement in which I want to group two rows of an internal table and assign a pointer to the two rows.
    This pointer variable will then be passed to ALV.
    Help reqd.
    regards.

    Hi Gaurav,
    Hope the below code helps:
    TYPES :BEGIN OF TY_ITAB2,
    DATA(400),
    END OF TY_ITAB2.
    DATA: ITAB3 TYPE TY_ITAB2 OCCURS 0 WITH HEADER LINE
    Loop at itab1.
    ITAB3-DATA = ITAB1-LABEL.
    APPEND ITAB3.
    ITAB3-DATA = ITAB1-MATNR.
    APPEND ITAB3.
    endloop.
                        or
    You can create a deep internal table. You can declare one Column as an internal table and store the NOTES in that Internal table for each row.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm
    you can check the example in the link
    Kindly Reward Points If You Find The Reply Helpful.
    Cheers,
    Chaitanya.

  • Determine Number of  rows in Internal Table

    Hi,
      I have defined my internal table as follows:
         TYPES : BEGIN OF ABC_KEY,
                  FIELD1(2)   TYPE C,
                  FIELD2(1)   TYPE C,
                  FIELD3(8)   TYPE N,
                  END OF ABC_KEY.
    DATA: itab1 TYPE TABLE OF ABC_KEY
                      WITH KEY FIELD1,
           wa_lines_1 LIKE LINE OF itab1.
    How can I retrieve the number of rows in Internal Table?
    Thanks.
    Regards,
    bw_newbie

    You can define the number of rows of the internal table using the DESCRIBE itab command .
    As the rest have already stated a sample code snippet .
    For more info type in DESCRIBE in your prgram and click on (F1) by placing the cursor on DESCRIBE .
    You will find more options as to how you can use the DESCRIBE command according to your requirement .
    Thanks ,
    Hari

  • To count number of records in an internal table for a condition

    Hello All,
            I want to count number of records in an internal table for a condition.
    For e.g. -- I have one internal table IT which having fields F1, F2, F3, F4, F5.
                     Now, I want number of records in itnternal table IT where F1 = 'ABC'.
    Is it possible to do..?? If yes, then how.??
    Thanks in advance...!!
    Regards,
    Poonam.

    Hi,
    If you mean an internal table, there are a few ways to do this.
    1 One would be to loop over the table with a WHERE clause and increment a counter.
    data: lv_counter type i.
    clear lv_counter.
    loop at itab where fld1 = 'ABC'.
    lv_counter = lv_counter + 1.
    endloop.
    lv_counter now has the number of rows per the condiction.
    2  Well, you may want to try this as well, and compare to the LOOP way. Not sure what kind of overhead you may get doing this way. Here ITAB is our main internal table, and ITAB_TMP is a copy of it. Again I think there may be some overhead in doing the copy. Next, delete out all records which are the reverse of your condition. Then whatever is left is the rows that you want to count. Then simply do a LINES operator on the internal table, passing the number of lines to LV_COUNT.
    data: itab type table of ttab.
    data: itab_tmp type table of ttab.
    itab_tmp[] = itab[].
    delete table itab_tmp where fld1  'ABC'.
    lv_count = lines( itab_tmp ).
    Thanks & Regards,
    ShreeMohan

  • How to create internal table for a structure in BSP

    hi ,
    I have created a Structure in BSP.I want to create an internal table for that Structure. But in my coding ie.
    <% data: begin of itab_1 .
                     include type zuvendstr.
                     data:end of itab_1.
                     data wa_str like line of itab_1.
                     loop at itab_1 into wa_str. %>
                    <tr>
                     <td><%=wa_str-name%> </td>
                           <%endloop.%>
    In this zuvendstr is Structure ,wa_str is workarea and itab_1 is an Internal table.But it is showinng an error that itab_1 is unknown.But we cannot define internal tables for an Structure in Page Attributes.So,please resolve how to create internal table for Structure in BSPS

    Hi,
    You can define itab_1 like this (assuming zuvendstr is a structure type):
    DATA: itab_1 TYPE TABLE OF zuvendstr.
    Regards,
    Tanguy

  • Number of entries in the internal table for perticular field value

    hi All,
    Is this possible to get the count of records from the internal table for a perticular field value.
    currently my requirement is to get the entries from the internal table which does not have two records for perticular field value (say a = 123) whose status is active (say b = 'X').
    also suggets should use LOOP or DELETE or DESCRIBE for a internal table to ful fill this requirement.
    Thanks in advance.
    Pradeep

    Try like this..
    Create another table itab2 with same structure as itab1 & move the contents of itab1 to itab2
    ITAB2[] = ITAB1[].
    Then delete entries from itab2
    Delete itab2 whete a = '123' and b = 'X'
    Then use Describe statement to get the no of entries
    Describe table itab2 lines v_lines.
    Hope this helps...

  • Fill Internal Table for Table Header EQUI - Long Time

    Good morning,
    I have installed DMIS (2006_1_620) and DMIS_CNT (2006_1_620), both at the level of SP = 13.
    I am running the subactivity "Fill Internal Table for Table Header EQUI" and have 1 day + 10 hours and continue working.
    Also note that the table CNVTDMS_05_equi  is increased million in millions and now has 6 million records.
    It is normal to take a long time? (EQUI table has 240 million records and therefore will take many days).
    Any suggestions?
    Thanks,
    Hugo

    Hello Hugo,
    I know this is old , but did you ever find a solution to this.  I am having the same problem.  I considered adding an index to table QMIH, with Keys MANDT and BEQUI.
    I also only have one bckgrd proc running in sender systems with this statement when I drill in using SM50:
    SELECT
    /*+
      FIRST_ROWS (1)
    FROM
      "QMIH"
    WHERE
      "MANDT"=:A0 AND "BEQUI"=:A1 AND ROWNUM <=:A2 #
    This has been running for over 8hrs now.
    Any thoughts?
    Thanks,
    NICK

  • Dynamic Internal Table for reading data from external file

    Hello All,
    The task was to create a internal table with dynamic columns,
    Actually this is my first task in the WebAS 6.20, my program is based on input file provided by user with certain effort. this file can have different effort for a one yr to five year frame..
    I needed to read the raw data from file, based on months create a internal table to hold the data, after this i need to validate the data...
    I have browsed thru dynamic internal table topic, but couldn't find any dynamic appending structure, the dynamic structure would contains 12 month fileds.
    can any one help me in getting my task completed..
    Thanks
    Kumar

    Hi,
    I see that you posted the same question a couple of days ago at Dynamic Internal Table for reading data from external file Didn't Charles's response address your problem?
    Regards

  • JBO-28004: Could not lock row in control table for table null

    hello.
    we have deployed two application on a server.
    both have code like this:
         select = "SELECT * from tab";
    vo = e.getDBTransaction().createViewObjectFromQueryStmt(select);
                        vo.executeQuery();
                        RowSet rs = vo.getRowSet();
                        if(rs != null)
                             Row lastRow = vo.getRowSet().last();
    the last line throws sometimes an exception (.last()).
    JBO-28004: Could not lock row in control table for table null
    at oracle.jbo.PCollException.throwException(PCollException.java:34)
    at oracle.jbo.pcoll.OraclePersistManager.commit(OraclePersistManager.java:229)
    at oracle.jbo.pcoll.OraclePersistManager.dropTable(OraclePersistManager.java:499)
    at oracle.jbo.pcoll.OraclePersistManager.createTable(OraclePersistManager.java:692)
    at oracle.jbo.pcoll.OraclePersistManager.insert(OraclePersistManager.java:1492)
    at oracle.jbo.pcoll.PCollNode.passivateElem(PCollNode.java:542)
    at oracle.jbo.pcoll.PCollNode.passivate(PCollNode.java:657)
    at oracle.jbo.pcoll.PCollection.passivateLRULeafNode(PCollection.java:351)
    at oracle.jbo.pcoll.PCollection.checkActiveLeafLimit(PCollection.java:404)
    at oracle.jbo.pcoll.PCollection.nodeRecentlyUsed(PCollection.java:252)
    at oracle.jbo.pcoll.PCollNode.<init>(PCollNode.java:73)
    at oracle.jbo.pcoll.PCollNode.checkForSplit(PCollNode.java:1553)
    at oracle.jbo.pcoll.PCollNode.addObject(PCollNode.java:1622)
    at oracle.jbo.pcoll.PCollNode.addObject(PCollNode.java:1610)
    at oracle.jbo.pcoll.PCollection.addElement(PCollection.java:753)
    at oracle.jbo.server.QueryCollection.fetch(QueryCollection.java:1247)
    at oracle.jbo.server.QueryCollection.getRowCount(QueryCollection.java:1065)
    at oracle.jbo.server.ViewRowSetImpl.getRowCount(ViewRowSetImpl.java:1444)
    at oracle.jbo.server.ViewRowSetIteratorImpl.last(ViewRowSetIteratorImpl.java:1183)
    at oracle.jbo.server.ViewRowSetImpl.last(ViewRowSetImpl.java:2246)
    at oracle.jbo.server.ViewObjectImpl.last(ViewObjectImpl.java:4352)
    at com.omv.emis.extemis.bc.EmsFreigabeImpl.checkFullMonth(EmsFreigabeImpl.java:327)
    at com.omv.emis.extemis.bc.EmsFreigabeImpl.doDML(EmsFreigabeImpl.java:293)
    at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:3410)
    at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:2274)
    at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2216)
    at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1511)
    at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:1677)
    at EmsFreigabeView1_BrowseEdit._jspService(_EmsFreigabeView1__BrowseEdit.java:134)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:563)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:309)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
    this exception does not occur every time just sometimes.
    (no other user/application uses the specific table, so there is no other lock)
    maybe someone knows an error source.
    thx in advance.

    Gina:
    Could you run you app with diagnostic turned on?
    If you're launching your middle tier from command prompt, you should invoke java as
    java -Djbo.debugoutput=console ...
    If you're launching your middle tier from w/i JDev..
    1. Select the project.
    2. Do right mouse click and select "Project Settings..."
    3. On the Settings dialog, select Configurations/Runner.
    4. In the righthand side pane, you should see a textbox for "Java
    Options". Please add the following JVM switch:
    -Djbo.debugoutput=console
    Then, rerun. The run command should include
    -Djbo.debugoutput=console as in
    "D:\JDev9i\jdk\bin\javaw.exe" -Djbo.debugoutput=console -classpath ...
    Then, you should see a lot of diagnostic messages. It will also give you complete stack trace including that of the detail exception.
    When you get the exception diagnostic output, please post that to this thread.
    Thanks.
    Sung

  • How to Read the internal table for the data download from the spool

    HI all,
    I have one issue regarding the spool ,we are getting the correct output as per requirement of  user but when we send the same to the user in pdf format they did notget the same.
    they are telling that the due date is missing from the pdf.
    Please advice me how to track the internal  table for the spool data converted intopdf in a readable format.
    the FM used for the above task is : 
    call function 'CONVERT_OTFSPOOLJOB_2_PDF'
    Please reply if any one worked on the same.
    Thanks in advance.
    Gaurav,

    Hi Wang,
    Please let me know how you solved your question.
    Points will be rewarded.
    Thanks,
    Arun.

  • Program times out while looping at internal table with huge records - Needs fine tuning suggestions

    Hi,
    I am trying to execute a report. It times out while looping at vbap internal table. This internal table has 140000  records and does the validation within this loop and geenrates data for the output. Due to this huge volume, the program times out when executed foreground.
    There are no nested loops, so I cannot apply 'Parallel Cursor' here.
    Is there any way I can fine tune the program so that it doesn't timeout? Is it possible to apply 'Parallel Processing' . If yes, how?
    Thanks,
    Pavan

    Hi Pavan ,
                  ->sort your internal table by all primary key for vbap.
                  ->Read a Record from the table (use your condition here)
                  ->if record satisfys your where condition ,get that record index .
                  ->loop the table from the index (without condition) .
                  its like parallel cursor only but for single loop .;-)
                  ->use field symbols ,wherever possible .
               if still dump is coming ,contact your basis team .
    regards,
    Krishna.

  • Open single record form for particular record

    It's simple to open tabular form for particular record
    - just add page item, pass value to this item
    and add this item to WHERE clause.
    But what is common approach for single record form?
    Where is it described?

    here is my solution:
    1) create page item which will receive primary key value
    2) look at Sample Application Page 7 - customers edit page -
    you need "Automated Row Fetch", called in "After Header" block

  • How to add a group of rows in internal table

    Hi champs,
       I have some requirement.
    I have one internal table which contain 4 columns .out of which 3 has some numeric value and first has some letters e.g A ,B,C etc.
    Now suppose i have 20 rows in itab in which 10 are A 5 are B and 5 are C .Now as column 3 has numeric values i need to get the total of column 3 for all A ,B and C .
    How to solve this problem.Please guid me.
    thanks in advance
    Jhon

    Hi,
    Check the following code:
    DATA: BEGIN OF LINE,
    COL1 TYPE C,
    COL2 TYPE I,
    COL3 TYPE I,
    END OF LINE.
    DATA ITAB LIKE HASHED TABLE OF LINE
    WITH UNIQUE KEY COL1 COL2.
    LINE-COL1 = 'A'.
    DO 3 TIMES.
    LINE-COL2 = SY-INDEX.
    LINE-COL3 = SY-INDEX ** 2.
    INSERT LINE INTO TABLE ITAB.
    ENDDO.
    LINE-COL1 = 'B'.
    DO 3 TIMES.
    LINE-COL2 = 2 * SY-INDEX.
    LINE-COL3 = ( 2 * SY-INDEX ) ** 2.
    INSERT LINE INTO TABLE ITAB.
    ENDDO.
    SORT ITAB.
    LOOP AT ITAB INTO LINE.
    WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
    AT END OF COL1.
    SUM.
    ULINE.
    WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
    SKIP.
    ENDAT.
    AT LAST.
    SUM.
    ULINE.
    WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
    ENDAT.
    ENDLOOP.
    Regards,
    Bhaskar

Maybe you are looking for

  • I need to use a USB port to drive a D/A converter to send audio to a PA mixer. How is that function done. I have the D/A

    We use MP3 files for music at church. I need to access my music files and send them to a D/A through a USB port then to my mixer. (Much better quality than internal audio card) Guidance please!! "G"

  • How to write an applescript and ignore errors

    I'm writing an applescript that uses a shell command that will always return an error. Applescript stops as soon as the error occurs. I want the applescript to continue running. How should I tell Applescript to ignore errors?

  • Mac Mini 2007 No OS

    Hello I have a macmini 2007 that my friend gave to me with no os and I said about the recovery discs and he said he doesnt know were they are so is there any chance of getting it to run ever again except to put windows on which I dont really want to

  • Using Multiple Output Devices

    Hello, I just bought a simple multi-input device. It's just a box with several inputs connected to my iMac via USB. The input works flawlessly - I can assign each input to a channel in Logic. I'm having trouble with the Output. When the box is connec

  • Simple SQL syntax problem

    Ok, I'm sure this is a very simple problem but I'm confused. Statement s = con.createStatement(); s.execute("SELECT COUNT (*) FROM table WHERE id = 6 AND somechar = 'N'");java.sql.SQLException: Syntax error or access violation message from server: "Y