Distinguishing Open and Closed Purchase Orders
We have a BI query which shows all Purchase Orders split by line item.
We would like to be able to determine which of those Purchase Order line items is closed within the core SRM system and which are still open.
Is anybody aware of an InfoObject that would allow us to do that?
Any help would be much appreciated.
Thanks,
Positive Parrot
You need to ask your functional team or business how they close Purchase Orders. Most companies I have been at never close the orders or line items.
At one company, I had an Open Order report requirement and it was messy. I had to identify which line items still had an open quantity and then load those line items only into a cube.
I wrote a ton of code to do this and had a few ODS objects to help out. This wasn't an easy task.
Hopefully for your sake, your company uses the 0COMPL_DEL (Delivery Completion) characteristic or 0FINAL_INV (Final Invoice Recieved indicator) characteristic and you can base your decision on the values in those fields.
I am assuming you are looking at the 2LIS_02_SCL extractor for Purchasing Schedule Lines....
Good luck,
Brian
Similar Messages
-
HOW WE FIND OUT OPEN PURCHASE ORDER AND CLOSED PURCHASE IN THE TABLE?
HI,
PLZZ HELP ME.
what are fields names for open purchase order and closed purchase order
thanksHi param,
Go to mseg table, pass the purchase order number and purchase order item. if the mseg-menge = ekpo-menge for the corresponding purchase order then consider the purchase order is close, else it is still open. even check if the entries are not there for corresponding purchase order in mseg table then also it is open.
select mblnr zeile matnr menge from mseg into it_mseg where ebeln = it_ekko-ebeln
and ebelp = it_ekpo-ebeln.
if sy-subrc <> 0.
then consider the purchase order is open.
This is the first case.
even u can consider like this
if sy-subrc = 0.
if it_ekpo-menge > it_mseg-menge.
then also the purchase order is open.
Regards,
Santosh Kumar M.
Award points if it is useful. -
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,
RomaHey,
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 -
How to Identify open Stock Transport Orders and their Purchase Order No?
I am looking for the most efficient way, with the best SAP tables, to read , to get STOs and their Purchase Order numbers.
Also, what would be the best way to get its related Sales Order Number.
Thank-You.STO's : EKPO-PSTYP = 7
SO : VBFA-VBTYP_N = 'V', AND VBFA-VBTYP_V = 'C', -
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,
MaddyDear 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. -
How to reopen a particular closed purchase order
Hi all,
In our company when AP_MATCHING is run, we got some matching exceptions. one of them is RULE_S210, which states that invalid POs. So we went to those POs, and found that the PO Status is Completed. I guess they were closed. so i am thinking by making those purchase orders' status to Dispatched will not give any matching exceptions.
But i am not sure how to reopen a close purchase order.
Can any one please tell me how to re-open a particular purchase order that is closed.
I have gone to Purchasing -> Purchase Orders -> Reconcile POs -> Reopen POs.
But according to my research in peoplebooks, that Reopen POs will just reverse the last run of PO_RECON(the process, which is used to close the purchase orders) of the PO process. I dont think it will not Re-open a particular PO. There are no parameters in the run control page fo reopen a PO.
Please help me. It's a production issue.
Thank you,
Bye.What I heard it it it is an issue with FS 8.8.
They fixed it in 9.0 so that you can re-open any purchase order. -
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 PMYes 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 -
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?
MizanHi..
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 AMUnless 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 -
How to calculate opening and closing balance for period
Hi all,
i have to find out opening and closing balance.
the table structure of temporary table is
select * from hwcn_xn_fa_report_temp1 where asset_id=10029400
PERIOD_COUNTER CST_OP_BAL CST_ADDITION CST_TRANSFER CST_DISPOSAL COST_CLOSING_BALANCE
24108 0 0 0
24109 12000
24110 0 0 0
24111 0 0 0
in this table cst_op_balnce and cost_closing_balace is null
i have display cost_op_bal and cost_closing_balnce
cost_closing_balance=cst_op_bal+cst_addition+cst_transfer+cst_disposal
for period 2408 op_balnce=0 closing_bal=0
for period 2409 op_balnce=0 closing_balce=1200
for period 2410 op_bal=1200 closing_bal=1200
closing balance of dec will be opening bal of jan
thanks and regards
Edited by: user10664276 on Apr 19, 2009 11:08 PM
Edited by: user10664276 on Apr 19, 2009 11:13 PMHi,
user11118871 wrote:
Can you explain what that is? Thank you if you have one example.
ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING
When you use the analytic SUM (c) function, then, on each row, it returns the values of column (or expression) c from several rows in the result set added together.
Which rows? That depends.
If the analytic clause (the part in parentheses after OVER) does not include ORDER BY, then it is all rows.
If the analytic clause has an ORDER BY clause, but no windowing clause (that is, ROWS BETWEEN ... or RANGE BETWEEN ...), then the rows included in the sum are all rows up to and including the row where the function is being called (as sorted by the analytic ORDER BY).
If the analytic cluase has both ORDER BY and a windowing clause "ROWS BETWEEN x PRECEDING AND y PRECEDING", then the rows included in the sum are the rows from x to y rows before the one where the function is called.
Do some experiments with different values of x and y.
First, create a table like the one in the problem above, but simplified a little.
CREATE TABLE test_sum
( period NUMBER
, new_amt NUMBER
INSERT INTO test_sum (period, new_amt) VALUES (24108, 1);
INSERT INTO test_sum (period, new_amt) VALUES (24109, 4);
INSERT INTO test_sum (period, new_amt) VALUES (24110, 2);
INSERT INTO test_sum (period, new_amt) VALUES (24111, 8);
INSERT INTO test_sum (period, new_amt) VALUES (25001, 32);
INSERT INTO test_sum (period, new_amt) VALUES (25002, 16);
COMMIT;The original problem above used names that were meaningful for its application, and columns that have nothing to do with the SUM function. Let's simplify the former and lose the latter.
That problem involved the SUM of three columns added together. Since we just want to understand how the windowing clause works, let's simplify that to one column.
With these simplifications, my original query is:
SELECT period
, new_amt
, SUM (new_amt) OVER ( ORDER BY period
ROWS BETWEEN UNBOUNDED PRECEDING
AND 1 PRECEDING
) AS opening_balance
, SUM (new_amt) OVER ( ORDER BY period
) AS closing_balance
FROM test_sum
ORDER BY period;Given the data above, it produces these results:
. PERIOD NEW_AMT OPENING_BALANCE CLOSING_BALANCE
24108 1 1
24109 4 1 5
24110 2 5 7
24111 8 7 15
25001 32 15 47
25002 16 47 63So, for example, on the row where period=24110,
opening_balance=5, which is the total of new_amt from all rows up to but not including that row: 5=1+4, and
closing_balance=7, which is the total of new_amt from all rows up to and including that row: 7=1+4+2.
To really understand how the windowing clause works, do some experiments. Change the definition of opening_balance to include " BETWEEN x PRECEDING AND y PRECEDING". You'll find that:
(a) "UNBOUNDED PRECEDING" means the same as "n PRECEDING", where n is greater than the number of rows in your result set.
(b) "CURRENT ROW" means the same as "0 PRECEDING"
(c) x must be greater than or equal to y
(d) neither x nor y can be negative (but you can use "FOLLOWING" instead of "PRECEDING" to get the same effect).
For more, see the introduction to "Analytic Functions" in the [SQL Language manual|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/functions001.htm#sthref972]
When you're finished, don't forget to
DROP TABLE test_sum; -
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. -
Diff. of Opening and Closing Stock versus Diff. of Incrs and Decrs in Stock
Hi Gurus,
Ideally Difference of Opening and Closing Stock should match with the difference of Increase and Decrease in stock.
But in our system Difference of Opening and Closing Stock is greater than difference of Increase and Decrease in stock.
Please tell me how can we solve this issue and where we are going wrong.
Thank YouHi frnd,
I think u will have non-valuated order stock also...
it will show difference in ur balance sheet....
Pls check it..
ASSIGN POINTS IF USEFUL
Regards,
Jigar -
Insert and update query to calculate the opening and closing balance
create table purchase(productid number(5) ,dateofpurchase date,
qty number(5));
create table inventory(invid number(5),productid number(5),
idate date,openingqty number(5),closingqty number(5));
Records in inventory:
1,1,'01-jan-2009', 10, 20
2,1,'03-jan-2009', 20, 30
3,1,'04-jan-2009', 40, 50
when I enter the purchase invoice for 15 qty on 02-jan-2009
after say '15-jan-09' , a new record should get inserted
with opening balance = (closing balance before 02-jan-2009)
and all the opening and closing balance for that product should
get affected.
If the invoice for 20 qty is entered for the existing date say
'03-jan-2009' in inventory , then the closing balance
for 03-jan-2009 should get updated and all the following records
should get affected.
I need the insert for the first one and update query for the
second one.
Vinodh<strike>You can do this in one statement by using the merge statement</strike>
Hmm, maybe I spoke too soon.
Edited by: Boneist on 25-Sep-2009 13:56
Thinking about it, why do you want to design your system like this?
Why not simply have your purchases table hold the required information and then either work out the inventory on the fly, or have a job that calls a procedure to add a row for the previous day?
If you continue with this design, you're opening yourself up to a world of pain - what happens when the data doesn't match the purchases table? Also when is the inventory cut-off to reset the opening/closing balances? Monthly? Annually? Weekly? If it's set to one of those, what happens when the business request the inventory for a particular week?
Edited by: Boneist on 25-Sep-2009 13:59 -
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 PMHi,
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 -
Reg : Viewing Opening and Closing remarks in the document
Dear All,
In any document (Sales Quotation, Sales order etc), while right click we can see Opening and Closing Remarks. I have entered Opening and closing remarks. But am not able view in the screen. Where i can view the same in the respective document.
Please do the needful
Thanks & regards
Venkatesh NHi,
You can check Note No. : 1038129 and 1289493 regarding the question asked by you.
Kind Regards,
Jitin
SAP Business One Forum Team
Maybe you are looking for
-
Best Buy Rips Me Off Yet Again
DO NOT SHOP AT BEST BUY! Now here is why... September 2013: I went with my mom to the Easton store to get her a laptop. While we were waiting the guy told us that we could save $50 on the laptop if I added a mobile hotspot to my phone plan. So I look
-
Album artwork not displaying on iPhone 5 iOS 6.0.2
I recently took the plunge from Android and got myself an iPhone 5. One thing that's driving me nuts is album artwork in my music library. I have two problems not all albums will display artwork on the phone despite being present in iTunes and WMP/Me
-
ICal multiple duplicates of events created for one
Please help. I created AN event in iCal for my work calendar. Repeats M-F, 0730-1600 thru March 2014. I've changed the "hours" of some of the "events" as needed (for example, vacation time, other time-off, etc.) Instead of ONE event, each DAY is s
-
Sending Mail Content as Input to Java WebService through SOA
Hi Experts, I am working on a SOA project in 11.1.1.6 My project requirement is to send Mail Content (a paragraph with 3 lines with new lines in middle of statements) as input to the Java API which is deployed as webservice. To one of the arguments o
-
Duplicate Data records occured while loading
Hai Experts While loading Duplicate Data records occured earlier there was less no of records i used to delete the duplicate records in background in PSA. Now i am having more records which i am confusing which to delete and which not to delete. Si