Can using query create aging report for GL Account

Hi all expert,
I have a challenge scenario which customer request print out aging report for the following GL Account.
This is not a business partner account. However, customer want display like aging report.
30 days aging report for the following GL accounts by projects:-
     i)     WIP (Work In Progress) account
     ii)     Accrued Revenue account
     iii)     Accrued Cost account
Examples:
                        Current Balance       30 day   60 day  90 day   120 day
Account  WIP         10000               2000        3000      5000     0
Any idea or example given? If yes, can you provide a query here?
Regards,
Eric Tan

Hi Eric
In standard SAP Business One this is difficult as the reports are 2 dimensional. To achieve this you will need to write multiple select statements into a temporary table and then select the final result from the temp table. Here is a sample for you to test:
USE [*DATABASE_NAME*]
GO
/****** Object:  StoredProcedure [dbo].[REPORT_NAME]    Script Date: 04/24/2009 13:17:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[*REPORT_NAME*]
as
set nocount on
begin
DECLARE @Day_no varchar(2)
DECLARE @Month_no varchar(2)
DECLARE @Year_no varchar(4)
DECLARE @Start_Date Datetime
SET @Day_no = DAY(GetDate())
SET @Month_no = MONTH(GetDate())
SET @Year_no = YEAR(GetDate())
SET @Start_Date = @Year_No + '/' + @Month_no + '/' + @Day_no --  + '/' + @Year_No
IF OBJECT_ID(N'tempdb..#CRDAGEING', N'U') IS NOT NULL
drop table #CRDAGEING
SELECT T0.[CardCode] AS [CardCode], T0.[CardName] AS [CardName], -T0.[Balance] AS [Balance], CAST(0 AS MONEY) AS [Current], CAST(0 AS MONEY) AS [1Week], CAST(0 AS MONEY) AS [2Weeks], CAST(0 AS MONEY) AS [3Weeks], CAST(0 AS MONEY) AS [4Weeks], CAST(0 AS MONEY) AS [5Weeks], CAST(0 AS MONEY) AS [6Weeks], CAST(0 AS MONEY) AS [Over6Weeks], CAST(0 AS MONEY) AS [Avg3Months], CAST (0 AS MONEY) AS [Onhand] INTO #CRDAGEING FROM OCRD T0 WHERE T0.[CardType] = 'S' -- and T0.[CardCode] <> '' --and T0.[DocDate] >= @FromDate AND T0.[DocDate] <= @ToDate
INSERT dbo.#CRDAGEING SELECT T1.[ShortName], NULL, 0, -SUM(T1.[BalDueDeb] - T1.[BalDueCred]), 0, 0, 0, 0, 0, 0, 0, 0, 0 FROM JDT1 T1, OCRD T2 WHERE T2.[CardType] = 'S' and T2.[CardCode] = T1.[ShortName] and T1.[DueDate] <= @Start_Date GROUP BY T1.[ShortName]
INSERT dbo.#CRDAGEING SELECT T1.[ShortName], NULL, 0, 0, -SUM(T1.[BalDueDeb] - T1.[BalDueCred]), 0, 0, 0, 0, 0, 0, 0, 0 FROM JDT1 T1, OCRD T2 WHERE T2.[CardType] = 'S' and T2.[CardCode] = T1.[ShortName] and T1.[DueDate] >= DATEADD(DAY,1,@Start_Date) and T1.[DueDate] <= DATEADD(DAY,8,@Start_Date) GROUP BY T1.[ShortName]
INSERT dbo.#CRDAGEING SELECT T1.[ShortName], NULL, 0, 0, 0, -SUM(T1.[BalDueDeb] - T1.[BalDueCred]), 0, 0, 0, 0, 0, 0, 0 FROM JDT1 T1, OCRD T2 WHERE T2.[CardType] = 'S' and T2.[CardCode] = T1.[ShortName] and T1.[DueDate] > DATEADD(DAY,8,@Start_Date) and T1.[DueDate] <= DATEADD(DAY,15,@Start_Date) GROUP BY T1.[ShortName]
INSERT dbo.#CRDAGEING SELECT T1.[ShortName], NULL, 0, 0, 0, 0, -SUM(T1.[BalDueDeb] - T1.[BalDueCred]), 0, 0, 0, 0, 0, 0 FROM JDT1 T1, OCRD T2 WHERE T2.[CardType] = 'S' and T2.[CardCode] = T1.[ShortName] and T1.[DueDate] > DATEADD(DAY,15,@Start_Date) and T1.[DueDate] <= DATEADD(DAY,22,@Start_Date) GROUP BY T1.[ShortName]
INSERT dbo.#CRDAGEING SELECT T1.[ShortName], NULL, 0, 0, 0, 0, 0, -SUM(T1.[BalDueDeb] - T1.[BalDueCred]), 0, 0, 0, 0, 0 FROM JDT1 T1, OCRD T2 WHERE T2.[CardType] = 'S' and T2.[CardCode] = T1.[ShortName] and T1.[DueDate] > DATEADD(DAY,22,@Start_Date) and T1.[DueDate] <= DATEADD(DAY,29,@Start_Date) GROUP BY T1.[ShortName]
INSERT dbo.#CRDAGEING SELECT T1.[ShortName], NULL, 0, 0, 0, 0, 0, 0, -SUM(T1.[BalDueDeb] - T1.[BalDueCred]), 0, 0, 0, 0 FROM JDT1 T1, OCRD T2 WHERE T2.[CardType] = 'S' and T2.[CardCode] = T1.[ShortName] and T1.[DueDate] > DATEADD(DAY,29,@Start_Date) and T1.[DueDate] <= DATEADD(DAY,36,@Start_Date) GROUP BY T1.[ShortName]
INSERT dbo.#CRDAGEING SELECT T1.[ShortName], NULL, 0, 0, 0, 0, 0, 0, 0, -SUM(T1.[BalDueDeb] - T1.[BalDueCred]), 0, 0, 0 FROM JDT1 T1, OCRD T2 WHERE T2.[CardType] = 'S' and T2.[CardCode] = T1.[ShortName] and T1.[DueDate] > DATEADD(DAY,36,@Start_Date) and T1.[DueDate] <= DATEADD(DAY,43,@Start_Date) GROUP BY T1.[ShortName]
INSERT dbo.#CRDAGEING SELECT T1.[ShortName], NULL, 0, 0, 0, 0, 0, 0, 0, 0, -SUM(T1.[BalDueDeb] - T1.[BalDueCred]), 0, 0 FROM JDT1 T1, OCRD T2 WHERE T2.[CardType] = 'S' and T2.[CardCode] = T1.[ShortName] and T1.[DueDate] > DATEADD(DAY,43,@Start_Date)  GROUP BY T1.[ShortName]
SELECT SR.[CardCode], MAX(SR.[CardName]), SUM(SR.[Balance]) AS [BalanceOwing], SUM(SR.[Current]) AS [Current], SUM(SR.[1Week]) AS [1Week], SUM(SR.[2Weeks]) AS [2Weeks], SUM(SR.[3Weeks]) AS [3Weeks], SUM(SR.[4Weeks]) AS [4Weeks], SUM(SR.[5Weeks]) AS [5Weeks], SUM(SR.[6Weeks]) AS [6Weeks], SUM(SR.[Over6Weeks]) AS [Over6Weeks] FROM dbo.#CRDAGEING SR GROUP BY SR.[CardCode] ORDER BY SR.[CardCode]
END
Go to Microsoft SQL Studio manager and select your company database. Then expand the list and select Programmability > Stored Procedures. Right click on Stored Procedures and select New Stored Procedure. Copy the above code over the code in the edit window and change the database name as well as report name. Then select Execute to create the stored procedure. If you make changes, remember to change the word CREATE to ALTER (with other words CREATE for the first execute, and ALTER thereafter). Then in SAP Business One create a new query and leave everything blank. Click on execute and select the pencil to change to edit mode. Remove the words SELECT and type in EXEC REPORT_NAME (change the REPORT_NAME to the name you used in SQL). Then execute again and the results will be displayed in SAP Business One.
Let me know if you get stuck. Remember the above is an example and will need to be changed to use your tables and fields as required. The basic idea is to move across by one column with each select statement. So for example the first select statement does the CURRENT column, the second one the 30DAYS column, and so on.
Kind regards
Peter Juby

Similar Messages

  • Why can't I create a report for standard price by material

    Any ideas? All reporting I have tried in SQO1 and even in SE16 returns 0 value for standard prices?
    Firstly why is this? and secondly is there another way I can pull a report by material showing standard price?
    Points awarded, many thanks

    hi,
    In MM60, u can get report for  materials having standard & moving average price based on ur input in selection screen like material,plant,material type,material group & created by only. As of my knowledge,
    there is no option to get list of materials with standard price in std.SAP.
    There are two options to generate report for materials with standard price.
    1. It is better go for customization . selection screen must contains price control field. if u enter price control like 'S' or 'V' in intial screen , report is generated.
    2. create a ABAP query for this.
    I hope this info is helpful to u.

  • Re: Aging Report For GL Accounts

    Hi Friends,
    Is their any report for aging GL Account? Without any conncection to Sub-ledger
    It is not reconciliation account, but open Item is managed.
    Regards,
    vivek

    Use t code ME2N and click 'Account Assignment" from application tool bar or press Shift + F12 to view PO with GL code. If GL code is not showing select from the layout.
    Rgds,
    Vijay

  • Aging Report for consolidating Business Partners

    I have a customer that is using consolidation functionality for its vendors. The BP parent it is set as multicurrency, the childrenu2019s for this parent are set with a different currency (USD, CAD, RMB etc).  My question is how I can obtain a proper aging report for this consolidated BP (by BP children currency) as for now all the transactions are automatically converted in local currency even when Iu2019m selecting the BP currency to display.
    Thank you,
    Alex Corbu

    Hi Alex
    The best would be a query on JDT1 table linked to OINV for example. The problem as you mentioned is that although the document is against the sub account, it is automatically posted against the head account for balance and payment purposes. In the journal file it only keeps the Head account and not the sub accounts. In OINV (and other marketing documents) you can use the FatherCard field to identify the Head account and the CardCode the sub account. These will of course be linked by the Document number from OINV and the Ref1 from JDT1.
    The above is assuming you need the information exactly the same as the ageing, as the ageing is by default pulled from the Journal tables. You could simplify this by using just the OINV table. Remember that the balance is made up of Invoices less Credit Notes, so in this instance it would be OINV minus ORIN entries.
    Hope the above all makes sense, if not just ask.
    Kind regards
    Peter Juby

  • Report for Inflation Accounting for Mexico

    Hello Experts,
    I am implementing fixed assets module for Mexico and as per the business requirements, the customer needs to adjust fixed assets values (APC and depreciation) for inflation. I have been able to configure the system for this but the problem is in reporting for inflation. There are no standard reports available in SAP for inflation accounting. Has anyone else too faced this problem in the past and what solution was used for this ?
    Thanks,
    Rohit

    Hi,
        Since you have a seperate area ,you can use all the standard reports for your requirements. It is strange that you do not post the area to G/L , but that is probably your clients requirement.
    Currently Inflation Accounting is not required in Mexico as the rate is below the threshhold.
    Kind regards

  • Can 10G express be used to create an application for use with a 10G instanc

    Hi
    Can 10G express be used to create an application for use with a 10G instance? I am new to Oracle 10G. I like the interface for creating applications, maintaining users, etc. Can this tool be pointed at a regular instance of 10G so that applications can be created against a regular 10G database not the express database?
    Can PL/SQL proceedures that are created in 10G express also be migrated to a 10G database?
    Thanks in advance
    Dean-O

    Can 10G express be used to create an application for use with a 10G instance?Yeah, that's the whole point from a marketing perspective ;)
    Can this tool be pointed at a regular instance of 10G so that applications can be
    created against a regular 10G database not the express database?Yes but it's a different version. Check out:
    http://www.oracle.com/technology/products/database/application_express/index.html
    Can PL/SQL proceedures that are created in 10G express also be migrated to a 10G database?Yes they can!
    ~Jer

  • Vendor ageing report for down payment bucketwise

    Hi
    I have paid many downpayment to various vendors. Now i want the ageing report for the same (i.e. bucket wise i.e. 0-30 days, 31-60 days and so on).
    This i am getting for vendor invoices in TCode: S_ALR_87012085 (Vendor payment history with OI sorted list).
    Please let me know if the bucketwise report is possible for the downpayment too.

    Hi,
    Vendor ageing for down payments as well as invoice i use to see from T.code FBL1N by creating layouts.
    Choose Arreas after net due date from layout and for that column you can apply a rule that from 0 to Lessthan or equal to 30.
    Like that you can create the layouts. In FBL1N you can give this layout (down) so information come in that format.
    The one disadvantage is that you have to select manually the layouts and you can see only one ageing information at a time.
    Regards,
    Sankar

  • Any Standard Aging report for MM

    Hello All,
    I am looking a standard aging report for Materials on my storage location.
    We are following batch.
    Please help
    Regards
    Lal

    Hi ,
    I hope for your new requirement this might help you .
    If you want to perform an analysis based on the key figure dead stock, proceed as follows:
    From the Inventory Controlling menu, select Environment -> Document evaluations-> Dead stock.
    1. The selection screen appears.
    2. Specify the desired analysis criterion and selection parameters.
    You can carry out the analysis for all plants, that is, for each material, data from all plants are grouped together or only for certain plants, that is, the analysis is created for every designated plant. Any period can be selected for the analysis. The system suggests 90 days as the period to analyze, the calculation starting from the current date.
    The following functions can be used to process the material list.
    Detailed Display
    By using the function Detailed display, you can call up in a table or graph form detailed data for a material including the respective material document. You can analyze all material documents that are related to the evaluated stock of a material.
    If you want to view detailed information for a certain material, proceed as follows:
    Position the cursor on the desired material in the results list and select Edit ->Detailed display.
    A dialog box appears in which you can choose either a graph or table display.
    If you select the graphic, you can display the latest information on:
    •     Cumulative receipts/issues
    •     Warehouse issues
    •     Warehouse receipts
    •     Stock level
    If you select the table, you can display the following information:
    •     Stock movements
    •     Cumulative stock movements
    •     Current stock level
    From the stock movement table you can drill down as far as the material document level to see detailed information. To display stock movements on a particular day, position the cursor on the relevant line and select the Choose function. A popup window appears which displays all the movements on the selected day. The individual movements for a selected date are displayed in a dialog box.
    To display the document for a particular movement, position the cursor on the relevant line and select the Choose function. A popup window appears which displays the document.
    Similarly you can try for the slow moving also .please let me know wether you were able to find what you were looking for .
    source: SAP
    cheers
    KP

  • Inventory ageing report for batches

    Hi Experts,
    I am looking for a ageing report for batches. MC46 and MC50 is not displaying the batches which is my main requirement. I learnt that its not available in standard SAP. I am planning to develop a Zreport which is a copy/reference of MC46 and MC50.
    If you ever come across this situation before, which approach you followed? I appreciate if you throw some thoughts on builiding a query or Zreport or any logics.
    Regards,
    R.S

    Hi Shiva,
    Thanks for the information. We are not using SLED for the batches and BMBC is just a **** pit where you can use it as work list when you try to change mass batches. I dont know how BMBC helps in fetching a report for ageing.
    Regards,
    R.S

  • How to create a report for open sales orde documents which are not invoiced

    Hi Experts this is urgent,
    +pls give the Logic for document flow+
    My requirement is create a report for sales orders which are not invoiced  using the following table.
    VBAK : sales order header
    VBAP : sales order item
    VBFA : sales document flow
    VBUK for processing status
    KOMV for duties value and sales order value
    LIKP : delivery not header
    LIPS :delivery note item
    For information : In the header level the processing Status is indicated in the table VBUK field LFSTK for one sales order number. A,B , C are the possible entries.
    Case A : When a sales order is invoiced we can display information on the header status :
    Overall status : Completed  and display a invoice number in the document flow. When the items of the sales orders are invoiced the process status is the following :  Overall status       Completed            
    Delivery status      Fully delivered      
    Case B : An open sales order not delivered and not invoiced will have overall status : Open on the header and item level and will not have subsequent documents.
    Case C :
    When the items for the sales order are delivered but not invoiced the status will be u201Cfully deliveredu201D
    And the subsequent documents will be delivery notes and good issue if the delivery note is issued.
    With regards
    ravi
    Edited by: ravik ravik on Jun 25, 2008 3:29 PM

    Hello Ravi,
    U neednot develop any report..
    there is std report with txn V.02
    or copy this and make necessary changes.
    Reward, if helpful.
    Rgds,
    Raghu.

  • 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

  • Inventory aging report for vehicle parts

    Hello Guys,
    I need to prepare an inventory aging report for Vehicle parts.
    We already have new vehice ad used vehicle's inventory aging reports created by somebody else.
    I am very new to sap-bi.
    I am very confused about designing same cz i checked with the fields ad they are a ittle different from the fields which are there in above two reports.
    I have downloaded 0ic_c03 from business content but do not know how to prepare its datasource......
    Please tell me how should i go about it.
    Thanks & Regards,
    Dolly

    Hi Dolly,
    What is your question? It's almost impossible to provide an answer without any information.
    Perhaps you should try to ask in your company for some help.
    Cheers

  • Creating Aging Report and Counting report

    Hi Everyone!
    Greetings to all of you,
    I would like to know where can i find some resources or step by step insruction to create aging report and also counting reports (i.e No of PO created for a period).
    If any of you have any information related to the above reporting requirement please do pass it to me
    Your information on the above issue are highly appreciated
    Thanking you in advance
    Thank you
    rgds
    Saravanan Ramasamy

    Hi Saravanan,
    Go through these links.
    Ageing analysis
    Re: Stock Ageing  (Qty & Value)
    No value could be determined for variable 0P_KEYD2
    Regards,
    BW IGA

  • Pls help out me to create a report for entry tax

    hi all,
                  pls help out me to create a report for entry tax.
                    and give some logic how i can do this.
    thanks and regards
      vikas

    SELECT < Columns>
    from pay_payroll_actions ppa,
    pay_all_payrolls_f papf,
    per_time_periods ptp
    where papf.payroll_id = ppa.payroll_id
    and ppa.effective_date between papf.effective_start_date and papf.effective_end_date
    and ppa.action_type IN ('Q','R')
    and ptp.payroll_id = papf.payroll_id
    and papf.payroll_name = :pPayrollName
    and ppa.date_earned BETWEEN ptp.start_date AND ptp.end_date
    and :pDate BETWEEN ptp.start_date AND ptp.end_date
    Pass Any Date and Payroll Name. The query should list down all payroll runs in the period in which the date falls.

  • How can I activate drill down report for planned line items please urgent?

    Hi Everyone,
    Please suggest me how can i activate drill down report for planned line items in internal orders. S_ALR_87012993. Please suggest me, I'll award full points. I am unable to do it in client system, which has already line items. I tried in my sys with new config it is working.
    Kind regards
    Arvey.

    Hi
    It is based on the reports attached in the Report Group - TCODE: GR53
    In the Report Group screen
    Press CONFIGURE – This is to attach any Drill Down reports.
    Press the “Insert Line” icon
    As is the screen may be used to insert a Report Writer report group. To add an ABAP, press “other report type”
    Double click on “ABAP Reports”
    Enter the name of the ABAP and ENTER
    <b>RCOPCA08                       Profit Center: Plan Line Items</b>
    VVR

Maybe you are looking for