Open invoice customer ageing query

I have set up a query to find a customer aging report - open ivoices. I just want to have open records... does anyone have a better query for this?
SELECT     TOP (100) PERCENT dbo.OCRD.CardName, dbo.OCRD.Balance, (CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE()) BETWEEN 0 AND
                      30 THEN CASE WHEN T1.SYSCred <> 0 THEN T1.SYSCred * - 1 ELSE T1.SYSDeb END ELSE 0 END) AS [0-30], (CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE())
                      BETWEEN 31 AND 60 THEN CASE WHEN T1.SYSCred <> 0 THEN T1.SYSCred * - 1 ELSE T1.SYSDeb END ELSE 0 END) AS [31-60], (CASE WHEN DATEDIFF(DD,
                      T0.REFDATE, GETDATE()) BETWEEN 61 AND 90 THEN CASE WHEN T1.SYSCred <> 0 THEN T1.SYSCred * - 1 ELSE T1.SYSDeb END ELSE 0 END) AS [61-90],
                      (CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE()) > 91 THEN CASE WHEN T1.SYSCred <> 0 THEN T1.SYSCred * - 1 ELSE T1.SYSDeb END ELSE 0 END) AS [90+],
                      dbo.OCRD.CardType, T1.TransType, T1.TransCode, T1.LineMemo, T1.BaseRef, dbo.OCRD.CardCode, T1.BalDueDeb
FROM         dbo.OJDT AS T0 INNER JOIN
                      dbo.JDT1 AS T1 ON T1.TransId = T0.TransId INNER JOIN
                      dbo.OCRD ON dbo.OCRD.CardCode = T1.ShortName
WHERE     (dbo.OCRD.Balance >= 1) AND (dbo.OCRD.CardType = 'C') AND (T1.BalDueDeb > 0)
ORDER BY dbo.OCRD.CardName
Regards,
knut

Knut,
Try this:
SELECT T2.CardName, T2.Balance,
(CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE()) BETWEEN 0 AND
30 THEN CASE WHEN T1.SYSCred != 0 THEN -T1.SYSCred ELSE T1.SYSDeb END ELSE 0 END) AS '0-30',
(CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE()) BETWEEN 31 AND
60 THEN CASE WHEN T1.SYSCred != 0 THEN -T1.SYSCred ELSE T1.SYSDeb END ELSE 0 END) AS '31-60',
(CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE()) BETWEEN 61 AND
90 THEN CASE WHEN T1.SYSCred != 0 THEN -T1.SYSCred ELSE T1.SYSDeb END ELSE 0 END) AS '61-90',
(CASE WHEN DATEDIFF(DD, T0.REFDATE, GETDATE()) >90
THEN CASE WHEN T1.SYSCred != 0 THEN -T1.SYSCred ELSE T1.SYSDeb END ELSE 0 END) AS '90+',
T1.TransType, T1.TransCode, T1.LineMemo, T1.BaseRef, T2.CardCode
FROM dbo.OJDT T0
INNER JOIN dbo.JDT1 T1 ON T1.TransId = T0.TransId
INNER JOIN dbo.OCRD T2 ON T2.CardCode = T1.ShortName
WHERE (T2.Balance >= 1) AND (T2.CardType = 'C') AND (T1.BalDueDeb != T1.BalDueCred)
Thanks,
Gordon

Similar Messages

  • Customer Ageing query

    Hi
    We have a standard query in BW for customer ageing query 0FIAR_C03_Q0002.
    In this query we have several dates
    1. Document date
    2. Posting date
    3. Base line date
    4. Net due date.
    Its very tough to understand what is the significance of these dates and how the query is calculated based on which date. I am finding it difficult to xplani to the client about this report.
    Can anyone explain me about these dates and how the query is calculated on which date.
    Regards
    Annie

    Hi
    When i execute the query, there is a variable called KEY DATE(*). What is that date. When i see in the query designer, there is no variable specified in filter, free characteristics or Rows. Then from where is this varialbe is getting popping up.
    and when i enter a date, how it is going to calculate. I am very much confused. need your inputs.
    Regards
    Annie

  • Customer aging query - show balance as of a specific date

    I am working on a query for a vendor aging to show information that is not available in the vendor aging report. However, I want to show the balance that was open at a specific point in time. i.e. today is Aug 17 and i want to show what was due at June 30. All the June invoices have been paid as of Aug 17 so i cannot use docstatus. The aging report gives you the option to select Vendors with a zero balance and reconciled transactions. How do i show that information in a query?

    Hi Vicki,
    I'm trying to do the exact same thing. Get the aging balance at any point in time in verion 2007.
    Have you succeded so far?.
    I use to run a query to get the balance at any point in 2005 like this..
    SELECT     T2.CardCode, T2.CardName , T0.[BatchNum], T0.[TransId], T0.[TransType], T1.[CreatedBy], T1.[RefDate], T1.[DueDate], T1.[MthDate],
    T1.[LineMemo], T0.[Ref1], T1.[BaseRef], T1.[Credit], T1.[Debit], T1.[FCCredit], T1.[FCDebit], T1.[SYSCred],
    T1.[SYSDeb], T1.[SourceLine], T1.[Ref1], T1.[LineType], T1.[TaxDate], T1.[Account], T1.FCCurrency, T1.[ObjType]
    FROM     [dbo].[OJDT] T0
    INNER     JOIN [dbo].[JDT1] T1 ON T1.[TransId] = T0.TransId
    INNER     JOIN [dbo].[OCRD] T2 ON T1.[ShortName] = T2.CardCode
    WHERE     T1.[Account] IN (SELECT AcctCode FROM oact WHERE LocManTran = 'Y' AND GroupMask = 1)
    AND      T1.[RefDate] <= '20091026'
    AND      (T1.[MthDate] > '20091026'
    OR      T1.[IntrnMatch] = 0 )
    ORDER BY T0.[TransType], T1.[RefDate], T2.CardCode, T1.DueDate
    But this baby shows more documents than needed and a lot of work has to be done to place payments on the right invoices to como up with the right balance age.
    I'd appreciate if you could help me out or let me know what have you found so far.
    Best,
    Ricardo Sada

  • Customer Aging Report Query (without invoices offset by incoming payment)

    Hi All Experts,
    May I know is there any field from JDT1 mention which invoices is already offset by the Incoming payment or AR Credit note? Because I do not want those invoices that already offset by incoming payment appear at the Customer Aging Report. Meaning, the data appear in the Customer Aging Report is only show those invoices that yet to pay by the customer. Kindly give some advise on it. Thanks a lot.
    Thanks and regards,
    Angie Ng

    Hi David,
    Thanks for your suggestion. I have try it, but all of my JDT1.IntrnMatch is in 0 value. Meaning in my situation it is none of any reconcilliation making. But from my SBO window, i manage to see that actually this incoming payment is pay for which invoices. Problem is it is difficult for me to do the possiblity logic that might be happen in my Customer Aging Report Query. Please give some advise that how to show only those invoices yet to pay? The current query will show all the data no matter the invoices or credit memo has been offset.
    select OCRD.cardcode 'Supplier Code',OCRD.cardname 'Name',sysdeb  'Debit GBP',syscred 'Credit GBP',
    case JDT1.transtype
    when '13' then 'INV'
    when '14' then 'AR CN'
    when '24' then 'INCOMING'
    else 'Other'
    end 'Type',
    Ref1,
    fccurrency 'BP 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 "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 "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 "61 to 90 days",
    CASE
    when (DATEDIFF(dd,refdate,current_timestamp))+1 > 90
    then
    case
    when syscred= 0 then sysdeb
    when sysdeb= 0 then syscred * - 1
    end
    end "90 + days"
    from JDT1,OCRD where JDT1.shortname = OCRD.cardcode and cardtype = 'c' and intrnmatch = '0'
    ORDER BY OCRD.CARDCODE, taxdate

  • 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,
    Tamara

    We 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.

  • Aging report for Open Invoice

    Hi All,
    I need to develop an Aging report for open invoice, there is no indication for open invoice or close invoice since we are using customise DS and DS from third party system. only one key flag we have is clearing date. so kindly let me know how to write the logic for this requirement.. can I use Customer exit for this? I have an Idea to do like
    first logic is
    *If Clearing date = blank than invoice is = open (by using of this logic we can get all open invoice).
    second logic
    total number of invoice = current date - document date.
    but I do not know how to implement this logic in BEx hnece kinnly advice me whether this logic can be work or suggest with different solution ples..
    Regards,

    hi,
    You can  check few default PO reports wid proper paramater in it
    or
    Can check table EKBE
    or
    Check PO history in the PO doc
    Or
    Check the ME80FN
    Regards
    Priyanka.P

  • Customer Aging Report query

    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,
    Avinash

    Give 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

  • Help me in  'AR Details ' report shows total open invoices by customer

    hi friends,
    please  help me in  'AR Details ' report shows total open invoices by customer and PO number over selected time range.
    any thing related to open invoices please send me as early as possible.
    Thanks,
    Regards,
    Yogesh

    Hi,
    Find the T.code VF05. You will get the list of open billing docs. Its SIS report. Please find whether the SIS is active or not in your system
    Regards,

  • Opening Balance in Customer Aging report

    Hi Gurus,
    I am making the Customer aging report am facing a problem in the calculation of 'opening balance'.
    If the opening balance has to done by using routines how to do it.
    I am using the 0FI_AR_4 datasource.
    I am getting Debit amount , Credit amount , and Balance. They can be seen in R/3 in the
    Tcode: FD10N.
    the balance must be calculated with the previous balance.
    How to write the routine / what logic must be used . If you have the code please paste it
    here or send to:   [email protected]
    regards
    Edited by: man man on Jan 16, 2008 11:04 AM

    Hi,
    I am making a report for the Customer Aging.
    using the keyfigures 'Debit'(Collections), 'Credit'(Sales), 'Balance'
    and the characteristics 'G/L Account', 'Customer'.
    I want all the above infoobjects in the report.
    regards,
    man

  • SAP Query (SQ01) Customer ageing  report

    Dear All,
    My Customer want  Customer  ageing  report  only  for" Due  amount"  open document in  Sq01.Customer ageing  report  based on  Document date+Payment term.
    thanking you,
    Rupang shah

    Hi
    We also required the same.  Since no standard report available, we have developed ABAP report for the same.
    regards
    Ravi

  • Query for Open Invoices

    Hi 2 all
    Anybody know that how to fetch open invoices in 11i and these invoices balances should be match with Supplier Statement of Account Report.
    Thanks,
    Zulqarnain

    Hi,
    I use this one:
    SELECT HEADER.*,
    HEADER.END_BALANCE - HEADER.BEGIN_BALANCE NET_BALANCE,
    HEADER.BEGIN_BALANCE BEGIN_BALANCE_2,
    LINE.*,
    NVL(LINE.DEBE, 0) - NVL(LINE.HABER, 0) NETO_LINEA
    FROM (SELECT TP.THIRD_PARTY_ID,
    TP.THIRD_PARTY_NAME,
    TP.THIRD_PARTY_NUMBER,
    S.SUB_ID,
    S.SUB_NAME,
    AB_START.ACCOUNT_SEGMENT,
    AB_START.PERIOD_NAME BEGIN_BALANCE_PERIOD,
    AB_END.PERIOD_NAME END_BALANCE_PERIOD,
    AB_START.END_BALANCE_DR - AB_START.PERIOD_NET_DR +
    AB_START.PERIOD_NET_CR - AB_START.END_BALANCE_CR BEGIN_BALANCE,
    AB_END.END_BALANCE_DR - AB_END.END_BALANCE_CR END_BALANCE
    FROM AX_THIRD_PARTIES_V TP,
    AX_SUBS_V S,
    AX_BALANCES AB_START,
    GL_PERIOD_STATUSES GPS_START,
    AX_BALANCES AB_END,
    GL_PERIOD_STATUSES GPS_END
    WHERE TP.APPLICATION_ID = 200
    AND TP.APPLICATION_ID = S.APPLICATION_ID
    AND TP.APPLICATION_ID = AB_START.APPLICATION_ID
    AND TP.APPLICATION_ID = GPS_START.APPLICATION_ID
    AND TP.APPLICATION_ID = AB_END.APPLICATION_ID
    AND TP.APPLICATION_ID = GPS_END.APPLICATION_ID
    AND TP.THIRD_PARTY_ID = AB_START.THIRD_PARTY_ID
    AND S.THIRD_PARTY_ID = AB_START.THIRD_PARTY_ID
    AND S.SUB_ID = AB_START.SUB_ID
    AND AB_START.SET_OF_BOOKS_ID = GPS_START.SET_OF_BOOKS_ID
    AND AB_START.PERIOD_NAME = GPS_START.PERIOD_NAME
    AND TP.THIRD_PARTY_ID = AB_END.THIRD_PARTY_ID
    AND S.THIRD_PARTY_ID = AB_END.THIRD_PARTY_ID
    AND S.SUB_ID = AB_END.SUB_ID
    AND AB_END.SET_OF_BOOKS_ID = GPS_END.SET_OF_BOOKS_ID
    AND AB_END.PERIOD_NAME = GPS_END.PERIOD_NAME
    AND AB_START.SET_OF_BOOKS_ID = :P_SOB
    AND TP.THIRD_PARTY_NUMBER =
    NVL(:P_VENDOR_NUMBER, TP.THIRD_PARTY_NUMBER)
    AND TP.THIRD_PARTY_NAME = NVL(:P_PARTY_NAME, TP.THIRD_PARTY_NAME)
    AND S.SUB_NAME = NVL(:P_SUB_NAME, S.SUB_NAME)
    AND AB_END.ACCOUNT_SEGMENT = AB_START.ACCOUNT_SEGMENT
    AND GPS_START.EFFECTIVE_PERIOD_NUM =
    (SELECT MIN(P_BALANCE.EFFECTIVE_PERIOD_NUM)
    FROM AX_BALANCES BALANCE,
    GL_PERIOD_STATUSES P_BALANCE,
    GL_PERIOD_STATUSES P_DATE
    WHERE BALANCE.APPLICATION_ID = AB_START.APPLICATION_ID
    AND BALANCE.APPLICATION_ID = P_BALANCE.APPLICATION_ID
    AND BALANCE.APPLICATION_ID = P_DATE.APPLICATION_ID
    AND BALANCE.THIRD_PARTY_ID = AB_START.THIRD_PARTY_ID
    AND BALANCE.SUB_ID = AB_START.SUB_ID
    AND BALANCE.SET_OF_BOOKS_ID = AB_START.SET_OF_BOOKS_ID
    AND BALANCE.SET_OF_BOOKS_ID = P_BALANCE.SET_OF_BOOKS_ID
    AND BALANCE.SET_OF_BOOKS_ID = P_DATE.SET_OF_BOOKS_ID
    AND P_DATE.PERIOD_NAME = :P_PERIOD_START
    AND P_BALANCE.EFFECTIVE_PERIOD_NUM >=
    P_DATE.EFFECTIVE_PERIOD_NUM
    AND P_BALANCE.PERIOD_NAME = BALANCE.PERIOD_NAME
    AND BALANCE.CODE_COMBINATION_ID =
    AB_START.CODE_COMBINATION_ID)
    AND GPS_END.EFFECTIVE_PERIOD_NUM =
    (SELECT MAX(P_BALANCE.EFFECTIVE_PERIOD_NUM)
    FROM AX_BALANCES BALANCE,
    GL_PERIOD_STATUSES P_BALANCE,
    GL_PERIOD_STATUSES P_DATE
    WHERE BALANCE.APPLICATION_ID = AB_END.APPLICATION_ID
    AND BALANCE.APPLICATION_ID = P_BALANCE.APPLICATION_ID
    AND BALANCE.APPLICATION_ID = P_DATE.APPLICATION_ID
    AND BALANCE.THIRD_PARTY_ID = AB_END.THIRD_PARTY_ID
    AND BALANCE.SUB_ID = AB_END.SUB_ID
    AND BALANCE.SET_OF_BOOKS_ID = AB_END.SET_OF_BOOKS_ID
    AND BALANCE.SET_OF_BOOKS_ID = P_BALANCE.SET_OF_BOOKS_ID
    AND BALANCE.SET_OF_BOOKS_ID = P_DATE.SET_OF_BOOKS_ID
    AND P_DATE.PERIOD_NAME = :P_PERIOD_END
    AND P_BALANCE.EFFECTIVE_PERIOD_NUM <=
    P_DATE.EFFECTIVE_PERIOD_NUM
    AND P_BALANCE.PERIOD_NAME = BALANCE.PERIOD_NAME
    AND BALANCE.CODE_COMBINATION_ID =
    AB_END.CODE_COMBINATION_ID)) HEADER,
    ((SELECT LINE.THIRD_PARTY_ID VENDOR_ID,
    HEAD.EFFECTIVE_DATE FECHA_CONTABLE,
    INV.INVOICE_DATE FECHA_TRANSACCION,
    LOOK.DESCRIPTION TIPO_TRANSACCION,
    LINE.REFERENCE_25 NUM_TRANSACCION,
    INV.DOC_SEQUENCE_VALUE SECUENCIA,
    LINE.ACCOUNTED_DR DEBE,
    LINE.ACCOUNTED_CR HABER,
    CODE.SEGMENT3 CUENTA
    FROM AX_SLE_LINES LINE,
    AX_SLE_HEADERS HEAD,
    GL_CODE_COMBINATIONS CODE,
    AP_INVOICES_ALL INV,
    FND_LOOKUP_VALUES LOOK
    WHERE HEAD.EFFECTIVE_DATE BETWEEN
    (SELECT START_DATE
    FROM GL_PERIOD_STATUSES_V
    WHERE PERIOD_NAME = :P_PERIOD_START
    AND SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
    AND APPLICATION_ID = 101)
    AND (SELECT END_DATE
    FROM GL_PERIOD_STATUSES_V
    WHERE PERIOD_NAME = :P_PERIOD_END
    AND SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
    AND APPLICATION_ID = 101)
    AND HEAD.SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
    AND HEAD.SET_OF_BOOKS_ID = INV.SET_OF_BOOKS_ID
    AND HEAD.JOURNAL_SEQUENCE_ID = LINE.JOURNAL_SEQUENCE_ID
    AND HEAD.SET_OF_BOOKS_ID = :P_SOB
    AND LINE.REFERENCE_7 = INV.INVOICE_ID
    AND CODE.CODE_COMBINATION_ID = LINE.CODE_COMBINATION_ID
    AND LINE.SLE_HEADER_ID = HEAD.SLE_HEADER_ID
    AND LINE.SOURCE_TABLE != 'AP_INVOICE_PAYMENTS'
    AND LOOK.LOOKUP_TYPE = 'INVOICE TYPE'
    AND LOOK.LANGUAGE = 'E'
    AND LOOK.LOOKUP_CODE = INV.INVOICE_TYPE_LOOKUP_CODE
    AND LINE.CODE_COMBINATION_ID IN
    (SELECT CODE_COMBINATION_ID
    FROM GL_CODE_COMBINATIONS
    WHERE SEGMENT3 LIKE '40%' -- Segment3 is our natural account, 40, 04, 41 are the natural accounts for suppliers
    OR SEGMENT3 LIKE '04%'
    OR SEGMENT3 LIKE '41%')) UNION ALL
    (SELECT LINE.THIRD_PARTY_ID VENDOR_ID,
    HEAD.EFFECTIVE_DATE FECHA_CONTABLE,
    INV.CHECK_DATE FECHA_TRANSACCION,
    'Pago' TIPO_TRANSACCION,
    LINE.REFERENCE_25 NUM_TRANSACCION,
    INV.DOC_SEQUENCE_VALUE SECUENCIA,
    LINE.ACCOUNTED_DR DEBE,
    LINE.ACCOUNTED_CR HABER,
    CODE.SEGMENT3 CUENTA
    FROM AX_SLE_LINES LINE,
    AX_SLE_HEADERS HEAD,
    GL_CODE_COMBINATIONS CODE,
    AP_CHECKS_ALL INV
    WHERE HEAD.EFFECTIVE_DATE BETWEEN
    (SELECT START_DATE
    FROM GL_PERIOD_STATUSES_V
    WHERE PERIOD_NAME = :P_PERIOD_START
    AND SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
    AND APPLICATION_ID = 101)
    AND (SELECT END_DATE
    FROM GL_PERIOD_STATUSES_V
    WHERE PERIOD_NAME = :P_PERIOD_END
    AND SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
    AND APPLICATION_ID = 101)
    AND HEAD.SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
    AND HEAD.JOURNAL_SEQUENCE_ID = LINE.JOURNAL_SEQUENCE_ID
    AND HEAD.SET_OF_BOOKS_ID = :P_SOB
    AND LINE.REFERENCE_7 = INV.CHECK_ID
    AND CODE.CODE_COMBINATION_ID = LINE.CODE_COMBINATION_ID
    AND LINE.SLE_HEADER_ID = HEAD.SLE_HEADER_ID
    AND LINE.SOURCE_TABLE = 'AP_INVOICE_PAYMENTS'
    AND LINE.CODE_COMBINATION_ID IN
    (SELECT CODE_COMBINATION_ID
    FROM GL_CODE_COMBINATIONS
    WHERE SEGMENT3 LIKE '40%' --Segment3 is our natural account, 40, 04, 41 are the natural accounts for suppliers
    OR SEGMENT3 LIKE '04%'
    OR SEGMENT3 LIKE '41%'))) LINE
    WHERE HEADER.THIRD_PARTY_ID = LINE.VENDOR_ID(+)
    AND HEADER.ACCOUNT_SEGMENT = LINE.CUENTA(+)
    ORDER BY LINE.FECHA_CONTABLE
    :P_VENDOR_NUMBER -> Supplier Num
    :P_PARTY_NAME -> Supplier Name
    :P_SUB_NAME -> Supplier Address
    :P_SOB -> set_of_books_id
    :P_PERIOD_START -> Period Start
    :P_PERIOD_END -> Period End

  • Import GL opening balance,AR and AP aging with each open invoice data

    We tried to use Data Transfer Workbench to import GL opening balance back to 2007 year end but got an error "can not post to Control Account". 
    In Admin>Sys Init> Opening Balances> GL opening, Businesss Partner, 1099 opening balance can import all opening balance with AR, AP. But, can not import for each open invoice amount, invoice number, invoice date information. 
    If we entered those GL, AR, AP opening balance those won't affect the GL F/S, right?
    We will need to close year 2007 then import each period Trial Balance Debit and Credit amount for each account then close each period to have all 2008 each account period data until May 2009. 
    Would like to know which is the best way to do this?
    Edited by: Lily Chien on Jun 4, 2009 11:21 PM

    Hi,
    Please, use oInvoice and oPurchaseInvoice templates (as service type and offset account is opening balance account) to import opening balance. This don't affect to inventory, P/L account.
    Hope this helps,
    Son.

  • Not able to pick Opening Balance in Ageing Report

    Hi
    I have made an query for customer ageing report based on our requirement, but am not able to fetch the OB (Opening Balance) in that.  If i generate Customer ageing report from B1, its showing the OB in the first line, then it showing the open invoices on the corresponding ageing days.
    Can anyone help me to fetch the opening balance in ageing report.  Below is the query i have given for ageing.
    SELECT     NNM1.Remark AS Branch, OINV.DocNum, OINV.NumAtCard AS VendorRef, OINV.DocType AS Type, OINV.DocStatus AS Status, OINV.DocDate,
                          OINV.DocDueDate, OINV.CardCode, OINV.CardName, OINV.DocTotal, OINV.PaidToDate AS [Paid/Credited],
                          OINV.DocTotal - OINV.PaidToDate AS [Balance Due], (CASE WHEN DateDiff(dd, OINV.DocDate, getdate()) BETWEEN - 120 AND
                          0 THEN (OINV.DocTotal - OINV.PaidToDate) END) AS 'Less then Due Date', (CASE WHEN DateDiff(dd, OINV.DocDate, getdate()) BETWEEN 0 AND
                          30 THEN (OINV.DocTotal - OINV.PaidToDate) END) AS '0 - 30', (CASE WHEN DateDiff(dd, OINV.DocDate, getdate()) BETWEEN 31 AND
                          45 THEN (OINV.DocTotal - OINV.PaidToDate) END) AS '30 - 45', (CASE WHEN DateDiff(dd, OINV.DocDate, getdate()) BETWEEN 46 AND
                          60 THEN (OINV.DocTotal - OINV.PaidToDate) END) AS '45 - 60', (CASE WHEN DateDiff(dd, OINV.DocDate, getdate()) BETWEEN 61 AND
                          90 THEN (OINV.DocTotal - OINV.PaidToDate) END) AS '60-90', (CASE WHEN DateDiff(dd, OINV.DocDate, getdate()) BETWEEN 91 AND
                          120 THEN (OINV.DocTotal - OINV.PaidToDate) END) AS '90-120', (CASE WHEN DateDiff(dd, OINV.DocDate, getdate())
                          > 120 THEN (OINV.DocTotal - OINV.PaidToDate) END) AS '120 +', OSLP.SlpName, OUBR.Name
    FROM         OINV AS OINV INNER JOIN
                          NNM1 AS NNM1 ON OINV.Series = NNM1.Series INNER JOIN
                          OSLP ON OINV.SlpCode = OSLP.SlpCode INNER JOIN
                          OHEM ON OSLP.SlpCode = OHEM.salesPrson INNER JOIN
                          OUBR ON OHEM.branch = OUBR.Code
    WHERE     (OINV.DocStatus = 'O') AND (OUBR.Code IN (@Branch)) AND (OSLP.SlpCode IN (@SalesEmployee))
    ORDER BY OINV.CardName, OSLP.SlpName
    How to add the OB in the above query.

    Check note 1023083 and for information about the expected release date of the patch please view note 578944.this problem is related to the new  SAP GUI 7 patch-level 0. There is something wrong with  the GUI function to get information from the local registry (CL_GUI_FRONTEND_SERVICES=>REGISTRY_GET_VALUE).
    We had the same issue sometime back and we applied the patch. I have the patch but it will be a huge file to send over internet. See the above notes and you should be able to apply the required patch.
    Also check Note
    Note 696069 below:
    Summary
    Symptom
    No Data is displayed when View is changed from ALV to Excel Inplace on
    ALV Grid. This Happens with Office XP/2003/2007.
    Other terms
    Excel inplace, Excel, ALV, Office 2003, Office XP, office 2007
    Reason and Prerequisites
    With newer release of MS Office (XP/2003/2007) Microsoft added new security settings/options for Visual Basic project and Macros. Excel Inplace uses Visual Basic Project and macro functionality of MS Office. If the setting for Macro security is High (which automatically disables macro or if access to Visual Basic Project is suppressed then Excel Inplace doesn't show any Data in Excel.
    Solution
    Required settings in MS office XP and MS Office 2003:
    To use the Excel Inplace functionality make sure the security settings for Macro is set to Medium and the option "Trust access to Visual Basic Project" must be checked on Tools->Macro->Security->Trusted Sources tab.
    Required settings in Office 2007:
    Please see the video file in attachments of this note.
    This is required with MS Office XP, MS Office 2003, MS Office 2007.
    Header Data
    Release Status: Released for Customer
    Released on: 22.12.2006  14:47:01
    Priority: Recommendations/additional info
    Category: Consulting
    Primary Component: BC-FES-OFFI SAP Desktop Office Integration
    Secondary Components: BC-FES-XXL XXL List Viewer/Lotus Connections
    Reward points if this help
    Sanghamitra
    Message was edited by:
            Sanghamitra11

  • AR Customer Aging - Calculations

    Hi
    I wanted to customize the customer aging report in AR,
    i was using the ORACLE API to calculate the aging, the API does not take care of the receipts, and reverse amout,
    I ended up in defining a new query for calcuating the receipts and reversal amount, i could not make it 100% success as there was complex conditions ...
    does the oracle provide any API to calcuate the receipts and reversal amount...
    pls do let me know if any..
    Regards
    Yram

    Hello.
    This query will show you the customer open receivable transactions:
    select c.customer_name,
    decode(ps.class, 'PMT', 'Payment', 'INV', 'Invoice', 'DM', 'Debit Memo', 'CM', 'Credit Memo') Type,
    ps.trx_number,
    ps.trx_date "Inv Date",
    ps.due_date "Due Date",
    ps.acctd_amount_due_remaining "Amount Remaining"
    from ar_payment_schedules_all ps,
    ra_customers c
    where c.customer_id = ps.customer_id
    and ps.status = 'OP'
    and ps.org_id = &orgID
    and c.customer_number = &CustNumber
    Octavio

  • Issue in counting open invoices

    Hi All,
    I am facing an issue which could be common but i am getting the correct count for open invoices.
    We have following scenario :
    Assume, we are loading an invoice(INV1) which was open(determined by item status = O) yesterday and loaded the same into ODS and to the cube yesterday itself.
    As we want to see the invoices which are open as of that particulat day.
    we have a CKF defined with value = 1 and aggregation : counter of all values, reference characteristic : 0REFERENCE.
    I run the report and I see open invoices = 1, which is correct.
    Now,the invoice which was open yesterday was cleared and paid today.
    Now , I loaded the data to ODS and then to the cube.
    In the cube, I have three entries like
    Invoice     Item Status            Amount 
    INV1         O(Open)                   100
    INV1         O(Open)                  -100
    INV1         C(Cleared)                100
    Since, this invoice is cleared today, when i run the report , i should get invoice count "Zero" but I am getting the count as "1" and the amount "0".
    The CKF which was created is getting the count as "1" even though it is cleared.If the invoice is cleared, it should not be counted.
    Anyone has any suggestions ?
    Regards,
    Jeevan

    okay - a number of issues here
    The two item statuses of O will cancel each other out and be deleted if you have zero elemination on the cube and run the next compression
    The negative zero was generated by the change log of the ODS when the item status = C cleared document came in
    You always run the open items as at a point in time using two RKFs added together in one CKF
    RKF1 is item status = O AND posting date <= key date of query
    RKF2 is cleared date > key date of query AND posting date <= key date of query
    Thus you can always restate the open items which have been subsequently cleared back to a point in time (ie historical aged debt reports etc..)
    You must not just use item status = O
    Now how to do the counts..
    I normally put a counter onto the cube and negate the counter when the changelog negative O record (so the two Os cancel each other out) and then just add up the values of the counter as per the RKFs above
    However there is another option but it still involves a change to the data model
    The counts are based on the uniqueness of a document number
    The full key of a uniqieness of an AR or AP document number in SAP is...
    Company Code, Fiscal Year, Document Number, line item
    (the line item is due to one AP document being split across many lines due to installment plans with different net due dates or partially allocated cash across many outstanding line items)
    The other items have to be considered in uniqueness because SAP allows you to configure number ranges per company code wither with internal or external numbering and these ranges can be year specific - hence the full key is required
    You cannot just count document number as this will give a false result as the same document numebr can be used in multiple years within the same company code AND across company codes as well (so group reporting of outstanding counts will be affected as well)
    So you have to create a new infoobject that is called "Document Full Key" - that concatenates Company Code, Fiscal Year, Document Number, line item into one object string
    You then put that in yoru cube and update it via the transformation rules
    Then you can create the RKFs above and do a count all values based on the characteristic  "Document Full Key" - then create a few more RKFs to do the splits of net due date and the offsets required for -30 -60 etc as per normal
    Sorry for the bad news - but if you want to do it properly - I don;t think you have another other choice but the two options above..
    But then what do I know!

Maybe you are looking for

  • JOB_CLOSE (exception: invalid_startdate)

    Hi,      I'm trying to run two jobs. One after the other. For this i do the following: JOB_OPEN (with: jobname) JOB_SUBMIT (with:authcknam, jobcount, jobname, language, report and variant) JOB_CLOSE (with: jobcount, jobname and strtimmed = X) JOB_OPE

  • Fast index creation suggestions wanted

    Hi: I've loaded a table with a little over 100,000,000 records. The table has several indexes which I must now create. Need to do this as fast as possible. I've read the excellent article by Don Burleson (http://www.dba-oracle.com/oracle_tips_index_s

  • Get an older version of GarageBand for iOS (pre 2.0.1)?

    How do I get an older version of GarageBand for iOS (pre 2.0.1)? Other than this method : https://sites.google.com/site/appleclubfhs/support/advice-and-articles/app-store -downloading-older-versions-of-apps-ios I have been all over that article tryin

  • Clear query when i enter on the request page

    I have a page with some query field and a button ('execute query'). When i return on the page the was dispaly the old query, it is possibile to enter in the page and finf it clear ?? Thank's'.

  • Premiere CS5 won't start with new UAD drivers

    Any workarounds? Can I change my vst folder prior to starting the program? Windows 7 64 bit