Query - Opening Balance

Hello,
I'm using SAP 8.81 PL 6 and would like to come up with a query that displays the opening of an account at a given date.
I have checked through the forums and come across the below query which unfortunately displays no results.
SELECT T0.[TransId],T1.[Line_ID], T1.[Account],T1.[ShortName],
  T1.[Debit], T1.[Credit], T1.[RefDate]
FROM OJDT T0 INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
WHERE T0.[TransType]=-2
I will appreciate if someone assists with the query. Thank you.
Rgds,
Henry

Hi all,
Sorry for the ambiguous question. Allow me to clarify.... When you drill down to an account under Chart of accounts, the Opening Balance displays on the top, followed by subsequent transactions whose cumulative total makes up the account balance.
I came up with the below query to display an account's transactions in a given date range and most importantly to display the Offset Account Name instead of the code
SELECT T0.RefDate, T2.AcctName, T0.ContraAct, T0.Debit, T0.Credit,(T0.Debit- T0.Credit)Balance,
Case When T0.ContraAct=T4.AcctCode Then T4.AcctName Else Case When T0.ContraAct=T3.CardCode
Then T3.CardName Else Null End End 'Offset Account' FROM dbo.JDT1 T0 INNER JOIN dbo.OACT T2
ON T0.Account = T2.AcctCode LEFT JOIN OCRD T3 ON T3.CardCode=T0.ContraAct LEFT JOIN OACT T4 ON T4.AcctCode=T0.ContraAct
WHERE T0.RefDate>='%1' and T0.RefDate<='%2' and T4.AcctName LIKE '[%0]%'
I would further like to improve the above query by displaying the 'opening balance' or the balance of the account on the previous day (i.e. the day prior to T0.RefDate>='%1'). Kindly assist me on this one.
Regards,
Henry

Similar Messages

  • How to query opening balance for all customer or Vendor for an speci. date

    Hi,
    How to query opening balance for all customer or Vendor for an specific date?
    Example:
    put any date and query will show all customer/ Vendor  that date opening/current balance.
    Regards,
    Mizan

    Hi mizan700 ,
    Try this
    SELECT T0.[DocNum] As 'Doc No.', T0.[CardCode] As 'Customer Code',
    T0.[CardName] As 'Customer Name',(T0.[DocTotal]-T0.[PaidSys]) As 'O/S Balance'
    FROM OINV T0 INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
    INNER JOIN OCRG T2 on T1.GroupCode = T2.GroupCode
    INNER JOIN INV1 T3 ON T0.DocEntry = T3.DocEntry
    WHERE T0.[DocStatus] ='O'
    AND
    (T0.[DocDate] >='[%0]' AND T0.[DocDate] <='[%1]')
    Regards:
    Balaji.S

  • Possibility to show opening balance of a GL account through SQL query?

    Hi experts,
    Is it possible to run an SQL query in SBO that shows the opening balance
    of a GL account based on a date entered by the user?
    This is similar to how the general ledger shows the opening balance of a GL account based on the posting dates entered.
    Thanks for your ideas.

    Hi Gordon,
    Thanks for that idea.
    I am thinking of the following:
    1. Create a virtual table (#TEST) from a SELECT statement that gets all journal entries for the specified GL account BEFORE the specified posting date.
    2. Perform a SELECT statement that sums the debit and credit from (#TEST).
    This should show the opening balance of the GL account right?
    Regards,
    Eric
    Edited by: eceguerra on May 18, 2011 7:02 AM
    Edited by: eceguerra on May 18, 2011 7:02 AM

  • How to get opening balance of a g/l account using query ?

    Dear all,
    I'm developing consolidated g/l accounts debit,credit totals month wise with opening & closing balances thru query based report,
    i'have got expected results except opening balance g/l account,
    How to get opening balance of a g/l account based on date as conditonal parameter ?
    Any one throw light on this ?
    Jeyakanthan

    Hi ,
    Please kindly help me on this.I don't know how to calculate opening bal and closing bal over a period of time by Quarter, and how to generate the reprot using crystal reports and please suggest me on this how to go ahead with this report.
    Here you can go through the reprot requirement , and also an attachment of my Report template.
    we have "Category of Investment" , "Income On Investment" ,"Gross yield" and "Net yield" are  report fields.
    1)"Category Of Investment " is Hardcoded.
    2)In this we have to get  "Investment" column from VTBFHAPO(BZBETR Field) table Database based on
    Flow type(SFHAZBA) in VTBFHAPO table ='0100' for bonds category.
    3)"Income on Investment" also we will get from DB using the following formula.
      Income On Investment= "Interest IncomeAmortizationCapitalgain"
    4)With the Date field(Making Date dimension based on date(DCRDAT) field in VTBFAHPO table.
    By Current Quarter,Year to Date,Last year)
    5)Opening bal---Investment
    Purchase--Flowtype=0100
    Meturity/Sales--Flowtype=0200
    Closing balance=Opening bal+(Investment or Purchase)-(Meturity or Sales)
                                      '0100'                 '0200'
    Here '0100' and '0200' are Flow types based on this i need to get value from the same Field.
    we need to Calculate "Gross yield" .
    The bellow are formulas  to evaluate "Gross yield "
    Ist Qtr  .Gross yield=Investment income/(((April opening balanceApril closing balance)/2)((May opening balanceMay Closing Balance)/2)((June opening balance+June closing balance)/2))/3)
    Ist qtr. Year to date   Gross yield=Investment income/(((April opening balanceApril closing balance)/2)((May opening balanceMay Closing Balance)/2)((June opening balance+June closing balance)/2))/3)
    Investment income=interest incomeamortisationcapital gain
    Iind Qtr.Gross yield=Investment income/(((July opening balanceJuly closing balance)/2)((Aug opening balanceAug Closing Balance)/2)((Sept. opening balance+Sept. closing balance)/2))/3)
    Iind Qtr. Year todateGross yield=Investment income/(((April opening balanceApril closing balance)/2)((May opening balanceMay Closing Balance)/2)((June opening balanceJune closing balance)/2))((July opening balanceJuly closing balance)/2)((Aug opening balanceAug Closing Balance)/2)((Sept. opening balance+Sept. closing balance)/2))/6
    This data should display over a period of time. based on "Current Quarter","YearToDate" and "Last year"
    The quarter starts from April,i,e FY,  I Like this i need to generate the report.
    Thanks in advance.

  • Please help with query for 5 lastest opening balance  !!!!!!!!!!!

    Can anyone plese tell me or guide me how to write the query to show the 5 lastest opening balance from the A/R invoice on the specific BP partner?
    Example
    The box to input "BP partner"
    and then show,
    Lastest transaction | Ship date | Invoice number | Balance Amount | Culmulative
    1    
    2
    3
    4
    5
    Your help will be very very appreciated.

    This is very good but I would like to show only the top 5 remaining invoice. I think that I have to combine it with JDT1. I have seen one query that may be able to apply on my case.
    SELECT
    T1.CardCode + '' AS 'BP Code',
    T2.Notes2 AS 'BP Name',
    T0.RefDate,
    CASE
         WHEN T0.TransType = 13 THEN 'IN'
         WHEN T0.TransType = 14 THEN 'CN'
         WHEN T0.TransType = 30 THEN 'JE'
         WHEN T0.TransType = 24 THEN 'RC'
         WHEN T0.TransType = 46 THEN 'PS'
         ELSE 'Error ! ! !'
    END AS 'Doc Type',
    T0.Ref1 'Doc. Number',
    ISNULL(T0.FCCurrency, ' - ') AS 'Ccy',
    (T0.BalFcDeb - T0.BalFcCred) AS 'Bal. F. Ccy',
    (T0.BalDueDeb - T0.BalDueCred) AS 'Bal. Rs',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate, '[%1]') <= -1)                     ,0) AS 'Future',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate, '[%1]') = 0)                         ,0) AS 'Current Mth',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate, '[%1]') = 1)                         ,0) AS '1 Mth Ago',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate, '[%1]') = 2)                         ,0) AS '2 Mth Ago',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate ,'[%1]') = 3)                         ,0) AS '3 Mth Ago',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate, '[%1]') between 4 and 6)    ,0) AS '4 - 6 Mth Ago',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate, '[%1]') >= 7)                       ,0) AS '>7 Mth Ago'
    FROM JDT1 T0
    INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode
    LEFT OUTER JOIN OCPR T2 ON T1.CardCode = T2.Cardcode
    LEFT OUTER JOIN OJDT T3 ON T0.TransID = T3.TransID
    LEFT OUTER JOIN OINV  T4 ON T3.TransID = T4.TransID
    LEFT OUTER JOIN ORIN  T5 ON T3.TransID = T5.TransID
    WHERE
    T1.CardType = 'C' and Balance != 0
    and (T0.BalDueDeb - T0.BalDueCred) != 0
    but still try to figure it out....

  • How to query the opening balance for an specific account for an spec. date

    Hi all,
    for my user query I need to calculate the opening balance for an cash account for an specific date.
    Any ideas, how can I do this?
    Or may be you know a field in an SBO table that already contains information I need...
    Best Regards,
    Inna

    Hi Inna,
    to find the opening balance for an account or a business partner, please see SAP Note [1114253|https://service.sap.com/sap/support/notes/1114253] :
    Symptom
    How to find the opening balance of a business partner or G/L account.
    Other terms
    Account, customer, supplier, vendor, creditor, debitor, start, initial, first, opening balance, business partner, G/L, SAP Business One
    Reason and Prerequisites
    Consulting
    Solution
    There are several possible approaches:
    Approach 1 - Business Partner Opening Balance:
    1. Go to Business Partners -> Business Partner Master Data -> find the Business Partner
    2. Click on the orange link arrow next to the field 'Account Balance' in the header region of the window.
    3. Untick the boxes next to 'Posting date from', 'Display' and 'Display Unreconciled Trans. Only'.
    4. Click on the button 'Refresh'.
    5. Find 'OB' in the column 'Origin', this is the opening balance journal entry.
    Approach 2 - Business Partner Opening Balance:
    1. Go to Business Partners -> Business Partner Master Data.
    2. Click on the orange link arrow next to the field 'Account Balance' in the header region of the window.
    3. Untick the boxes next to 'Posting date from', 'Display' and 'Display Unreconciled Trans. Only'.
    4. Click on the button 'Refresh'.
    5. Double click on the column header 'Posting Date' to find the earliest transaction on the business partner account. This transaction could be opening balance, verify this with the company accountant.
    Approach 3 - G/L Account Opening Balance:
    1. Go to Financials -> Chart of Accounts -> click on the account name once.
    2. Click on the orange link arrow next to the field 'Balance'.
    3. Untick the boxes next to 'Posting date from', 'Display' and 'Display Unreconciled Trans. Only'.
    4. Click on the button 'Refresh'.
    5. Find 'OB' in the column 'Origin', this is the opening balance journal entry.
    Approach 4 - Business Partner and/or G/L Account Opening Balance:
    1. If using SAP Business One 2005 SP01 or earlier, go to Reports -> Query Generator -> click on 'Execute'.
    2. If using SAP Business One 2007 or later, go to Tools -> Queries -> Query Generator -> click on 'Execute'.
    3. Ignore the red system message in the bottom of the screen.
    4. Click on the pencil icon in the top left of the window, the field with 'SELECT *' will change colour to white, then yellow when activated by clicking in the field.
    5. Copy the query below:
               SELECT T0.[TransId], T0.[Debit], T0.[Credit] , T0.[CreatedBy], T0.[TransType] FROM [dbo].[JDT1]  T0 WHERE T0.[TransType] = '-2'  and T0.[ShortName]  = '[%1]'
    6. Click on 'Save' and give the query an appropriate name and select the appropriate category.
    7. Click on 'Execute'.
    8. Click on 'Existing Values'.
    9. Select the G/L account or the Business Partner name from the list and click on 'OK'.
    10. The system message 'Records retrieved by this query #' (# = number of records) will pop up. Click on 'OK'.
    All the best,
    Kerstin

  • To caluclate the opening balances

    I want to calulate the opening balances and closing balances for each month in the result like this :
    Month uom Opening Closing
    Apr
    May
    Jun
    Jul
    Aug
    sep
    Oct
    Nov
    Dec
    Jan
    Feb
    Mar
    SELECT UOM,
    SUM(OPSTK) OPSTK, SUM(OPVAL) OPVAL
    SUM(INQTY) INQTY, SUM(INVAL) INVAL,
    SUM(OUTQTY) OUTQTY, SUM(OUTVAL) OUTVAL,
    SUM(CLSTK) CLSTK, SUM(CL_VAL) CL_VAL
    FROM
    SELECT
    UOM, ITEM_CODE, ITEM_NAME,
    ROUND(OPSTK/CNV/ML,2) OPSTK, ROUND(OPVAL,3)OPVAL,
    ROUND(INQTY/CNV/ML,2) INQTY, ROUND(INVAL,3) INVAL,
    ROUND(OUTQTY/CNV/ML,2) OUTQTY, ROUND(OUTVAL,3)OUTVAL,
    ROUND((NVL(OPSTK,0)+NVL(INQTY,0)-NVL(OUTQTY,0))/CNV/ML,2) CLSTK,
    ROUND((NVL(OPVAL,0)+NVL(INVAL,0)-NVL(OUTVAL,0)),3) CL_VAL
    FROM
    SELECT
    ITEM_UOM_CODE UOM, ITEM_CODE, ITEM_NAME,
    IU_CONV_FACTOR CNV,
    IU_MAX_LOOSE_1 ML
    FROM OM_ITEM,OM_ITEM_UOM
    WHERE ITEM_CODE = IU_ITEM_CODE AND IU_UOM_CODE = ITEM_UOM_CODE
    SELECT
    SL_ITEM_CODE OP_ICODE,
    SUM(DECODE(SL_RCVD_ISSD,'R',1,'I',-1)*SL_QTY_BU) OPSTK,
    ROUND(SUM(DECODE(SL_RCVD_ISSD,'R',1,'I',-1)*SL_VAL_1),2) OPVAL
    FROM OS_STK_LEDGER
    WHERE SL_DT < TO_DATE(:P249_DATE1,'DD-MM-YYYY')
    GROUP BY SL_ITEM_CODE
    SELECT
    SL_ITEM_CODE TX_ICODE,
    SUM(DECODE(SL_RCVD_ISSD,'R',1)*SL_QTY_BU)INQTY,
    SUM(DECODE(SL_RCVD_ISSD,'R',1)*SL_VAL_1) INVAL,
    SUM(DECODE(SL_RCVD_ISSD,'I',1)*SL_QTY_BU)OUTQTY,
    SUM(DECODE(SL_RCVD_ISSD,'I',1)*SL_VAL_1) OUTVAL
    FROM OS_STK_LEDGER
    WHERE SL_DT BETWEEN TO_DATE(:P249_DATE1,'DD-MM-YYYY') AND TO_DATE(:P249_DATE2,'DD-MM-YYYY')
    GROUP BY SL_ITEM_CODE
    WHERE ITEM_CODE = OP_ICODE(+)
    AND ITEM_CODE = TX_ICODE(+)
    AND ITEM_CODE LIKE 'R%'
    --AND   ITEM_CODE LIKE :P249_ITEMCODE
    ORDER BY ITEM_CODE
    GROUP BY UOM
    The below given query gives me the opening and closing balances, for the date range entered by me.
    For ex. if I enter the date in TO_DATE(:P249_DATE1,'DD-MM-YYYY') field as '01-04-2008', then i get the opening balance for the month April. The SL_DT is the date column in the table.
    Kindly guide me for this to solve..

    There seems to be a problem with your query formatting. I've formatted it and the ORDER BY clause is not needed in the In line view. Remove it. I have added new GROUP BY column.
    SELECT UOM,
           SUM(OPSTK) OPSTK, SUM(OPVAL) OPVAL
           SUM(INQTY) INQTY, SUM(INVAL) INVAL,
           SUM(OUTQTY) OUTQTY, SUM(OUTVAL) OUTVAL,
           SUM(CLSTK) CLSTK, SUM(CL_VAL) CL_VAL
    FROM ( SELECT UOM, ITEM_CODE, ITEM_NAME,
                  ROUND(OPSTK/CNV/ML,2) OPSTK, ROUND(OPVAL,3)OPVAL,
                  ROUND(INQTY/CNV/ML,2) INQTY, ROUND(INVAL,3) INVAL,
                  ROUND(OUTQTY/CNV/ML,2) OUTQTY, ROUND(OUTVAL,3)OUTVAL,
                  ROUND((NVL(OPSTK,0)+NVL(INQTY,0)-NVL(OUTQTY,0))/CNV/ML,2) CLSTK,
                  ROUND((NVL(OPVAL,0)+NVL(INVAL,0)-NVL(OUTVAL,0)),3) CL_VAL
           FROM ( SELECT ITEM_UOM_CODE UOM, ITEM_CODE, ITEM_NAME,
                         IU_CONV_FACTOR CNV,
                         IU_MAX_LOOSE_1 ML
                  FROM OM_ITEM,OM_ITEM_UOM
                  WHERE ITEM_CODE = IU_ITEM_CODE AND IU_UOM_CODE = ITEM_UOM_CODE
                 ( SELECT SL_ITEM_CODE OP_ICODE,
                          SUM(DECODE(SL_RCVD_ISSD,'R',1,'I',-1)*SL_QTY_BU) OPSTK,
                          ROUND(SUM(DECODE(SL_RCVD_ISSD,'R',1,'I',-1)*SL_VAL_1),2) OPVAL
                   FROM OS_STK_LEDGER
                   WHERE SL_DT < TO_DATE(:P249_DATE1,'DD-MM-YYYY')
                   GROUP BY SL_ITEM_CODE
                 ( SELECT SL_ITEM_CODE TX_ICODE,
                          SUM(DECODE(SL_RCVD_ISSD,'R',1)*SL_QTY_BU)INQTY,
                          SUM(DECODE(SL_RCVD_ISSD,'R',1)*SL_VAL_1) INVAL,
                          SUM(DECODE(SL_RCVD_ISSD,'I',1)*SL_QTY_BU)OUTQTY,
                          SUM(DECODE(SL_RCVD_ISSD,'I',1)*SL_VAL_1) OUTVAL,
                          trunc(SL_DT, 'MM')
                   FROM OS_STK_LEDGER
                   WHERE SL_DT BETWEEN TO_DATE(:P249_DATE1,'DD-MM-YYYY') AND TO_DATE(:P249_DATE2,'DD-MM-YYYY')
                   GROUP BY SL_ITEM_CODE, trunc(SL_DT, 'MM')
           WHERE ITEM_CODE = OP_ICODE(+)
           AND ITEM_CODE = TX_ICODE(+)
           AND ITEM_CODE LIKE 'R%'
           --AND ITEM_CODE LIKE :P249_ITEMCODE
    GROUP BY UOM;Cheers
    Sarma.

  • Problem in getting opening balance for multiple GL Account

    Hi,
    I am working on a  Trail Balance Report in which i am trying to fetch the data for the opening balance for multiple GL Accounts but it is not coming accurate.. Here is the link to the code which i am using currently right now:-
    http://docs.google.com/View?id=dfxswwff_13fgpdcbgt
    here i am showing the logic for the data of previous year only... i.e. data from begining to 1 day less of the date-low.

    Hi,
    It is a tranparent table which is getting data from the 2 other tables,the filling of this table is right. The execution of this query is right in the program but the problem comes when it is trying to calculate the opening balance for the respective GL Account present in the query it is not doing it. i.e. if there are 2 gl account ids having 3 rows of data each it is not calculating the of it in a single row.. i hope it is clear now...

  • Period Wise Inventory Opening balance,Receipts ,Issues and Closing Balance

    Hi Guys I need Period Wise Details,but the above query is giving date wise can any one give me a solution plz.
    the Below is the table structure and the select statement that i am working on.
    CREATE TABLE INV_TRACK( TRANS_ID NUMBER,
    ITEM_ID VARCHAR2(10), QTY NUMBER,
    COST NUMBER, TRANS_TYPE VARCHAR2(2 ),
    TRANS_DATE DATE )
    INSERT INTO INV_TRACK ( TRANS_ID, ITEM_ID, QTY, COST, TRANS_TYPE,
    TRANS_DATE ) VALUES ( 1, 'a1', 100, 50, 'r', TO_DATE( '10/01/2005 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'))
    INSERT INTO INV_TRACK ( TRANS_ID, ITEM_ID, QTY, COST, TRANS_TYPE,
    TRANS_DATE ) VALUES ( 2, 'a1', 105, 50, 'r', TO_DATE( '10/01/2005 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'))
    INSERT INTO INV_TRACK ( TRANS_ID, ITEM_ID, QTY, COST, TRANS_TYPE,
    TRANS_DATE ) VALUES ( 3, 'a2', 100, 100, 'r', TO_DATE( '10/01/2005 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'))
    INSERT INTO INV_TRACK ( TRANS_ID, ITEM_ID, QTY, COST, TRANS_TYPE,
    TRANS_DATE ) VALUES ( 4, 'a1', 90, 50, 'i', TO_DATE( '10/02/2005 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'))
    INSERT INTO INV_TRACK ( TRANS_ID, ITEM_ID, QTY, COST, TRANS_TYPE,
    TRANS_DATE ) VALUES ( 5, 'a2', 90, 100, 'i', TO_DATE( '10/02/2005 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'))
    INSERT INTO INV_TRACK ( TRANS_ID, ITEM_ID, QTY, COST, TRANS_TYPE,
    TRANS_DATE ) VALUES ( 6, 'a2', 200, 100, 'r', TO_DATE( '10/02/2005 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'))
    INSERT INTO INV_TRACK ( TRANS_ID, ITEM_ID, QTY, COST, TRANS_TYPE,
    TRANS_DATE ) VALUES ( 7, 'a3', 2500, 10, 'r', TO_DATE( '10/03/2005 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'))
    INSERT INTO INV_TRACK ( TRANS_ID, ITEM_ID, QTY, COST, TRANS_TYPE,
    TRANS_DATE ) VALUES ( 8, 'a3', 100, 10, 'r', TO_DATE( '10/03/2005 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'))
    INSERT INTO INV_TRACK ( TRANS_ID, ITEM_ID, QTY, COST, TRANS_TYPE,
    TRANS_DATE ) VALUES ( 9, 'a3', 1500, 10, 'i', TO_DATE( '10/03/2005 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'))
    SELECT *
    FROM(SELECT TRANS_ID,item_id,trans_type,trans_date,
    lag(qty)
    over(PARTITION BY item_id ORDER BY trans_id ASC) "Opening Balance",
         DECODE(SIGN(qty-lag(qty)over(PARTITION BY item_id ORDER BY trans_id ASC)),1,(qty-lag(qty)over(PARTITION BY item_id ORDER BY trans_id ASC))) "Receipts",
         ABS(DECODE(SIGN(qty-lag(qty)over(PARTITION BY item_id ORDER BY trans_id ASC)),-1,(qty-lag(qty)over(PARTITION BY item_id ORDER BY trans_id ASC)))) "issues",
         qty "Closing Balance"
    FROM inv_track)     
    WHERE trans_date BETWEEN :date1 AND :date2

    You have the right idea for the issues/receipts, but the KEEP function will get you your opening/closing quantities.
    SQL> SELECT item_id,
      2         period,
      3         MIN(qty) KEEP (DENSE_RANK FIRST ORDER BY trans_id) AS opening_qty,
      4         SUM(CASE WHEN qty_delta>0 THEN qty_delta END) AS receipts,
      5         SUM(CASE WHEN qty_delta<0 THEN qty_delta END) AS issues,
      6         MAX(qty) KEEP (DENSE_RANK LAST ORDER BY trans_id) AS closing_qty
      7    FROM (
      8  SELECT trans_id,
      9         item_id,
    10         trunc(trans_date,'mm') AS period,
    11         qty,
    12         qty-LAG(qty) OVER (PARTITION BY item_id ORDER BY trans_id) AS qty_delta
    13    FROM inv_track
    14         )
    15   GROUP BY
    16         item_id,
    17         period
    18  /
    ITEM_ID    PERIOD    OPENING_QTY   RECEIPTS     ISSUES CLOSING_QTY
    a1         01-OCT-05         100          5        -15          90
    a2         01-OCT-05         100        110        -10         200
    a3         01-OCT-05        2500       1400      -2400        1500
    SQL>

  • AR Open Balances ~java.sql.SQLException: No corresponding LOB data found

    Dear all,
    Please gudie me to solve this error..
    OPP.log file
    [10/24/12 12:16:18 PM] [UNEXPECTED] [82244:RT2787964] java.sql.SQLException: No corresponding LOB data found :SELECT L.FILE_DATA FILE_DATA,DBMS_LOB.GETLENGTH(L.FILE_DATA) FILE_LENGTH, L.LANGUAGE LANGUAGE, L.TERRITORY TERRITORY, B.DEFAULT_LANGUAGE DEFAULT_LANGUAGE, B.DEFAULT_TERRITORY DEFAULT_TERRITORY,B.TEMPLATE_TYPE_CODE TEMPLATE_TYPE_CODE, B.USE_ALIAS_TABLE USE_ALIAS_TABLE, B.START_DATE START_DATE, B.END_DATE END_DATE, B.TEMPLATE_STATUS TEMPLATE_STATUS, B.USE_ALIAS_TABLE USE_ALIAS_TABLE, B.DS_APP_SHORT_NAME DS_APP_SHORT_NAME, B.DATA_SOURCE_CODE DATA_SOURCE_CODE, L.LOB_TYPE LOB_TYPE FROM XDO_LOBS L, XDO_TEMPLATES_B B WHERE L.APPLICATION_SHORT_NAME= :1 AND L.LOB_CODE = :2 AND L.APPLICATION_SHORT_NAME = B.APPLICATION_SHORT_NAME AND L.LOB_CODE = B.TEMPLATE_CODE AND (L.LOB_TYPE = 'TEMPLATE' OR L.LOB_TYPE = 'MLS_TEMPLATE') AND ( (L.LANGUAGE = :3 AND L.TERRITORY = :4) OR (L.LANGUAGE = :5 AND L.TERRITORY = :6) OR (L.LANGUAGE= B.DEFAULT_LANGUAGE AND L.TERRITORY= B.DEFAULT_TERRITORY ))
    at oracle.apps.xdo.oa.schema.server.TemplateInputStream.initStream(TemplateInputStream.java:403)
    at oracle.apps.xdo.oa.schema.server.TemplateInputStream.<init>(TemplateInputStream.java:236)
    at oracle.apps.xdo.oa.schema.server.TemplateHelper.getTemplateFile(TemplateHelper.java:1164)
    Regards
    Dharma

    what you can't understand?
    OPP.log tell you what no lob for template (layout as rtf, pdf) in tables XDO_LOBS and XDO_TEMPLATES_B
    so you have the query for checking
    >
    Please gudie me to solve this error..
    >
    for AR Open Balances get appl_short_name
    find template by query from opp.log or by xml publisher resp
    check existing of template file

  • Reporting Issue   "Opening Balance values are going to Not Assigned Values"

    Hi Friends,
    Closing Balance values are perfectly showing but opening balance values are going to Not Assingned Values? I am not able to find it out.
    our query is built on PCA Daily Multiprovider.
    Pls Help.
    Thanks
    Asim

    Hi Ravish,
    Here are the details
    Stock values and quantities in the PCA cube of BW never show correctly at an article level due to an opening balance issue.  This reduces our ability to report on stocks at moving average price, i.e. anything that actually matches the financial values in the system. The issue arises because stock at the beginning of the year (quantity and value) for any site is only shown against an article of "Not assigned."  Stock movements during the year are shown against the appropriate article.(If you have a new site, the will have stock assigned against an article up until 31 December and then the 31 December values are shown against "not assigned" for the next year).
    Thanks
    Asim

  • Difference in Trial Balance & Legder report because Zeero opening balance appearing in Trial balance for some accounts

    Hi Experts,
    When I am generating System trial balance report, it shows null in opening balance column for some of accounts while ledger for respective accounts are showing correct figure of opening balance.
    And because of this my trial balance showing wrong figures
    Also, I have checked it through query report, it showing same opening balance figure as ledger report.
    (Attachment for trial Bal, Ledger & Query reports for one of the account are attached here)
    I have checked all selection criteria in Trial balance report, but nothing is working.
    Please suggest me any solution for for above issue.
    regards,
    Raviraj

    Hi Raviraj
    Can you confirm In Trail Balance Opening balance for the Period is OB Starts from Company Activity.
    With Regards
    Balaji Sampath

  • FI_GL Line items-Opening Balance

    Hi Frieds,
    We have installed 0FI_GL_4 datasource and loaded data 0FIGL_O02 DSO. We have bulit a cube based the 0FIGL_O02 and passing the data from 0FIGL_O02 to Newly created custom cube.  We are now building report called Trail Balance. In the report i have to show the GL Account, Opening balance and amount. Which key figure i have to use for Opening Balance. For the Amount we have direct key figure. Can we have chance to get Openong Balance with Amount Key figure.
    What is the procedure to get Openong Balance with FI-GL Line items. And how to design query to get opening balance.
    Thanks & Regards
    Anand

    Unfortunately period 000 is only available in the totals table and the 0FI_GL_6
    Normally you can do one of two things..
    Opening balance = 0fi_gl_6 for period minus 1
    Detailed movements = 0fi_gl_4
    CLosing balance = Opening + movements
    (difference) = 0fi_gl_6 for period minus closing balance (this is just there for a check)
    The other way to do it is..
    Opening balance = 0fi_gl_4 for 01.01.1900 up to period minus 1 month (for balance sheet only) - for P&L you need to go from the beginning of the year up to period -1
    Detailed Movements = 0fi_gl_4
    CLosing balance = Opening + movements
    The problem with using the second one it the read from the begninning of time to get the balance sheet data (rathere than period 000 which you can do in the fi_gl_6 extractor) you will always end up with incorrect data for retained profit - this is because no journal in bseg (0fi_gl_4) is posted for the closing down of retained profit in the prvious financial year - it is posted by a hard hack(!) into period 000 of the followin gyear into the balance sheet

  • GL Line items and Opening balance extraction

    Hi
    I would like to extract BSEG line item details into BI, and this I can achieve using the extractor 0FI_GL_4 (we are still using the old GL ledger). We need to have the WBS and Profit Center fields for this extractor, and this availble in the BSEG
    However, as we know this extractor does not bring in the opening balances.
    We need to have opening balances as well and this can be achieved using the extractor 0FI_GL_6. But this does not have the fields WBS and Profit Center. Can this totals extracor be enhanced to include these two fields or would this become a very big challenge? If it can be done what tables can be used to do the join.
    Thanks

    Hi Bal
    Check the link below if it answers your query.
    FI_GL Line items-Opening Balance
    Regards
    Anindya

  • Opening Balance only for Assets and Liabilities in Trial Balance Report

    Hi SAP B1 members,
    Following is my query :
    I would like to see the Opening balance in the Trial Balance report only for Assets and Liabilities and not for Revenue and Expenses.Though the other details such as Debit,Cumulative balance etc should be seen for all Assets,Liabilities,Revenues and Expenses.Kindly help.

    Hi,
    You can try the option of running the Trail Balance for Assets and Liabilities with the Opening Balance checkbox and the other for revenue and other drawers without checking the Opening Balance.
    Export the values to Excel and consolidate the reports to get the required result(if that is what is needed).
    Kind Regards,
    Jitin
    SAP Business One Forum Team

Maybe you are looking for

  • Connect to Airport Express and Wireless Router (Linksys) at the same time?

    I have a laptop that connects to a Linksys wireless G (WRT54G) router. I just got an Airport Express to play iTunes wirelessly over my stereo. Is there a way to connect to both the Linksys router and the Airport at the same time - i.e., connect to th

  • Trying to understand rollback segments - offline tblspaces for backup

    Using Oracle 8i, on Windows platform - The question - receive an error ORA-01556 when performing a sql "ALTER TABLESPACE MY_TBS_LT OFFLINE IMMEDIATE"; ============================================= First off I created a tablespace and table on an 8i d

  • Mac Mini + Dell 2707 WFP via Denon AVR4310 = no image

    Hi, I have the above setup (having upgraded from a Yamaha RXV2700). I can get all my other devices to work alright-but am having no end of trouble with the Mac Mini. The Denon is Connected to the Dell with a HDMI-DVI plug, and the mini is connected t

  • "CREATE EDITION" command in Oracle 11g r1

    Hi all, I am trying create edition, but I get the following response. <pre> SQL> select * 2 from dba_editions 3 / EDITION_NAME PARENT_EDITION_NAME USA ORA$BASE YES SQL> create edition e2 2 / create edition e2 ERROR at line 1: ORA-00901: invalid CREAT

  • Re: Restoring windows after sudden shut down during updating

    Hi everyone, Last night I was updating my windows on my Toshiba laptop, however, my laptop had a sudden shut down during the updating process. Now when I start my laptop, I am prompted that a system error occurred and I have to insert my windows CD t