Retreive all records that fall in month by passing date

This is more of an sql question. Is it possible to create a query that selects all records based for the month up to the day given in an sql Date without having to pass two separate dates(starting day of month and day of month to select up to)?
public void getRecords(java.sql.Date aDate) {
Something like:
SELECT *
FROM <table>
WHERE <records in month up to> aDate
return records;
}

This is going to be server specific, and I am going to give you MSSQL syntax.
select * from mytable where datepart(m,mydate)=datepart(m,getdate()) and datepart(yy,mydate)=datepart(yy,getdate())
I haven't tested this, but it should work.
Please note that query is going to require a table scan. every record is going to have to be lloked at to see if it matches. If you have a lot of records, look for a better way.

Similar Messages

  • How i can take all record that start for Epi using a select?

    How i can take all record that start for Epi using a select?
    exemple
    select objnr from jest where objnr = 'Epi*'  -
    so don't go

    Is case important? Can it be "EPI"?
    I think case is important, so do it like Shakir showed you, but put it in upper case.
    Rob
    Message was edited by:
            Rob Burbank

  • Find all records that have character alone in a string

    Oracle 10g Enterprise Edition
    Hi all,
    I must select from a varchar2 field, all the records that have a character (number or char) alone in the string.
    For example.
    ASDF BHGR H RR (yes, cause "H")
    ASDF BHGR H4 R (yes, cause "R")
    ASDF B H4 DDR (yes, cause "B")
    ASDF B H4 DDR (yes, cause "B")
    ASDF BC 1 DDR (yes, cause "1")
    ASDF BC / DDR (yes, cause "/")
    ASDF BHGR H4 RR (no)
    ASDF (no)
    I'm trying by SubStr, but I cannot generally solutions.
    Thank's for any suggestion.
    Ciao

    Ok, just a try :
    SQL> with tbl as
      2  (select 'ASDF BHGR H RR' str from dual union all
      3   select 'ASDF BHGR H4 R' str from dual union all
      4   select 'ASDF B H4 DDR' str from dual union all
      5   select 'ASDF BHGR H4 R1' str from dual union all
      6   select 'ASDF BHGR H4' str from dual union all
      7   select 'ASDF - H4' str from dual union all
      8   select 'a1 ASDF BHGR H4' str from dual union all
      9   select 'ASDF B H4 DDR' str from dual union all
    10   select 'ASDF BC 1 DDR' str from dual union all
    11   select 'ASDF BC / DDR' str from dual)
    12  select str,
    13         decode(regexp_instr(str,'^. | . | .$'),0,'no',decode(regexp_instr(str,'^- | - | -$'),0,'yes','no')) res
    14  from tbl;
    STR             RES
    ASDF BHGR H RR  yes
    ASDF BHGR H4 R  yes
    ASDF B H4 DDR   yes
    ASDF BHGR H4 R1 no
    ASDF BHGR H4    no
    ASDF - H4       no
    a1 ASDF BHGR H4 no
    ASDF B H4 DDR   yes
    ASDF BC 1 DDR   yes
    ASDF BC / DDR   yes
    10 rows selected.May is there is a simpler way.
    Nicolas.

  • How to remove all records(Truncate) In SalesForce Object before load data in to it ?

    I'm loading data from Oracle to SalesForce staging object.Here i have to remove all the records in SFDC object before load data. Please guide me ,My work struck due to this

    I'm loading data from Oracle to SalesForce staging object.Here i have to remove all the records in SFDC object before load data. Please guide me ,My work struck due to this

  • Deleting all Records in a Table

    I have an table that is populated as users login and move through an application so I can tell what they are doing as well as who is logged in. Once and a while I would like to empty this table of all records once I have exported the audit data. I would like to do this from the same page that I have based a tabular form on. Can any suggest the easiest way to achieve this?
    Could the following SQL be used somewhere to do the job?
    delete CREATE_BY, CREATE_ON, ACTION, SUBJECT from AUDIT;
    Kind Regards,
    Steve

    Hi,
    Even with TRUNCATE (which is what I use to do this sort of thing), you have to bear in mind what happens to indexes on the table (and, I'm assuming that there will be sizable indexes involved) and the time it takes to clear these out on top of clearing out the table's data. From advice I've seen on the SQL forum, I do something like the following in PL/SQL to clear a table:
    BEGIN
    EXECUTE IMMEDIATE 'ALTER INDEX TABLENAME_IDX1 UNUSABLE';
    EXECUTE IMMEDIATE 'TRUNCATE TABLENAME';
    EXECUTE IMMEDIATE 'ALTER INDEX TABLENAME_IDX1 REBUILD NOLOGGING';
    COMMIT;
    END;Andy

  • Calculate % of answers across all records in a list

    I have a list that gathers information from users. I want to calculate the percentage of a given answer across all records. To keep things simple, consider the following example.
    A list called "Shirts" contains 3 choice fields:
    1) Color: with choice options of Red, Blue or Green
    2) Size: with choice options of Small, Medium or Large
    3) Style: with choice options of T-Shirt, Button-up or Long-Sleeve
    At the bottom of the page I want to display what percentage (across all records) that the shirt color chosen was Blue.
    So if I had 10 records in the list and 4 of those listed color as Blue, the bottom of the main view page would show: Blue = 40%. This percentage would then update as more records are added. ie - an 11th record is added that does not choose Blue so the percentage
    would then display as 36%.
    I know how to do calculations like this within a given list record but I need a way to keep a running calculation across all records that updates as new records are added.

    Hi Mike,
    As a workaround, you can use JavaScript to retrieve items value from a List and calculate the value according to your requirement, then display the result in the list
    view page.
    Here is a link about how to retrieve items from a List using JavaScript:
    http://msdn.microsoft.com/en-us/library/office/hh185007(v=office.14).aspx
    I modify the script a bit in the link above, you can apply the script below to your list view page, it will display the percentages of each value as you need:
    <script type= text/javascript>
    _spBodyOnLoadFunctionNames.push("ready");
    function ready()
    ExecuteOrDelayUntilScriptLoaded(retrieveListItems, "sp.js");
    function retrieveListItems()
    var clientContext = new SP.ClientContext.get_current();
    var oList = clientContext.get_web().get_lists().getByTitle('List1');
    var camlQuery = new SP.CamlQuery();
    this.collListItem = oList.getItems(camlQuery);
    clientContext.load(collListItem);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    function onQuerySucceeded(sender, args)
    var blueCount = 0, redCount = 0, yellowCount = 0;
    var listItemEnumerator = collListItem.getEnumerator();
    var sum = collListItem.get_count();
    while (listItemEnumerator.moveNext())
    var oListItem = listItemEnumerator.get_current();
    if(oListItem.get_item('Color') === 'Blue')
    blueCount += 1;
    if(oListItem.get_item('Color') === 'Red')
    redCount += 1;
    if(oListItem.get_item('Color') === 'Yellow')
    yellowCount += 1;
    document.getElementById('blueSpan').innerHTML = "Blue: " + blueCount/sum*100 + "%";
    document.getElementById('redSpan').innerHTML = "Red: " + redCount/sum*100 + "%";
    document.getElementById('yellowSpan').innerHTML = "Yellow: " + yellowCount/sum*100 + "%";
    function onQueryFailed(sender, args)
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    </script>
    <p id="blueSpan">Blue:</p>
    <p id="redSpan">Red:</p>
    <p id="yellowSpan">Yellow:</p>
    About how to add JavaScript into SharePoint page:
    http://blog.cloudshare.com/2012/10/29/how-to-insert-custom-javascript-code-in-sharepoint-2013-pages-part-i/
    Best regards
    Patrick Liang
    TechNet Community Support

  • Trying to find a record that does not have an event created for it

    Post Author: tzinser
    CA Forum: Formula
    A little background on how it works....
    We create a record, and everytime it is created, a number of "events" within that record are automatically created.  The specific event I am trying to run a report on is "REC".  I can run a report and get the information entered into the REC event no problem, but my problem is that if someone deletes the "REC" event it does not show up in my report.
    So my question is, what is the best way to write a function that displays all records that have the "REC" event, and all records that the "REC" event is missing.
    I'm using the generic funtion {EVENT.EventCode} = "REC"  right now....any suggestions?

    Post Author: tzinser
    CA Forum: Formula
    Okay, I left off a lot of important information...
    I'm using two tables
    TWDATA
    EVENT
    From TWDATA I'm pulling the fields TWDATA.OrderNumber and TWDATA.DisbursementDate
    From EVENT I'm pulling the fields EVENT.EventCode and EVENT.CompletedDate
    The two tables are linked by OrderNumber.

  • How to get all records created this month?

    Ok I'm trying to write a query that would get records that were created this month or later but not in the past.
    So today is Nov 16th 2009
    I need to look for all records created from 11/2009 and onward (>11/2009)
    Any ideas?

    Do you have any field like "create_date" on that table ? Here is simple qry
    with t as ( select 1 as id,to_date('01-OCT-2009','DD-MON-YYYY') as create_date from dual
    UNION
    select 2,to_date('11-OCT-2009','DD-MON-YYYY') from dual
    UNION
    select 3, to_date('02-NOV-2009','DD-MON-YYYY') from dual
    UNION
    select 4, to_date('01-NOV-2009','DD-MON-YYYY') from dual
    UNION
    select 5, to_date('13-DEC-2009','DD-MON-YYYY') from dual)
    select * From t
    where CREATE_DATE >= trunc(sysdate,'MON')Edited by: rkolli on Nov 16, 2009 1:23 PM

  • I have been dragging my files to a external drive to have a back-up for them and I lost some of my folders. They just went completely missing. I didn't delete them, and it was all stuff that I have worked on in the past month. How do I get them back?

    I have been dragging my files to a external drive to have a back-up for them and I lost some of my folders. They just went completely missing. I didn't delete them, and it was all stuff that I have worked on in the past month. How do I get them back?

    You really should be doing backups with an actual backup application, especially one that will work automatically, and, if your external HD is large enough, back up your entire system.  These can automatically back up only what's changed since the  previous backup, and some will keep "archive" copies of things you've changed or deleted, also.
    Too many things can go wrong, such as your internal HD failing, and you'll have a major project to reinstall everything.
    You already have Time Machine, built-in to OSX.  You might want to review the Time Machine Tutorial, and perhaps browse Time Machine - Frequently Asked Questions.
    #27 in the second link mentions some alternatives, too.

  • TS3899 I upgraded to iOS 7 and I lost emails that were in my inbox - I used to see all emails that I did not delete, now I only have emails from the past month - how can I get the old, undeleted emails back? Or, at least, show email older than one month o

    I upgraded to iOS 7 and I lost emails that were in my inbox - I used to see all emails that I did not delete, now I only have emails from the past month - how can I get the old, undeleted emails back? Or, at least, show email older than one month old?

    I upgraded to iOS 7 and I lost emails that were in my inbox - I used to see all emails that I did not delete, now I only have emails from the past month - how can I get the old, undeleted emails back? Or, at least, show email older than one month old?

  • Hi. I have the Apple connector kit...and actually played my M-Audio Oxygen 25-keyboard thru  my iPad2--without a powered hub.  But that was two month ago.   Now...I can't get it to play.   I can hear the notes...but faintly.  And I have pushed ALL the pos

    Hi. I have the Apple connector kit...and actually played Garageband via my M-Audio Oxygen 25-keyboard thru  my iPad2--without a powered hub. 
    But that was two month ago.
      Now...I can't get it to play--with volume.   I can hear the notes...but faintly.  And I have pushed ALL possible volume controls up (Keyboard & iPad). 
      I know the keyboard is triggering, because I tested it on a MacBook: got full volume, just like before.
      But just can't get full volume from the iPad2.  I got a 4-port USB hub...and tried interfacing it between the keyboard and the connector kit/iPad2.  But still no volume.  It's almost like a switch is off in the iPad???
      Any help would be appreciated.  Dan

    hello again,
    i didn't really dare to delete the blue home folders before, just in case everything went wrong, but now i think i have so little space that i can't afford to lose 2.25gb!
    one thing that slightly worries me is the fact that the 'proper' library folder (in the home icon) is 2.09gb, whereas the 'wrong' one (from the blue folder forenamesurname) is 2.24gb - this is the one i would be deleting. just seems odd to delete a larger file than the one i presume i'm using.
    "Move everything you want to keep out of the blue folders, and then place both of the folders on your desktop. If everything works properly after a few days, delete both folders. If you are asked for your administrator password at any point or if either folder is copied instead of moved when dragged, don't delete that folder."
    by 'everything you want to keep', does this include the library folder? 'cause there doesn't seem to be much else, and i'm not sure if deleting the library folder would ruin all my preferences.
    i've put both of the folders on the desktop, it didn't ask for the admin password or try to copy them, so i guess that's good news. what kind of things should i be looking out for to act differently?
    are the folders not in use now that they are on the desktop?
    also if i put them in the trash will they have no effect? i.e. the same as permanently deleting them, so i could put them in the trash as a test.
    cheers, stephen.

  • HT203167 my pc was stolen i have a new one but when i open my itunes there is no music how do i retreive all my itunes music that was on stolen computer was thinking considering its my account

    my PC was stolen now that i have new laptop was expecting that once logged into Itunes i could retreive all perviously downloaded music again but i cant see option anywhere.  can someone please tell me how to get all my music back

    Download Past Purchases
    http://support.apple.com/kb/HT2519

  • Suddenly my calendar events are deleted from 2 months ago and all before that.  I like to keep that information.  How is that done?

    How can I stop my I pad calendar from deleting events in the past, like all of them from 2 months ago and earlier?
    Thanks.

    When you connect your iPad to your computer, open iTunes, click on the name of your ipad and then on the info tab. In there you'll see the options for the calendar, one of which is how far back to keep info. Set it as far back as you want. Just know that calendar data is part of what makes up the 'other' part of your memory consumption. So more data like that you keep, less room you will have for other stuff.

  • All Records not showing in Report

    Hi All,
    U just solved my amount problem....
    But now i gives my earlier problem again, means displaying only 1 rows, when i executing for 1 month in selection criteria...and amount showing right total of all records...
    example---
    Document No......Doc. date.......P.date........Vendor..........Name.........Tax Code.........Base Amt....... Tax Amt........Ven. Ref.........P. Doc...
    5500000022 .......22.04.2008 ...28.04.2008....1011............XXXXXXX........NB..................500,000............25,000.............A-102.......4500034463
    This Document No. is my 1st Document no. (5500000022)..
    Here Base Amount (500,000) & Tax Amount (25,000) is the total of more than 100 records total but showing in Single Row...(This rows showing the only 1st record)...
    Here what is the problem in my program...where i m wrong in clearing the itab or itab2...
    please let me know...
    I m again sending my corrected Program...
    Code-----
    REPORT  zak_form_c4 NO STANDARD PAGE HEADING LINE-SIZE 125  .
    TABLES : bsik,bkpf,bseg,j_1imovend,lfa1,t001,t005u,bsak,ekko,bsis, ekkn, anla, anlc.
    TYPE-POOLS : slis.
    DATA : BEGIN OF itab OCCURS 0,
           hkont LIKE bseg-hkont, "Gl account
           mwskz LIKE bseg-mwskz, "Tax Code
           dmbtr LIKE bseg-dmbtr, "Amount
           buzei LIKE bseg-buzei, "line item
           ebeln LIKE bseg-ebeln, "Purchasing Document
           ebelp LIKE bseg-ebelp, "line item nbr
           hwbas LIKE bseg-hwbas, "Base amount
           shkzg LIKE bseg-shkzg, "Debit/Credit code
           belnr LIKE bsik-belnr, "Document number
           gjahr LIKE bsik-gjahr, "Fiscal Year
           bldat LIKE bsik-bldat, "Document Date
           budat LIKE bsik-budat, "Posting Date
           lifnr LIKE bsik-lifnr, "Vendor number
           xblnr LIKE mkpf-xblnr, "Ven invoice nbr
           name1(25),                                           "name1
           ort01 LIKE lfa1-ort01,   "City
           j_1ilstno LIKE j_1imovend-j_1ilstno,  " Vendor tin nbr
           regio LIKE lfa1-regio, "Region Code
           bezei LIKE t005u-bezei, "Region desc
           dmbtr1 LIKE bseg-dmbtr, "Amount
           hwbas1 LIKE bseg-hwbas, "Base amount
    END OF itab.
    DATA : BEGIN OF itab3 OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA:END OF itab3.
    DATA : wa LIKE LINE OF itab.
    DATA : BEGIN OF itab1 OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA:END OF itab1.
    DATA : BEGIN OF itab2 OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA:END OF itab2.
    ***********************************Purchase order history
    DATA:   BEGIN OF bet OCCURS 50.
            INCLUDE STRUCTURE ekbe.
    DATA:   END OF bet.
    DATA:   BEGIN OF bzt OCCURS 50.
            INCLUDE STRUCTURE ekbz.
    DATA:   END OF bzt.
    DATA:   BEGIN OF betz OCCURS 50.
            INCLUDE STRUCTURE ekbez.
    DATA:   END OF betz.
    DATA:   BEGIN OF bets OCCURS 50.
            INCLUDE STRUCTURE ekbes.
    DATA:   END OF bets.
    DATA:   BEGIN OF xekbnk OCCURS 10.
            INCLUDE STRUCTURE ekbnk.
    DATA:   END OF xekbnk.
    DATA : w_container TYPE scrfname VALUE 'CL_GRID',
           w_cprog TYPE lvc_s_layo,
           g_repid LIKE sy-repid,
           w_save TYPE c,
           w_exit TYPE c,
           cl_grid TYPE REF TO cl_gui_alv_grid,
           cl_custom_container TYPE REF TO cl_gui_custom_container,
           it_fld_catalog TYPE slis_t_fieldcat_alv,
           wa_fld_catalog TYPE slis_t_fieldcat_alv WITH HEADER LINE ,
           layout TYPE slis_layout_alv,
           col_pos  LIKE sy-cucol ,
           alvfc TYPE slis_t_fieldcat_alv.
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS       :  hkont LIKE bseg-hkont OBLIGATORY. "GL Code
    *SELECT-OPTIONS   : hkont FOR bseg-hkont .
    SELECT-OPTIONS   : belnr FOR bsik-belnr .
    SELECT-OPTIONS   : gjahr FOR bsik-gjahr .
    SELECT-OPTIONS   : bldat FOR bsik-bldat.
    SELECT-OPTIONS   : budat FOR bsik-budat.
    SELECTION-SCREEN : END OF BLOCK b1.
    PERFORM fill_catalog1 USING:
    'HKONT'    'ITAB2'    'G/L Code' ,
    'BELNR'    'ITAB2'    'Document Number',
    'GJAHR'    'ITAB2'    'Year',
    'BLDAT'    'ITAB2'    'Doc. date' ,
    'BUDAT'    'ITAB2'    'Posting Date',
    'LIFNR'    'ITAB2'    'Vendor',
    'NAME1'    'ITAB2'    'Name',
    'EBELN'    'ITAB2'    'Purchasing Document',
    'MWSKZ'    'ITAB2'    'Tax Code',
    'HWBAS'    'ITAB2'    'Base Amount',
    'DMBTR'    'ITAB2'    'Tax Amount',
    'XBLNR'    'ITAB2'    'Vendor Inv. No.'.
    SELECT DISTINCT hkont belnr gjahr bldat budat INTO CORRESPONDING FIELDS OF TABLE itab
                      FROM bsis
                      WHERE bukrs = '1000'
                      AND hkont = hkont
                      AND belnr IN belnr
                      AND gjahr IN gjahr
                      AND bldat IN bldat
                      AND budat IN budat.
    SORT itab BY belnr.
    LOOP AT itab.
      SELECT * FROM bseg WHERE belnr = itab-belnr  AND gjahr = itab-gjahr
                                                   AND bukrs = '1000'
                                                   AND ( ebeln <> ' ' OR hkont = hkont ).
        IF sy-subrc = 0.
          itab-buzei = bseg-buzei.
          itab-mwskz = bseg-mwskz.
          IF bseg-ebeln <> ' '.
            itab-ebeln = bseg-ebeln.
            itab-ebelp = bseg-ebelp.
            MODIFY itab.
          ENDIF.
          IF bseg-hkont = hkont.
            itab-shkzg = bseg-shkzg.
            itab-hwbas = bseg-hwbas.
            itab-dmbtr = bseg-dmbtr.
            IF itab-shkzg = 'H'.
              itab-dmbtr = itab-dmbtr * ( -1 ).
            ENDIF.
            MOVE-CORRESPONDING itab TO itab2.
            APPEND itab2.
          ENDIF.
        ENDIF.
      ENDSELECT.
    ENDLOOP.
    LOOP AT itab2.
      SELECT SINGLE * FROM ekko WHERE ebeln = itab2-ebeln.
      IF sy-subrc = 0.
        itab2-lifnr = ekko-lifnr.
      ENDIF.
      CALL FUNCTION 'ME_READ_HISTORY'
        EXPORTING
          ebeln  = itab2-ebeln
          ebelp  = itab2-ebelp
          webre  = 'X'
        TABLES
          xekbe  = bet
          xekbz  = bzt
          xekbes = bets
          xekbez = betz
          xekbnk = xekbnk.
      itab2-xblnr = bet-xblnr.
      SELECT SINGLE * FROM lfa1 WHERE lifnr = itab2-lifnr.
      itab2-name1 = lfa1-name1.
      itab2-ort01 = lfa1-ort01.
      itab2-regio = lfa1-regio.
      SELECT SINGLE * FROM t005u WHERE bland = itab2-regio
                                  AND spras = 'EN'
                                  AND land1 = 'IN'.
      itab2-bezei = t005u-bezei.
      SELECT SINGLE * FROM  j_1imovend WHERE lifnr = itab2-lifnr.
      IF sy-subrc = 0 .
        itab2-j_1ilstno = j_1imovend-j_1ilstno.  " Vendor tin nbr
      ENDIF.
      MODIFY itab2.
    ENDLOOP.
    SORT itab2 BY belnr.
    LOOP AT itab2.
      DATA : cnt TYPE i,
             cnt1 TYPE i.
      itab1-dmbtr1 = itab1-dmbtr1 + itab2-dmbtr.
      itab1-hwbas1 = itab1-hwbas1 + itab2-hwbas.
      AT END OF belnr.
        cnt = sy-tabix.
        cnt1 = cnt - 1.
        DO cnt1 TIMES.
          DELETE itab2.
        ENDDO.
        CLEAR itab2.
        itab2-dmbtr = itab1-dmbtr1.
        itab2-hwbas = itab1-hwbas1.
        MODIFY itab2 TRANSPORTING dmbtr hwbas .
      ENDAT.
    ENDLOOP.
    layout-zebra = 'X' .
    layout-colwidth_optimize(1) = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program = 'ZAK_FORM_C4'
        is_layout          = layout
        it_fieldcat        = it_fld_catalog
        i_default          = 'X'
        i_save             = 'A'
      TABLES
        t_outtab           = itab2
      EXCEPTIONS
        program_error      = 1
        OTHERS             = 2.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *&      Form  FILL_CATALOG1
          text
         -->P_FIELDNAME  text
         -->P_REF_TABLE  text
         -->P_SCRTEXT    text
    FORM fill_catalog1  USING   p_fieldname TYPE any
                                p_ref_table TYPE any
                                p_scrtext   TYPE any.
      CLEAR : wa_fld_catalog.
      wa_fld_catalog-fieldname  = p_fieldname.
      wa_fld_catalog-tabname    = p_ref_table.
      wa_fld_catalog-seltext_s  = p_scrtext.
      wa_fld_catalog-seltext_m  = p_scrtext.
      wa_fld_catalog-seltext_l  = p_scrtext.
    wa_fld_catalog-datatype = 'CURR'.
      wa_fld_catalog-outputlen = 20.
      APPEND wa_fld_catalog TO it_fld_catalog.
    ENDFORM.                    " fill_catalog1.
    Plz let me know...
    Thanks

    Hello Prince,
    I just want that my code will show single time records..and Sum of base Value and Tax amount...
    You want to summarise Base Value and Tax amount per document, right
    I am making a very very small modification to the declaration of ITAB:
    DATA :
    BEGIN OF itab OCCURS 0,
    belnr LIKE bsik-belnr, "Document number "--> Add here
    buzei LIKE bseg-buzei, "line item "--> Add here
    hkont LIKE bseg-hkont, "Gl account
    mwskz LIKE bseg-mwskz, "Tax Code
    dmbtr LIKE bseg-dmbtr, "Amount
    " buzei LIKE bseg-buzei, "line item "--> Delete Here
    ebeln LIKE bseg-ebeln, "Purchasing Document
    ebelp LIKE bseg-ebelp, "line item nbr
    hwbas LIKE bseg-hwbas, "Base amount
    shkzg LIKE bseg-shkzg, "Debit/Credit code
    " belnr LIKE bsik-belnr, "Document number "--> Delete here
    gjahr LIKE bsik-gjahr, "Fiscal Year
    bldat LIKE bsik-bldat, "Document Date
    budat LIKE bsik-budat, "Posting Date
    lifnr LIKE bsik-lifnr, "Vendor number
    xblnr LIKE mkpf-xblnr, "Ven invoice nbr
    name1(25), "name1
    ort01 LIKE lfa1-ort01, "City
    j_1ilstno LIKE j_1imovend-j_1ilstno, " Vendor tin nbr
    regio LIKE lfa1-regio, "Region Code
    bezei LIKE t005u-bezei, "Region desc
    dmbtr1 LIKE bseg-dmbtr, "Amount
    hwbas1 LIKE bseg-hwbas, "Base amount
    END OF itab.
    And modified the code as below:
    DATA:
    V_DMBTR TYPE DMBTR,
    V_HWBAS TYPE HWBAS.
    LOOP AT ITAB2.
      V_DMBTR = V_DMBTR + ITAB2-DMBTR.
      V_HWBAS = V_HWBAS + ITAB2-HWBAS.
      AT END OF BELNR.
        ITAB2-DMBTR = V_DMBTR.
        ITAB2-HWBAS = V_HWBAS.
        APPEND ITAB2 TO ITAB3.
        CLEAR: ITAB2, V_DMBTR, V_HWBAS.
      ENDAT.
    ENDLOOP.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = 'ZAK_FORM_C4'
    is_layout = layout
    it_fieldcat = it_fld_catalog
    i_default = 'X'
    i_save = 'A'
    TABLES
    t_outtab = itab3 "itab2 --> Use ITAB3 instead of ITAB2
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    BR,
    Suhas
    Edited by: Suhas Saha on Jan 13, 2009 3:23 PM

  • SQ02 InfoSet Get Count of Total Number of Records that will be processed

    I am developing a query (SQ01) and am currently working on building an InfoSet (SQ02). 
    The Infoset was set up using a 'Direct read of table'.  Next, I'm adding some various fields and then going to Extras and trying to define some code to get the total number of records that my query will be processing.  I'm not sure if SAP pulls a filtered result set into a temporary table (by default - if so how could I reference it?) that I can reference or is just pulling in a row at a time in the record processing code, but my question is in regards to getting a record count of how many records are returned in my result set PRIOR TO going through all of the records.
    Overall, I'd like to be able to have a field that says Record X of Y.  I can get the X part for each line, but cannot get 'Y' until the very end.  Any help or ideas would be much appreciated.  I've looked around a bunch, but haven't found anything like what I'm requesting.
    Query Output would look something like:
    Record X1 of Y | Title1 | Amount1
    Record X2 of Y | Title2 | Amount2

    Hi Subin,
         I have tossed around this idea in my head, but am trying to figure out how to get the values and selection options from the query screen to incorporate into my Select statement within my infoset.  The problem I'm running into is that my user enters a group of account numbers and an ending date that has to be pulled from the SQ01 query screen to the SQ02 infoset code.  I've looked around for examples on pulling the data from the query screen, but have been unsuccessful thus far.  Say for instance I have 15 specific accounts that the user is entering in and they want any records that have been submitted prior to the end of the current month and the start of the business year.
         On my query screen they would enter in something like
    Business Year:  2011
    Reporting End Date:  <= 31.03.2011 (Which equates to all records between 01.01.2011 AND 31.03.2011)
    Account #s:  0000, 0001, 0003, 0005, ..., 9999  (These are a variable amount of accounts entered and could include options such as not equal to or even between ranges etc)
    In my START-OF-SELECTION code I would need a select like:
    NOTE:  This is just a pseudo code format, not checked for syntax here
    SELECT count(*)
    FROM TABLE
    WHERE BusinessYear = '2011' AND
        RecordDate Between 01.01.2011 AND 31.03.2011 AND
        Accounts IN (0000, 0001, 0003, 0005, ..., 9999).
    So In this select I need to reference the values in the SQ01.  How would I reference the account #'s and whether or not the user has entered an account number and said Not Equal on it etc.  This select statement would have to be built on the fly, since it's not guaranteed to be the same for each run.
    Thanks,
    Mark

Maybe you are looking for

  • Missing Topics in Topics box

    As you can see there is a lot of missing subtopics under the Main Menu Overview topic in the left hand Topics Box. These topics all show up in the ,.chm file. Can anyone tell me how to correct this. I can't add the missing topics to the printed doc.

  • MM functional Help

    experts, I need a help in MM functional area. I have a requirement to display in report for differnt movement types like transfers, issues and receipts. The movement types for tranfers 411 412 , but I observed in MB51 that 411 text(+ sloc to sloc) an

  • SO! my adobe illustrator crashes, what?

    so my adobe illustrator crashes every time I click file and I am not sure why... I have reinstalled the illustrator and still have the same problem ps I have a PC BUT ITS NEW SO... also I have paid for the illustrator so I am not sure what is going o

  • Is there a tab I can add to the toolbar to "empty" the contents of folders?

    On one of my email accounts I have a junk folder. However there is no flame icon next to it. When I right click the folder, there is no option to "empty junk". Is there a way to enable that feature?

  • Color rendering issue

    i'm using aperture since version 1. and till today i see the same color rendering issues which occurs when applying heavy exposure correction on my canon pro camera files.  when i correct overexposed images i get a strange yellow  posterisation not a