Combine two date ranges in calender display

Using Apex 3.2, Oracle 10g, IE7
I have a calender that displays two date ranges: one that does a total count of assets over a one year period and the other is a breakdown of what assets are scheduled to be in use. I would like to combine them into one display (total - in use). Any suggestions or ideas on combining the date ranges?
code below * thank you Denes Kubicek *
select 'a href="f?p=&APP_ID.:27:&SESSION.::NO::'||'P27_TYPE:'||category_name||'">'||('Count Avail: '||to_char(asset))||' /a asset , SYSDATE -1 + LEVEL
FROM (SELECT (sysdate +365) - sysdate conn_level, count(a.id) asset, b.category_name FROM hd_asset_assets a, hd_asset_categories b WHERE a.category_id = :P23_SEARCH and a.category_id = b.id GROUP BY category_name)
CONNECT BY LEVEL <= conn_level
UNION ALL
SELECT ('In Use: '||b.asset_name) asset , session_date FROM TABLE (SELECT return_table_fn () AS session_table_type FROM DUAL) left join (select asset_name, category_id from hd_asset_assets) b on UPPER(title) = UPPER(b.asset_name) where b.category_id = :P23_SEARCH
Edited by: tread on Aug 4, 2009 1:29 PM
Edited by: tread on Aug 4, 2009 1:29 PM

Hi,
You would probably have to simplify the existing statement and then wrap it within another select statement that does a GROUP BY over the date column:
SELECT Datecolumn, AssetName, SUM(Total)-SUM(InUse) Available
FROM (
...your existing select statements ensuring that both statements return the same number/names of columns...
GROUP BY DateColumn, AssetNameAndy

Similar Messages

  • Select Between two date ranges from xml file

    Hi ,
    I have a column date_ with datatype VARCHAR2(150) it stores
    data as
    05/19/2010 11:23 AM
    05/20/2010 12:23 PM
    05/22/2010 11:23 AM
    05/25/2010 11:23 AM
    i have to select all the rows between 05/19/2010 and 05/22/2010 how to do that this column is in xml file

    I have a table wit two fields
    Field1 is integer and field2 is xmltype
    in the xmltype i store an xml file
    <ParentNode>
    <Node>
    <Cat>1</Cat>
    <Date>05/19/2010 11:23 AM </Date>
    </Node>
    <Node>
    <Cat>2</Cat>
    <Date>05/20/2010 12:23 PM </Date>
    </Node>
    <Node>
    <Cat>3</Cat>
    <Date>05/22/2010 11:23 AM </Date>
    </Node>
    </Parentnode>
    I am using teh below query to retrive teh result
    SELECT T.Feild1, XML.* FROM Tablename T,
    XMLTable( 'Parentnod/Node' PASSING T.Feild2 COLUMNS Cat NUMBER PATH 'Cat' ,
    DATE_ VARCHAR2(100) PATH 'Date'
    )XML where cat >1;
    now i have to do teh same to select the rows between two date range 05/19/2010 and 05/21/2010
    hope i am able to make teh question simple

  • Combine two date field into one timestamp field

    Hello all,
    I need help combining two date fields into one timestamp field.
    I have separate Date and Milliseconds fields and want to
    combine to one Timestamp field can some suggest sql???

    This is my data
    01 JAN 1989 12:01:00.001 AM
    this is my insert drag_time is a timestamp field in another schema
    INSERT
    INTO DRAG (drag_time)
    SELECT to_char(drag_time, 'DD MON YYYY HH12:MI:SS')||(drag_second)||to_char(drag_time, ' AM')
    FROM sa.drag;
    This is the error
    ERROR at line 3:
    ORA-01855: AM/A.M. or PM/P.M. required

  • Extracting a count of distinct values between two date ranges over months

    Hi All,
    I am having a bit of difficulty in figuring out the query to build a list of active campaigns over a date range.
    i.e. I have a table with campaign IDs and their start and end date details like this
    Campaign_id     Start_date     End_date
            10001     1-Jun-09     31-May-11
            10002     1-Jun-09     23-Jun-11
            30041     21-Aug-09     31-Dec-09
            20005     3-Jun-10     31-May-11
            90021     21-Nov-09     30-Nov-10
            54000     1-Jun-11     1-Dec-12
            35600     1-Mar-10     31-Mar-12 What the above data means is, for eg. the campaign 10001 is active from 1-Jun-09 to 31-May-11 i.e. for 24 months (inclusive of the month Jun-09 and May-11)
    What I need to figure out is the counts of active campaigns between a date range and display that active count at a month level (for e.g. lets say we want to see all the campaigns that were active
    between the date range '01-JUN-2007' and '30-APR-2012' ). So the partial output would be as seen below. The list would continue till december-2012
    Month    Year    Count of active campaigns
    Jan    2009    0
    Feb    2009    0
    Mar    2009    0
    Apr    2009    0
    May    2009    0
    Jun    2009    2
    Jul    2009    2
    Aug    2009    3
    Sep    2009    3
    Oct    2009    3
    Nov    2009    4
    Dec    2009    4
    Jan    2010    3
    Feb    2010    3
    Mar    2010    4
    Apr    2010    4
    Dec    2012    1 Could anybody please help me with the right query for this.
    Thanks a lot for help
    Regards
    Goldi

    set pagesize 40
    with tab as
                    select 1 id, sysdate -100 start_date, sysdate end_date from dual
                    union
                    select 1 id, sysdate -200 start_date, sysdate -150 end_date from dual
                    union
                    select 1 id, sysdate -600 start_date, sysdate - 400 end_date from dual
                    union
                    select 1 id, sysdate -300 start_date, sysdate - 150 end_date from dual
                    union
                    select 2 id, sysdate -100 start_date, sysdate-50 end_date from dual
          year_tab as
                        select
                                 add_months(min_date, level -1) m
                        from
                                select min(trunc(start_date,'YYYY')) min_date, add_months(max(trunc(end_date,'YYYY')), 12) max_date
                                from tab
                        connect by level <= months_between(max_date, min_date)
    select to_char(m,'YYYY') year_,
             to_char(m,'Month') month_,
             nvl(act, 0) act
    from   year_tab,
                select m date_,count(*)  act
                from tab, year_tab
                where m between trunc(start_date,'MM') and trunc(end_date,'MM')
                group by m
                ) month_tab
    where m = date_(+)
    order by m;
    YEAR_ MONTH_           ACT
    2010  January            0
    2010  February           0
    2010  March              0
    2010  April              0
    2010  May                0
    2010  June               0
    2010  July               0
    2010  August             0
    2010  September          1
    2010  October            1
    2010  November           1
    2010  December           1
    2011  January            1
    2011  February           1
    2011  March              1
    2011  April              0
    2011  May                0
    2011  June               0
    2011  July               1
    2011  August             1
    2011  September          1
    2011  October            2
    2011  November           2
    2011  December           2
    2012  January            2
    2012  February           2
    2012  March              2
    2012  April              1
    2012  May                1
    2012  June               0
    2012  July               0
    2012  August             0
    2012  September          0
    2012  October            0
    2012  November           0
    2012  December           0
    36 rows selected.

  • Date range to be displayed  & Displaying multiple values on the report

    Hi,
    I have date range parameters, but I also need it to be displayed it on the report. Is there any way I can display it. E.G If a parameter is created one can drag and drop it on the report if it needs to be displayed on the report, I tried to do the same for the date range parameter but it does not work.
    Also If a parameter is created by selecting the option 'Allow Multiple Values', and if you drag and drop it on the report only the first value is displayed and the rest does not show. Has anyone tried this before and been successful in displaying multiple values in the report.
    Thanks in advance.

    Hi,
    A multi-value parameter is actually treated as an array in Crystal Reports.
    To display the values selected in the parameter, create a formula from the Field Explorer and type this code:
    Join({?ParameterName},",");
    Place this formula on the header or the footer sections of the report.
    Regarding the date range issue, please follow Sastry's advice and it should work fine.
    Make sure you're using the parameter in the Minimum and Maximum functions. For eg: If I was to create a date range parameter called OrderDate, my formula to show the start date would look like this:
    Minimum({?OrderDate})
    -Abhilash

  • Function module to calculate no of days between two date ranges

    hi experts,
    can some one please suggest a function module that can calculate no of days between specified date range.
    for example : if i enter date range between 26.02.2011 to 20.05.2011, then it should calculate no of days between these dates.
    Moderator message : Basic date questions not allowed. Read forum rules before posting. Thread locked.
    Edited by: Vinod Kumar on May 25, 2011 10:57 AM

    Hi,
    Please search SDN.. there are lots of posts for teh same.
    [http://wiki.sdn.sap.com/wiki/display/ABAP/FunctionModulerelatedonDate+calculations]

  • How to merge two date ranges

    Hi,
    I have following table. I want to merge date ranges if the dates are continuous and the value is same.I am using Oracle 10g.Please help.
    START_DATE END_DATE VALUE
    1/1/2008 12/31/2008 1234
    1/1/2009 12/31/2009 1234
    Sql statement output should be as follows:
    START_DATE END_DATE VALUE
    1/1/2008 12/31/2009 1234
    Thanks in advance.
    Edited by: user3898545 on Jan 27, 2010 7:44 PM

    Hi,
    user3898545 wrote:
    create table test_group(emp_id varchar2(5),
    start_date date,
    end_date date,
    value varchar2(10));
    insert into test_group(emp_id,start_date,end_date,VALUE) values ('E1','1-JAN-2008','31-DEC-2008','G1');start_date and end_date are DATEs; don't try to put VARCHAR2 values (such as '1-JAN-2008') into DATE columns. Use TO_DATE or DATE literals instead. The INSERT statements you posted may work on your system, but they won't necessarily work anywhere else. In particular, they don't work on my system. Post some sample data that anyone can use.
    ... I used following query to get the output 1/1/2009 - 12/31/2009 G2 when I ran for any date in 2010 or greater.There can be break in date ranges. Although query is giving the correct output which I am looking for I am looking for better performence.
    SELECT MAX (START_DATE)     AS START_DATE,MAX (END_DATE) AS END_DATE ,
    MAX(VALUE) KEEP (DENSE_RANK FIRST ORDER BY START_DATE DESC) GROUP_NUMBER
    FROM
    (WITH     GOT_GRP     AS
    (SELECT     TB_TEST_DATA.*,
         END_DATE - SUM (END_DATE + 1 - START_DATE) OVER ( PARTITION BY VALUE
                                            ORDER BY START_DATE) AS GRP
    FROM
    (SELECT HD.START_DATE,NVL(HD.END_DATE,'31-DEC-9999') "END_DATE",HD.VALUE
    FROM test_group HD
    WHERE HD.EMP_ID = 'E1'
    AND HD.START_DATE < NVL (HD.END_DATE, '31-DEC-9999')
    AND HD.END_DATE < :VDT_AS_OF_DATE
    ORDER BY EMP_ID,START_DATE) TB_TEST_DATA
    SELECT MIN (START_DATE)     AS START_DATE,MAX (END_DATE) AS END_DATE,VALUE
    FROM GOT_GRP
    GROUP BY VALUE,GRP
    ORDER BY START_DATE) CO_GRP;If you have new requirements, maybe you should start a new thread.
    What are your new requirements?
    When you say "There can be break in date ranges", do you mean grp plays no role in this new problem? In that case, you can save time and effort by not computing it.
    The following should produce the results you want from the sampe data given:
    WITH     got_r_num     AS
         SELECT     start_date, end_date, value
         ,     ROW_NUMBER () OVER ( ORDER BY start_date  DESC
                            ,           value       DESC
                           )     AS r_num
         FROM     test_group
         WHERE     end_date < TO_DATE ( :vdt_as_of_date
                           , 'DD-MON-YYYY'
    SELECT     start_date, end_date, value
    FROM     got_r_num
    WHERE     r_num     = 1
    ;

  • Two dates ranges

    Hi Guys,
    I have a problem here:
    For example
    SELECT
    emp.id_employe,
    taux.id_taux,
    emp.nom_emp,
    emp.prenom_emp,
    taux.taux_tc,
    per.periode_debut_tc,
    per.periode_fin_tc,
    fac.id_facture,
    fac.periode_debut_fac,
    fac.periode_fin_fac
    FROM dtp_spe_factures fac
    join dtp_spe_commandes com on COM.ID_COMMANDE = FAC.ID_COMMANDE
    join dtp_spe_ao_consortiums con on CON.ID_AO_CONSORTIUM = COM.ID_AO_CONSORTIUM
    join dtp_spe_taux_categories taux on TAUX.ID_AO_CONSORTIUM = CON.ID_AO_CONSORTIUM
    join dtp_spe_categories cat on CAT.ID_CATEGORIE = TAUX.ID_CATEGORIE
    join DTP_SPE_TAUX_PERIODE per on PER.ID_TAUX_PERIODE = TAUX.ID_TAUX_PERIODE
    join dtp_spe_employes2 emp on EMP.ID_AO_CONSORTIUM = con.ID_AO_CONSORTIUM and CAT.ID_CATEGORIE = EMP.ID_CATEGORIE
    PROBLEM
    The first 4 lines
    1471     11015     Joe     Billy     82.84     2010-04-01     2011-03-31     4474     2009-12-14     2010-04-29
    1471     10989     Joe     Billy     79.56     2008-04-01     2009-03-31     4474     2009-12-14     2010-04-29
    1471     11020     Joe     Billy     84.5     2011-04-01     2012-03-31     4474     2009-12-14     2010-04-29
    1471     11007     Joe     Billy     81.23     2009-04-01     2010-03-31     4474     2009-12-14     2010-04-29
    It supposed to return me just the lines 1 and 4
    I tried to use this
    periode_debut_fac between periode_debut_tc AND periode_fin_tc
    and
    periode_fin_fac between periode_debut_tc AND periode_fin_tc
    But not worked !! The only way that it worked was when I put this select inside another select, but after it the select get time to execut.
    Thanks

    The model
    http://ericyuri.wordpress.com/?attachment_id=423
    the full code is this:
    -- THIRD select
    -- SELECT TAUX_TC FROM ( ...
    select
    NOM_EMP||', '||PRENOM_EMP ||' P-'|| SEQ AS D,
    id_view
    from (
    SELECT ROW_NUMBER () OVER (PARTITION BY id_ao_consortium ORDER BY id_ao_consortium) id_view,
    emp.id_employe,
    taux.id_taux,
    ROW_NUMBER () OVER (PARTITION BY emp.id_employe ORDER BY taux.id_taux) SEQ,
    emp.nom_emp,
    emp.prenom_emp,
    emp.date_debut_emp,
    emp.date_fin_emp,
    emp.id_ao_consortium,
    taux.id_categorie,
    taux.taux_tc,
    per.periode_debut_tc,
    per.periode_fin_tc,
    con.num_ao,
    con.nom_con,
    com.id_commande,
    com.code_commande_com,
    fac.id_facture,
    fac.periode_debut_fac,
    fac.periode_fin_fac
    FROM dtp_spe_factures fac
    join dtp_spe_commandes com on COM.ID_COMMANDE = FAC.ID_COMMANDE
    join dtp_spe_ao_consortiums con on CON.ID_AO_CONSORTIUM = COM.ID_AO_CONSORTIUM
    join dtp_spe_taux_categories taux on TAUX.ID_AO_CONSORTIUM = CON.ID_AO_CONSORTIUM
    join dtp_spe_categories cat on CAT.ID_CATEGORIE = TAUX.ID_CATEGORIE
    join DTP_SPE_TAUX_PERIODE per on PER.ID_TAUX_PERIODE = TAUX.ID_TAUX_PERIODE
    join dtp_spe_employes2 emp on EMP.ID_AO_CONSORTIUM = con.ID_AO_CONSORTIUM and CAT.ID_CATEGORIE = EMP.ID_CATEGORIE
    where id_facture = :P28_ID_FACTURE
    where
    periode_debut_fac between periode_debut_tc AND periode_fin_tc
    or
    periode_fin_fac between periode_debut_tc AND periode_fin_tc
    order by 1
    -- WHERE ID_VIEW = :P28_ID_VIEW
    It is working and fast now ..... the problem is when I try to select another things based on id_view ...
    if I want to select another thing for example TAUX_TC... I have to use another select, so it gonna be 3 Select :S
    I'd like to known just one way more elegant with performance to do it !! It is working but its wierd for me :P !!

  • Figuring out the range of weeks betweeing two Dates?

    Hi all,
    Is there any hard and fast rule to calculate the number of days and/or weeks occupied between two date ranges?

    If you have Date date1, Date date2 and I assume date1 and date2 can belong to any year, I would do it in the basic way:
    int days =(int) Math.abs((date1.getTime() - date2.getTime()) / (24 * 60 * 3600 * 1000));
    int weeks = days / 7;
    That should be it.
    PC

  • G/L account ,date, wise material stock display

    Hi Experts
    My requirement is I need to display G/L accounts(mseg-sakto) material stock(mara) present on a particular date (budat)range.
    For this in select-options i am taking sakto as mseg-sakto and datum as bsim-budat.
    Now i need to apply select query and fetch data according so that i can show my MATERIAL STOCK  as per the G/L A/C choosen on particular date range.
    i am displaying material stock in a ALV GRID.
    Am i correct in choosing tables and fields for my requirement to fullfill?
    should i take some other table or field ?
    it is a modification to standared mb5b trnx.

    Hi,
    Try with tables:
    SKA1     G/L Account Master (Chart of Accounts)
    SKAT     G/L Account Master Record (Chart of Accounts- Description)
    SKB1     G/L account master (company code)
    BSIS     Accounting- Secondary Index for G/L Accounts
    Regards,
    Renjith Michael.

  • Same date range values

    Hi Experts,
    I have a complex requirement for a date range functionality.
    Here is the detailed explanation:
    I have field TransactionDate field coming from an Oracle View.
    I have 2 parameters to be created on the same field and either of them can be selected but not both and both can be blank even.
    1. Transaction date on or before
    2. Transaction Date Range
    We may have values for only one prompt at any given point.
    If the user enters value for Transaction date on or before, then report should display data less than or equal to the date entered.
    If the user enters values for the Transaction Date Range, report should display date between the user entered dates.
    If none is entered report should display data for all dates.
    Now, when the Transaction Date Range has same values in Start of Range and End of Range, we need to display the record for maximum(Transaction Date) under a particular account, irrespective of the dates specified, i.e if the user enters current date in Start of Range and End of Range and there will be no records for this date. In this scenario, report should display the maximum(Transaction Date) for that account.
    I've tried all of I could, but ending up with a blank report.
    Any suggestions will be of great help. Thanks in advance.
    Naresh

    HI Naresh,
    Have you tried this,
    add 'maximum' infront of this '...... {DBVW.DT} <= CurrentDate'  condition
    if(({@FrmBalDt}(NotEqualto)" " and {@ToBalDt}(NotEqualto)"  ") and ({@FrmBalDt} = {@ToBalDt})
    and MAXIMUM({DBVW.DT} )<= CurrentDate)
    then maximum({@BalDate})
    else {@BalDate}
    if it is not working, Check where the condition is failing..
    or else try this also
    (not HasValue({?Client Id}) OR {DBVW.CLID} = {?Client Id}) and
    (not HasValue({?Base Currency Code}) OR {DBVW.BCCYCOD} = {?Base Currency Code}) and
    (not HasValue({?Account Type}) OR {DBVW.ACDES} = {?Account Type}) and
    (not HasValue({?Legal Entity Name}) OR {DBVW.CUST} = {?Legal Entity Name}) and
    (not HasValue({?Account Currency}) OR {DBVW.CCY} = {?Account Currency}) and
    (not HasValue({?Account Number}) OR {DBVW.ACNO} in {?Account Number}) and
    (not HasValue({?Account Group}) OR {DBVW.ACGRP} = {?Account Group}) and
    (not HasValue({?Show Latest Statement on or before}) OR {DBVW.DT} <= {?Show Latest Statement on or before}) and
    (if {?Activity Only} = "True" then ({DBVW.CT_CR} <>0 or {DBVW.CT_DB}0)
    ELSE if {?Activity Only} = "False" then ({DBVW.CT_CR} >=0 or {DBVW.CT_DB}>=0)) and
    (if {?Business Days Only} = "True" then (not(datepart("w",{DBVW.DT}) in 7,1) and
    (not HasValue({?Balance Date Range}) OR {@BalDate} = {?Balance Date Range}))
    else if {?Business Days Only} = "False" then ((not HasValue({?Balance Date Range})
    Up to this copy paste of your formula
    OR {@BalDate} = (if maximum({?Balance Date Range})>maximum({DBVW.DT} ) then maximum(date({DBVW.DT} )) else {?Balance Date Range}))))
    i think this may work, without your second formula
    regards,
    Salah
    Edited by: salahudheen muhammed on Sep 11, 2009 4:56 PM
    Edited by: salahudheen muhammed on Sep 11, 2009 5:02 PM

  • Problem with customer exit variable on date range

    Hi All,
    I have customer exit variable on date range. In the selection screen it has to give the week range  as a default (05/21/2009 to 05/27/2009).
    Earlier its working fine and from yesterday onwards it is not working properly. yesday onwards default date range was not displaying in selection screen.
    Wht would be the problem.
    Thanks in Advance

    Hi Ashish,
    I checked every thing what u told earlier. Every thing is fine.
    And another thing is
    I have routine in infopackage level. Since day before yesterday it was working fine and yesterday onwards it was not working.
    Eg: budat will take the data based on routine for the week. But yesterday onwards it is not picking up the data.however I have the data in datasource for the week.
    Wht would be the problem. I debuged the code and its working fine.
    Sekhar

  • Split dates into date range windows

    Hi,
    I have a peculiar requirement to create windows for different dates.
    For example I have two date ranges (two rows in the table column
    Start Date End Date
    01-Jan 28-Feb
    15-Jan 14-Feb (this starts between the previous date range i.e. 01-Jan to 28-Feb)
    I have to split dates in a way so that it creates different windows with start and end date i.e.
    Start Date End Date
    01-Jan 15-Jan (15Jan because it comes before 28 Feb)
    16-Jan 14-Feb ( 14Feb as it comes before 28 Feb)
    15-Feb 28-Feb
    Is there any sql function which can be used to achieve this? or any help you can provide? Thanks.
    -Salman

    Welcome to the forum!
    Unfortunately you posted to the wrong forum. This forum is for sql developer only.
    Repost you question in the SQL and PL/SQL forum and you will get help there.
    Please mark this question ANSWERED to people will follow up in the other forum.

  • How do I take two separate non numeric fields in a acrobat form and combine the data to display in a third separate field?

    How do I take two separate non numeric fields in a acrobat form and combine the data to display in a third separate field?

    You have to use custom JavScripting to concatenate the first 2 fields. You cannot use the first 2 calculation options because they force the values of the fields to a numeric value or ignore string values.
    Possible scripts for the 3rd field are:
    event.value = this.getField("Text1").valueAsString + " " + this.getField("Text2").valueAsString;
    or
    event.value = this.getField("Text1").valueAsString.concat( " ",  this.getField("Text2").valueAsString);
    If you do not want change the separator or not show the separator when on or the other field is empty, you will need to add more code to adjust for change.
    The above scripts will also concatenate number because the field values are read as strings and not numbers.
    There is also a generalized user written function to concatenate up to 3 fields with a separator that adjust for missing data.

  • Reg: Combining two display lists into one list

    Dear All,
    i want to combine two display lists into one display list. Please give the idea for this one issue.
    *****************dispaly list 1 starting here*********************
    *&      Form  F_006_DISPLAY_LIST
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM F_006_DISPLAY_LIST.
    *  TABLES : LFA1 .
      DATA : V_DEBIT_TOTAL TYPE P DECIMALS 2 ,
             V_CREDIT_TOTAL TYPE P DECIMALS 2 ,
             V_CLOSE_BAL TYPE P DECIMALS 2 .
      DATA : V_CNT TYPE I .
      SORT ITAB_OPG BY LIFNR.
      LOOP AT ITAB_OPG.
        NEW-PAGE.
    * Displaying Vendor Name
        SELECT SINGLE NAME1 FROM LFA1 INTO LFA1-NAME1 WHERE
                                                 LIFNR EQ ITAB_OPG-LIFNR .
        FORMAT COLOR COL_POSITIVE INTENSIFIED ON.
        WRITE:/2 'Vendor Code:' ,
                 ITAB_OPG-LIFNR  ,
              40 LFA1-NAME1 .
        CLEAR : LFA1 .
        WRITE :/(190) SY-ULINE .
    * Displaying Opening Balance
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON .
        READ TABLE ITAB_OPG WITH KEY LIFNR = ITAB_OPG-LIFNR .
        IF ITAB_OPG-BAL LE 0 .
          WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,
                  171(18) ITAB_OPG-BAL .
        ELSE.
          WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,
                  151(18) ITAB_OPG-BAL .
        ENDIF.
        WRITE :/(190) SY-ULINE .
    * Displaying Line Items
        LOOP AT ITAB_DISPLAY WHERE LIFNR EQ ITAB_OPG-LIFNR.
          V_CNT = SY-TABIX MOD 2.
          IF V_CNT EQ 0.
            FORMAT COLOR COL_NORMAL INTENSIFIED ON.
          ELSE.
            FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
          ENDIF.
    * Selecting Bank Name and Cheque Number
          SELECT SINGLE CHECT HBKID INTO (PAYR-CHECT , PAYR-HBKID)
                               FROM PAYR WHERE
                        ZBUKR EQ P_BUKRS AND
                        VBLNR EQ ITAB_DISPLAY-BELNR AND
                        LIFNR EQ ITAB_DISPLAY-LIFNR .
          SELECT SINGLE BANKS BANKL INTO (T012-BANKS , T012-BANKL) FROM
                 T012 WHERE BUKRS EQ P_BUKRS AND
                            HBKID EQ PAYR-HBKID.
          SELECT SINGLE BANKA INTO BNKA-BANKA FROM BNKA WHERE
                            BANKS EQ T012-BANKS AND
                            BANKL EQ T012-BANKL .
          WRITE :/2 ITAB_DISPLAY-BUDAT ,
                 14 ITAB_DISPLAY-BELNR ,
                 26 ITAB_DISPLAY-BLDAT ,
                 40 ITAB_DISPLAY-XBLNR ,
                 58(16) PAYR-CHECT ,
                 75 BNKA-BANKA ,
                105(40) ITAB_DISPLAY-SGTXT ,
                146(4) ITAB_DISPLAY-BLART .
    * Determinig Debit or Credit
          IF ITAB_DISPLAY-SHKZG EQ 'S'.
            V_DEBIT_TOTAL = V_DEBIT_TOTAL + ITAB_DISPLAY-DMBTR.
            WRITE:151(18)  ITAB_DISPLAY-DMBTR ,
                  171(18)  SPACE .
          ELSEIF ITAB_DISPLAY-SHKZG EQ 'H'.
            V_CREDIT_TOTAL = V_CREDIT_TOTAL + ITAB_DISPLAY-DMBTR.
            WRITE:151(18) SPACE ,
                  171(18)  ITAB_DISPLAY-DMBTR .
          ENDIF.
          CLEAR : T012 , BNKA , PAYR .
        ENDLOOP.
        FORMAT COLOR COL_TOTAL INTENSIFIED ON.
        WRITE:/(190) SY-ULINE.
    * Displaying Debit and Credit Totals
        WRITE:/125 TEXT-001 ,
           151(18) V_DEBIT_TOTAL ,
           171(18) V_CREDIT_TOTAL .
        WRITE:/(190) SY-ULINE.
    * Displaying the Closing Balance
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
        V_CLOSE_BAL = ITAB_OPG-BAL + V_DEBIT_TOTAL - V_CREDIT_TOTAL .
        IF V_CLOSE_BAL GT 0.
          WRITE:/122 TEXT-002 ,
             151(18) V_CLOSE_BAL NO-SIGN.  " D00K909674
        ELSEIF V_CLOSE_BAL LE 0.
          WRITE:/122 TEXT-002 ,
             171(18) V_CLOSE_BAL NO-SIGN.  " D00K909674
        ENDIF.
        CLEAR : V_CLOSE_BAL.
      ENDLOOP.
    ENDFORM.                               " F_006_DISPLAY_LIST
    *****************dispaly list 1 ending here*********************
    *****************dispaly list 2 starting here*********************
    *&      Form  F_006_DISPLAY_LIST1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM F_006_DISPLAY_LIST1 .
    TABLES : KNA1 .
      DATA : V_DEBIT_TOTAL1 TYPE P DECIMALS 2 ,
             V_CREDIT_TOTAL1 TYPE P DECIMALS 2 ,
             V_CLOSE_BAL1 TYPE P DECIMALS 2 .
      DATA : V_CNT1 TYPE I .
      SORT ITAB_OPG1 BY KUNNR.
      LOOP AT ITAB_OPG1.
        NEW-PAGE.
    * Displaying Vendor Name
        SELECT SINGLE NAME1 FROM KNA1 INTO KNA1-NAME1 WHERE
                                                 KUNNR EQ ITAB_OPG1-KUNNR .
        FORMAT COLOR COL_POSITIVE INTENSIFIED ON.
        WRITE:/2 'Customer Code:' ,
                 ITAB_OPG1-KUNNR  ,
              40 KNA1-NAME1 .
        CLEAR : KNA1 .
        WRITE :/(190) SY-ULINE .
    * Displaying Opening Balance
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON .
        READ TABLE ITAB_OPG1 WITH KEY KUNNR = ITAB_OPG1-KUNNR .
        IF ITAB_OPG1-BAL1 LE 0 .
          WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,
                  171(18) ITAB_OPG1-BAL1 .
        ELSE.
          WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,
                  151(18) ITAB_OPG1-BAL1 .
        ENDIF.
        WRITE :/(190) SY-ULINE .
    * Displaying Line Items
        LOOP AT ITAB_DISPLAY1 WHERE KUNNR EQ ITAB_OPG1-KUNNR.
          V_CNT1 = SY-TABIX MOD 2.
          IF V_CNT1 EQ 0.
            FORMAT COLOR COL_NORMAL INTENSIFIED ON.
          ELSE.
            FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
          ENDIF.
    * Selecting Bank Name and Cheque Number
          SELECT SINGLE CHECT HBKID INTO (PAYR-CHECT , PAYR-HBKID)
                               FROM PAYR WHERE
                        ZBUKR EQ P_BUKRS AND
                        VBLNR EQ ITAB_DISPLAY1-BELNR AND
                        KUNNR EQ ITAB_DISPLAY1-KUNNR .
          SELECT SINGLE BANKS BANKL INTO (T012-BANKS , T012-BANKL) FROM
                 T012 WHERE BUKRS EQ P_BUKRS AND
                            HBKID EQ PAYR-HBKID.
          SELECT SINGLE BANKA INTO BNKA-BANKA FROM BNKA WHERE
                            BANKS EQ T012-BANKS AND
                            BANKL EQ T012-BANKL .
          WRITE :/2 ITAB_DISPLAY1-BUDAT ,
                 14 ITAB_DISPLAY1-BELNR ,
                 26 ITAB_DISPLAY1-BLDAT ,
                 40 ITAB_DISPLAY1-XBLNR ,
                 58(16) PAYR-CHECT ,
                 75 BNKA-BANKA ,
                105(40) ITAB_DISPLAY1-SGTXT ,
                146(4) ITAB_DISPLAY1-BLART .
    * Determinig Debit or Credit
          IF ITAB_DISPLAY1-SHKZG EQ 'S'.
            V_DEBIT_TOTAL1 = V_DEBIT_TOTAL1 + ITAB_DISPLAY1-DMBTR.
            WRITE:151(18)  ITAB_DISPLAY1-DMBTR ,
                  171(18)  SPACE .
          ELSEIF ITAB_DISPLAY1-SHKZG EQ 'H'.
            V_CREDIT_TOTAL1 = V_CREDIT_TOTAL1 + ITAB_DISPLAY1-DMBTR.
            WRITE:151(18) SPACE ,
                  171(18)  ITAB_DISPLAY1-DMBTR .
          ENDIF.
          CLEAR : T012 , BNKA , PAYR .
        ENDLOOP.
        FORMAT COLOR COL_TOTAL INTENSIFIED ON.
        WRITE:/(190) SY-ULINE.
    * Displaying Debit and Credit Totals
        WRITE:/125 TEXT-001 ,
           151(18) V_DEBIT_TOTAL1,
           171(18) V_CREDIT_TOTAL1 .
        WRITE:/(190) SY-ULINE.
    * Displaying the Closing Balance
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
        V_CLOSE_BAL1 = ITAB_OPG1-BAL1 + V_DEBIT_TOTAL1 - V_CREDIT_TOTAL1 .
        IF V_CLOSE_BAL1 GT 0.
          WRITE:/122 TEXT-002 ,
             151(18) V_CLOSE_BAL1 NO-SIGN.  " D00K909674
        ELSEIF V_CLOSE_BAL1 LE 0.
          WRITE:/122 TEXT-002 ,
             171(18) V_CLOSE_BAL1 NO-SIGN.  " D00K909674
        ENDIF.
        CLEAR : V_CLOSE_BAL1.
      ENDLOOP.
    ENDFORM.                    " F_006_DISPLAY_LIST1
    *****************dispaly list 2 ending here*********************
    Thanks,
    Sankar M

    Hi,
    Can you post it as two halves ?
    Regards,
    Swarna Munukoti

Maybe you are looking for