Customer receivable History Query
Dear Expert,
if any body have customer receivable history query please help me.
Regards
Bharat.
Dear Bharat.
Please check following query may its help you.
SELECT T0.DocNum, T0.DocDate, T0.DocDueDate, T0.CardCode,T0.DocTotal,T0.PaidToDate As ReceiptsAmount, T0.CardName, T1.DocNum As ReceiptsEntryNo, T1.DocDate, T1.DocDueDate, T1.CashSum, T1.CheckSum,T1.TrsfrSum,DATEDIFF(Day, T0.DocDueDate, T1.DocDueDate)As OverdueDays
FROM OINV T0 LEFT OUTER JOIN ORCT T1
ON T0.ReceiptNum = T1.DocEntry
WHERE T0.DocDate >=[%0] AND T0.DocDate <=[%1] AND (T0.CardName ='[%2]' or '[%2]'=' ')
REGARDS
MANGESH PAGDHARE.
Similar Messages
-
Multi-Currency Customer Receivables Aging Query
Hello Everyone,
SAP B1 2005 SP 01 PL 42
We cannot produce customer statements for multi-currency accounts (CND & USD) through the Customer Receivables Aging report. The report converts all FC to LC which is not useful to the customer.
The statement must show the open invoices in USD and open invoices in CND so that the customer can pay in the appropriate currency.
We are attempting to create a query to solve this issue and assign a PLD to execute the calculations, but cannot see the best way to execute the task.
The customer account balance (displaying only unreconciled tans.) would be the most reliable data set (form 809), but it is not available as a table in the query manager. Any other table suggestions?
We would like to avoid building the query from scratch (collecting all open invoices, credits, payments etc...) to avoid error. We would also like to avoid exporting the data as this is very time consuming. Any suggestions?
Thanks in advance,
TamaraWe have found it better to set up two customers where different currencies are transacted - one in each currency. That way you can produce a statement in each currency.
I know it's not a perfect solution, but a good work around?
The only way to get the data you need would be to use OJDT and JDT1 tables, but you would need to join to the reconciliation table as well (OITR?) to get open transactions. -
Query for Customer Receivables Aging Report
What is the query to the Customer Receivables Aging Report? I cannot seem to reproduce the same results that SAP has in my Crystal Report.
ThanksTo reproduce it by query would not be an easy job. Crystal Report is a better tool for report.
Thanks,
Gordon -
We need to use a report similar to "Customer payment history", whith reference between customer invoice and payment of it, because we need to know the days between this events.
Using standard SAP, Do you know a report for this funtionality?
Thanks on advance.
R.LenaTry S_ALR_87012167 - Accounts Receivable Information System. Then pick the report you want. Try the DSO report. At the summary double click to get DSO by customer. The following reports types are available;
Due date analysis
Payment history
Overdue items
DSO analysis
Terms offered / terms taken
pls assign points to say thanks. -
Overdue amount in Customer Receivable Aging report
Hi all!
Got a question.
In customer receivable aging report SAP Business One displays the relevant open receivables in columns representing the specifications you made in the Interval field in the selection criteria window. But how does it counts them? I've tried to pick all total from invoices,where between doc date and aging date 30 days passed. But it displays incorrect values. Is there any specific query for that?
Please see screenshot attached for the values i need.Hi,
Try with below query.But your selection criteria for date should be week.
declare @Cust as nvarchar(20)
Declare @FromDate Datetime
Declare @ToDate Datetime
declare @Group as nvarchar(20)
set @cust = (select max(t0.cardcode) from OINV t0 where t0.cardcode = '[%0]')
Set @FromDate = (Select min(t0.Docdate) from dbo.OINV t0 where t0.Docdate >='[%1]')
Set @ToDate = (Select max(t0.Docdate) from dbo.OINV t0 where t0.Docdate <='[%2]')
set @group = (select max(t2.groupname) from OCRG t2 where t2.groupname = '[%3]')
SELECT [CustName] as CustName, [G] as CustGroup,[1] as W1, [2] as W2, [3] as W3, [4] as W4, [5] as W5, [6] as W6, [7] as W7, [8] as W8, [9] as W9, [10] as W10, [11] as W11, [12] as W12, [13] as W13, [14] as W14, [15] as W15, [16] as W16, [17] as W17, [18] as W18, [19] as W19, [20] as W20, [21] as W21, [22] as W22, [23] as W23, [24] as W24, [25] as W25, [26] as W26, [27] as W27, [28] as W28, [29] as W29, [30] as W30 , [31] as W31, [32] as W32, [33] as W33, [34] as W34, [35] as W35, [36] as W36, [37] as W37, [38] as W38, [39] as W39, [40] as W40, [41] as W41, [42] as W42, [43] as W43, [44] as W44, [45] as W45, [46] as W46, [47] asW47, [48] as W48, [49] as W49, [50] as W50, [51] as W51, [52] as W52
from
(SELECT T0.[CardName] as CustName, sum(T0.[DocTotal]) as Total, datepart(ww,T0.[DocDate]) as week, t2.groupname as G FROM OINV T0 left JOIN OCRD T1 ON T0.CardCode = T1.CardCode left JOIN OCRG T2 ON T1.GroupCode = T2.GroupCode WHERE year(T0.[DocDate]) = 2013 and T0.[CardCode] = @Cust and T0.[DocStatus] ='o' and T0.[DocDate] between @fromdate and @todate and t2.groupname = @group GROUP BY T0.[CardName],T0.[DocDate],t2.groupname
union all
(SELECT T0.[CardName] as CustName, -sum(T0.[DocTotal]) as Total, datepart(ww,T0.[DocDate]) as week,t2.groupname as G from ORIN T0 left JOIN OCRD T1 ON T0.CardCode = T1.CardCode left JOIN OCRG T2 ON T1.GroupCode = T2.GroupCode WHERE year(T0.[DocDate]) = 2013 and T0.[CardCode] = @Cust and T0.[DocStatus] ='o' and T0.[DocDate] between @fromdate and @todate and t2.groupname = @group GROUP BY T0.[CardName],T0.[DocDate],t2.groupname )) S
Pivot
(sum(S.total) For WEEK IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12], [13], [14],[15],[16],[17],[18],[19],[20],[21], [22], [23], [24], [25], [26], [27], [28],[29], [30], [31], [32],[33],[34],[35],[36],[37],[38],[39],[40], [41],[42],[43],[44],[45],[46],[47],[48],[49],[50],[51],[52])) P
Thanks & Regards,
Nagarajan -
Customer Payment History with days
Hi is there any std t code for customer payment history whcih shows after how many days the customer has paid his dues...!? S_ALR_87012177 provides the same but I need a report in teh following way
as per Account Group
Regards,
AJHi ,
For that better to go SAP Query.
Regards
Surya -
Customer payment history record error
Hi
I have a query related to the customer payment history record.
Actually in customer master data I have not click in payment history record check box field, thats why system not calculated customer payment history in report S_ALR_87012177 and table KNB4. But after when i click on payment history recor , then when I create a invoice and payment system calculate the data in customer payment history record.and table.
My query is How to display the data in payment history reocrd which was enetered before the before the check box payment history was enable in customer master
Please advise
Stop Cross-PostingHi,
Customer payment history record is not getting displayed. We have selected payment history check box in customer master, but payment records prior to enabling customer history check box are not getting displayed.
Is there a way to display customer payment history records prior to enabling customer payment history check box in customer master -
SAP B1 crystal report: Customer Receivable Aging report
Hi All, I want to write a Customer Receivable Aging report in crystal report. I was using query to union open AR crdit memo and AR invoice. but, I foggot to add incomming payment ORCT. I really have trouble to get Customer Receivable Aging report . Can anyone help me? thanks Is that I did in wrong direction?
SELECT OINV.DocEntry,OINV.DocNum,OINV.ObjType,OINV.CardCode,OCRD.CntctPrsn,OCRD.fax,OINV.NumAtCard,OINV.Address,OCTG.PymntGroup
,OINV.CardName,OINV.DocDate,OINV.DocDueDate,OINV.DocCur,OINV.DocTotalFC,
OINV.DocTotal, (OINV.DocTotal-OINV.PaidToDate) as AmountAUD
FROM SAPLIVE.dbo.OINV OINV join SAPLIVE.dbo.OCTG OCTG
On OINV.GroupNum=OCTG.GroupNum
join SAPLIVE.dbo.OCRD OCRD
On OINV.CardCode=OCRD.CardCode
WHERE OINV.CANCELED='N' AND OINV.DocStatus='O' AND (OINV.DocTotal-OINV.PaidToDate)>0
union
SELECT ORIN.DocEntry,ORIN.DocNum,ORIN.ObjType,ORIN.CardCode,OCRD.CntctPrsn,OCRD.fax,ORIN.NumAtCard,ORIN.Address,OCTG.PymntGroup
,ORIN.CardName,ORIN.DocDate,ORIN.DocDueDate,ORIN.DocCur,ORIN.DocTotalFC,
ORIN.DocTotal,(ORIN.DocTotal-ORIN.PaidToDate)as AmountAUD
FROM SAPLIVE.dbo.ORIN ORIN join SAPLIVE.dbo.OCTG OCTG
On ORIN.GroupNum=OCTG.GroupNum
join SAPLIVE.dbo.OCRD OCRD
On ORIN.CardCode=OCRD.CardCode
WHERE ORIN.CANCELED='N' AND ORIN.DocStatus='O' AND (ORIN.DocTotal-ORIN.PaidToDate)Hello Julian - maybe you can start with the JDT1 table which contains all of the General Ledger Journal Entries...
Hope this helps...
Regards - Zal
--F-BP AR Aging Report Detail Ver 1 ZP 2011 04 16
--DESCRIPTION: SQL uses General Ledger Detail to create an Aging Report which shows
actual invoices, credit memos, and payments by reference date in the JDT1 table.
--AUTHOR(s):
--Version 1 Zal Parchem 16 April 2011
SELECT
T1.CardCode AS 'Cust Num',
T1.CardName AS 'Cust Name',
T0.SysDeb AS 'Debit Amt',
T0.SysCred * -1 AS 'Credit Amt',
CASE
WHEN T0.TransType = 13 THEN 'AR Invoice'
WHEN T0.TransType = 14 THEN 'AR Cred Memo'
WHEN T0.TransType = 24 THEN 'Payment'
ELSE 'Other'
END AS 'Trans Type',
T0.Ref1 AS 'Reference',
FcCurrency AS 'Currency',
CONVERT(VARCHAR(10), RefDate, 103) 'Posting Date',
CONVERT(VARCHAR(10), DueDate, 103) 'Due Date',
CONVERT(VARCHAR(10), TaxDate, 103) 'Doc Date' ,
CASE
WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 31 THEN
CASE
WHEN SysCred < > 0 THEN SysCred * -1
ELSE SysDeb
END
END AS '0-30 Days',
CASE
WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 30
AND (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 61 THEN
CASE
WHEN SysCred < > 0 THEN SysCred * -1
ELSE SysDeb
END
END AS '31 to 60 Days',
CASE
WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 60
AND (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 91 THEN
CASE
WHEN SysCred < > 0 THEN SysCred * -1
ELSE SysDeb
END
END AS '61 to 90 days',
CASE
WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 90
AND (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 121 THEN
CASE
WHEN SysCred < > 0 THEN SysCred * -1
ELSE SysDeb
END
END AS '90 to 120 Days',
CASE
WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 120
THEN
CASE
WHEN SysCred != 0 THEN SysCred * -1
ELSE SysDeb
END
END AS '120 Plus Days'
FROM JDT1 T0
INNER JOIN OCRD T1
ON T0.ShortName = T1.CardCode
AND T1.CardType = 'C'
WHERE
T0.IntrnMatch = '0'
AND T0.BalDueDeb != T0.BalDueCred
ORDER BY
T1.CardCode,
T0.TaxDate
FOR BROWSE -
How to get exact Ageing Date In "Customer Receivable Ageing" report?
Need query that give the exact aging date instead of date/month range in customer receivable ageing.Pls Help
Hi,
Please note, just added for 52 days. if you want more days, just add.
declare @Cust as nvarchar(20)
Declare @FromDate Datetime
Declare @ToDate Datetime
declare @Group as nvarchar(20)
set @cust = (select max(t0.cardcode) from OINV t0 where t0.cardcode = '[%0]')
Set @FromDate = (Select min(t0.Docdate) from dbo.OINV t0 where t0.Docdate >='[%1]')
Set @ToDate = (Select max(t0.Docdate) from dbo.OINV t0 where t0.Docdate <='[%2]')
set @group = (select max(t2.groupname) from OCRG t2 where t2.groupname = '[%3]')
SELECT [CustName] as CustName, [G] as CustGroup, [1] as '1', [2] as '2', [3] as '3', [4] as '4', [5] as '5', [6] as '6', [7] as '7', [8] as '8', [9] as '9', [10] as '10', [11] as '11', [12] as '12', [13] as '13', [14] as '14', [15] as '15', [16] as '16', [17] as '17', [18] as '18', [19] as '19', [20] as '20', [21] as '21', [22] as '22', [23] as '23', [24] as '24', [25] as '25', [26] as '26', [27] as '27', [28] as '28', [29] as '29', [30] as '30' , [31] as '31', [32] as '32', [33] as '33', [34] as '34', [35] as '35', [36] as '36', [37] as '37', [38] as '38', [39] as '39', [40] as '40', [41] as '41', [42] as '42', [43] as '43', [44] as '44', [45] as '45', [46] as '46', [47] as '47', [48] as '48', [49] as '49', [50] as '50', [51] as '51', [52] as '52'
from
(SELECT T0.[CardName] as CustName, sum(T0.[DocTotal]) as Total, datepart(dd,T0.[DocDate]) as DAYS, t2.groupname as G FROM OINV T0 left JOIN OCRD T1 ON T0.CardCode = T1.CardCode left JOIN OCRG T2 ON T1.GroupCode = T2.GroupCode WHERE year(T0.[DocDate]) = 2013 and T0.[CardCode] = @Cust and T0.[DocStatus] ='o' and T0.[DocDate] between @fromdate and @todate and t2.groupname = @group GROUP BY T0.[CardName],T0.[DocDate],t2.groupname
union all
(SELECT T0.[CardName] as CustName, -sum(T0.[DocTotal]) as Total, datepart(dd,T0.[DocDate]) as DAYS,t2.groupname as G from ORIN T0 left JOIN OCRD T1 ON T0.CardCode = T1.CardCode left JOIN OCRG T2 ON T1.GroupCode = T2.GroupCode WHERE year(T0.[DocDate]) = 2013 and T0.[CardCode] = @Cust and T0.[DocStatus] ='o' and T0.[DocDate] between @fromdate and @todate and t2.groupname = @group GROUP BY T0.[CardName],T0.[DocDate],t2.groupname )) S
Pivot
(sum(S.total) For DAYS IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12], [13], [14],[15],[16],[17],[18],[19],[20],[21], [22], [23], [24], [25], [26], [27], [28],[29], [30], [31], [32],[33],[34],[35],[36],[37],[38],[39],[40], [41],[42],[43],[44],[45],[46],[47],[48],[49],[50],[51],[52])) P
Hope helpful.
Thanks & Regards,
Nagarajan -
Customer Receivables Aging Report doesn't show correct data
Hi Experts,
I have some problem when executing Customer Receivables Aging Report.
I'm using 8.8 PL14.
(It should be bug this is very strange ...)
I can't get same result even if I run it continuosly when I selected option "group by Customer" .
Total amount of balance due is change each time because of BP shown in the report is change.
I also got the message " Data is not available, modify selection criteria and re-enter" even though I never change selection.
During executing this report, no Invoice and JE and banking data were input.
Please advice if you know about this error or having something information.
Thanks,
Kaori ShirasunaHi,
The latest patch level available for B1 8.8 is PL16. it will be released on week Oct 25-29, 2010. You may directly upgrade to this latest patch level to solve the issue. If you want to try using query SQL to generate the aging report, there are some threads discussion about the query. You may search it in the SBO reporting and printing forum.
JimM -
Customer Receivables Aging_Query
Hi, I have a query for Customer Receivables Aging, I found it in the next link [] I customize it for specific needs. It gives the correct total of Balance Due for all our customers, but it doesn't give the right age of the debt. Every time I Think I solve it, the next day is wrong again (Compare it with System's Standard Aging), The amounts for 0_7, 8_14 and so on are not correct. ¿What is wrong?
DECLARE @Documents Table (DocNum Numeric(19,0), CardCode VarChar(15), CardName VarChar(100), DocDate DateTime, DocDueDate DateTime, DueDate DateTime, DayPastDue Numeric(19,2), Balance Numeric(19,2), Unapplied Numeric(19,2), Source VarChar(5))
INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, CAST(GetDate()-T0.DocDueDate AS NUMERIC) AS DayPastDue, (T0.DocTotal-T0.PaidToDate) AS Balance, (T0.DocTotal-T0.PaidToDate) AS Unapplied, 'RF' AS Source
FROM OINV T0 LEFT OUTER JOIN JDT1 T1 ON T0.CardCode=T1.ShortName
WHERE T0.DocDate<GetDate ()+1 AND T0.DocStatus='O' AND (T0.DocTotal-T0.PaidToDate)<>0 AND (T0.DocTotal-T0.PaidToDate)=T1.BalDueDeb + (- T1.BalDueCred)
GROUP BY T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, T0.DocTotal, T0.PaidToDate
INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, CAST(GetDate ()-T0.DocDueDate AS NUMERIC) AS DayPastDue, -T0.OpenBal AS Balance, T0.DocTotal AS Unapplied, 'PR' AS Source
FROM ORCT T0 LEFT OUTER JOIN JDT1 T1 ON T0.CardCode=T1.ShortName
WHERE T0.doctype='C' AND T0.DocDate < GetDate ()+1 AND T0.[Canceled] ='N' AND T0.OpenBal<>0 AND -T0.OpenBal=T1.BalDueDeb + (- T1.BalDueCred)
GROUP BY T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, T0.OpenBal, T0.DocTotal
INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, CAST(GetDate()-T0.DocDueDate AS NUMERIC) AS DayPastDue, T0.OpenBal AS Balance, T0.DocTotal AS Unapplied, 'PP' AS Source
FROM OVPM T0
WHERE T0.doctype='C' AND T0.DocDate < GetDate ()+1 AND T0.[OpenBal]<>0 AND T0.[Canceled] ='N' AND T0.DocTotal<>-T0.OpenBal
GROUP BY T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, T0.OpenBal, T0.DocTotal
ORDER BY CardCode
INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
SELECT T2.TransId, T1.CardCode, T1.CardName, T0.[RefDate], T0.[DueDate], CAST(GetDate()-T0.DueDate AS NUMERIC) AS DayPastDue, T0.BalDueDeb + (- T0.BalDueCred) AS 'Balance', CASE WHEN T0.Debit>0 THEN T0.Debit else T0.Credit*-1 END Unapplied, 'AS' AS Source
FROM OJDT t2 INNER JOIN JDT1 T0 on T2.TransId=T0.TransId INNER JOIN ocrd t1 on T0.ShortName=T1.CardCode
WHERE T1.cardtype='C' AND T2.transtype=30 AND T2.REFdate < GetDate ()+1 AND T0.[LineType]=' ' AND (T0.[BalDueDeb]>0 or T0.[BalDueCred]>0)
GROUP BY T2.TransId, T1.CardCode, T1.CardName, T0.[RefDate], T0.[DueDate], T0.Debit, T0.Credit, T0.[Line_ID], T0.BalDueDeb, T0.BalDueCred
INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
SELECT T0.DocNum, T0.CardCode, T0.CardName, DocDate, DocDueDate, CAST(GetDate()-DocDueDate AS NUMERIC) AS DayPastDue, (-1)*DocTotal AS Balance, (-1)*(DocTotal-PaidToDate) AS Unapplied, 'RC' AS Src
FROM ORIN T0 INNER JOIN (SELECT distinct DocEntry, bASeentry FROM rin1 WHERE DocDate < GetDate ()+1 ) T1 on T0.DocEntry=T1.DocEntry
WHERE T0.DocStatus='O' AND T1.bASeentry is null AND T0.DocDate<GetDate ()+1 AND DocStatus='O'
GROUP BY T0.DocNum, T0.CardCode, T0.CardName, DocDate, DocDueDate, DocTotal, PaidToDate
SELECT B.CardCode AS 'SBO Code', B.CardName AS 'Customer', T2.GROUPName AS 'Group', B.Balance_Due AS 'Total_Debt', (B.Future_Remit) AS 'Future_Remit', B.Days7 AS 'Due_on_7_Days', B.Days_0_7 AS '0_7', B.Days_8_14 AS '8_14', B.Days_15_30 AS '15_30', B.Days_31_45 AS '31_45', B.Days_46_60 AS '46_60', B.Days_61_90 AS '61_90', B.Days_91_120 AS '91_120', B.Days_120_Over AS '120+'
FROM
(SELECT A.CardCode, A.CardName, Sum(A.Balance)Balance_Due, Sum(A.Future_Remit)Future_Remit, Sum(A.Days_0_7)Days_0_7, Sum(A.Days_31_45)Days_31_45,
Sum(A.Days_61_90)Days_61_90, Sum(A.Days_91_120)Days_91_120, Sum(A.Days_120_Over)Days_120_Over, Sum(Days7)Days7, Sum(Days_8_14)Days_8_14, Sum(Days_15_30)Days_15_30, Sum(Days_46_60)Days_46_60
FROM
(SELECT CardCode, CardName, Sum(CASE WHEN DayPastDue<=0 THEN Balance else 0 END) AS CurrBal, Sum(Balance) Balance, Source, Sum(CASE WHEN DayPastDue<=0 THEN Balance else 0 END) AS Future_Remit, Sum(CASE WHEN DayPastDue>=-7 AND DayPastDue<=0 THEN Balance else 0 END) AS Days7, Sum(CASE WHEN DayPastDue>=1 AND DayPastDue<8 THEN Balance else 0 END) AS Days_0_7, Sum(CASE WHEN DayPastDue>=8 AND DayPastDue<15 THEN Balance else 0 END) AS Days_8_14, Sum(CASE WHEN DayPastDue>=15 AND DayPastDue<31 THEN Balance else 0 END) AS Days_15_30, Sum(CASE WHEN DayPastDue>=31 AND DayPastDue<46 THEN Balance else 0 END) AS Days_31_45, Sum(CASE WHEN DayPastDue>=46 AND DayPastDue<61 THEN Balance else 0 END) AS Days_46_60, Sum(CASE WHEN DayPastDue>=61 AND DayPastDue<91 THEN Balance else 0 END) AS Days_61_90, Sum(CASE WHEN DayPastDue>=91 AND DayPastDue<121 THEN Balance else 0 END) AS Days_91_120, Sum(CASE WHEN DayPastDue>=121 THEN Balance else 0 END) AS Days_120_Over
FROM @Documents GROUP BY CardCode, CardName, Source)A
WHERE A.Balance<>0 GROUP BY A.CardCode, A.CardName)B
LEFT OUTER JOIN [dbo].[OCRD] T1 ON T1.[CardCode] = B.CardCode AND T1.[CardType] = 'C' LEFT OUTER JOIN [dbo].[OCRG] T2 ON T1.[GroupCode] = T2.[GroupCode]
WHERE B.Balance_Due<>0 ORDER BY B.CardCode
Edited by: mariaem on Feb 17, 2011 4:03 PM
Edited by: mariaem on Feb 17, 2011 4:05 PMHi, I have a query for Customer Receivables Aging, I found it in the next link [] I customize it for specific needs. It gives the correct total of Balance Due for all our customers, but it doesn't give the right age of the debt. Every time I Think I solve it, the next day is wrong again (Compare it with System's Standard Aging), The amounts for 0_7, 8_14 and so on are not correct. ¿What is wrong?
DECLARE @Documents Table (DocNum Numeric(19,0), CardCode VarChar(15), CardName VarChar(100), DocDate DateTime, DocDueDate DateTime, DueDate DateTime, DayPastDue Numeric(19,2), Balance Numeric(19,2), Unapplied Numeric(19,2), Source VarChar(5))
INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, CAST(GetDate()-T0.DocDueDate AS NUMERIC) AS DayPastDue, (T0.DocTotal-T0.PaidToDate) AS Balance, (T0.DocTotal-T0.PaidToDate) AS Unapplied, 'RF' AS Source
FROM OINV T0 LEFT OUTER JOIN JDT1 T1 ON T0.CardCode=T1.ShortName
WHERE T0.DocDate<GetDate ()+1 AND T0.DocStatus='O' AND (T0.DocTotal-T0.PaidToDate)<>0 AND (T0.DocTotal-T0.PaidToDate)=T1.BalDueDeb + (- T1.BalDueCred)
GROUP BY T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, T0.DocTotal, T0.PaidToDate
INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, CAST(GetDate ()-T0.DocDueDate AS NUMERIC) AS DayPastDue, -T0.OpenBal AS Balance, T0.DocTotal AS Unapplied, 'PR' AS Source
FROM ORCT T0 LEFT OUTER JOIN JDT1 T1 ON T0.CardCode=T1.ShortName
WHERE T0.doctype='C' AND T0.DocDate < GetDate ()+1 AND T0.[Canceled] ='N' AND T0.OpenBal<>0 AND -T0.OpenBal=T1.BalDueDeb + (- T1.BalDueCred)
GROUP BY T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, T0.OpenBal, T0.DocTotal
INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
SELECT T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, CAST(GetDate()-T0.DocDueDate AS NUMERIC) AS DayPastDue, T0.OpenBal AS Balance, T0.DocTotal AS Unapplied, 'PP' AS Source
FROM OVPM T0
WHERE T0.doctype='C' AND T0.DocDate < GetDate ()+1 AND T0.[OpenBal]<>0 AND T0.[Canceled] ='N' AND T0.DocTotal<>-T0.OpenBal
GROUP BY T0.DocNum, T0.CardCode, T0.CardName, T0.DocDate, T0.DocDueDate, T0.OpenBal, T0.DocTotal
ORDER BY CardCode
INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
SELECT T2.TransId, T1.CardCode, T1.CardName, T0.[RefDate], T0.[DueDate], CAST(GetDate()-T0.DueDate AS NUMERIC) AS DayPastDue, T0.BalDueDeb + (- T0.BalDueCred) AS 'Balance', CASE WHEN T0.Debit>0 THEN T0.Debit else T0.Credit*-1 END Unapplied, 'AS' AS Source
FROM OJDT t2 INNER JOIN JDT1 T0 on T2.TransId=T0.TransId INNER JOIN ocrd t1 on T0.ShortName=T1.CardCode
WHERE T1.cardtype='C' AND T2.transtype=30 AND T2.REFdate < GetDate ()+1 AND T0.[LineType]=' ' AND (T0.[BalDueDeb]>0 or T0.[BalDueCred]>0)
GROUP BY T2.TransId, T1.CardCode, T1.CardName, T0.[RefDate], T0.[DueDate], T0.Debit, T0.Credit, T0.[Line_ID], T0.BalDueDeb, T0.BalDueCred
INSERT INTO @Documents (DocNum, CardCode, CardName, DocDate, DocDueDate, DayPastDue, Balance, Unapplied, Source)
SELECT T0.DocNum, T0.CardCode, T0.CardName, DocDate, DocDueDate, CAST(GetDate()-DocDueDate AS NUMERIC) AS DayPastDue, (-1)*DocTotal AS Balance, (-1)*(DocTotal-PaidToDate) AS Unapplied, 'RC' AS Src
FROM ORIN T0 INNER JOIN (SELECT distinct DocEntry, bASeentry FROM rin1 WHERE DocDate < GetDate ()+1 ) T1 on T0.DocEntry=T1.DocEntry
WHERE T0.DocStatus='O' AND T1.bASeentry is null AND T0.DocDate<GetDate ()+1 AND DocStatus='O'
GROUP BY T0.DocNum, T0.CardCode, T0.CardName, DocDate, DocDueDate, DocTotal, PaidToDate
SELECT B.CardCode AS 'SBO Code', B.CardName AS 'Customer', T2.GROUPName AS 'Group', B.Balance_Due AS 'Total_Debt', (B.Future_Remit) AS 'Future_Remit', B.Days7 AS 'Due_on_7_Days', B.Days_0_7 AS '0_7', B.Days_8_14 AS '8_14', B.Days_15_30 AS '15_30', B.Days_31_45 AS '31_45', B.Days_46_60 AS '46_60', B.Days_61_90 AS '61_90', B.Days_91_120 AS '91_120', B.Days_120_Over AS '120+'
FROM
(SELECT A.CardCode, A.CardName, Sum(A.Balance)Balance_Due, Sum(A.Future_Remit)Future_Remit, Sum(A.Days_0_7)Days_0_7, Sum(A.Days_31_45)Days_31_45,
Sum(A.Days_61_90)Days_61_90, Sum(A.Days_91_120)Days_91_120, Sum(A.Days_120_Over)Days_120_Over, Sum(Days7)Days7, Sum(Days_8_14)Days_8_14, Sum(Days_15_30)Days_15_30, Sum(Days_46_60)Days_46_60
FROM
(SELECT CardCode, CardName, Sum(CASE WHEN DayPastDue<=0 THEN Balance else 0 END) AS CurrBal, Sum(Balance) Balance, Source, Sum(CASE WHEN DayPastDue<=0 THEN Balance else 0 END) AS Future_Remit, Sum(CASE WHEN DayPastDue>=-7 AND DayPastDue<=0 THEN Balance else 0 END) AS Days7, Sum(CASE WHEN DayPastDue>=1 AND DayPastDue<8 THEN Balance else 0 END) AS Days_0_7, Sum(CASE WHEN DayPastDue>=8 AND DayPastDue<15 THEN Balance else 0 END) AS Days_8_14, Sum(CASE WHEN DayPastDue>=15 AND DayPastDue<31 THEN Balance else 0 END) AS Days_15_30, Sum(CASE WHEN DayPastDue>=31 AND DayPastDue<46 THEN Balance else 0 END) AS Days_31_45, Sum(CASE WHEN DayPastDue>=46 AND DayPastDue<61 THEN Balance else 0 END) AS Days_46_60, Sum(CASE WHEN DayPastDue>=61 AND DayPastDue<91 THEN Balance else 0 END) AS Days_61_90, Sum(CASE WHEN DayPastDue>=91 AND DayPastDue<121 THEN Balance else 0 END) AS Days_91_120, Sum(CASE WHEN DayPastDue>=121 THEN Balance else 0 END) AS Days_120_Over
FROM @Documents GROUP BY CardCode, CardName, Source)A
WHERE A.Balance<>0 GROUP BY A.CardCode, A.CardName)B
LEFT OUTER JOIN [dbo].[OCRD] T1 ON T1.[CardCode] = B.CardCode AND T1.[CardType] = 'C' LEFT OUTER JOIN [dbo].[OCRG] T2 ON T1.[GroupCode] = T2.[GroupCode]
WHERE B.Balance_Due<>0 ORDER BY B.CardCode
Edited by: mariaem on Feb 17, 2011 4:03 PM
Edited by: mariaem on Feb 17, 2011 4:05 PM -
Dear Friends,
I want to see customer collection history Invoice wise.
Means what collection received against which invoice.
any help will be highly appricated.
Regards
MalikIn FBL5N, you have three options to select, viz. (a) Open Items, (b) Cleared Items and (c) Both
Open items is nothing but billed but payment has not been received. So if you execute after selecting any of these options, you can see billing document wise what amount is credited.
thanks
G. Lakshmipathi -
hello experts,,,,
anyone who could help find the codes to be dragged in crystal reports about the customer receivable lapses.....as highlighted in my attchment ...pleaseHi John,
Refer below link,
Query for Customer Receivables Ageing Report
-Rajesh N -
Kindly help me with a query to generate a customer aging covering;
1. Invoices
2. Credit Memos
3. Payments
4. Manual Journal Entries
I have tried one of the aging queries posted in the forum, but the results are incorrect for some customers.
Thanks in advance,
AvinashGive this a try.
Ken Worst
-- SAP B1 Customer Receivables Aging - By Due Date
-- Version 10022008
select OCRD.cardcode 'Customer Code',OCRD.cardname 'Customer Name',
SUM(case when syscred <> 0 then syscred * - 1
else sysdeb
end) "Balance Due",
ISNULL(SUM(CASE when DATEDIFF(dd,JDT1.DueDate,current_timestamp) < 0
then
case
when JDT1.BalDueCred <> 0 then JDT1.BalDueCred * - 1
else JDT1.BalDueDeb
end
end),0.00) "Future Remit",
ISNULL(SUM(CASE when (DATEDIFF(dd,JDT1.DueDate,current_timestamp) >= 0
and datediff(dd,JDT1.DueDate,current_timestamp)< 30)
then
case
when JDT1.BalDueCred <> 0 then JDT1.BalDueCred * - 1
else JDT1.BalDueDeb
end
end),0.00) "0-30 days",
ISNULL(SUM(CASE when (datediff(dd,JDT1.DueDate,current_timestamp) >= 30
and datediff(dd,JDT1.DueDate,current_timestamp)< 60)
then
case
when JDT1.BalDueCred <> 0 then JDT1.BalDueCred * - 1
else JDT1.BalDueDeb
end
end),0.00) "31 to 60 days",
ISNULL(SUM(CASE when (datediff(dd,JDT1.DueDate,current_timestamp) >= 60
and datediff(dd,JDT1.DueDate,current_timestamp)< 90)
then
case
when JDT1.BalDueCred <> 0 then JDT1.BalDueCred * - 1
else JDT1.BalDueDeb
end
end),0.00) "61 to 90 days",
ISNULL(SUM(CASE when (datediff(dd,JDT1.DueDate,current_timestamp) >= 90
and datediff(dd,JDT1.DueDate,current_timestamp) < 120)
then
case
when JDT1.BalDueCred <> 0 then JDT1.BalDueCred * - 1
else JDT1.BalDueDeb
end
end),0.00) "91 to 120 days",
ISNULL(SUM(CASE when DATEDIFF(dd,JDT1.DueDate,current_timestamp) >= 120
then
case
when BalDueCred <> 0 then BalDueCred * - 1
else BalDueDeb
end
end),0.00) "120+ days"
from JDT1,OCRD
WHERE JDT1.shortname = OCRD.cardcode and OCRD.cardtype = 'c'
GROUP BY OCRD.cardcode, OCRD.cardname
--Filters Out Zero Balances
HAVING SUM(case when syscred <> 0 then syscred * - 1
else sysdeb
end) > 0 OR SUM(case when syscred <> 0 then syscred * - 1
else sysdeb
end) < 0
ORDER BY OCRD.CARDCODE -
Hi Friends:
I am facing problems in customer receivable statement for a client of mine.
We are currently using the Aging by sales documents to produce our
customer statements as it produces the correct aging of customer
details.
But i feel that the following functionalities or criteria are not available in producing the statements (which is available in most of the small end packages like tally, sage pastel etc)
1.Payments entered in the current period should be displayed on the
customer statement regardless of whether they have been allocated to
current or prior period documents.
2. All credit notes entered in the current period should be displayed
on the customer statement.
3. All invoices which have a credit note applied against the entire
invoice amount should be displayed alongside the credit note.
4. We would like to see only the current period's transactions with the
opening balance consisting of the balances for the previous periods.
5. Payments made in the current period related to previous periods must
appear in the statement, the opening balance should be offset and the
correct aging should be displayed.
Kindly let me know whether there is a solution to this any help is highly appreciated
thanks in advance
regards
ManianHi,
Although you use SBO 2005A SP 01 PL 32, the problem seems unresolved too but you could try.I do not know id other cluster could solve. The solution could be addon or workaround by developing query report or using crystal report.
Limitations that made your statement could not be solved, maybe caused by aging date and the collection of the documents that not fit to your business process.
Rgds,
Maybe you are looking for
-
Fonts not printing properly in Acrobat 11
I am running Acrobat 11.0.04 on a Mac with Mountain Lion. On 3 Oct 2013 I converted a .xlsx file (I use Excel 2011 v14.3.8) to pdf following the procedure File > Print > PDF > Save as Adobe PDF. It worked perfectly. Sometime since then, something has
-
3241 ISDN Gateway--DTMF Relay Type & local vs. national signaling
Question 1: Is there a way to configure the 3241 so that it will flag local vs. national call types on the d-channel appropriately? The local TSP sees all calls flagged national.. They do accept both 7 and 10 digit formats for local calls so we set
-
hi,tnks in advance.... i have this scenario... I have my star schema.I have a column in my product_dimension,let;s say product.It contains all the products,at about 300.000 items.It connects ok with my fact table. i want this, if i want to choose , l
-
I can't re install apps in my new computer
Hi my name is Jessica! I was using my apps in my macbook and all good. I have a one year student membership to use the creative cloud. I bought an iMac and tried to install the apps there but it just allows me to install the trials. Why? I should be
-
Macro in Deski is greyed out (XIR2)
Hi I am using BO XIR2 SP3 version. The macro menu is grayed out in Desktop Intelligence tool. May i know how to enable it? Thanks Venkat