AR Aging by account query

Hi ,
I am building a view which should have the aging information for all the customers who are having amount due remaining to pay.
here I have 1 query which gives all the dues for all the customers.
select trx_number
, ps.trx_date
, ps.due_date
, ps.invoice_currency_code
, sob.currency_code
, ps.class
, ps.amount_due_original
, ps.amount_due_original * nvl(exchange_rate, 1) acctd_amount_due_original
, ps.amount_due_remaining
, ps.acctd_amount_due_remaining
, ps.status
, ps.cust_trx_type_id
, ps.customer_id
, ps.customer_site_use_id
, ps.customer_trx_id
, ps.cash_receipt_id
, ps.gl_date
, ps.org_id
from gl_sets_of_books sob
, hr_operating_units ou
, ar_payment_schedules_all ps
where sob.set_of_books_id = ou.set_of_books_id
and ou.organization_id = ps.org_id
and ps.status = 'OP'
and ps.org_id is not null
order by ps.org_id asc, ps.due_date desc
I have added buckets and all other details to the query as
select rc.customer_number
, rc2.CUSTOMER_NUMBER Brand_Cust_Number
, rc.CUSTOMER_NAME
, rc2.CUSTOMER_NAME Brand_Customer_Name
, ps.trx_number
, ps.trx_date
, ps.due_date
, ps.class
, ps.status
, ps.cust_trx_type_id
, ps.customer_id
, nvl(rcta.attribute5,ps.CUSTOMER_ID) Brand_Customer_id
, ps.customer_site_use_id
, ps.customer_trx_id
, ps.cash_receipt_id
, ps.gl_date
, sob.set_of_books_id
, sob.chart_of_accounts_id
, gcc.SEGMENT1 Company
, gcc.SEGMENT2 Location
, gcc.SEGMENT3 Department
, gcc.SEGMENT4 Account
, gcc.SEGMENT5 Future_1
, gcc.SEGMENT6 Future_2
, gcc.SEGMENT7 Future_3
, gcc.CONCATENATED_SEGMENTS gl_cc_concat_kff
, gcc.CODE_COMBINATION_ID
, ps.invoice_currency_code invoice_currency_code
, sob.currency_code SOB_Currency_Code
, ps.amount_due_original inv_curr_amount_original
, round(ps.amount_due_original * nvl(ps.exchange_rate, 1),2) sob_acctd_amount_due_original
, ps.AMOUNT_DUE_REMAINING
, ps.ACCTD_AMOUNT_DUE_REMAINING sob_acctd_amount_due_REMAINING
, ps.org_id
, round(sysdate-ps.due_date) No_Of_Days
, sysdate Run_date
, sysdate as_of_date
, (CASE WHEN round(sysdate-ps.due_date)<0 THEN AMOUNT_DUE_REMAINING END) Inv_Cur_Current_amt
, (CASE WHEN round(sysdate-ps.due_date) between 0 and 30 THEN AMOUNT_DUE_REMAINING END) Inv_Cur_Days_0_to_30
, (CASE WHEN round(sysdate-ps.due_date) between 31 and 60 THEN AMOUNT_DUE_REMAINING END) Inv_Cur_Days_31_to_60
, (CASE WHEN round(sysdate-ps.due_date) between 61 and 90 THEN AMOUNT_DUE_REMAINING END) Inv_Cur_Days_61_to_90
, (CASE WHEN round(sysdate-ps.due_date) between 91 and 120 THEN AMOUNT_DUE_REMAINING END) Inv_Cur_Days_91_to_120
, (CASE WHEN round(sysdate-ps.due_date) between 121 and 180 THEN AMOUNT_DUE_REMAINING END) Inv_Cur_Days_121_to_180
, (CASE WHEN round(sysdate-ps.due_date)>180 THEN AMOUNT_DUE_REMAINING END) Inv_Cur_Days_180_plus
, (CASE WHEN round(sysdate-ps.due_date)<0 THEN ACCTD_AMOUNT_DUE_REMAINING END) sob_Cur_Current_amt
, (CASE WHEN round(sysdate-ps.due_date) between 0 and 30 THEN ACCTD_AMOUNT_DUE_REMAINING END) sob_Cur_Days_0_to_30
, (CASE WHEN round(sysdate-ps.due_date) between 31 and 60 THEN ACCTD_AMOUNT_DUE_REMAINING END) sob_Cur_Days_31_to_60
, (CASE WHEN round(sysdate-ps.due_date) between 61 and 90 THEN ACCTD_AMOUNT_DUE_REMAINING END) sob_Cur_Days_61_to_90
, (CASE WHEN round(sysdate-ps.due_date) between 91 and 120 THEN ACCTD_AMOUNT_DUE_REMAINING END) sob_Cur_Days_91_to_120
, (CASE WHEN round(sysdate-ps.due_date) between 121 and 180 THEN ACCTD_AMOUNT_DUE_REMAINING END) sob_Cur_Days_121_to_180
, (CASE WHEN round(sysdate-ps.due_date)>180 THEN ACCTD_AMOUNT_DUE_REMAINING END) sob_Cur_Days_180_plus
from gl_sets_of_books sob
, hr_operating_units ou
, ar_payment_schedules_all ps
, ra_customers rc
, ra_cust_trx_line_gl_dist_all rctlda
, gl_code_combinations_kfv gcc
, ra_customer_trx_all rcta
, ra_customers rc2
where sob.set_of_books_id = ou.set_of_books_id
and ou.organization_id = ps.org_id
and ps.status = 'OP'
and ps.org_id is not null
and ps.CUSTOMER_ID=rc.CUSTOMER_ID
and ps.CUSTOMER_TRX_ID=rctlda.CUSTOMER_TRX_ID
and rctlda.ACCOUNT_CLASS='REC'
and rctlda.latest_rec_flag = 'Y'
and rctlda.CODE_COMBINATION_ID=gcc.CODE_COMBINATION_ID
and ps.CUSTOMER_TRX_ID=rcta.CUSTOMER_TRX_ID
and gcc.segment4 in('111100','111102','4110000')
and nvl(rcta.ATTRIBUTE5,ps.CUSTOMER_ID)=rc2.CUSTOMER_ID
and ps.CUSTOMER_ID=14273
order by rc.customer_name
From this query i am missing the payments records,because of this i am unable to get proper customer balance.
actually I could get straight away from 1st query but i need to restrict for some accounts as i wrote in second query where clause.
to get this i wrote one more query same as second but instead of ra_cust_gl_dist_lines_all i have used ar_receivables_applications_all to get the code_combintaion with cash receipt id.
2nd query is working perfect and giving all the details and amounts,but missing payments details as i told in the above.
Coud any one please tell me how to get payments/cash receipts applied to a customer query or else if you have complete aging query.
Thanks,
Y

Hi
Could you please send me the query if possible to [email protected]
Thank you very much for that.
Thanks,
YMR

Similar Messages

  • Modified Historic Accounting query tools/Inflation Accounting tool for Assets

    Modified Historic Accounting query tools/Inflation Accounting tool for Assets
    Does anybody know if Oracle provide such a product, or is it a third party solution that interfaces with Oracle? If you have any info on this, I would be grateful
    Thanks

    First check if you can add the function associated with the tools option to "responsibility exclusions" using sysadmin.
    See http://download.oracle.com/docs/cd/A60725_05/html/comnls/us/fnd/fndscrsp.htm
    If not, then consider writing a personalization (one for each tools>menu option)
    The personalization will fire on the "special7" (or whichever the number is).
    In the actions, you should display an error message that says "This option is not available". That will prevent the user from opening the form.
    Hope this helps
    Sandeep Gandhi
    Independent Techno-functional Consultant

  • Aging Report SQL Query

    Dear Guys,
    I have tried for aging report query , but still my expected results is not come. Please go through below the table and script data for your reference. Please wirte a query for aging report.
    USE [SAMPLES]
    GO
    /****** Object: Table [dbo].[NEW_DCB_REPORT] Script Date: 02/12/2015 01:19:06 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING OFF
    GO
    CREATE TABLE [dbo].[NEW_DCB_REPORT](
    [MFDB_LedgerNumber] [int] IDENTITY(1,1) NOT NULL,
    [MFDB_TxnDate] [datetime] NOT NULL,
    [MFDB_StateId] [int] NOT NULL,
    [MFDB_RegionId] [int] NOT NULL,
    [MFDB_BranchId] [int] NOT NULL,
    [MFDB_SHGId] [int] NOT NULL,
    [MFDB_SHGName] [varchar](75) NOT NULL,
    [MFDB_ShgMemberId] [int] NOT NULL,
    [MFDB_MemberName] [varchar](50) NOT NULL,
    [MFDB_VillageId] [int] NOT NULL,
    [MFDB_LoanNumber] [int] NOT NULL,
    [MFDB_LoanAmount] [int] NOT NULL,
    [MFDB_DisbursedDate] [datetime] NOT NULL,
    [MFDB_DemandDate] [datetime] NULL,
    [MFDB_CollectionDate] [datetime] NULL,
    [MFDB_InstallmentNumber] [int] NOT NULL,
    [MFDB_ArrearPrincipal] [numeric](18, 2) NOT NULL,
    [MFDB_ArrearInterest] [numeric](18, 2) NOT NULL,
    [MFDB_DemandPrincipal] [numeric](18, 2) NOT NULL,
    [MFDB_DemandInterest] [numeric](18, 2) NOT NULL,
    [MFDB_TotDemandPrincipal] [numeric](18, 2) NOT NULL,
    [MFDB_TotDemandInterest] [numeric](18, 2) NOT NULL,
    [MFDB_AdvOBPrincipal] [numeric](18, 2) NOT NULL,
    [MFDB_AdvOBInterest] [numeric](18, 2) NOT NULL,
    [MFDB_CollectedPrincipal] [numeric](18, 2) NOT NULL,
    [MFDB_CollectedInterest] [numeric](18, 2) NOT NULL,
    [MFDB_AdvCBPrincipal] [numeric](18, 2) NOT NULL,
    [MFDB_AdvCBInterest] [numeric](18, 2) NOT NULL,
    [MFDB_BalancePrincipal] [numeric](18, 2) NOT NULL,
    [MFDB_BalanceInterest] [numeric](18, 2) NOT NULL,
    [MFDB_OS_Pri] [numeric](18, 2) NOT NULL,
    [MFDB_OS_Int] [numeric](18, 2) NOT NULL,
    [MFDB_RepaymentPercentage] [int] NOT NULL,
    [MFDB_LoanSchemeId] [int] NOT NULL,
    [MFDB_LActivityId] [int] NOT NULL,
    [MFDB_LActSpecId] [int] NOT NULL,
    [MFDB_FundAgencyId] [int] NOT NULL,
    [MFDB_LSourceId] [int] NOT NULL,
    [MFDB_Months] [varchar](15) NOT NULL,
    [MFDB_PanchayatId] [int] NOT NULL,
    [MFDB_PanchayatName] [varchar](100) NOT NULL,
    [MFDB_VillageName] [varchar](100) NOT NULL
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    USE [SAMPLES];
    SET NOCOUNT ON;
    SET XACT_ABORT ON;
    GO
    SET IDENTITY_INSERT [dbo].[NEW_DCB_REPORT] ON;
    BEGIN TRANSACTION;
    INSERT INTO [dbo].[NEW_DCB_REPORT]([MFDB_LedgerNumber], [MFDB_TxnDate], [MFDB_StateId], [MFDB_RegionId], [MFDB_BranchId], [MFDB_SHGId], [MFDB_SHGName], [MFDB_ShgMemberId], [MFDB_MemberName], [MFDB_VillageId], [MFDB_LoanNumber], [MFDB_LoanAmount], [MFDB_DisbursedDate], [MFDB_DemandDate], [MFDB_CollectionDate], [MFDB_InstallmentNumber], [MFDB_ArrearPrincipal], [MFDB_ArrearInterest], [MFDB_DemandPrincipal], [MFDB_DemandInterest], [MFDB_TotDemandPrincipal], [MFDB_TotDemandInterest], [MFDB_AdvOBPrincipal], [MFDB_AdvOBInterest], [MFDB_CollectedPrincipal], [MFDB_CollectedInterest], [MFDB_AdvCBPrincipal], [MFDB_AdvCBInterest], [MFDB_BalancePrincipal], [MFDB_BalanceInterest], [MFDB_OS_Pri], [MFDB_OS_Int], [MFDB_RepaymentPercentage], [MFDB_LoanSchemeId], [MFDB_LActivityId], [MFDB_LActSpecId], [MFDB_FundAgencyId], [MFDB_LSourceId], [MFDB_Months], [MFDB_PanchayatId], [MFDB_PanchayatName], [MFDB_VillageName])
    SELECT 18, '20140422 00:00:00.000', 6, 16, 67, 5514, N'MAHALAXMI-5514', 66735, N'SUNITA', 4624, 1, 10000, '20140422 00:00:00.000', NULL, NULL, 0, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 10000.00, 1051.00, 0, 3, 4, 77, 3, 2, N'Apr - 14', 2927, N'PALI', N'PALI' UNION ALL
    SELECT 162, '20140521 00:00:00.000', 6, 16, 67, 5514, N'MAHALAXMI-5514', 66735, N'SUNITA', 4624, 1, 10000, '20140422 00:00:00.000', '20140521 00:00:00.000', NULL, 1, 0.00, 0.00, 0.00, 150.00, 0.00, 150.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 150.00, 10000.00, 1051.00, 0, 3, 4, 77, 3, 2, N'May - 14', 2927, N'PALI', N'PALI' UNION ALL
    SELECT 13932, '20140621 00:00:00.000', 6, 16, 67, 5514, N'MAHALAXMI-5514', 66735, N'SUNITA', 4624, 1, 10000, '20140422 00:00:00.000', '20140621 00:00:00.000', NULL, 2, 0.00, 150.00, 909.00, 150.00, 909.00, 300.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 909.00, 300.00, 10000.00, 1051.00, 0, 3, 4, 77, 3, 2, N'Jun - 14', 2927, N'PALI', N'PALI' UNION ALL
    SELECT 32505, '20140721 00:00:00.000', 6, 16, 67, 5514, N'MAHALAXMI-5514', 66735, N'SUNITA', 4624, 1, 10000, '20140422 00:00:00.000', '20140721 00:00:00.000', NULL, 3, 909.00, 300.00, 909.00, 136.00, 1818.00, 436.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1818.00, 436.00, 10000.00, 1051.00, 0, 3, 4, 77, 3, 2, N'Jul - 14', 2927, N'PALI', N'PALI' UNION ALL
    SELECT 62524, '20140821 00:00:00.000', 6, 16, 67, 5514, N'MAHALAXMI-5514', 66735, N'SUNITA', 4624, 1, 10000, '20140422 00:00:00.000', '20140821 00:00:00.000', NULL, 4, 1818.00, 436.00, 909.00, 123.00, 2727.00, 559.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 2727.00, 559.00, 10000.00, 1051.00, 0, 3, 4, 77, 3, 2, N'Aug - 14', 2927, N'PALI', N'PALI' UNION ALL
    SELECT 100871, '20140921 00:00:00.000', 6, 16, 67, 5514, N'MAHALAXMI-5514', 66735, N'SUNITA', 4624, 1, 10000, '20140422 00:00:00.000', '20140921 00:00:00.000', NULL, 5, 2727.00, 559.00, 909.00, 109.00, 3636.00, 668.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 3636.00, 668.00, 10000.00, 1051.00, 0, 3, 4, 77, 3, 2, N'Sep - 14', 2927, N'PALI', N'PALI' UNION ALL
    SELECT 153679, '20141021 00:00:00.000', 6, 16, 67, 5514, N'MAHALAXMI-5514', 66735, N'SUNITA', 4624, 1, 10000, '20140422 00:00:00.000', '20141021 00:00:00.000', NULL, 6, 3636.00, 668.00, 909.00, 96.00, 4545.00, 764.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 4545.00, 764.00, 10000.00, 1051.00, 0, 3, 4, 77, 3, 2, N'Oct - 14', 2927, N'PALI', N'PALI' UNION ALL
    SELECT 203840, '20141119 00:00:00.000', 6, 16, 67, 5514, N'MAHALAXMI-5514', 66735, N'SUNITA', 4624, 1, 10000, '20140422 00:00:00.000', NULL, '20141119 00:00:00.000', 2, 4545.00, 764.00, 0.00, 0.00, 4545.00, 764.00, 0.00, 0.00, 10000.00, 150.00, 5455.00, 0.00, 0.00, 614.00, 0.00, 901.00, 0, 3, 4, 77, 3, 2, N'Nov - 14', 2927, N'PALI', N'PALI' UNION ALL
    SELECT 291259, '20141221 00:00:00.000', 6, 16, 67, 5514, N'MAHALAXMI-5514', 66735, N'SUNITA', 4624, 1, 10000, '20140422 00:00:00.000', '20141221 00:00:00.000', NULL, 8, 0.00, 614.00, 909.00, 68.00, 909.00, 682.00, 5455.00, 0.00, 0.00, 0.00, 4546.00, 0.00, 0.00, 682.00, 0.00, 901.00, 0, 3, 4, 77, 3, 2, N'Dec - 14', 2927, N'PALI', N'PALI' UNION ALL
    SELECT 363176, '20150121 00:00:00.000', 6, 16, 67, 5514, N'MAHALAXMI-5514', 66735, N'SUNITA', 4624, 1, 10000, '20140422 00:00:00.000', '20150121 00:00:00.000', NULL, 9, 0.00, 682.00, 909.00, 55.00, 909.00, 737.00, 4546.00, 0.00, 0.00, 0.00, 3637.00, 0.00, 0.00, 737.00, 0.00, 901.00, 0, 3, 4, 77, 3, 2, N'Jan - 15', 2927, N'PALI', N'PALI'
    COMMIT;
    RAISERROR (N'[dbo].[NEW_DCB_REPORT]: Insert Batch: 1.....Done!', 10, 1) WITH NOWAIT;
    GO
    SET IDENTITY_INSERT [dbo].[NEW_DCB_REPORT] OFF;
    I expected results as below:
    Report As On Date: 30-10-2014
    S.No. SHG NAME MEMBER NAME <=30 31-60 61-90 91-120 91-180 181-365 365 - 689 Above 2 Yrs
    1 MAHALAXMI-5514 SUNITA 0 909 1818 2727 3636 4545 0 0
    Report As On Date:
    30-10-2014
    S.No.
    SHG NAME
    MEMBER NAME
    <=30
    31-60
    61-90
    91-120
    91-180
    181-365
    365 - 689
    Above 2 Yrs
    1
    MAHALAXMI-5514
    SUNITA
    0
    909
    1818
    2727
    3636
    4545
    0
    0

    Thanks for your replay,  I have checked your query it seems nearly ok, Please find my script which i tried above for the same.
    DECLARE @i_AsOnDate AS DATETIME = '2014-09-30'
    ;WITH CA1 AS
    SELECT ROW_NUMBER() OVER(Order  By DR.MFDB_SHGName,DR.MFDB_MemberName)
    AS SerialNumber,
      DR.MFDB_SHGId
    AS ShgId,
      DR.MFDB_SHGName
    AS ShgName,
      DR.MFDB_ShgMemberId
    AS MemId,
      DR.MFDB_MemberName
    AS MemName,
      ISNULL((SELECT CAST(SUM(LD.MFDB_StdPrincipal) AS BIGINT )
      FROM  MFDB_LOAN_DISBURSEMENT LD
      WHERE LD.MFDB_SHGId
    = DR.MFDB_SHGId 
      AND   LD.MFDB_ShgMemberId
    = DR.MFDB_ShgMemberId 
      AND   LD.MFDB_LoanNumber
    = DR.MFDB_LoanNumber
      AND   LD.MFDB_ApprovalStatus = 1
      AND   DATEDIFF(DAY,@i_AsOnDate,LD.MFDB_CollectionDate) > 0 ),0)
    AS YETDUE,
    ISNULL((SELECT TOP 1 CAST(ND.MFDB_BalancePrincipal AS BIGINT )
    FROM dbo.MFDB_NEW_DCB_REPORT ND
    WHERE ND.MFDB_SHGId
    = DR.MFDB_SHGId 
    AND   ND.MFDB_ShgMemberId
    = DR.MFDB_ShgMemberId  
    AND   ND.MFDB_LoanNumber
    = DR.MFDB_LoanNumber
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) >= 0
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) <= 30
    ORDER BY ND.MFDB_LedgerNumber DESC),0)
    AS '0-30',
    ISNULL((SELECT TOP 1 CAST(ND.MFDB_BalancePrincipal AS BIGINT )
    FROM dbo.MFDB_NEW_DCB_REPORT ND
    WHERE ND.MFDB_SHGId
    = DR.MFDB_SHGId 
    AND   ND.MFDB_ShgMemberId
    = DR.MFDB_ShgMemberId  
    AND   ND.MFDB_LoanNumber
    = DR.MFDB_LoanNumber
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) <= 60 
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) > 30
    ORDER BY ND.MFDB_LedgerNumber DESC),0)
    AS '31-60',
    ISNULL((SELECT TOP 1 CAST(ND.MFDB_BalancePrincipal AS BIGINT )
    FROM dbo.MFDB_NEW_DCB_REPORT ND
    WHERE ND.MFDB_SHGId
    = DR.MFDB_SHGId 
    AND   ND.MFDB_ShgMemberId
    = DR.MFDB_ShgMemberId  
    AND   ND.MFDB_LoanNumber
    = DR.MFDB_LoanNumber
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) <= 90 
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) > 60
    ORDER BY ND.MFDB_LedgerNumber DESC),0)
    AS '61-90',
    ISNULL((SELECT TOP 1 CAST(ND.MFDB_BalancePrincipal AS BIGINT )
    FROM dbo.MFDB_NEW_DCB_REPORT ND
    WHERE ND.MFDB_SHGId
    = DR.MFDB_SHGId 
    AND   ND.MFDB_ShgMemberId
    = DR.MFDB_ShgMemberId  
    AND   ND.MFDB_LoanNumber
    = DR.MFDB_LoanNumber
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) <= 120 
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) > 90
    ORDER BY ND.MFDB_LedgerNumber DESC),0)
    AS '91-120',
    ISNULL((SELECT TOP 1 CAST(ND.MFDB_BalancePrincipal AS BIGINT )
    FROM dbo.MFDB_NEW_DCB_REPORT ND
    WHERE ND.MFDB_SHGId
    = DR.MFDB_SHGId 
    AND   ND.MFDB_ShgMemberId
    = DR.MFDB_ShgMemberId  
    AND   ND.MFDB_LoanNumber
    = DR.MFDB_LoanNumber
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) <= 180 
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) > 120
    ORDER BY ND.MFDB_LedgerNumber DESC),0)
    AS '121-180',
    ISNULL((SELECT TOP 1 CAST(ND.MFDB_BalancePrincipal AS BIGINT )
    FROM dbo.MFDB_NEW_DCB_REPORT ND
    WHERE ND.MFDB_SHGId
    = DR.MFDB_SHGId 
    AND   ND.MFDB_ShgMemberId
    = DR.MFDB_ShgMemberId  
    AND   ND.MFDB_LoanNumber
    = DR.MFDB_LoanNumber
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) <= 365 
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) > 180
    ORDER BY ND.MFDB_LedgerNumber DESC),0)
    AS '181-365',
    ISNULL((SELECT TOP 1 CAST(ND.MFDB_BalancePrincipal AS BIGINT )
    FROM dbo.MFDB_NEW_DCB_REPORT ND
    WHERE ND.MFDB_SHGId
    = DR.MFDB_SHGId 
    AND   ND.MFDB_ShgMemberId
    = DR.MFDB_ShgMemberId  
    AND   ND.MFDB_LoanNumber
    = DR.MFDB_LoanNumber
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) <= 689 
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) > 365
    ORDER BY ND.MFDB_LedgerNumber DESC),0)
    AS '366-689',
    ISNULL((SELECT TOP 1 CAST(ND.MFDB_BalancePrincipal AS BIGINT )
    FROM dbo.MFDB_NEW_DCB_REPORT ND
    WHERE ND.MFDB_SHGId
    = DR.MFDB_SHGId 
    AND   ND.MFDB_ShgMemberId
    = DR.MFDB_ShgMemberId  
    AND   ND.MFDB_LoanNumber
    = DR.MFDB_LoanNumber
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) <= 730 
    AND   DATEDIFF(Day,ND.MFDB_TxnDate,@i_AsOnDate) > 689
    ORDER BY ND.MFDB_LedgerNumber DESC),0)
    AS 'Above_2_Yrs'   
    FROM DBO.MFDB_NEW_DCB_REPORT DR
    WHERE DR.MFDB_BranchId
    = 67
    AND   DR.MFDB_SHGId
    IN (5514)
    AND   DR.MFDB_ShgMemberId = 66735
    AND   DATEDIFF(DAY,MFDB_TxnDate,@i_AsOnDate) >= 0  
    SELECT * FROM CA1
    results after the execution of the script:
    SerialNumber
    ShgId
    ShgName
    MemId
    MemName
    YETDUE
    0-30
    31-60
    61-90
    91-120
    121-180
    181-365
    366-689
    Above_2_Yrs
    3
    5514
    MAHALAXMI-5514
    SUNITA
    10000
    3636
    2727
    1818
    909
    0
    0
    0
    0
    2
    5514
    MAHALAXMI-5514
    SUNITA
    10000
    3636
    2727
    1818
    909
    0
    0
    0
    0
    6
    5514
    MAHALAXMI-5514
    SUNITA
    10000
    3636
    2727
    1818
    909
    0
    0
    0
    0
    4
    5514
    MAHALAXMI-5514
    SUNITA
    10000
    3636
    2727
    1818
    909
    0
    0
    0
    0
    1
    5514
    MAHALAXMI-5514
    SUNITA
    10000
    3636
    2727
    1818
    909
    0
    0
    0
    0
    5
    5514
    MAHALAXMI-5514
    SUNITA
    10000
    3636
    2727
    1818
    909
    0
    0
    0
    0
    But I expected results is:
    s.n
    ShgId
    ShgName
    MemId
    MemName
    YETDUE
    0-30
    31-60
    61-90
    91-120
    121-180
    181-365
    366-689
    Above_2_Yrs
    1
    5514
    MAHALAXMI-5514
    66735
    SUNITA
    10000
    909
    1818
    2727
    3636
    0
    0
    0
    I want only one record per member with aging .. please advice me for further action.

  • How to calculate Age in BEx query

    Hi,
    I need to calculate age in years based on person's date of birth and the key date that user of the report will enter.
    So, basically in my query I already have date of birth characteristic from 0PERSON InfoObject. I created ZAGE key figure and added it to the query that I would like to populate with person's age.
    So I know I have to enter some code in CMOD for calculated key figure ZAGE to get calculated based on birthdate and key date that user enters. Can somebody help with the code?
    thanks

    Hi,
    The variable should be in "Date" dimension. I have missed one important information in earlier mail.
    The processing type of the variable (user entry date) should be of "Customer Exit' and dimension (in last tab) should be "Date".
    By selecting this dimension, the variable input help screen also appears in calendar format to help user to select date instead of writing it in variable input.
    No need to write any custom code for this variable. We are selecting the "Customer exit" processing type to get Date dimension. In Normal user entry variables we can't get date & time dimension.
    "Ready for Input" should be selected so that user can enter date.
    I hope you can solve your issue now.
    Thanks for your feedback.
    Regards,
    Arun Thangaraj.
    Edited by: Arun  Thangaraj on Oct 8, 2008 8:48 AM

  • How do you calculate the age of a query?

    Hi,
    We are trying to determine how old a query is?  Do one of the statistical cubes/queries contain the age or created on date of a query?
    Thanks for you help.  Points will be rewarded for the correct answer.
    Thanks,
    Mike

    Hi rathi/mike,
    check these tables RSRREPDIR,RSZCOMPDIR.
    Cheers
    RK

  • Retained Earnings Account query

    Hi Folks,
    At Ledger level we can assign one balancing segment value for Retained earnings account , where as if we have multiple balancing segment values in same BG LE and OU so how we can differentiate the retained earning account balances for different balancing segment values.
    Regards
    Prasanth

    Hi Rupa,
    Thanks for your reply,
    Sorry for inconvience, actually my query is as follow.
    We have single ledger with multiple balancing segements , we will enter multiple transactions for each balancing segment values. but we can assign only one balancing segment at ledger level how system will create other balancing segment retained earnings account , and how it will get effect.
    Ex:- Balancing segments (1, 2, 3, 4, 5) we will assign only "1" at ledger level. later we entered transanctions for "2" , "3" vis versa, how system will generate retaned earnings account combination for "2" , "3" . based on what functionality it is working .
    Regards
    Prasanth

  • Calculate age in a query

    Hi everyone,
    i have create a query, but now i've been askeed to introduce de age of de partners, how can i do this? i only have a variavel call birthaydate.... i think the best way is to subtracte the todays day to that field... but how can i do it....
    thanks
    GPC

    Hi,
    Let us assume you have following charactertics in the datatarget.
    Plant ,Material, Creationdate, No of document(counter)
    1) Take <i>Plant</i> into Rows part ,
    2) Take <i>No of document(counter)</i> into columns 5 times.
    3) Create 5 Customer exit variables on <i>Creationdate</i>
    4) Take <i>Creation date</i> into selection screen (edit screen) of  the columns created by step2. And restrict them with one Customer exit variable each time differently.
    5) In the code of variable1 assign [Current date,current date-30]
    In the code of variable2 assign [Current date-31,current date-60]
    In the code of variable3 assign [Current date-61,current date-90]
    In the code of variable4 assign [Current date-91,current date-120]
    In the code of variable5 assign [Current date-121,current date-150]
    Then you age bucketing report is ready .
    With rgds,
    Anil Kumar Sharma .P

  • Get age from DOB query problem

    Hi I'm a bit of a noob. I've found this query and got it to work but I want to find all the people over the age of 30. How do I go about doing this?
    SELECT FLOOR( MONTHS_BETWEEN( CURRENT_DATE, DOB ) / 12 ) AS person_age FROM Customer
    This shows everyones age.
    Many thanks

    It's working fine
    This is example to illustrate find age which are greater than 25.
    SQL> select *
    2 from (
    3 SELECT FLOOR( MONTHS_BETWEEN( CURRENT_DATE, hiredate ) / 12 ) AS person_age
    4 FROM emp
    5 )
    6 where person_age > 25
    7 /
    PERSON_AGE
    27
    27
    27
    27
    27
    27
    27
    27
    27
    27
    27
    PERSON_AGE
    26
    12 rows selected.
    Actual requirement is as follows:
    SQL> select *
    2 from (
    3 SELECT FLOOR( MONTHS_BETWEEN( CURRENT_DATE, hiredate ) / 12 ) AS person_age
    4 FROM emp
    5 )
    6 where person_age > 30
    7 /
    Edited by: venkata on Dec 15, 2008 11:02 AM

  • Ageing On Account Statement

    Hi  Guys
    I've coppied the standard SAPscript Form F140_acc_stat_01 to Zf140_acc_stat1. My issue is we require an ageing for the customer account at the bottom of the statement. In otherwards the open items. What do i need to do to get this on my statement? i.e. 30 days; 60 days; 90days; 120 days; 120 + days.
    your assistance is highly appreciated.
    thanks
    Vimal

    HI
    ADD  'AGEING BUCKET' into buttom of SAPSCRIPT.
    Now Compare The due Date with Key date for each Customer And Check 'ARREARS' which is Available In the print program with 'rart' field.
    Depending The value of ARREARS check that in which conditon they lie means 1to30,or 31to60 etc.
    Pass the value Amount rast1,rast2 etc.
    Regards
    Ajit

  • Calculating Age in BEx Query

    I want to calculate age of Order based on Order create date. I am having order create date as key figure date in Order cube. Age is calculated at runtime as (Last day of month) - Order create Date. For Example.
    If ORder 'A' is created in 10/01/2004 and if query is executed at 12/31/2004 then Query should produce output  as follows:
    Order Number        Month    Age
    A                   10/2004  31 Days
    A                   11/2004  61 Days
    A                   12/2004  92 Days
    In my infocube I've only one record for this order with Order number and Order create date. How to produce above mentioned o/p from this.
    Thanks,
    Milind

    Hi Milind,
    if you are looking for a web solution, use a table interface to create a new column for the age. You can calculate the value for the order age with the table interface, too. An advantage of this table interface solution is, that you can concatenate your unit [days] into the output range, like "31 Days".
    For BEx Analyzer, you can create a VBA macro to get the same advantage...
    rgds Jens

  • Freelance (DPS pro account) query

    Hi all,
    Bob Levine has kindly cleared up a lot of my confusion on this for which I'm very grateful.  However I have a final query that I thought I'd ask here if that's ok.
    I am a freelance designer specialising in printed magazines and I'd ideally want to be able to offer ios/android newstand versions to existing and new clients.  In my head I thought I could purchase a pro DPS account and be able to do this, but I've found out that even with the pro account I could only make 1 multi-folio app.
    So for me to offer this as a service I'd have to have my clients each purchase a pro account for their app and I would design their publication/folios for it.  Obviously the client would have to manage payments of their account, otherwise I could end up with a number of different accounts on behalf of numerous clients to take care of!
    Now, if the above is correct, then what is the advantage of buying a pro account over going with one of the many companies who give you their own inDesign plug in and deal with submission etc, sometimes for slightly cheaper, than the pro account subscription.  Is it just a case of having more freedom with the design if you use the DPS plug-in?
    I'm obviously missing something but I'm trying to get a clear understanding of the costs of different options  before I dive in.  I wish the adobe info would do that :/
    Hope that's clear, sorry if it's not!
    Any help is appreciated.
    Thanks
    Ian

    Thanks for the reply Brian.  I totally agree that a small or individual licence to publish apps would be a much more elegant solution.  I mean the clients would have their own apple id so the certs etc would be in their name.  I'm amazed it's this convoluted.
    It seems that it would be clearer if instead of calling the different accounts 'licences' or 'accounts', they should just say it's a monthly app maintenance fee or something like that, because it really is linked to the app that's created rather than the professional designer who created it.
    I'd be interested though in your thoughts on the benefits of going with Adobe's publishing suite over one of the other companies out there.  I'm very much an adobe user of course so I naturally look at the DPS first in the hopes that it would be the best for inDesign interaction, but there's some pretty big publications that use plug-ins from other companies, although I'd still have the same hassle with having to manage different 'accounts' for different apps/clients.

  • Indicating age in account setup

    Somewhere ... when I set up my daughter's iTunes account, I recall being able to set an age and choosing 11-13 yrs. However, this seems to be limiting her from downloading apps rated 12+.
    I can't figure out where I set it... any ideas?

    Hi,
    In Address Book, go to your card, click on your picture and select 'Clear image' from the Advanced menu (or words to those effect - sorry not on a Mac to check the exact wording)

  • Changing my Apple ID Account query

    I have an apple ID that is not in the form of an e-mail address.  For example: abcdefghijk99.  I've had it for years, going back to when I was a Windows PC user (until I saw the light 2 years ago and switched to Apple products) for itunes purchases initially.  As far as I was concerned my appleid was fine and I've used it to purchase more music and apps for my Mac, iphone, ipad and ipod since.  Then I discovered a problem. Having downloaded the Find My iphone app it prompted me for an appleid in the form of an e-mail address and would not accept my original appleid.  Likewise the same issue applied to the the same for finding the ipad.
    So I checked it out online a little to try and see if it is possible to change your applid and found the "My Apple ID" section at https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/ and that under the "Manage my account" section you can make changes to your appleid account.  But changing your name to an e-mail address is not one of them, at least if it is to the e-mail address that is your default e-mail address as held by itunes.
    So ok, and I imagine others would suggest this, that I could set up another ID as an e-mail address and use this for the Find my iphone and ipad facilities.
    But looking forward, it doesn't solve the problem at all.
    1.  I've built up a fair history of purchases using itunes and from the App store under my original non e-mail address and I don't want to lose them.  And of course future updates to software that I've purchased from the App Store would be against my original appleid and I don't want to lose that thread.
    With the advent of "iCloud" I understand that it will want you to enter your Appleid in order to upload to, sync your devices with etc.,  If it wants this to be entered in e-mail address format then it will not be accessible to me.
    2.  Appleid software is inconsistent in that for iTunes and The App Store it will allow the ID to be entered both as a non E-Mail address and as an E-Mail address.  But for the Find my iphone App, will only accept an E-Mail format address as the Appleid.  I think this is perhaps a legacy of MobileMe, which possibly The iCloud is going to use the MobileMe format as an Appleid.  And if so that will have implications for other users who have the same type of appleid as me.
    3.  All I want to do is simply change my Appleid to my default E-Mail address, but it won't let me.  I raised this issue on the telephone with Apple who understood my issue, did not immediately know the answer, but said would discuss with colleagues and E-Mail me back.  The reply was:
    "I talked about your case with my colleagues. The only suggestion that came to mind is that you consult iTunes via email and ask if they can amend the ID or if it would be possible to transfer you purchases from one account to another account."
    Ok. So it led me to here, the Support area, because it seems impossible to be able to raise the issue by E-Mail with them, as much as I've tried to by going from page to page trying to find out "how to contact them".
    So does anyone here have any good ideas as to how I solve my problem?   Additionally is there anyone from Apple itself who monitors questions raised in this community?  If so could they let me know that they appreciate my problem and how/if it can be dealt with?
    Hoping someone comes up with a solution and looking forward to hearing from anyone with suggestions.

    Solved with assistance from iTunes support.  The main problem was that you cannot use an e-mail address which is associated with your existing account.  So the answer is to set set up a new e-mail address with your Internet Service provider.  Next step is to log into iTunes using your existing appleID (which in my case was a non e-mail address as mentioned in my question) and then modify your itunes id and e-mail account, both to the new e-mail address.  I tried it and it worked.  All downloaded history such as itunes music and apps that I have downloaded onto my devices over time has been retained.  Furthermore I can now use the "Find my iPhone app" to find both my iphone and iPad.  Likewise will be able to use this revised appleid to access iCloud once available and synch my apps etc.,  Very pleased with iTunes Support's prompt response and remedy.

  • GR/IR Clearing account query

    Hi SAP Gurus,
    We have business scenarios where GR/IR account gets debited and credited with different amounts. We want to clear even those cases using program SAPF124 by maintaing the required tolerances. Also in SPRO we can maintain the GL to which the clearing differences shall get posted. The path for maintaing these GLs is as below:
    SPRO>Financial Accounting>General Ledger Accounting>Business Transactions>Open Item Clearing>Clearing Differences>Create Accounts for Clearing Differences
    I want to know if it is possible in SAP to maintain specific GL accounts for posting differences for specific GR/IR accounts. This is the requirement as we have many GR/IR accounts for different purposes.
    Regards,
    Vijay

    Hi Sridhar,
    Could you please eleborate this for me.
    Regards,
    Vijay

  • I have three email accounts query...does anyone ha...

    Hello Members, my phone is 5800 and i have a Hotmail, Googlemail and an AOL email account, i find i need to access them as i still get inportant emails.
    I understand there are email clients for my phone ie Nokia messaging, OVI, but i don't really want an application running on my phone that allows anyone to enter my inbox, should the phone get lost, or i forget it at someone house, say.
    So my prefered access to my email accounts would be to go directly through there websites, but i was wondering if there exists an app that can sit on the desktop of the phone that when i click say an icon within it for Google mail all that would open is a Google mail login screen, and then my inbox appears.
    I understand this sound a bit like having 'Favourites' link in Internet Explorer but more direct to the point of getting to the login of the website.
    Do any members have any ideas?
    Kind regards
    Livio   

    Hi,
    There is no such option in the handset, where in you can open the mail using the Web. But you can install Gmail appliaction in the handset. But for AOL & Hotmail, you need to check if they have developed application for Symbian platform.

Maybe you are looking for

  • Satellite P300D-10V - Turn off by high temperature

    Hi! I have a TOSHIBA Satellite P300D-10V and I have a problem with overheating! When I load my CPU with 2,2 GHz for a long time, it turn off by high temperature! What must be my solution about this problem? "Normal" temperature for my laptop is aroun

  • Extremely Urgent (BPS - STS Transport to Quality)

    Hello Everyone, I am trying to transport *Status and Tracking System* (Transport Request includes Sub Plan and Planning Session). The objects get attached to the Transport Request (TR) in the Development System. We release the request to Quality Syst

  • HT3702 How do I get refunded for a purchase

    I have recently purchased a Tom Tom by mistake as I already have this app can I be refunded many thanks allyg28

  • IT 0210 Message Control

    I want to change the warning message:  5U265  (number of exmptns/addl withholding should be blank if exempt is selected) to an error message- hard stop. Where in customizing is the message control that will let me make that change?   Thanks, Joyce

  • HT201320 Does Gmail effectively work with Exchange Activesync?

    Also, why doesnt push feature work for Gmail?