Stock Statement - Opening & Closing Values

Hi Guys,
I am using the below query for  opening & Closing Stock Report.
select a.ItemCode,a.Des, a.WareHouse , (SELECT (sum(t1.inqty - t1.outqty))
FROM OINM t1 
WHERE (T1.DocDate < '[%1]') and (t1.itemcode = a.itemcode) and
(t1.warehouse = a.whs) ) as 'OB',
a.Price,a.inqty as 'Goods Receipt',a.outqty as 'Goods Issue',
(SELECT (sum(t1.inqty) - sum(t1.outqty))
FROM OINM t1  
WHERE (T1.DocDate <= '[%2]') and
(t1.itemcode = a.itemcode) and (t1.warehouse = a.whs)) as 'Closing',
(SELECT (sum (t1.transvalue))
FROM OINM t1  
WHERE (T1.DocDate <= '[%2]') and (t1.itemcode = a.itemcode) and
(t1.warehouse = a.whs)) as 'ClosingValue'
from (SELECT max(T0.[ItemCode]) as 'ItemCode',
max(T0.[Dscription]) as 'Des',sum(T0.[InQty]) as 'InQty', sum(T0.[OutQty]) 'OutQty',
t0.warehouse as 'whs' ,
(select w1.whsname from owhs w1 where w1.whscode = t0.warehouse) as 'Warehouse',
avg(T0.[Price]) as 'Price'
FROM OINM T0 
inner join oitm o1 on o1.itemcode = t0.itemcode
inner join oitb o2 on o2.itmsgrpcod = o1.itmsgrpcod 
WHERE (T0.[DocDate] >= '[%1]' and  T0.[DocDate] <= '[%2]')  and
(TransType != '10000071'  and Transtype !='67' ) and
(o2.itmsgrpnam >= '[%3]' and o2.itmsgrpnam <= '[%4]' )
group by T0.[ItemCode],t0.warehouse)a
But i need some changes in the Report and  below is the selection criteria,
Pls somebody help me in achieveing this.
Report 1:
Item Group: Group B
u2022 Column: Goods Issue
Field to be fetched: Invoice Qty. for the respective FG items
From Ware House No.: 02
Fetching type: Cumulative for given date range
u2022 Column: Goods Receipt
Field to be fetched: Receipt from Production for FG items
Receipt Warehouse: 02
Fetching type: Cumulative for given date range
Report 2:
For Item Groups- Accessories, Consumables & Raw materials:
Column: Goods Issue
Issue from Warehouse No.: 08 ,33
Field to be fetched: Issue for Production (BoM qty-Back-flush & Manual issue by system)
Fetching type: Cumulative for given date range
Column: Goods Receipt
Receiving Warehouse No.: 08 ,33
Field to be fetched: GRPO qty. against respective Purchase Order.
Fetching type: Cumulative for given date range
Report 3:
For Item Group-WIP
Column: Goods Issue
Issue from Warehouse No: 04,09,17,18,20,21,23,28,29,30,31,32,34,38,39,44,45,46
Fields to be fetched: All types of issues ( Issue for prodn. through Prodn.order, GI &
Inventary Transfer)
Fetching type: Cumulative for given period.
Column: Goods Receipt
Receiving Warehouse Nos:04,09,17,18,20,21,23,28,29,30,31,32,34,38,39,44,45,46
Fields to be fetched: All types of Receipt (Receipt from Prodn. through Prodn.order, GR )
Fetching Type: Cumulative for given period.
Regards,
Vamsi

Dear Srini,
Yes of-course Tally shows OB,and Closing balance at a particular time, SAP B1 Shows them too, but in a different manner.
1. Suppose , you have given OB to SAP on 01/04/10.(which is actually the closing balance of Tally as on 31/03/10).
    Under trial balance report OB Column is there.
     If you are trying to populate Tally's OB of 01/04/09, You Can't.
2. Getting the OB at a particular time in SAP, depends how you are maintaining your Posting Periods.
For Closing balance in SAP, The last column -'Balance' is actually the Closing balance as on the date for you are running Trial Balance Report.
Hope this will help you.
Best Regards
Ashutosh T

Similar Messages

  • Spry Panel State - open/closed ?

    Hello Guys/Gals,
    I don't want to re-invent the wheel here if at all possible...
    Has anyone ever included the Spry Collapsible Panel in menu by PHP Includes?
    Here is what I need to accomplish, the spry panels are in 1 file which is included throughout the entire site with php includes.
    I need the open/closed state to be remembered - so if you open panel #2 and click a link, you end up on that page with only panel #2 open.
    If the user closes that panel, then the panel is closed on any page visited.
    Tracking user with cookies or what?
    Can someone point me to any example code for this?
    Thanks,
    RD

    Does this help:
    http://www.spry-it.com/examples/spry-widget-cookie-history/
    http://www.spry-it.com/examples/spry-widget-cookie-history/#collapsiblepanel

  • How to maintain the state(opened/closed) of a Hierarchical expanding list

    Hi,
    I've created a list with template "hierarchical expanding". When I click on the list node to go to a page, page related to the node appears but the tree doesn't remain expanded. It always shrinks back to the highest level.
    Please suggest a solution.
    Regards,
    Gaurav.

    Hi,
    use a setPropertyListener to save the row key of this select item and then restore this key as the current selected key.
    Frank
    Ps.: I don't ask why you call clearForRecreate() on the iterator. I am sure you have a reason.

  • Opening & Closing Stock in P&L Statement

    Dear All,
    My client is using Tally software preior to SAP B1 Implementation. In Tally the P/L satatment shows  Opening Stock , purchases and  Closing Stock ledgers.We are not using Purchase Accounts posting system. How to map the existing SAP Ledgers  according to Tally. We are using SAP B1 2007 B.
    Please help me to map the G/L accoring to the above requirements.
    Thanks
    Srini

    Dear Srini,
    Yes of-course Tally shows OB,and Closing balance at a particular time, SAP B1 Shows them too, but in a different manner.
    1. Suppose , you have given OB to SAP on 01/04/10.(which is actually the closing balance of Tally as on 31/03/10).
        Under trial balance report OB Column is there.
         If you are trying to populate Tally's OB of 01/04/09, You Can't.
    2. Getting the OB at a particular time in SAP, depends how you are maintaining your Posting Periods.
    For Closing balance in SAP, The last column -'Balance' is actually the Closing balance as on the date for you are running Trial Balance Report.
    Hope this will help you.
    Best Regards
    Ashutosh T

  • Opening and Closing values on two separate rows for an indvidual A/c?

    Hi / Salam To all SAP Members,
    I am creating a COGS report in which i need to show opening and closing values for a stock account in two separate rows. The tool i am using is report painter.
    What i need to know is how can the system identify between opening and closing values for that account? Which characteristic/s do i need to include in the rows? The table i am using is FAGLFLEXT.
    Please provide help.
    Regards,
    Mohammed Ali Khan.

    Resolved Issue.

  • Opening & Closing closing Stock

    Dear Experts,
                        Please find the below query for Opening and Closing Stock of RM, where in I have been trying to arrest the Inventory Transfer quantity & Value  in IN QTY & OUT QTY. I used Transtype<> 67 to arrest but the same is not working out for me...
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare
    @ItmsGrpNam varchar(100)
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >= '[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
    select
    @ItmsGrpNam = max(s2.ItmsGrpNam) from dbo.OITB S2 Where S2.ItmsGrpNam ='[%2]'
    Select  a.Itemcode, max(a.Dscription) as ItemName,
    (Select i.InvntryUom from OITM
    i where i.ItemCode=a.Itemcode) as UOM,
    sum(a.OpeningBalance) as OpeningBalance,
    sum(a.OpeningValue) as OpeningValue,
    sum(a.INq) as 'IN',
    (select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE
    AND T100.DOCDATE >=
    @FROMDATE
    AND T100.DOCDATE <=
    @TODATE AND T100.INQTY
    <> 0) AS [IN Stock Value],
    sum(a.OUT) as OUT,
    (select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE
    AND T100.DOCDATE >=
    @FROMDATE
    AND T100.DOCDATE <=
    @TODATE AND T100.OUTQTY
    <> 0)*-1 AS [OUT Stock Value],
    ((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,
    (select SUM(T100.TRANSVALUE) from oinm T100 WHERE
    T100.ITEMCODE
    = A.ITEMCODE AND T100.DOCDATE < @TODATE) AS [Closing Value Transaction],
    (Select i.LastPurDat from OITM
    i where i.ItemCode=a.Itemcode) as 'Last Purchase Date',
    (Select b.ItmsGrpNam from OITB
    b where
    b.ItmsGrpCod =
    I1.ItmsGrpCod) as 'Group Name'
    from( Select  N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
    as
    OpeningBalance,
    (sum(N1.Transvalue))
    as
    OpeningValue,
    0 as
    INq, 0 as OUT From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
    inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
    Where N1.DocDate <@FromDate
    and b.ItmsGrpNam
    = @ItmsGrpNam
    Group By N1.ItemCode,N1.Dscription
    Union All
    select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue,
    sum(N1.inqty) , 0 as OUT From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
    inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
    Where N1.DocDate >=
    @FromDate and N1.DocDate
    <= @ToDate
    and N1.Inqty >0  and b.ItmsGrpNam =
    @ItmsGrpNam
    Group By N1.ItemCode,N1.Dscription
    Union All
    select  N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue, 0 , sum(N1.outqty) as OUT
    From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
    inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
    Where N1.DocDate >=
    @FromDate
    and N1.DocDate <=@ToDate
    and N1.OutQty > 0 and  b.ItmsGrpNam = @ItmsGrpNam
    and N1.Transtype = '67'
    Group By N1.ItemCode,N1.Dscription) a, dbo.OITM I1 ,OITB b1
    where a.ItemCode=I1.ItemCode
    and I1.ItmsGrpCod = b1.ItmsGrpCod
    Group By a.Itemcode ,I1.ItmsGrpCod , b1.ItmsGrpNam 
    Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0
    Order By a.Itemcode
    Thanks,
    Bhoopathi.K

    Hi,
    Removed transtype  67 from above query. Try this:
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @ItmsGrpNam varchar(100)
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >= '[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
    select @ItmsGrpNam = max(s2.ItmsGrpNam) from dbo.OITB S2 Where S2.ItmsGrpNam ='[%2]'
    Select  a.Itemcode, max(a.Dscription) as ItemName, (Select i.InvntryUom from OITM
    i where i.ItemCode=a.Itemcode) as UOM, sum(a.OpeningBalance) as OpeningBalance, sum(a.OpeningValue) as OpeningValue,sum(a.INq) as 'IN',
    (select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE AND t100.transtype <> '67' and  T100.DOCDATE >= @FROMDATE
    AND T100.DOCDATE <= @TODATE AND T100.INQTY <> 0) AS [IN Stock Value],
    sum(a.OUT) as OUT,
    (select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE AND t100.transtype <> '67' and T100.DOCDATE >= @FROMDATE AND T100.DOCDATE <=
    @TODATE AND T100.OUTQTY <> 0)*-1 AS [OUT Stock Value],
    ((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,
    (select SUM(T100.TRANSVALUE) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE AND T100.DOCDATE < @TODATE) AS [Closing Value Transaction],
    (Select i.LastPurDat from OITM i where i.ItemCode=a.Itemcode) as 'Last Purchase Date',
    (Select b.ItmsGrpNam from OITB b where b.ItmsGrpCod = I1.ItmsGrpCod) as 'Group Name'
    from( Select  N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty)) as
    OpeningBalance,
    (sum(N1.Transvalue)) as
    OpeningValue,
    0 as
    INq, 0 as OUT From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
    Where N1.DocDate <@FromDate
    and b.ItmsGrpNam
    = @ItmsGrpNam and N1.Transtype <> '67'
    Group By N1.ItemCode,N1.Dscription
    Union All
    select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue,
    sum(N1.inqty) , 0 as OUT From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
    inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
    Where N1.DocDate >=
    @FromDate and N1.DocDate
    <= @ToDate
    and N1.Inqty >0  and b.ItmsGrpNam =
    @ItmsGrpNam and N1.Transtype <> '67'
    Group By N1.ItemCode,N1.Dscription
    Union All
    select  N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue, 0 , sum(N1.outqty) as OUT
    From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
    inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
    Where N1.DocDate >=
    @FromDate
    and N1.DocDate <=@ToDate
    and N1.OutQty > 0 and  b.ItmsGrpNam = @ItmsGrpNam
    and N1.Transtype <> '67'
    Group By N1.ItemCode,N1.Dscription) a, dbo.OITM I1 ,OITB b1
    where a.ItemCode=I1.ItemCode
    and I1.ItmsGrpCod = b1.ItmsGrpCod
    Group By a.Itemcode ,I1.ItmsGrpCod , b1.ItmsGrpNam 
    Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0
    Order By a.Itemcode
    Thanks & Regards,
    Nagarajan

  • Opening & Closing Stock in transit

    Hi All,
    I Developed an abap report for Yield Statement with opening & closing Stock Quantities.
    How to Find opening & Closing For transit Stock for 641 movement.I mean how to display the current transit stocks date wise at plant level without SLOC.
    I Knew that current transit stock would be in Marc Table & previous closings in March Tables.
    I'm looking for the date logic with respect to displaying opening & closing dates of transit stock.Be it Date Wise Or Month Wise.
    Any help would be greatly appreciated.
    Thanks & Regards,
    Ravi S

    Hi Ravi,
    Please find the Link below hope they are very useful to you
    [Stock|Re: closing stock of a particular date]
    [Stock|Tables/FM for opening/closing stock for material on given posting date]
    Thanks
    kalyan

  • Tables/FM for opening/closing stock for material on given posting date

    Hi All,
    I had requirement of find the opening/closing stock for material on given posting date. The values we can find out using TCode - MB5B.
    But I cannt use MB5B to extract data because I need to find detials for thousands of material.
    Can you please adivce if their is any FM or tables through which i can find this detial on any given date apart from current date.
    Thanks & Regards,

    Hi,
    [https://forums.sdn.sap.com/click.jspa?searchID=19631709&messageID=6593903]
    [https://forums.sdn.sap.com/click.jspa?searchID=19631709&messageID=6630975]

  • Storage location wise Opening/Closing Stock on posting date (mb5b)

    Hi,
    Report mb5b gives opening stock and closing stock as on date. In the selection screen, if we do not enter specific storage location then the opening/closing stock is displayed as sum of all storage location stocks for a given material.
    Where as if we enter storage location, it gives storage location specific output. (with Storage loc/batch stock radio button)
    My requirement is - without entering storage location in the initial screen, the system should display storage location specific opening/closing stock.
    To get this, presently I need to execute mb5b transaction individually for every storage location.
    Warm regards,
    MS

    Hi Madhavi
    This report you can have in T code MC.6 and another t code for opening and closing stock in t code MC.9
    Regards
    Vivek
    -- Reward if helpful
    Edited by: Supergene on Feb 28, 2008 3:17 PM

  • Error: ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.(System.Data)

    Dear all,
    Can any one explain about this error,
    2014-11-02 19:19:29.58    *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) ***
    2014-11-02 19:19:29.58    *** Error: ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.(System.Data) ***
    2014-11-02 19:19:29.58    Deleting log backup file. File: '\\Jdccb-mis\logshipping\JDCCBPROD_20141030134512.trn', Last Write Time (UTC): '10/30/2014 1:45:13 PM'
    2014-11-02 19:19:29.60    *** Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) *****
    This errors comes on My Secondary server during log shipping and database goes to restore mode.
    satish Kumar

    Hi Krishnp,
    These are the latest jobs in queue:
    89 Quadro de Horários 28/6/2014 1:45  N/D Arquivar Configurações do Sistema Aguardando Processamento 0%  
     88 Quadro de Horários 28/6/2014 1:30  N/D Arquivar Modos de Exibição do Project Web App Aguardando Processamento 0%  
     87 Quadro de Horários 28/6/2014 1:00  N/D Arquivar Campos Personalizados Aguardando Processamento 0%  
    When I delete the last work automatically related are excluded.
    Currently the queue is 406 jobs.
    David Soares MCTS:MBS - MCTS - MCITP

  • Opening & Closing Stock - Query Correction

    Dear Experts,
                             Please find the below query, where I need IN quantity & values , OUT quantity& values should  pick only from  Standard Production Order , whereas  it should not pick from special Production Order. Rest all in the same is sufficient for me.
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @ItmsGrpNam varchar(100)
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >= '[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
    select @ItmsGrpNam = max(s2.ItmsGrpNam) from dbo.OITB S2 Where S2.ItmsGrpNam ='[%2]'
    Select  a.Itemcode, max(a.Dscription) as ItemName,
    (Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM,
    sum(a.OpeningBalance) as OpeningBalance,
    sum(a.OpeningValue) as OpeningValue,
    sum(a.INq) as 'IN',
    (select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE
    AND T100.DOCDATE >= @FROMDATE
    AND T100.DOCDATE <= @TODATE AND T100.INQTY <> 0) AS [IN Stock Value],
    sum(a.OUT) as OUT,
    (select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE
    AND T100.DOCDATE >= @FROMDATE
    AND T100.DOCDATE <= @TODATE AND T100.OUTQTY <> 0)*-1 AS [OUT Stock Value],
    ((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,
    (select SUM(T100.TRANSVALUE) from oinm T100 WHERE
    T100.ITEMCODE = A.ITEMCODE AND T100.DOCDATE < @TODATE) AS [Closing Value Transaction],
    (((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT))*
    ISNULL((SELECT CASE WHEN
    X.PRICE = 0
    THEN
    (SELECT DISTINCT MAX(ISNULL(P.PRICE,0)) AS PRICE FROM ITM1 P WHERE PRICELIST = 1 )
    ELSE
    X.PRICE
    END
    FROM (SELECT
    DISTINCT MAX(ISNULL(B.PRICE,0)) AS PRICE
    FROM OITM T
    LEFT JOIN PCH1 B ON T.ITEMCODE = B.ITEMCODE
    INNER JOIN OPCH C ON B.DOCENTRY = C.DOCENTRY
    WHERE B.DOCENTRY =  (SELECT DISTINCT (MAX(D.DOCENTRY)) FROM OPCH D WHERE C.DOCENTRY = D.DOCENTRY
    AND C.DOCDATE <= @ToDate )
    AND A.ITEMCODE = T.ITEMCODE) X ),0))
    --(Select i.LstEvlPric from OITM i where i.ItemCode=a.Itemcode))
    as 'Closing Value',
    (Select i.LastPurDat from OITM i where i.ItemCode=a.Itemcode) as 'Last Purchase Date',
    --(Select i.LstEvlDate from OITM i where i.ItemCode=a.Itemcode) as 'Last Issue Date',
    --(Select i.ItmsGrpCod from OITM i where i.ItemCode=a.Itemcode) as 'Group code',
    (Select b.ItmsGrpNam from OITB b where  b.ItmsGrpCod = I1.ItmsGrpCod) as 'Group Name'
    from( Select  N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
    as OpeningBalance,
    (sum(N1.Transvalue))
    as OpeningValue,
    0 as INq, 0 as OUT From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
    inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
    Where N1.DocDate <@FromDate and b.ItmsGrpNam = @ItmsGrpNam
    Group By N1.ItemCode,N1.Dscription
    Union All
    select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue,
    sum(N1.inqty) , 0 as OUT From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
    inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
    Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate
    and N1.Inqty >0  and b.ItmsGrpNam = @ItmsGrpNam
    Group By N1.ItemCode,N1.Dscription
    Union All
    select  N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue, 0 , sum(N1.outqty) as OUT
    From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
    inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
    Where N1.DocDate >= @FromDate and N1.Transtype != 67
    and N1.DocDate <=@ToDate and N1.OutQty > 0 and  b.ItmsGrpNam = @ItmsGrpNam
    Group By N1.ItemCode,N1.Dscription) a, dbo.OITM I1 ,OITB b1
    where a.ItemCode=I1.ItemCode
    and I1.ItmsGrpCod = b1.ItmsGrpCod
    Group By a.Itemcode ,I1.ItmsGrpCod , b1.ItmsGrpNam 
    Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0
    Order By a.Itemcode
    Thanks in Advance,
    Bhoopathi.K

    Hi,
    Try this:
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @ItmsGrpNam varchar(100)
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >= '[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
    select @ItmsGrpNam = max(s2.ItmsGrpNam) from dbo.OITB S2 Where S2.ItmsGrpNam ='[%2]'
    Select  a.Itemcode, max(a.Dscription) as ItemName,
    (Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM,
    sum(a.OpeningBalance) as OpeningBalance,
    sum(a.OpeningValue) as OpeningValue,
    sum(a.INq) as 'IN',
    (select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE
    AND T100.DOCDATE >= @FROMDATE
    AND T100.DOCDATE <= @TODATE AND T100.INQTY <> 0) AS [IN Stock Value],
    sum(a.OUT) as OUT,
    (select SUM(ISNULL(T100.TRANSVALUE,0)) from oinm T100 WHERE T100.ITEMCODE = A.ITEMCODE
    AND T100.DOCDATE >= @FROMDATE
    AND T100.DOCDATE <= @TODATE AND T100.OUTQTY <> 0)*-1 AS [OUT Stock Value],
    ((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,
    (select SUM(T100.TRANSVALUE) from oinm T100 WHERE
    T100.ITEMCODE = A.ITEMCODE AND T100.DOCDATE < @TODATE) AS [Closing Value Transaction],
    (((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT))*
    ISNULL((SELECT CASE WHEN
    X.PRICE = 0
    THEN
    (SELECT DISTINCT MAX(ISNULL(P.PRICE,0)) AS PRICE FROM ITM1 P WHERE PRICELIST = 1 )
    ELSE
    X.PRICE
    END
    FROM (SELECT
    DISTINCT MAX(ISNULL(B.PRICE,0)) AS PRICE
    FROM OITM T
    LEFT JOIN PCH1 B ON T.ITEMCODE = B.ITEMCODE
    INNER JOIN OPCH C ON B.DOCENTRY = C.DOCENTRY
    WHERE B.DOCENTRY =  (SELECT DISTINCT (MAX(D.DOCENTRY)) FROM OPCH D WHERE C.DOCENTRY = D.DOCENTRY
    AND C.DOCDATE <= @ToDate )
    AND A.ITEMCODE = T.ITEMCODE) X ),0))
    --(Select i.LstEvlPric from OITM i where i.ItemCode=a.Itemcode))
    as 'Closing Value',
    (Select i.LastPurDat from OITM i where i.ItemCode=a.Itemcode) as 'Last Purchase Date',
    --(Select i.LstEvlDate from OITM i where i.ItemCode=a.Itemcode) as 'Last Issue Date',
    --(Select i.ItmsGrpCod from OITM i where i.ItemCode=a.Itemcode) as 'Group code',
    (Select b.ItmsGrpNam from OITB b where  b.ItmsGrpCod = I1.ItmsGrpCod) as 'Group Name'
    from( Select  N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
    as OpeningBalance,
    (sum(N1.Transvalue))
    as OpeningValue,
    0 as INq, 0 as OUT From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
    inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
    Where N1.DocDate <@FromDate and b.ItmsGrpNam = @ItmsGrpNam
    Group By N1.ItemCode,N1.Dscription
    Union All
    select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue,
    sum(N1.inqty) , 0 as OUT From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
    inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
    Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate
    and N1.Inqty >0  and b.ItmsGrpNam = @ItmsGrpNam
    Group By N1.ItemCode,N1.Dscription
    Union All
    select  N1.Itemcode, N1.Dscription, 0 as OpeningBalance,0 as OpeningValue, 0 , sum(N1.outqty) as OUT
    From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
    inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod left join OWOR t0 on t0.docentry = N1.[AppObjAbs]
    Where N1.DocDate >= @FromDate and N1.Transtype != 67
    and N1.DocDate <=@ToDate and N1.OutQty > 0 and  b.ItmsGrpNam = @ItmsGrpNam and  T0.[Type] = 's'
    Group By N1.ItemCode,N1.Dscription) a, dbo.OITM I1 ,OITB b1
    where a.ItemCode=I1.ItemCode
    and I1.ItmsGrpCod = b1.ItmsGrpCod
    Group By a.Itemcode ,I1.ItmsGrpCod , b1.ItmsGrpNam 
    Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0
    Order By a.Itemcode
    Thanks & Regards,
    Nagarajan

  • Daily stock statement by location in dp value

    hi guys,
    iam using the t.code mb52 for daily stock statement by location in dp value report. i have to dipspaly the date wise 4 locations i.e ( snt,sabh,sarawak,departement). these are the 4 locations and i want total sum of snt sabah etc of cost in date wise. so how to find out the cost of particular locations.
    Thanks & Regards,
    praveen.

    Perfect - many thanks for the quick response. Points have been awarded.

  • Daily Stock Statements by location  in dp value report

    hi guys,
    iam using the t.code mb52 for daily stock statement by location in dp value report. i have to dipspaly the date wise 4 locations i.e ( snt,sabh,sarawak,departement). these are the 4 locations and i want total sum of snt sabah etc of cost  in date wise. so how to find out the cost of particular locations.
    Thanks & Regards,
    praveen.

    Perfect - many thanks for the quick response. Points have been awarded.

  • Limit Values in Open/closed Activities of BP Page

    Hi,
    On the BP overview page we have views displayed for 'Open Activities' and 'Closed Activiities'. By default they would display all open/closed activities. After a while this can become a lot (and slow, and not very useful).
    So, there is a view (CRMV_ACC_1O_CUST) where we can customise the time frame of activities that we wish to see. Our problem is that none of the time frames there are useful to us.
    We can choose, 'This Year', which is useless in January or we can choose, "Last Year', which is useless in general. What we can't choose is, 'From last year until today'. That would, of course, be entirely useful.
    The entries in the customising table take the form Y-1, Y A, Y1 etc and these formulae are translated at run time to an actual date range. This is hard coded in a CASE statement in FORM build_the_query of Include LCRM_BSP_OIC_1O_SEARCHF01 so changes can only be done as a repair.
    The way the standard works is that Y+-1, if run on date 20120126, will return the date range 20110101 - 20111231. This means that we won't see any open activities from January. Y A, which means current year will return the from date as 20120101, which means that we won't see open activities from December.
    I read about the BAdI CRM_BP_UIU_BT, which would allow us to inject our own selection parameters; but I can't seem to work out which parameter names should be used for activity start/end dates. Pushing 'STARTDATE', 'FROM' etc result in an empty activities table being displayed.
    What I would like, of course, is that Y+-1 would return 20110101 - 20120126 when executed on 20120126. Or to create a new entry such as Y*1 which would mean one year either side of the given date. I can make a repair to the standard code, but I'd rather not have to perform a repair to write my own logic for dates range.
    Any other ideas? I assume we're not the only people using the 'Open Activities' view; how did the rest of you handle January?
    Thanks for your time,
    P.

    Hi,
    We got an answer from OSS;
    For your business requirement, in order to set up a time frame option
    like 'last 12 months', you need to extend the customizing table:
    "CRMT_ACC_1O_CUST". You can define your own time frame as below.
    I will provide a sample for it:
    ***********************Creating Time Frames***************************
    1. Go to Tx: SE16.
    2. Enter the table TSCTFGROUP.
    3. Create new records here with the following details:
    (Please ensure that you enter a sort order that doesn't already exist)
    APPL NAME TIMEENTITY LENGTH DEF FLAG SORT ORDER
    CRM_1O_LOC M+ - 12 <blank> 14
    4. Go to Tx:SE16.
    5. Enter the table TSCTFGRT.
    6. Create new records here with the following details:
    (This table is to create the text. Please ensure that you create here
    as many records as you have created in the above step 3)
    LANGU APPL_NAME TIMEENTITY LENGTH TF_TEXT
    EN CRM_1O_LOC M+ -12 last 12 months
    7. If needed, enter the same records in other required languages also.
    After this, time frame 'last 12 months' will be visible in the selection list. Now You can select this time frame in the SPRO customizing for certain business transactions. But above changes are not standard changes If you upgrade CRM landscape to higher versions/packages, you will have to transport these changes manually.
    That was the answer, we've done as was suggested and things are fine now.
    You can have a programmer look at
    Include: LSSC_RULESF03
    Form:  compute_dates_f
    To see how the formulae are translated at runtime.
    For instance, you'll see that you can create an entry such as D365, which means 365 days before until 365 days after today. However, in the code there is no way for M or Y* to be translated; a programmer can explain that to you if required.
    I hope that this helps someone at some point,
    Patrick.

  • AGE WISE CLOSING STOCK STATEMENT

    Dear All,
    Kindly send me your valuable inputs with regard to getting the detailed closing stock statment with AGE wise details ( above 60 days / 90 days / 120 days / 180 days,
    etc ) - if it is possible immediately.
    Thanks & regards
    G. Janarthanan
    Edited by: N-Power FI TEAM on Feb 11, 2008 6:17 AM

    Hi,
    Please send me the details with regard to getting the AGE wise Stock statement as mentioned in my earlier mail.
    Thanks
    G. Jana

Maybe you are looking for

  • Flex with Eclipse WST

    Hi I'am new to Flex, I like to get started using Flex, ActionScript3 using Eclipse IDE.. Iam looking for some tutorial or workshop article how to get Flex with Eclipse IDE.

  • When I launch firefox 3.6.8 2 tabs open for my home page instead of just one.

    Just installed 3.6.8. At launch 2 tabs are opened, both for my home page. I have closed out several times and relaunched but each time 2 tabs are opening. Just looked at the plug-ins listed below and have no idea why I would have a plug-in for Netsca

  • Whts the role of exchangeProfile in XI?

    I'm bit confused about role exchange profile in XI. Could some one help me understanding it? Sheetal

  • [SOLVED] Cannot open x apps with sudo

    Hi all, I just did a fresh install of kde in Arch, and I cannot open any x server apps, like kwrite, using "sudo kwrite". I tried xhost +localhost and my user name, but that didn't work. Then I tried tweaking the $DISPLAY... I couldn't get anything t

  • History Columns Unable to Track Changes.

    Hi, I am creating a row from trigger, based on some action in jspx page. The history columns are not able to track row stats as CREATED_BY, CREATED_ON & so on. Since, new row creation is not invoked by application layer, history columns not get updat