Open and closed order reports

Hi,
Please anyone tell me how we can find which orders are open order & which are closed orders??
Also the difference in the recognition between WIP Sales order and Closed Sales order??
Regards,
Roma

Hey,
I know about open and sales order. Actually i have to make an open order report, a WIP order report and a closed order report. And i know we can make these reports from the following:-
CHARACTERISTICS: Bill-to-party,Ship to party, sold to party, Company code,Plant,Sales organization ,Sales Office,Material Number,Deliver block
KEY FIGURES:orders,Open Orders,Order items,Subtotal,Net weight, open Quantity,Gross weight
But i dont know which characteristics and key figures we will use for open order report, which one are for WIP order report and also for closed order report.
Please do tell me how can i make these three reports.
Regards,
Roma

Similar Messages

  • Vendor Line item with Opening and Closing Balances report regarding

    Dear All,
    I need a report for vendor line items with Opening and Closing balances.
    Thanks in advance
    Sateesh

    Hi
    Try S_ALR_87012082 - Vendor Balances in Local Currency
    Regards
    Sanil Bhandari

  • Opening and closing stock report

    Hi,
    i have to develop  a report in abap of stock (Opening and closing stock) with each material, plant, business area & monthly date wise. I got some fields from mseg like material number, plant, business area but i didnt get fileds like opening stock, purchase, consumption & closing stock
    in report fileds should be like
    material number
    plant
    business area
    posting date
    opening stock
    purchase
    consumption
    closing stock
    kinldy help <removed by moderator>
    Moderator message: Welcome to SCN!
    Moderator message: please search for available information, ask a functional consultant near you.
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|Asking Good Questions in the SCN Discussion Spaces will help you get Good Answers]
    Edited by: Thomas Zloch on Nov 21, 2011 3:35 PM

    Yes umesh from external 99% of your stock from mvt 101, 501 is very rare case & 561 is not from external source it is initial stock updation which will be done only once when you are going live & later 561 mvt will be normally blocked for use.
    You can also sort in MB5B more than one movement type click on multiple selection (that is on yellow arrow icon) & in single value tab enter mvt 101 below that 501.
    This will give you report for mvt types 101 & 501 in this way you can also sort reports for more than one mvt type.
    Regards
    Rang
    Message was edited by:
            Ranganath Mysore

  • Opening and closing Stock report at Storage location level- date wise

    Dear all
    Is there any standard report to view opening and closing stock at storage location level? ( we have MB5B which resets the entry screen if we enter SLOC details).
    Thanks
    Sam

    Do  I have the option of  selecting Storage Location wise opening and closing stock on a particular date or period, that is what I have requested? Is it possible, evenafter selecting storageloc/batch stock and entering all the SLOCs in the selection creen, the report output does not contain any SLOC, and using ctrl+F8 or display variant does not have SLOC as a field also.
    pls gudie
    sam

  • Opening and closing Inventory report in CR

    Hi Experts,
    I want report like as below
    ItemCode     ItemDescription     OpeningStk      Reciept       Issue     ClosingStk
    Selection Criteria
    OpeningStk Date :  01 .01. 2013
    ClosingStk Date : 31.12.2013
    My working:
    OINM and OITM table inner join.
    select expert record for the closing stock.
    But for opening stock , how to achieve it ?
    Is it possible in single report to get my requirement?
    Thanks in advance,
    Dwarak

    Hi,
    Yes. i want the Opening stock, Reciept, Issue and Closing stock as per the date.
    Item Code
    Description
    Date
    Inqty
    Outqty
    sum of Opening
      Stock
    sum of reciept
    sum of reciept
    Closing Stock
    I0001
    Item A
    10-10-2013
    10
    0
    I0001
    Item A
    11-11-2013
    5
    0
    I0001
    Item A
    12-12-2013
    0
    10
    I0001
    Item A
    03-01-2014
    2
    0
    I0001
    Item A
    10-01-2014
    0
    1
    I0001
    Item A
    20-02-2014
    15
    0
    I0001
    Item A
    24-03-2014
    0
    12
    5
    17
    13
    9
    how to achieve this ?
    thanks in advance,
    Dwarak

  • Hai opening and closing stock

    Dear all
    iam trying to generate the opening and closing stock report for normal materials and sub contract material , so what logic i have to uss to generate the report
    1) opening stock its movement type
    2)recived movement types
    3) issues movement type
    4) closing stock
    standard t-code mb5b 
    i want to make new report,
    waiting for reply

    Have you tried with MB51 / MB52 ??
    Lakshmipathi

  • COPA reporting with open and closed projects

    Dear All,
    I am designing a COPA solution for an infrastructure providing company using project systems and posting to/settling out of projects on a monthly basis. Projects run for long periods and continually incurr costs and earn revenue untill they are closed. The requirement is to report by common characteristics (say customer group) and separately for open and closed projects. My issue is how to separate the line items of projects where status changed to closed (having posted with the status REL previously), from the open ones, without entering the projects individually in the selections screen.
    Any ideas will be greatly appreciated.
    Thanks,
    Maddy

    Dear Satya,
    http://help.sap.com/saphelp_erp2005/helpdata/en/75/ee0bbd55c811d189900000e8322d00/content.htm
    An item of a purchase requisition is only regarded as Closed if the requested order quantity has been included in a purchase order.
    You can also set an item to Closed manually. <b>This item will then not be taken into account by the materials planning and control system.</b>
    You can set the Closed indicator manually at the following points (it can later be cancelled if necessary):
    When changing a purchase requisition, on the item detail screen
    When creating a purchase order referencing a requisition, on the item detail screen of the PO
    You can still create purchase orders by referencing a requisition if this indicator has been set in the requisition concerned.
    The indicator can also be set in the case of automatic PO generation from purchase requisitions. On the initial screen of the requisition, you can specify that the requisition is to count as closed as soon as an associated purchase order has been generated, even if the complete quantity requested has not been ordered, for example (Set reqs. to "closed" indicator).
    Analyses of Purchase Requisitions:
    http://help.sap.com/saphelp_erp2005/helpdata/en/75/ee1fa755c811d189900000e8322d00/frameset.htm (visit section under Reporting in Purchasing)
    Hope this will help.
    Regards,
    Naveen.

  • MB5B Report table for Open and Closing stock on date wise

    Hi Frds,
    I am trying get values of Open and Closing stock on date wise form the Table MARD and MBEW -Material Valuation but it does not match with MB5B reports,
    Could anyone suggest correct table to fetch the values Open and Closing stock on date wise for MB5B reports.
    Thanks
    Mohan M

    Hi,
    Please check the below links...
    Query for Opening And  Closing Stock
    Inventory Opening and Closing Stock
    open stock and closing stock
    Kuber

  • Open and closing balances std report

    Dear All,
    please suggest me open and closing balances std report and can i suggest my user below t.code for viewing open and closing balnces for India scenarion T.code:J3RFLVMOBVED
    Regards
    Gopal.S

    hi
    kindly chk MB5B it will fullfill your requirement
    regards
    praveen.k

  • Material wise reciept and Issue report with Opening and Closing Stock

    Hi
    I need a report,Material wise Receipt and issue with Opening and Closing stock.Is there any standard report available in SAP ?
    Or we have to go for Customised Report.
    Please reply

    Hi,
    MB5B gives total receipts - if i click on the receipts i can view the multiple material documents - BUT is there any way to drill down the reciepts or view the breakup of the receipts on the same screen OR is there any other report for this.
    Regards,
    Laxmi

  • Inventory opening and closing stock with value report

    Hi All,
    Is it possible to get details of both opening and closing stock with value of each items of last financial year (2009-10) in inventory report?
    Mizan

    Hi..
    you can  try this query
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    set @FromDate =
        (Select min(S0.Docdate) from OINM S0 where S0.Docdate >='[%0]')
    set @ToDate =
        (Select max(S1.Docdate) from OINM S1 where S1.Docdate <='[%1]')
    select * from
        SELECT T0.itemcode,
        min(T0.Dscription) as 'Item Description',
        min(B1.ItmsGrpNam) as 'Item Group', W1.Whscode, C1.Location,
        (isnull((
            Select sum(isnull(inqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode
            and O1.Warehouse=W1.Whscode
            and O1.docdate<@FromDate ),0)-
        isnull((
            Select sum(isnull(outqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode
            and O1.Warehouse=W1.Whscode
            and O1.docdate<@FromDate),0)
        ) as [Opening Stock],
        isnull((
            Select sum(isnull(inqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode
            and O1.Warehouse=W1.Whscode
            and O1.docdate>=@FromDate
            and O1.docdate<=@ToDate and O1.inqty>0
            and O1.transtype in (20,18)),0
        ) as [Purchase Quantity],
        isnull((
            Select sum(isnull(outqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
            and O1.docdate>=@FromDate and O1.docdate<=@ToDate
            and O1.outqty>0 and O1.transtype in (21,19)),0
        ) as [Purchase Return Quantity],
       isnull((
            Select sum(isnull(outqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
            and O1.docdate>=@FromDate and O1.docdate<=@ToDate and O1.outqty>0
            and O1.transtype in (13,15)),0
        ) as [sale Quatity],
        (isnull
            Select sum(isnull(inqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
            and O1.docdate<=@ToDate),0
            isnull((
                Select sum(isnull(outqty,0))
                from OINM O1
                where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
                and O1.docdate<=@ToDate),0)
        ) as [Closing Stock]
        FROM OINM T0
        INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
        INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode
        INNER JOIN OITB B1 ON T1.ItmsGrpCod=B1.ItmsGrpCod
        INNER JOIN OWHS W1 ON T2.WhsCode = W1.WhsCode
        INNER JOIN OLCT C1 ON W1.Location=C1.Code
        Group by T1.itemcode, T0.Itemcode, W1.WhsCode, C1.Location
    ) a
    where (a.[Opening Stock]
            +a.[Purchase Quantity]
            + a.[Purchase Return Quantity]
            +a.[sale Quatity]+a.[Closing Stock]
           ) !=0
    Regards,
    Bhavank

  • Intersperse daily totals with opening and closing balance

    Hi All
    Suppose we have a data set (simplified from my query but will suffice)
      select 1 as daynum, 'CR' as trantype, 200 as amount from dual union all
      select 1 as daynum, 'DR' as trantype, -300 as amount from dual union all
      select 2 as daynum, 'CR' as trantype, 800 as amount from dual union all
      select 2 as daynum, 'DR' as trantype, -200 as amount from dual union all
      select 3 as daynum, 'CR' as trantype, 900 as amount from dual union all
      select 3 as daynum, 'DR' as trantype, -500 as amount from dual
    )How would you go about getting a result set that looks like:
    1, Opening Balance, 0
    1, CR, 200
    1, DR, -300
    1, Closing Balance, -100
    2, Opening Balance, -100
    2, CR, 800
    2, DR, -200
    2, Closing Balance, 500
    3, Opening Balance, 500
    3, CR, 900
    3, DR, -500
    3, Closing Balance, 900
    4, Opening Balance, 900
    4, Closing Balance, 900
    I'm thinking:
    generate an arbitrary number of rows for the number of days I want to report over (in this case, 4)
    cross join these with 2 row set of constants "opening" and "closing" balanace
    -> I have now an opening and closing balance row for every day
    union it with my data so that "opening/CLosing balance" is a type too (and nulls in the amount column)
    case when the type is like '%Balance' then sum(amount) over(order by day, orderkind rows unbounded preceding) else amount
    (orderkind is a constant 0 for opening, 1 for all the datarows, 2 for closing)
    Is it right?
    Is there a better way?
    Edited by: charred on Apr 1, 2010 7:03 AM

    Unless I'm missing something, Tom's answer won't work for more than 4 days?
    with t as
        select 1 as daynum, 'CR' as trantype, 200 as amount from dual union all
        select 1 as daynum, 'DR' as trantype, -300 as amount from dual union all
        select 2 as daynum, 'CR' as trantype, 800 as amount from dual union all
        select 2 as daynum, 'DR' as trantype, -200 as amount from dual union all
        select 3 as daynum, 'CR' as trantype, 900 as amount from dual union all
        select 3 as daynum, 'DR' as trantype, -500 as amount from dual union all
        select 4 as daynum, 'CR' as trantype, 900 as amount from dual union all
        select 4 as daynum, 'DR' as trantype, -500 as amount from dual union all
        select 5 as daynum, 'CR' as trantype, 900 as amount from dual union all
        select 5 as daynum, 'DR' as trantype, -500 as amount from dual
      data
      as
      ( select daynum, r
          from (select level daynum from dual connect by level <= 4),
                   (select level r from dual connect by level <= 2 )
      select daynum,
             r,
             ttype,
             amt,
             case when ttype in ( 'close', 'open' )
                  then sum(samt) over (order by daynum, r)
              end theamount
        from (
      select data.daynum,
             data.r,
             case when (nvl(t.trantype,'CR') = 'CR' and data.r = 1 )
                  then 'open'
                  when (nvl(t.trantype,'DR') = 'DR' and data.r = 2)
                  then 'close'
                  else t.trantype
             end ttype,
             case when (t.trantype = 'CR' and r = 2) or (t.trantype = 'DR' and r=1)
                  then t.amount
              end amt,
             case when (t.trantype = 'DR' and r = 2)
                  then sum(case when r=1 then t.amount end) over (partition by data.daynum)
                  else 0
              end samt
      from   t, data
      where data.daynum (+) = t.daynum
      order by daynum, r, decode( ttype, 'open', 1, 'CR', 2, 'DR', 3, 'close', 4 );
        DAYNUM          R TTYPE        AMT  THEAMOUNT
             1          1 open                      0
             1          1 DR          -300          
             1          2 CR           200          
             1          2 close                  -100
             2          1 open                   -100
             2          1 DR          -200          
             2          2 CR           800          
             2          2 close                   500
             3          1 open                    500
             3          1 DR          -500          
             3          2 CR           900          
             3          2 close                   900
             4          1 open                    900
             4          1 DR          -500          
             4          2 CR           900          
             4          2 close                  1300
                          CR                        
                          DR  Here's a solution using partitioned outer join:
    with my_tab as (select 1 as daynum, 'CR' as trantype, 200 as amount from dual union all
                    select 1 as daynum, 'DR' as trantype, -300 as amount from dual union all
                    select 2 as daynum, 'CR' as trantype, 800 as amount from dual union all
                    select 2 as daynum, 'DR' as trantype, -200 as amount from dual union all
                    select 3 as daynum, 'CR' as trantype, 900 as amount from dual union all
                    select 3 as daynum, 'DR' as trantype, -500 as amount from dual union all
                    select 4 as daynum, 'CR' as trantype, 900 as amount from dual union all
                    select 4 as daynum, 'DR' as trantype, -500 as amount from dual union all
                    select 5 as daynum, 'CR' as trantype, 900 as amount from dual union all
                    select 5 as daynum, 'DR' as trantype, -500 as amount from dual),
          dummy as (select 1 id, 'Opening Balance' descr from dual union all
                    select 2 id, 'CR' descr from dual union all
                    select 3 id, 'DR' descr from dual union all
                    select 4 id, 'Closing Balance' descr from dual)
    select mt.daynum,
           d.descr,
           decode(d.id, 1, 0,
                        2, amount,
                        3, amount,
                        4, amount + lag(amount, 2) over (partition by mt.daynum order by d.id)) amount
    from   my_tab mt
           left outer join dummy d partition by (id, descr) on (mt.trantype = d.descr)
    where  (d.id = 1 and mt.trantype = 'CR')
    or     (d.id = 2 and mt.trantype = 'CR')
    or     (d.id = 3 and mt.trantype = 'DR')
    or     (d.id = 4 and mt.trantype = 'DR')
    order by mt.daynum, d.id;
        DAYNUM DESCR               AMOUNT
             1 Opening Balance          0
             1 CR                     200
             1 DR                    -300
             1 Closing Balance       -100
             2 Opening Balance          0
             2 CR                     800
             2 DR                    -200
             2 Closing Balance        600
             3 Opening Balance          0
             3 CR                     900
             3 DR                    -500
             3 Closing Balance        400
             4 Opening Balance          0
             4 CR                     900
             4 DR                    -500
             4 Closing Balance        400
             5 Opening Balance          0
             5 CR                     900
             5 DR                    -500
             5 Closing Balance        400ETA: And, if there can be any number of CR or DR rows:
    with my_tab as (select 1 as daynum, 'CR' as trantype, 200 as amount from dual union all
                    select 1 as daynum, 'DR' as trantype, -300 as amount from dual union all
                    select 1 as daynum, 'CR' as trantype, 400 as amount from dual union all
                    select 1 as daynum, 'DR' as trantype, -500 as amount from dual union all
                    select 2 as daynum, 'CR' as trantype, 800 as amount from dual union all
                    select 2 as daynum, 'DR' as trantype, -200 as amount from dual union all
                    select 3 as daynum, 'CR' as trantype, 900 as amount from dual union all
                    select 3 as daynum, 'DR' as trantype, -500 as amount from dual union all
                    select 4 as daynum, 'CR' as trantype, 900 as amount from dual union all
                    select 5 as daynum, 'CR' as trantype, 900 as amount from dual union all
                    select 5 as daynum, 'CR' as trantype, 200 as amount from dual union all
                    select 5 as daynum, 'DR' as trantype, -500 as amount from dual union all
                    select 6 as daynum, 'DR' as trantype, -200 as amount from dual),
          dummy as (select 1 id, 'Opening Balance' descr from dual union all
                    select 2 id, 'CR' descr from dual union all
                    select 3 id, 'DR' descr from dual union all
                    select 4 id, 'Closing Balance' descr from dual)
    select mt.daynum,
           d.descr,
           mt.trantype,
           decode(d.id, 1, 0,
                        2, amount,
                        3, amount,
                        4, sum(decode(d.id, 1, 0, 4, 0, amount)) over (partition by mt.daynum)) amount
    from   (select mt1.*, row_number() over (partition by mt1.daynum order by mt1.trantype) rn
            from   my_tab mt1) mt
           left outer join dummy d partition by (id, descr) on (mt.trantype = d.descr)
    where  case when d.id = 1 and rn = 1 then 1
                when d.id = 2 and mt.trantype = 'CR' then 1
                when d.id = 3 and mt.trantype = 'DR' then 1
                when d.id = 4 and rn = 1 then 1
                else 0
           end = 1
    order by mt.daynum, d.id;
        DAYNUM DESCR           TRANTYPE     AMOUNT
             1 Opening Balance CR                0
             1 CR              CR              400
             1 CR              CR              200
             1 DR              DR             -300
             1 DR              DR             -500
             1 Closing Balance CR             -200
             2 Opening Balance CR                0
             2 CR              CR              800
             2 DR              DR             -200
             2 Closing Balance CR              600
             3 Opening Balance CR                0
             3 CR              CR              900
             3 DR              DR             -500
             3 Closing Balance CR              400
             4 Opening Balance CR                0
             4 CR              CR              900
             4 Closing Balance CR              900
             5 Opening Balance CR                0
             5 CR              CR              900
             5 CR              CR              200
             5 DR              DR             -500
             5 Closing Balance CR              600
             6 Opening Balance DR                0
             6 DR              DR             -200
             6 Closing Balance DR             -200Edited by: Boneist on 16-Apr-2010 17:10

  • Query for Opening And  Closing Stock

    Hi Experts...
    I need a report for Opening and Closing stocks and Goods Receipt and Goods Issue for Raw Materials and Finished Goods and Consumbles ..instead of going for different reports for each we need a combined report which can display for all Raw Materials, Finished Goods and Consumbles and we need it for a specific date range Material type(Raw MAterials,Finished Goods, Consumbales)
    and below is the format i needed.
                                                                           RAW MATERIALS /FINISHED GOODS/CONSUMBALES
                            Opening Stock                      Closing Stock         Goods Receipt                  Goods Issue
                             Qty   Value                             Qty   Value                     Qty   Value                      Qty   Value
    Item Name
    Regards,
    Vamsi.

    Hi Guys.
    I need an Inventory stock report with Item name, Opening Stock,Goods issue Quantity,Goods Received ,Item Price,Location ,(Closing Stock)Total Value.
    We need the input by Date Range and Item Group and Location(if Possible) Below is the Code i used to run the report.
    Pls Update the Query...
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @Group nvarchar(10)
    Declare @Whse nvarchar(10)
    Set @FromDate = (Select min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]')
    Set @ToDate = (Select max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]')
    Set @Group = (Select Max(s2.ItmsGrpCod) from dbo.OITB S2 Where S2.ItmsGrpNam = '[%2]')
    Set @Whse = (Select Max(s3.Warehouse) from dbo.OINM S3 Where S3.Warehouse = '[%3]')
    Select @Whse as 'Warehouse', a.Itemcode, max(a.Dscription), sum(a.[Opening Balance]) as [Opening Balance], sum(a.[IN]) as [IN], sum(a.OUT) as OUT,max(a.Price) as 'Price', ((sum(a.[Opening Balance]) + sum(a.[IN])) - Sum(a.OUT)) as Closing from dbo.OITM I1
    Left JOIN (Select N1.Warehouse, N1.Itemcode, N1.Dscription,N1.Price, (sum(N1.inqty)-sum(n1.outqty)) as [Opening Balance], 0 as [IN], 0 as OUT
    From dbo.OINM N1
    Where N1.DocDate < @FromDate and N1.Warehouse = @Whse
    Group By N1.Warehouse,N1.ItemCode,N1.Dscription,N1.Price
    Union All
    select N1.Warehouse, N1.Itemcode, N1.Dscription,N1.price, 0 as [Opening Balance], sum(N1.inqty) as [IN], 0 as OUT From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate and N1.Inqty >0 and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription,N1.price
    Union All
    select N1.Warehouse, N1.Itemcode, N1.Dscription,N1.price, 0 as [Opening Balance], 0 as [IN], sum(N1.outqty) as OUT From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <=@ToDate and N1.OutQty > 0 and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription,N1.price) a ON a.ItemCode=I1.ItemCode
    where  I1.ItmsGrpCod = @Group
    Group By a.Itemcode
    Order By a.Itemcode
    Regards,
    Vamsi.

  • Query For Finding Yearly Opening and Closing Balance for All the Items

    Hi Experts,
    I am working on Query Based Report for finding the Yearly Opening and Closing Stock for all the Items
    i will give yearwise selection and I want opening and closing stock in between that years
    Warm Regards,
    Sandip Kokate
    Edited by: Sandipk on May 20, 2011 1:58 PM

    Hi,
    Declare @SDate DateTime
    Declare @EDate DateTime
    Declare @Whse nvarchar(10)
    Set @SDate= (SELECT min(F_RefDate)  FROM  OFPR T1 where  T1.[Name] ='[1%]' )
    Set @EDate= (SELECT max(T_RefDate)  FROM  OFPR T1 where  T1.[Name] ='[%1]' )
    Set @Whse=(Select Max(s2.Warehouse) from OINM S2 Where S2.Warehouse = '[%2]')
    BEGIN
    Select @Whse as 'Warehouse', a.Itemcode, max(a.Dscription) as ItemName,
    sum(a.OpeningBalance) as OpeningBalance, sum(a.INq) as 'IN', sum(a.OUT) as OUT,
    ((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,
    (Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM
    from( Select N1.Warehouse, N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
    as OpeningBalance, 0 as INq, 0 as OUT From dbo.OINM N1
    Where N1.DocDate < @SDate and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,
    N1.Dscription Union All select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance,
    sum(N1.inqty) , 0 as OUT From dbo.OINM N1 Where N1.DocDate >= @SDate and N1.DocDate <= @EDate
    and N1.Inqty >0 and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription
    Union All select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance, 0 , sum(N1.outqty) as OUT
    From dbo.OINM N1 Where N1.DocDate >= @SDate and N1.DocDate <=@EDate and N1.OutQty > 0
    and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription) a, dbo.OITM I1
    where a.ItemCode=I1.ItemCode
    Group By a.Itemcode Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0 Order By a.Itemcode
    END
    I hope this will work for you.
    In above query you can also user OFPR.Code, OFPR, Category OFPR.Indicator instead of OFPR.Name.
    Regards
    Vaibhav Anharwadkar
    Edited by: Vaibhav Ancharwadkar on May 24, 2011 9:23 AM

  • Open and closed invoices

    hi experts,
    I have to capture the parked, open and closed invoices in a report in reference to vendor...
    I got the parked invoice condition from the table BSTAT either v or w.
    But i am not getting the idea how to capture the open and closed invoices...
    Some one suggested me to use the ITEMSET structure but i donno how to capture those values can anyone suggest me how to do it...?
    SIRI

    Hi,
    you can use the same query...Also check the new code after the select..
    SELECT BUKRS BELNR GJAHR <b>BSTAT</b>
    FROM BKPF
    INTO TABLE T_BKPF
    WHERE BUKRS = P_BUKRS
    AND BSTAT IN ( ' ' , 'A' ) " ' ' - Normal document, A - Parked doc
    AND BLART = P_BLART
    AND CPUDT IN SO_CPUDT " Selection screen input.
    IF NOT T_BKPF[] IS INITIAL.
    SELECT BUKRS BELNR GJAHR BUZEI EBELN AUGBL AUGBT
    INTO TABLE T_BSEG
    FOR ALL ENTRIES IN T_BKPF
    WHERE BUKRS = T_BKPF-BUKRS
    AND BELNR = T_BKPF-BELNR
    AND GJAHR = T_BKPF-GJAHR
    AND EBELN IN SO_EBELN " selection-screen input
    ENDIF.
    LOOP AT T_BKPF.
    Parked
      IF T_BKPF-BSTAT = 'A'.
        WRITE: / T_BKPF-BELNR , ' - Parked'.
    process the next record.
        CONTINUE.
      ENDIF.
    Check for Open / Closed.
      LOOP AT T_BSEG WHERE BELNR = T_BKPF-BELNR
                                   AND      BUKRS = T_BKPF-BUKRS
                                   AND      GJAHR = T_BKPF-GJAHR
                                   AND      AUGBL <> ' '.
        EXIT.
      ENDLOOP.
    If the return code is 0 then the document is cleared..
      IF sy-subrc = 0.
        WRITE: / T_BKPF-BELNR , ' - Closed'.
    Else the document is not cleared.
      ELSE.
        WRITE: / T_BKPF-BELNR , ' - Open'.
      ENDIF.
    ENDLOOP.
    Thanks,
    Naren

Maybe you are looking for