Monthly Sale By Item
Hello,
We are looking for a Query that will show all of our items and monthly sale by Qty and Amt. This includes items that do not have sales for that month - those fields would just be left blank.
So, header would be...
Item #...Jan Qty...Feb Qty...Mar Qty...etc...Jan Amt...Feb Amt...etc...
Does anyone know a Query that can do this?
Sales analysis will just show only items that have sold.
This is similar to Queries we have asked for in the past that shows all items.
Thanks!
Mike
creo que nececitan algo como esto:
DECLARE @FECHAINI DATE = '2015-01-01';
DECLARE @FECHAFIN DATE = '2015-02-28';
DECLARE @sql nvarchar(MAX) = '';
DECLARE @columns_1 nvarchar(MAX) = '';
DECLARE @columns_2 nvarchar(MAX) = '';
SET @columns_1 = STUFF(
SELECT DISTINCT
',Piezas_Mes' + cast( MONTH(DocDate) as varchar) + '_año_' + cast( YEAR(DocDate) as varchar)
FROM
(SELECT DocDate FROM OINV where DocDate BETWEEN @FECHAINI AND @FECHAFIN) AS P
FOR XML PATH('')
), 1, 1, '');
SET @columns_2 = STUFF(
SELECT DISTINCT
',Monto_Mes' + cast( MONTH(DocDate) as varchar) + '_año_' + cast( YEAR(DocDate) as varchar)
FROM
(SELECT DocDate FROM OINV where DocDate BETWEEN @FECHAINI AND @FECHAFIN) AS P
FOR XML PATH('')
), 1, 1, '');
SET @sql = N'
select
Z.PRODUCTO,
Z.DESCRIPCION,
' + @columns_1 + ',' + @columns_2 + N'
from
select
FROM
SELECT
a.ItemCode AS PRODUCTO,
a.Dscription AS DESCRIPCION,
''Piezas_Mes'' + cast( MONTH(b.DocDate) as varchar) + ''_año_'' + cast( YEAR(b.DocDate) as varchar) AS MES,
a.Quantity AS CANTIDAD
FROM INV1 AS a
INNER JOIN OINV AS b
ON a.DocEntry=b.DocEntry
INNER JOIN OCRD AS c ON b.CardCode = c.CardCode
WHERE b.DocType = ''I'' AND b.DocDate BETWEEN ''' + CAST( @FECHAINI AS VARCHAR) + ''' AND ''' + CAST( @FECHAFIN AS VARCHAR) + '''
UNION ALL
SELECT
d.ItemCode AS PRODUCTO,
d.Dscription AS DESCRIPCION,
''Piezas_Mes'' + cast( MONTH(e.DocDate) as varchar) + ''_año_'' + cast( YEAR(e.DocDate) as varchar) AS MES,
(d.Quantity * -1) AS CANTIDAD
FROM RIN1 AS d
INNER JOIN ORIN AS e
ON d.DocEntry = e.DocEntry
INNER JOIN OCRD AS f ON e.CardCode = f.CardCode
WHERE e.DocType = ''I'' AND e.DocDate BETWEEN ''' + CAST (@FECHAINI AS VARCHAR) + ''' AND ''' + CAST( @FECHAFIN AS VARCHAR) + '''
) as TABLADATOS
pivot
SUM(TABLADATOS.CANTIDAD) for TABLADATOS.MES IN(' + @columns_1 + N')
) as P
) as Z
inner join
select
from
SELECT
a.ItemCode AS PRODUCTO,
a.Dscription AS DESCRIPCION,
''Monto_Mes'' + cast( MONTH(b.DocDate) as varchar) + ''_año_'' + cast( YEAR(b.DocDate) as varchar) AS MES,
a.LineTotal AS TOTAL
FROM INV1 AS a
INNER JOIN OINV AS b
ON a.DocEntry=b.DocEntry
INNER JOIN OCRD AS c ON b.CardCode = c.CardCode
WHERE b.DocType = ''I'' AND b.DocDate BETWEEN ''' + CAST( @FECHAINI AS VARCHAR) + ''' AND ''' + CAST( @FECHAFIN AS VARCHAR) + '''
UNION ALL
SELECT
d.ItemCode AS PRODUCTO,
d.Dscription AS DESCRIPCION,
''Monto_Mes'' + cast( MONTH(e.DocDate) as varchar) + ''_año_'' + cast( YEAR(e.DocDate) as varchar) AS MES,
(d.LineTotal * -1) AS TOTAL
FROM RIN1 AS d
INNER JOIN ORIN AS e
ON d.DocEntry = e.DocEntry
INNER JOIN OCRD AS f ON e.CardCode = f.CardCode
WHERE e.DocType = ''I'' AND e.DocDate BETWEEN ''' + CAST( @FECHAINI AS VARCHAR) + ''' AND ''' + CAST( @FECHAFIN AS VARCHAR) + '''
) as TABLADATOS
pivot
SUM(TABLADATOS.TOTAL) for TABLADATOS.MES IN (' + @columns_2 + N')
) as P
) as Y
on Z.PRODUCTO = Y.PRODUCTO and Z.DESCRIPCION = Y.DESCRIPCION
order by
PRODUCTO,
DESCRIPCION;';
EXEC sp_executesql @sql;
SALUDOS ...
Similar Messages
-
Can I build a query to show monthly sales by item by business partner?
Hi all
Is it possible to build a query to show monthly sales (quantity not value) by item by business partner?
So the table would look something like this.
Jan Feb Mar Apr
Item 1 10 4 8 7
Item 2 4 3 5 6
Item 3 4 12 9 3
Item 4 1 0 1 2
Etc...
As you can see, the monthly figure needs to be quantity of the item and not sales value.
Would be grateful for any help.
Many thanks.
WendyHi,
Try this:
declare @code as varchar(15)
set @code = ( select max(ta.cardcode) from OINV ta where ta.cardcode = [%0])
Select [a] as Cardcode, [B] as Cardname, [c] as Item#, [D] as Descr,[1] as Jan,[2] as Feb,[3]as Mar,[4] as April,[5] as May,[6] as June,[7] as July ,[8] as Aug,[9] as Sept,[10] as Oct ,[11]as Nov,[12] as Dec
from(
SELECT T0.[CardCode] as A , T0.[CardName] as B, T1.[ItemCode] as C, T1.[Dscription] as D, sum(T1.[Quantity]) as t,month(T0.[DocDate]) as month FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry WHERE year( T0.[DocDate]) = 2014 and t0.cardcode = @code GROUP BY T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription],T0.[DocDate] ) S
pivot
(sum(t) for month IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) P
Thanks & Regards,
Nagarajan -
Sales doc items with the status CLSD ARE being selected for month-end
We are working to improve month-end processing time for Sales Orders We use SAPKKA12 to set CLSD status on line items
SAP Help states: be sure that the status CLSD (closed) is set for all sales document items that you do not want to include in the period-end closing process. The sales document items with the status CLSD are then not selected for processing in the period-end closing process. Use report program SAPKKA12 to set the status.
This use to work (in 4.0). I have been on other projects and just brought back to this after several years (now in 5.0). Testing today shows that orders with CLSD status are being selected for month-end process.
Any ideas why this is so? System is selceting over 300,000 orders when well over half of them are set to CLSD. I do get a message that the order is not relevant to processing, but selecting the order and logging the message take time. and the logs are VERY long.
thanksDoes any one else have this issue that Sales documents with status CLSD are selected by RA (KKAK)?
In just one of our jobs, i get this Basic List
Perform actual results analysis 31273
Not relevant 103894
Error 2306
Objects Selected 137,473
75% of the orders are CLSD. and the system is still counting them. (we do not out put information messages)
I do understand that the orders are not analyzed, but all documentaion states that CLSD status is not selected, and in our 5.0 system, they are selected. In our 4.0 system, they were not selected.
Does this truely work for anyone in a 5.0 system?
Thanks
Althea -
XL Reporter Report for comparison of last month and current month sales
Hi,
Our management requires an MIS report for comparison of sales in revenue and in terms of units for the last and the current month todate.
Is there a way to view this data for both the months together, without any user input?
Best Regards
JyotiJyoti,
I'll try and explain the XLR Report you'd need for this. This is isn't the best way to explain something like this, but I'll give it a shot.
- Put an expansion on Row 8 and choose all Items (*), click Apply
- In A8, put ItemCode
- In B8, put Item Name
- In C8, put Sales - A/R Row Total
- In D8,put Sales - A/R Row Total again
- Setup a Parameter
- Call it Period
- Dimension
- Financial Period
- In Column D, put a column Summary and click into Financial Period
- click the button to open the selection window
- click to the parameter tab
- select your parameter and click OK and click Apply
- In Column C, put a column Summary and click into Financial Period
- click the button to open the selection window
- click to the parameter tab
- in the bottom right corner, add a "-1" it should look like this @Period-1
- click OK and click Apply
- In C7 and D7 - choose Financial Period Code from formula builder
(so you can see the period code at the column header)
This will show sales by item in the current Period (column D) and previous Period (column C)
Hope that helps and at least gets you going. I can't guarantee those are perfect instructions from memory.
Brad Windecker
[Omega Business Solutions|http://www.omegagroup.com] -
Manually closed DN appear with value 0 on sales analysis - items
Hello everyone,
When i manually close a Delivery Note (DN) using Data->Close that DN still appears on my sales analysis -> customer. (using the filter -> Delivery Notes)
However when i use sales analysis -> items i only get the list of items contained on that DN. All the columns (quantity, sales amount, gross profit, etc) are with zero values.
Is there any way of showing those values on the sales report? Or any other report? Is this standard system behavior? Shouldn't the items disappear completely then? What is the purpose of showing them without any further information?
Looking forward to be hearing from you.
Regards,
Sérgio RomãHello Gordon,
Thanks for the quick reply.
The business process requires me to close the DN manually:
The customer has something like 4000 employees that are created as customers. Each of those employees has a pre-defined creditline amount. DNotes can be created for each employee until that amount. On the second week of every month i need to close all these DNotes (i am doing this using an addon that runs based on schedule defined in a user table and that closes all DN that meet certain conditions) so that i can add more DNotes to each employee. At the end of every month i have another addon that totals all DN added that month (closed and open) and creates a single service invoice for a customer (defined in each employee).
So i need to close them manually because i cannot copy them to a consolidation partner (release of employee creditline and invoicing occur at the different moments during the month).
My disagreament with the system behavior is the following:
- I get the correct the results if i create a sales analysis -> customer. If they don't result in a sales transaction they shoudn't appear on this report either. (according to the logic you presented)
- Sales analysis -> Item. The item lines appear with zero. Once again, if it is not a sales transaction they shoudn't appear at all (according to the same logic). The system is doing the same thing as if the DN has been copied to an invoice which is a wrong behavior. This is a different situation and the item detail should be visible on the sales analysis report.
What do you think?
Regards,
Sérgio Romã -
Hi All!
Is there any kind of report in SAP B1 that shows comparison of monthly sales year over year by state. So, for example, CA sales Jan-Dec 07 vs. Jan-Dec 08?
Thanks,
MikeHi Mike,
Only 3 types of reports built-in for sales analysis. Namely: By Customers, By Items or By Sales Employee.
You need either a XL Report or a query to define this report.
Thanks,
Gordon -
Sales Employee mandatory field in sales order item level
Hi all
I want to do SALES Employee mandatory on sales doc. item level, once i have gone through customization i did it check BOX on but once i save there where no effect, that check BOX still blank
please provide me how i should do it
Regards,
Abhijeethi Cong,
i earlier i unable to save due to VE and PE confusing partner function but now i have to save the setting means check BOX marked but still there where not effect.
Again i want to tell you the requirement i have to do Mandatory Partner function (Sales Employee) on sales order item level,may be that will be PE or VE i m not sure....
Management want to track like who is the owner of this business at the per item level for incentives purpose and after that marketing team can analyze the incentive or commission by the end of the every months from early this practice is going on but every sales order or every line item every time user not used to fill sales employee so that i have to do Mandatory, If any user creating sales order and if in sales order there end of line item means 2-3- 5-10-50...so on....may be every item has different sales employee and all has to be complete or els sales order should be pending or sales order not going to save...
I hope u understand the requirement and pls provide me solution
Regards,
Abhijeet -
CURRENT YEAR PREVIOUS TWO MONTHS SALES+MDX
QUERY TO GET CURRENT YEAR LAST TWO MONTH SALES DYNAMICALLY IN MDX
assuming you are looking for data with the latest two months and taking adventure works DW 2008 as sample DB
try this
select [Measures].[Internet Sales Amount]
on 0,
{Tail(nonempty(descendants([Date].[Calendar].[Calendar
Year],[Date].[Month of Year]))).item(0),
Tail(nonempty(descendants([Date].[Calendar].[Calendar
Year],[Date].[Month of Year]))).item(0).prevmember}
on 1
from [Adventure Works] -
Productwise Monthly Sales by a Customer
Dear Experts,
Can anybody help me how to get the monthly sales qty like April, May ....etc according to Customer wise for a perticular Item.
Any help to modify the existing query
SELECT T1.[ItemName] 'Item Name', T0.[CardName] 'Customer Name', T2.[City], T3.[GroupName] 'Category', SUM(T0.[OutQty]) as 'Sale Qty', SUM(T0.[InQty]) as 'Return Qty', SUM(T0.[OutQty])-SUM(T0.[InQty]) as 'Total Sale.Qty' FROM OINM T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN OCRG T3 ON T2.GroupCode = T3.GroupCode WHERE T0.[DocDate] >= [%0] and T0.[DocDate] <= [%1] and T0.[ItemCode] = [%2] and T0.[TransType] in ('15', '16', '14') GROUP BY T0.[CardName], T2.[City], T1.[ItemName], T3.[GroupName] order by T1.[ItemName], T3.[GroupName] desc
Regrds,
SriniHi,
you may test the Istvan query in your SQL server query --> demo datbase :
SELECT T1.ItemName 'Item Name', T0.CardName 'Customer Name',
T2.City, T3.GroupName 'Category', T0.DocDate,
datepart(m,T0.DocDate) Month,
SUM(T0.OutQty) as 'Sale Qty', SUM(T0.InQty) as 'Return Qty',
SUM(T0.OutQty)-SUM(T0.InQty) as 'Total Sale.Qty'
FROM OINM T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode
INNER JOIN OCRG T3 ON T2.GroupCode = T3.GroupCode
WHERE
T0.DocDate >= '01/01/2009' and T0.DocDate <= '12/30/2009'
and
T0.ItemCode = 'A00001'
and T0.TransType in ('15', '16', '14')
GROUP BY T0.CardName, T2.City, T1.ItemName, T3.GroupName,datepart(m,T0.DocDate), T0.DocDate
order by T1.ItemName, T3.GroupName desc
JImM -
Surcharge rate for sales order item condition
Hi,
I have a two condition for sales order item.
First condition is ZP00-Price. It is using for automatically price with customer and material. It linked with account key in pricing procedure.
Second condition is ZI00-Index rate. Calculation type is A-Percentage. This condition value is monthly. It will be used for surcharge with percantage . I have a formule this condition.
It is not linked with account key in pricing procedure.
Formula for ZI00 - Index rate:
(Index Rate to delivery date - 1 / Index Rate to contract start date) x 100
For example;
Index rate conditions is entrying monthly;
Index date Index%
01.08.2008 1,05
01.09.2008 1,15
01.10.2008 1,17
Contract start date = 03.08.2008
Delivery date = 02.10.2008
ZP00 = 500
ZI00 = Index rate for sales order item = ((1,17-1)/1,05 ) * 100 = 16,19
Last condition value = 500 + (500 * 16,19)/100 = 500 + 80,95 = 580,95
What can I do for this pricing?
Best Regards
Gulay CelikHi
I think that perhaps it is too late. The application supports cancellation and re-billing as separate transactions. Maybe this is not a 'development' problem.
Cheers
Dom -
Free goods determined in Delivery over Order Quantity in Sales Order Item
Hi Gurus,
I've a problem about using free goods determination.
First I created free goods master record with following information
ZG1010012060075 From 100 PC -> Free good ZG1040012060075 2 PC
Free goods Category = '2' (Exclusive)
Free goods delivery control = 'E' (Delivery proportional to quantity in main item)
Then I've created Sales Order with
Item 10 ZG1010012060075 4,000 PC.
Item 11 ZG1040012060075(Free good) has been automatically determined for 80 PC
Then I've splitted Item 10 into 4 deliveries. The result of free goods determine in each delivery are as follow:
Delivery#1)
Item10 ZG1010012060075 = 1,176 PC
Item20 ZG1040012060075 = 24 PC
Delivery#2)
Item10 ZG1010012060075 = 1,176 PC
Item20 ZG1040012060075 = 24 PC
Delivery#3)
Item10 ZG1010012060075 = 1,176 PC
Item20 ZG1040012060075 = 24 PC
Delivery#4)
Item10 ZG1010012060075 = 472 PC
item20 ZG1040012060075 = 9 PC
*Remark : Total quantity of 'ZG1040012060075'(free goods) = 92424+24 = 81 PC
(Greater than 80 PC)*
I think the system determined free goods in Delivery#4 correctly due to rounding up. But It might not be over the order quantity in Sales Order Item 11. Even though I've set the item category in delivery with Check overdelivery = 'B' (Situation rejected with an error message), the free goods are determined over order qty. BUT if I change delivery qty in delivery#4 Item20 from 9 PC -> 8 PC -> 9 PC, the error message occurred.
My point is to fix the system not determine free goods in delivery items over order quantity in sales order item.
Has anyone met this situation before? Do you have any idea about this issue?
Best Regards,
Prachya LalitnorasateDear Sai,
Thank you for your advice, but it didn't solve my problem.
I would like the system to determine free goods with proportional to main item AND In the last delivery main item delivered completely free goods must be determined equal to remaining open delivery item.
Do you have any idea about configuration/customization? -
Table Name to take report of Open Sales Order items&its relevant GL Number.
Hi,
I wanted to take a report with Output as Open Sales Order Items and its relevant GL account numbers. is there any T Code in the Standard or atleast the table name.
I have already fetched the Open Sales Order Items from T code VA05, but i need the relevant GL account numbers also.
Any pointers on this will be appreciable.
Rgds,Hi
There are no standard reports where in you can fetch the data of the open sales order items and its G/L accounts with the output. But by creating your own report using LIS then it is possible
Regards
Srinath -
Sales order item report based on results analysis key and status
Hi,
I am trying to find a a report to generate list of sales order items with following selection
-invoicing status -invoiced/not invoices (other status)
-result analysis key assigned to this item (VBAP-ABGRS)
-system status /released/teco
Basically i am CO consultant and not so familiar with the SD statuses. I tried VA05 and V.26 but all required selections are not available in these reports.
If no standard report is available in ERP, i would like to have it in BI. Can some help me with table fields for statuses.
Thanks in advance.
Regards
RaghuHi Raghu
Go to SE16 and give VBUK table and execute it there you can select the following feilds and then check wheather they are meeting your requirements or not.If they are meeting your requirements then create a new Z report by copying standard VA05 key feilds. and include the other feilds which you need.So you take your ABAP team help
Billing status FKSTK
Posting Status BUCHK
Overall status GBSTK
Document category VBTYP
Regards
Srinath -
Sales Analysis Item Tab Function Not Showing Orders Dollars
Hello Gurus of SAP B1.
This pertains to SAP B1 SP 00 PL 16 Version 8.8.
While doing the Sales Analysis function under Sales A/R > Sales Reports > Sales Analysis > Item Tab, the system does not report on the dollars for the day when I select "Orders" or "Delivery Notes'. The system does display the proper dollars when I select "Invoices" on the "Item" Tab.
And the "Invoices" and "Orders" and "Delivery Notes" buttons display correct dollars on the other tabs for Customer and Sales Employee...so why not on the "Items" tab???
Does anyone know why this might be happening and/or how to fix this???
Thanks in Advnace - ZalThanks for the quick reply Gordon - hope things are continuing to go well in your new endeavors &;-D
Well that is really strange that items is handled that way - I have created SQL to get the results but I always like to balance out to what SAP B1 is reporting. My SQL detail and grand totals are fine by Customer and I have been able to reconcile in that manner, but wanted to reconcile by items also. I am certain I have done it before in SAP 2007A...
Has there been a change to the item/sales order table in Version 8.8???
Take care my FFF - Zal -
Sales Analysis Item Tab Displays Zero Dollars for "Orders"
This pertains to SAP B1 SP 00 PL 16 Version 8.8.
While doing the Sales Analysis function under Sales A/R > Sales Reports > Sales Analysis > Item Tab, the system does not report on the dollars for the day when I select "Orders" or "Delivery Notes'. The system does display the proper dollars when I select "Invoices" on the "Item" Tab.
And the "Invoices" and "Orders" and "Delivery Notes" buttons display correct dollars on the other tabs for Customer and Sales Employee...so why not on the "Items" tab??? Strange that a button would be displayed which does not work...
Does anyone know why this might be happening and/or how to fix this???
Does SAP plan on fixing this in any upcoming patch levels???
Regards - Zal
Responses received from SAP B1 Core Forum:
Sales Analysis Item Tab Function Not Showing Orders DollarsThanks for the quick reply Gordon - hope things are continuing to go well in your new endeavors &;-D
Well that is really strange that items is handled that way - I have created SQL to get the results but I always like to balance out to what SAP B1 is reporting. My SQL detail and grand totals are fine by Customer and I have been able to reconcile in that manner, but wanted to reconcile by items also. I am certain I have done it before in SAP 2007A...
Has there been a change to the item/sales order table in Version 8.8???
Take care my FFF - Zal
Maybe you are looking for
-
Itunes 12.0 won't open on Yosemite 10.10
Hi, only recently switched to mac. Booted up today and itunes won't open, the icon just bounces. Tried rebooting etc. If I look into more info in finder it says the itunes was opened the last time I tried, it wasn't. Do I have to go through the hassl
-
Do I need to partition external drive?
I'm about to format my first external hard drive and am unsure whether I need to partition it as I'm new to this (my experience of backing up is limited to emailing files to my webmail provider's server). I bought the drive primarily for backup in ca
-
Hi, I have an agent configured in UCCX on a remote site. All of the CRS config should be correct and the agent can log on to the agent desktop. When a call is routed to the agent the status goes into reserved, then straight back to Not Ready (or Read
-
PSE 8 - metadata is reduced?
The metadata shown by PSE 8 (Organiser, Properties) seems much reduced in comparison to PSE 5. It's no big deal, all of the essentials are there (I think. You don't miss something until you need it!). For instance PSE 5 showed GPS data (from memory).
-
i have oralce streams in a bi-directinole environment. with schema replication. how can i check of the tables on rows level are is sync. is there any script procedure or somthing to check this. regards, Shamier