Query for Item wise Sales.......
*Hi Guys, Below is the query i have used to run Sales Register. But we need Item wise sales register and those Excise Duty calculations are needed for item wise instead of total document wise.
Pls update the query ...*
SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price, (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)', (SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ', (SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ', (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ', (SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ', (SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ', (SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ', (SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ', (SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ', (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ', (SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total' FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14 GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal
Closing this ...
Edited by: Parimis on Jun 25, 2010 5:44 PM
Similar Messages
-
Query for Item wise sales report
Hi Guys,
Below is the query i have used to run Sales Register.
But we need Item wise sales register and those Excise Duty calculations are needed for item wise instead of total document wise. Pls update the query ...
SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price,
(Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
(SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
(SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
(SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ',
(SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ',
(SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ',
(SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ',
(SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ',
(SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ',
(SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ',
(SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ',
(SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ',
(SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total'
FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry
WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14
GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal
ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotalHi experts..
Pls Update the Query -
Please any one provide crystal report for Location wise sales report with GP
Please any one provide crystal report for Location wise sales report with GP.Please its urgent
A report writer tool like Crystal reports is not available due to the cost involved in its licenses.Do you think that Oracle Reports is free then? It's $$$$.
You can download and test it for free, but if you want to use it in production you have to buy a license. -
How to create sql query for item master with operator LIKE with variables?
hi all,
How to create sql query for item master with
operator LIKE(Contains,Start With,End With) with variables using query generator in SAP B1 ?
JeyakanthanHi Jeyakanthan,
here is an example (put the like statement into the where field)
SELECT T0.CardCode, T0.CardName FROM OITM T0 WHERE T0.CardName Like '%%test%%'
The %% sign is a wildcard. If you need start with write 'test%%' and otherwise ends with '%%test'. For contains you need '%%test%%'. You also could combinate this statements like 'test%%abc%%'. This means starts with test and contains abc.
Regards Steffen -
Query For Series wise Collection
Hi
Please anyone provide query for series-wise collectionSatish Doke,
Im using this query as "Series Wise Outstanding" I want to create another query for "series wise collection".How can i do this.Im not into SAP accounting.Please help.
DECLARE @Date AS DATETIME
DECLARE @Series AS varchar(30)
DECLARE @Branch AS varchar(30)
DECLARE @Exec AS varchar(30)
/* SELECT FROM [dbo].[OINV] S0 WHERE */ SET @Date = /* S0.DocDate*/ '[%0]'
/* SELECT FROM [dbo].[NNM1] S2 WHERE */ SET @Series = /* S2.SeriesName*/ '[%2]'
/* SELECT FROM [dbo].[OLCT] S3 WHERE */ SET @Branch = /* S3.Location*/ '[%3]'
/* SELECT FROM [dbo].[OSLP] S4 WHERE */ SET @Exec = /* S4.SlpName*/ '[%4]'
if( @Exec ='') set @Exec ='%'
if( @Series ='') set @Series ='%'
if( @Branch ='') set @Branch ='%'
if( @Date ='') set @Date =GETDATE()
Select distinct OINV.CardName [Customer Name], ISNULL(NNM1.SeriesName ,'-')+'/'+ CAST(OINV.DocNum as varchar) [Bill No.],
OINV.DocDate [Bill Date],INV1.Dscription,INV1.Quantity,
OINV.DocTotal - OINV.PaidToDate [Out Standing Amount],
DATEDIFF(dd,OINV.DocDate,@Date)[No of Days] from OINV
inner join INV1 on OINV.DocEntry = INV1.DocEntry
inner join OLCT on INV1.LocCode = OLCT.Code
inner join NNM1 on OINV.Series = NNM1.Series
inner join OSLP on OINV.SlpCode = OSLP.SlpCode
where OINV.DocType ='I' and (OINV.DocTotal - OINV.PaidToDate)>0
and NNM1.SeriesName like @Series and OINV.DocDate<= @Date
and OLCT.Location like @Branch and OSLP.SlpName like @Exec -
hi all,
i want to create a query for items in the item master data that shows the changed field, the old value, the new value, user name and the date it was changed .
can anyone help please.
ciaothanks for the reply
my clients internal auditors require that they have Exception Reports in SAP , i.e reports that can show changes made, date and by which user etc...
1. changes made to item master data
2. changes made to business partner master data
3. changes made to invoices, purchase orders etc..
this reports can be set in query form or xl reporter..
i tried but couldent find the tables ....
any sugestion will be appriciated.. -
How to identify Sale Order costing is required for Items in Sales Order
Howstandard cos estimate*w to identify Sale Order costing is required for Items in Sales Order?
On which criteria we can conclude Sale Order Costing is reqd ?
? * means what and wat is the purpose and how to chk for the Item in Sales Order, either it is required or not**.Hi Dharamveer,
The best way is to make the order qty is equal to the quantity delivered. This way, when some one looks at this order in future - they think that the order was for X and the delivery was for X qty is completed. They will not know the background of the issue unless they go through change log. Even in change log, they see that the Ord qty was adjusted, but may not understand why?
The good practice is to make order qty equal to already delivered qty.
Create a new line for the remaining qty and reject the same with appropriate reason for rejection. This way, any one can understand the background , the reason for rejection easily. Hope it helps ! -
Notification Query for Item Group
Dear Experts,
Please Guide me for a Notification Query for this Scenario :
I want to put a Notification Query for a Group i.e. when any user do transactions in any form or any Particular form using items
of this Group than if the Item Quantity is in Decimal then he can not do that Transaction and Get Error Message.
Thanks in Advance.
Atul ChakrabortyHi Atul,
to achieve this you have to write SPTN at the back end
under databases node select your live database.
Select programability
select stored procedure
select db.sbo.SP_Transactionnotification
and paste your code into
ADD YOUR CODE AREA
If (@object_type = '17') and (@transaction_type in ('A', 'U'))
BEGIN
Declare @ItmGrpCode as int
Declare @Qty as int
set @ItmGrpcode = (select oitm.itmsgrpcod from oitm inner join rdr1 on oitm.itemcode = rdr1.itemcode inner join ordr on
rdr1.docentry = ordr.docentry where ordr.docentry=@list_of_cols_val_tab_del)
set @Qty = (select quantity from rdr1 inner join ordr on ordr.docentry = rdr1.docentry where ordr.docentry =
@list_of_cols_val_tab_del)
BEGIN
if @ItmGrpcode = 10 and @qty = 0
Begin
set @error = -1
set @error_message = 'Invalid Input'
End
End
END
Like wise by capturing object type and dml mode you have to write code for every document that you want to check.
For example I've given code for Sales Order.
hope this will help you
Thanking you
Malhaar' -
QUERY FOR STATUS OF SALES ORDER
Hi Experts,
Here my Client required one query for status of the Sales Order line item wise and by when material will be ready after giving clients PO no. sales order NO. Clients name etc.
Please give me guide to write this query.
Regards
MadhuHi,
Try this link,
http://help.sap.com/erp2005_ehp_04/helpdata/EN/d2/cb4759455611d189710000e8322d00/frameset.htm
Cheers,
Shailabh -
Query for details of Sale order , Invoice and COGS
I Need the report cointing following based on month & Business partner
Sale order, Sale Amount, Due date, Invoice Amount, Last Invoice date, COGS amountHi Anantha,
Please check below link and modify according to your requirement.
Sales Order Query for in SAP B1
Query - Sales Orders linked to Deliveries
My Top SQL Queries for SAP Business One
Hope this helps
Regards::::
Atul Chakraborty -
Query for material wise pricing
i want to extract price for sales org/distribution channel/ Division/material. which tables can i used .
Table
Field combination
A274
- Sales org./Distr. chl/Division/Material/Item
A273
- Sales org./Distr. chl/Division/Material/Customer/Item
Regards
JP -
Dear SAP Members,
I need a query that contains
ItemCode,ItemDescription from oitm table and its first child item code,Item Description,Quantity,currency and price from itt1 table.I have taken all the datas but there is no ItemDescription from itt1 table.How to join all these datas.
Please Give suggestions or query for this issue.
With Regards,
RevathyHi try this
Declare @BOMDetails table(TreeType Nvarchar(MAX),PItem NVARCHAR(Max),PName NVARCHAR(MAX),CItem NVARCHAR(Max),CName NVARCHAR(MAX),Comment NVARCHAR(MAX),onHand Numeric(18,0),[Committed] Numeric(18,0),FreeStock Numeric(18,0),[Status] NVARCHAR(MAX),Quantity numeric(18,0),Price numeric(18,0),Warehouse nvarchar(MAX),Currency nvarchar(MAX))
INSERT Into @BOMDetails
SELECT T1.TreeType ,T0.Father AS [Parent Code], T2.ItemName AS [Parent Description], T0.Code AS [Child Code],
T1.ItemName AS [Child Description], T0.Comment, cast((T1.OnHand ) as Numeric(18,0)) as [Un-Committed Stock],
cast(T1.IsCommited as Numeric(18,0)) AS [Committed Stock], cast((T1.OnHand - T1.IsCommited)as Numeric(18,0)) AS [Free Stock], T2.FrgnName AS [Status],T0.Quantity,T0.Price ,T0.Warehouse,T0.Currency
FROM ITT1 T0 INNER JOIN OITM T1 ON T0.Code = T1.ItemCode
INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
WHERE T0.ChildNum=1
Union All
SELECT ' ',T0.Father as [Parent Code], T2.ItemName AS [Parent Description], '', '', '', 0,0,0 , '',0,0,'','' FROM ITT1 T0 INNER JOIN OITM T1
ON T0.Code = T1.ItemCode INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
Group By T0.Father,T2.ItemName
ORDER BY T0.Father, T0.Code
update @BOMDetails set PItem='' ,PName='' where TreeType='N' or TreeType='P'
Select PItem as[Parent Code] ,PName as [Parent Description],CItem as [Child Code],CName as [Child Description],Comment,Quantity,Price,Warehouse,Currency from @BOMDetails
thanks,
Neetu -
SAP B1 query for turnover in sales sorted by item and supplier.
Hello experts,
please, is it possible to create a query SAP B1 for finding turnover in sales by item and supplier? I would need to know exact total quantity of sold items sorted by supplier.
Is it possible?
Thank you in advance
jonmar7Try to include Credit Memo in this way:
SELECT T4.CardCode,T4.CardName, SUM(T0.Price * T0.Quantity) AS turnover,SUM(T0.Quantity) AS QTY, T2.ItmsGrpNam, T5.GroupName, T1.ItemCode, T1.ItemName
FROM INV1 T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITB T2 ON T2.ItmsGrpCod = T1.ItmsGrpCod INNER JOIN OINV T3 ON T3.DocEntry = T0.DocEntry INNER JOIN OCRD T4 ON T1.CardCode = T4.CardCode INNER JOIN OCRG T5 ON T4.GroupCode = T5.GroupCode
WHERE T4.CardName LIKE '[%0]%'AND T3.DocDate Between [%1] AND [%2]
GROUP BY T4.CardCode, T4.CardName, T2.ItmsGrpNam, T5.GroupName, T1.ItemCode, T1.ItemName
UNION ALL
SELECT T4.CardCode,T4.CardName, SUM(-T0.Price * T0.Quantity) AS turnover,SUM(-T0.Quantity) AS QTY, T2.ItmsGrpNam, T5.GroupName, T1.ItemCode, T1.ItemName
FROM RIN1 T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITB T2 ON T2.ItmsGrpCod = T1.ItmsGrpCod INNER JOIN ORIN T3 ON T3.DocEntry = T0.DocEntry INNER JOIN OCRD T4 ON T1.CardCode = T4.CardCode INNER JOIN OCRG T5 ON T4.GroupCode = T5.GroupCode
WHERE T4.CardName LIKE '[%0]%'AND T3.DocDate Between [%1] AND [%2]
GROUP BY T4.CardCode, T4.CardName, T2.ItmsGrpNam, T5.GroupName, T1.ItemCode, T1.ItemName
Inventory transfer should not affect your sales at all. As for A/R Correction Invoice, you need to include OCSI and CSI1 tables. We don't have those data to try. You have to add them by yourself. -
Query for all open sales order with a date range
Hi Experts!
I wrote this query that will look up all open sales order of a particular customer and how much was served:
SELECT T0.[DocNum] 'OS #', T0.[DocDate] 'Posting Date', T0.[CardName] 'Customer', T1.[Dscription] 'Item Description',T4.[SalUnitMsr] 'Sales UOM', T4.[InvntryUom] 'Invty UOM', T1.[UseBaseUn] 'Use of Invty UOM' , T1.[Quantity], T1.[Quantity]-T1.[OpenQty] 'Served Qty', T1.[OpenQty] 'Unserved Qty' FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCTG T2 ON T0.GroupNum = T2.GroupNum INNER JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode INNER JOIN OITM T4 ON T1.ItemCode = T4.ItemCode WHERE T0.[DocStatus] = 'O' and T0.[CardName] =[%0]
However, I don't know how to input a parameter for the date range in a query. Can anyone help with this issue?
Your input will be highly appreciated.
Warm regards,
JenHiiiiiii
Try This.....
SELECT T0.DocNum 'OS #', T0.DocDate 'Posting Date', T0.CardName 'Customer', T1.Dscription 'Item Description',T4.SalUnitMsr 'Sales UOM', T4.InvntryUom 'Invty UOM', T1.UseBaseUn 'Use of Invty UOM' , T1.Quantity, T1.Quantity, T1.OpenQty 'Served Qty', T1.OpenQty 'Unserved Qty' FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCTG T2 ON T0.GroupNum = T2.GroupNum INNER JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode INNER JOIN OITM T4 ON T1.ItemCode = T4.ItemCode WHERE T0.DocStatus = 'O' and T0.CardName ='[%0]' and (T0.DocDate>='[%1]' and T0.DocDate<='[%2]')
Regards, -
Confirmed Quantity for Item in sales order
Dear All,
In one sales order there is confirmation block (this is through the delivery block in the sales order header level).
The sales order contains BOM (header and it's sub items) and some standard items also two third party items.
When the sales order is saved there are no confirmed quantity for any of the item except the BOM header.
May I know what could be the reason to have this BOM header confirmed quantity..??? this is leading to a problem in the data from sales order.
Is there any customizing related to this item (item category or schedule line category) to look out for..??
Thanks & Regards,
Vishi...hello, friend.
your issue is quite broad. outcome depends on -
1. configuration of delivery block (which, in your case, we can assume to include confirmation block)
2. selection of availability check and MRP type in material master
3. schedule line category and schedule line determination
now in standard, if the order line item category is TAN, and MRP type is PD and availability check is PD... the system might temporarily confirm the item even when putting a delivery block at header level, but the system should delete confirmed quantities when you save the order. you can check the confirmed quantities when you open the sales order in change mode... the confirmation should be zero.
however, in third party items (item category TAS), these items are normally confirmed even in change mode. this may hold true if either MRP = none (e.g. ND) and/or if availability check is KP (no check).
nevertheless, regardless of confirmation quantity, the system should not allow creating of delivery while delivery block is in place.
please try these scenarios and post your feedback.
regards.
jy
Maybe you are looking for
-
How Do I stop Calendar from Updating a Subscribed Calendar?
I have a calendar that I do not want updated. I am subscribed to it, have it stored in iCloud, and have set auto-refresh to 'No'. However it continues to update itself at least once a day. How do I stop that? And what, exactly, does the auto-refr
-
How can I limit the number of emails resident in Apple Mail?
How can I limit the number of emails resident in Apple Mail inbox?
-
Excel spreadsheet export doesn't show chinese characters properly
Hi all. I've created the excel export option following the steps in Bex's book, and it's working fine, but I'm not able to export results in UTF8. I'm facing problems when the dDoctitle for some documents is in chinese. So far, I've tried adding the
-
[solved] How to restart all services with systemd?
I had the habit of restarting all daemons after an upgrade so to make sure the newest libraries, configuration files etc were loaded. I did that with a shell script that restarted the daemons in order which they were listed in rc.conf. With systemd I
-
HT4915 Just wish to delete icloud songs from itunes
I woke up to find most of my music doubled due to iCloud being present. I'm not a big fan oc icloud so i choose not to use it. is there anyway to get the icloud songs off of my itunes?