Query to see Material movements in MM (MSEG) + storage type from WM (LTAP)
Hallo,
I tried transaction MCLH, but the transaction gives to informations. I think that the infosystem is not completely builded up.
So I have do create a new Z-Report to get the an query so see Material movements in MM (MSEG) with the
storage type from WM (LTAP). But I don`t know how to get the relations between those tables MSEG and ltap. But I need to know which storage type belongs to which movement in MM. Is that possible?
LTAP is Transfer Order item table while LTAK is the header table. You can get movement type (both IM and WM) and material document number from LTAK table.
Similar Messages
-
HT3819 how can I use airplay to see a movie on my TV (using AppleTV) from my iPad?
How do I use Airplay to watch a movie stored on my iPad on my TV using appleTV? For example. I downloaded a rental from Amazon onto my iPad and I want to watch it on my TV that has appleTV hooked up to it...
OR can I watch movies from my amazon library on the appleTV directly?Amazon has blocked the ability to airplay
-
Transfer material from Storage location to Storage type.
Hello,
At the time of usage decision we are posting the stock in "To Reserve stock" for that we have created seperate storage location ie for Sample material.
we having two samples one is customer sample and other is in house sample both the samples we are posting in same storage location.
Client want to differentiate these two samples, so we have created two storage types.
Now My question is " can we transfer the samples in different storage types from Storage location.
This is the QM and WM integration.
Please advice
Thanks in advance.
Regards
AnilHello Anil
I don't think you can transfer from storage location to storage type.
If your purpose is to differentiate these two samples, then why not use different Sample types with different number ranges and thus identify them. You don't have to get into QM-WM integration just for that.
If you want you may also set up 2 different physical sample locations: That would be ideal.
SPRO/IMG/Quality Management/Quality Inspection/Sample Management/Define Physical-Sample Types
SPRO/IMG/Quality Management/Quality Inspection/Sample Management/Define Number Range
SPRO/IMG/Quality Management/Quality Inspection/Sample Management/Define Physical-Sample Locations
On the application side you may use the sample management procedures to deal with samples. See the following link:
http://help.sap.com/saphelp_erp60_sp/helpdata/en/b8/b9b3341a933f50e10000009b38f83b/frameset.htm
Does that work? Let me know. -
Storage type indicator in material master
For a combination of a particaular plant+WH no, a material can have ONLY ONE storage type indicator defined..is it correct?
What if I need multiple storage type indicator for a specific plant+WH combination.
Regards.>
Prajith KP wrote:
> For a combination of a particaular plant+WH no, a material can have ONLY ONE storage type indicator defined..is it correct?
>
> What if I need multiple storage type indicator for a specific plant+WH combination.
>
> Regards.
You can have multiple storage type indicators for a warehouse. However for a particular material, only one storage type indicator may be used for picking and putaway.
You would normally require storage type indicators for different search strategies. You may use an exit for the strategy.
Regards,
Aroop -
Storage type indicators in Material master
Hi all,
I have created the list of Storage type indicator as follows,
<u><i><b>Storage type Indicator</b></i></u>
A01 A FIF
A01 E ARD
A01 E ATD
A01 E CGD
A01 E LGT
A01 E RSK
For stock removal storagetype indicator is only FIF
For Stock placement storagetype indicator is ARD,ATD,CGD,LGT,RSK
When i create a material in Material master ,for the WM view ,
the fields stock removal & stock placement having list of all the Storage type indicators.
AS per requirement ,The fields stock removal & stock placement (material master )should contain only the relevent storage type indicator.
Please suggest me how to do the same...?
Thanks & regards,
DhanapalHello Dhanapal,
In material master you can maintain only one storage type indicator for putaway and one for removal, now based on this indicator you need to define the putaway storage type search stretagy so it will be optimized to find the storage bin.
For example,
As per the business requirement material ABCD must go to Storage type 001 and material BCDE must go to Storage type 002
so in above case,
Define storaget type indicator ARD and assign it to material ABCD, then in configuration you define putaway storage search as 001 with that ARD indicator.
In the same fashion you can define 002 for the another material.
Hope this helps.
Regards,
Arif Mansuri -
How to create a query to see Opening stock and closing stock as on particul
Hi All,
How to create a query to see Opening stock and closing stock as on particul.
Regards
AlbaikHi,
In BI 0IC_C03 will provide u the required information and also having standard queries provided by the SAP.
Plz find the list of Queries provided by the SAP.
=======================================================================================================
Inventory turnover 0IC_C01_Q0001
Range of coverage - quantity 0IC_C01_Q0002
Range of Coverage - Value 0IC_C01_Q0003
Range of coverage of finished goods - quantity 0IC_C01_Q0004
Range of Coverage of Finished Goods - Value 0IC_C01_Q0005
Range of coverage of raw materials - quantity 0IC_C01_Q0006
Range of Coverage of Raw Materials - Value 0IC_C01_Q0007
Obsolete Stock on Hand 0IC_C01_Q0008
Period-dependent requirement coverage 0IC_C01_Q0009
Value of stock on hand 0IC_C01_Q0010
Quantity of stock on hand 0IC_C01_Q0011
Material consumption 0IC_C01_Q0012
Material Movements 0IC_C01_Q0013
Consignment stock: receipts and issues 0IC_C01_Q0014
Valuated stock: receipts and issues 0IC_C01_Q0015
Material stock and movements 0IC_C01_Q0016
Material Movements (Healthcare) 0IC_C01_Q0020
Material Consumption (Healthcare) 0IC_C01_Q0021
Material Availability 0IC_C01_Q0022
Inventory Turnover Frequency (Value) 0IC_C01_Q0023
Consignment Stock Received and Issued per Unit 0IC_C01_Q0024
Material Consumption (Quantity) 0IC_C02_Q0001
Valuated Stock Receipts and Issues (Quantity) 0IC_C02_Q0002
Range of Valuated Stock (Quantity) 0IC_C02_Q0003
Inventory Turnover 0IC_C02_Q0004
Receipt and Issue Consignment Stock at Customer 0IC_C03_Q0001
Receipt and Issue Quality Inspection Stock 0IC_C03_Q0002
Vendor Consignment Stock Receipt and Issue 0IC_C03_Q0003
Receipt and Issue Stock in Transit 0IC_C03_Q0004
Receipt and Issue of Blocked Stock 0IC_C03_Q0005
Valuated Stock 0IC_C03_Q0006
Stock in Quality Inspection 0IC_C03_Q0007
Stock in Transit 0IC_C03_Q0008
Blocked Stock 0IC_C03_Q0009
Vendor Consignment Stock 0IC_C03_Q0010
Consignment Stock at Customer 0IC_C03_Q0011
Stock Overview 0IC_C03_Q0012
Stock Overview (as of 3.1 Content) 0IC_C03_Q0013
Quantities of Valuated Project Stock (as of 3.1 Content) 0IC_C03_Q0014
Valuated Stock (as of 3.1 Content) 0IC_C03_Q0015
Quantities of Valuated Sales Order Stock (as of 2.1 Cont.) 0IC_C03_Q0016
Inventory Turnover 0IC_C03_Q0017
Days' Supply 0IC_C03_Q0018
SUS: Vendor Consignment Stock 0IC_C03_Q0019
Scrap 0IC_C03_Q0020
Inventory Aging 0IC_C03_Q0021
Stock Overview - extended 0IC_C03_Q0022
Demand Supply Match 0IC_C03_Q0023
Warehouse Stock Analytics Inventory Turnover 0IC_C03_Q0024
Warehouse Analytics - Obsolescence and Variance 0IC_C03_Q0025
Stock Overview: Materials 0IC_C03_Q0030
Average Stock Value Over Time 0IC_C03_Q0031
Stock Overview Over Time 0IC_C03_Q0032
Range of Coverage Over Time 0IC_C03_Q0033
==================================================================================================
Regards
Ram.
Edited by: Ramakanth Deepak Gandepalli on Jan 18, 2010 8:06 AM -
Query for Stock Tranfer Mov-311
Dear Experts,
I want to make a query to know value of stock transfer from one storage location to another on certain date or from x date to y date. In MB51 there is no value appears, as there is no financial transaction.
I am preparing query using SQVI, one table I have selected MSEG which other table I select so that value apprears.
My company requirement is this, they want how much material in terms of quantity and value has been transffered from RM Store to WIP Store.
Regards
GRHi G R,
see below table data's from MM60
MARA - Material master
MAKT - Material text
MARC - Material per plant / stock
MARD - Storage location / stock
MSEW - Material Valuation
MARM - Units of Measure for Material
Regards,
Sankaran -
Material Movements how are clasified
Hi,
I need to print a sapscript where I put the plant where is the material actually and other part where I put the destiny where the material was moved. My first question is in witch table I can find that info, if is in mseg table, what field is? and my second quiestion is in witch transaccion I can made material movements?.
Some idea about this thead, I will apreciate.
Thanks
Message was edited by:
diablabapdiablabap,
MSEG-UMWRK - The Receiving Plant
MSEG-WERK - The Plant from which the movement is innitiated
But if you are trying to create a report only using these two parameters, or keeping them as the main search parameters, it will not be very efficient, as neither of these two fields are key fields. And therefore the result of a query to the MSEG table with plants as the search criteria will probably result in a dump due to the very large amount of data that will be returned.
Hope this helps.
Regards,
Mad
You can post Material Movements via the following Transactions:
MB1B - Transfer Posting (Moving a material from one plant to the other [mvt type 301] etc.)
MB1A - Goods Issue
MB31 - Goods Receipt for Order
MB1C - Other Goods Movements
MIGO - Several Varaitions for goods movements to POs as well as process orders -
HOW CAN I GET MATERIAL MOVEMENTS BY CUSTOMER
Hi
I need to check ship to customer to see if its had any material movements on it for a given peroid for customer obsolescence programme
All reports I can find bomb out, which table will give me material movments with customer number?
I just want to input the customer number and see if there have been any movements on those accounts for a set period of time
Thanks to advise
JoHi,
Drill out the deliveries for the customer for particular period from standard delivery tables.
Then input the deliveries in the VBFA table and fetch out the material documents with subsequent document category "R"
When you get the material document and year.Then input the same in MSEG table and you can find the respective movements done for the customer.
regards,
Saju,S -
Stock to be deleted which have no material movement hostory & not in Tables
Hello, I have a strange issue as below.....
we have plant ABC with 2 storage locations 100 & 200. Sloc 200 created in 2003 & only one transaction done with 101 mvt type for 100 quantity. but now we can find 300 quantities with batch xyz, 200 extra,No material movement is done for this extra 200 quantity, I have checked in stock (MMBE) - Environment-material movements...but system shows only stock of other storage locations & for this 200 Sloc no data exists.
I have checked in Tables MSEG , MCHB also but could not find any documents or stock quantity.
Please help how to delete this stock.
BheemaCheck in MB51 against that material any documents available.If you are not able to see then these documents might have archived.If you want to remove those extra stock you can use 551 movement to scrap.Check any purchase orders available for the material so that you can get some idea.If you are not able to use above option then contact SAP to remove the qty.
-
Link of material movement with inspection type
Hello Masters,
I have scenario where component at shop floor will be segregated for inspection. The requirement is to do result/defect recording for those parts and if required then those parts need to be scrapped. So one way of doing that can be to move those parts to either blocked stock or QI stock (ideal option) or to specific storage location so that planning can be taken care of (if material are still in unrestricted then planning will consider those part as OK part and planning may fail). And to record result/defect we require inspection lot, which can be created by using above mentioned material movement.
But problem is how to create inspection lot so that we can do result/defect recording for those materials and scrap those material.
Please note that material master will have QM setup active (inspection type 01 - Goods Receipt Insp. for Purchase Order) and hence we can move material from unrestricted stock to QI stock only through QM.
I am not sure if we should use inspection type 08 - Stock transfer inspection, as there can be many instances of material transfer within plant. And with inspection type 08 active, system will create inspection lot every time there is any material transfer.
One way can be to create new goods movement only for this kind of transfer and new inspection type and link both together. So that when ever material is transferred using that particular goods movement, system creates inspection lot as well as material will be in QI stock. But I am not sure how this is possible or not and if yes then how this can be done.
I know query was too long to read and I think I was clear enough to explain what the requirement is.
It would be great if I can get some guidance from you masters at the earliest convenience as it is bit of importance.
Thanks and regards,
DevangHi Devang,
I guess this is Line rejection scenario. Correct me if understanding goes wrong. You have okayed the material against 01 inspection lot and UD has been given. Now you find this material defective on shop floor.
I think the 2nd option suggested by marwadi sounds better. I suggest one more possibility, just check whether feasible.
1. Create quality notification Q2 type through QM01. While creating you can give references of original PO and material document, which fetch vendor name and material code automatically.
2. Record defects and all other required information in notification.
3. After this, you find an option in action box, transfer post unrestricted - >block . Click there. This will transfer the stock from unrestricted to block.
4. If you want planning persons should not consider this stock as OK, remove block stock from MRP stock availability check. As a result of which stock lying in block will not be considered as available stock.
5. From block stock you can send this material back to vendor through MIGO. Otherwise you can create return delivery from notification through action box also. Check what is feasible in your case.
Here you need not create inspection lot, no need to use any user exit.
Regards,
Anand Rao -
Amount not turning up for material movement type : 601 from 2lis_03_bf
Hi all,
i have loaded the inventory cube from 2lis_03_bx the quantity is turning up for movement type 601 but the amount is not getting reflected it is always blank.
If ( SOURCE_FIELDS-BWVORG EQ '000' "Other Issues
OR SOURCE_FIELDS-BWVORG EQ '101' "Returns / Vendor
OR SOURCE_FIELDS-BWVORG EQ '104' "Material Transfer
OR SOURCE_FIELDS-BWVORG EQ '105' "Stock Adjustment InvD
OR SOURCE_FIELDS-BWVORG EQ '106' "Stock Ajdustment Other
OR SOURCE_FIELDS-BWVORG EQ '110' )
"Issues from stock transfer
AND SOURCE_FIELDS-BWAPPLNM EQ 'MM'
only movements which are relevant for stock control
AND SOURCE_FIELDS-BWBREL EQ '1'
AND SOURCE_FIELDS-BWGEO <> 0
SEE OSS NOTE 630254
AND ( SOURCE_FIELDS-BSTTYP IS INITIAL OR
( SOURCE_FIELDS-BSTTYP CA 'EQ' AND
SOURCE_FIELDS-KZBWS CA 'AM' ) ).
*IF THE RETURNCODE IS NOTE EQUAL ZERO, THE RESULT WILL NOT BE UPDATED
RESULT = SOURCE_FIELDS-BWGEO.
and i can see for other movement type like 641 the amount is turning up.
Can anyone advise me on this
thanksdoes the material movement type : 601 will be updated from this data source : 2lis_03_bx nor it is from 2lis_03_um??
Can anyone advise me on this!!
thanks -
Hi
We have a custom data source: ZMARACD created usingMARA,MARD,MARC and MBEW. Now we need Storage location and Storage Bin from MSEG. I wrote start routine and reading the Material movements ODS in to Material plant ODS as we need these fields in to material plant and material movements ODS has them...
But when I run the full load of ZMARACD , it is taking more than 10 hours with no data to ODS, where as if I remove the start routine logic it is taking less than 10 mins to load...Any idea on why this is not working?MARD already has that info
-
Apple tv claims i am not authorized to see purchased movie
I can see other downloaded material and previous and free shows, but i am unable to see purchased movies. I have authorized and deauthorized, and re-authorized my computer several times without success. I have restarted my computer as well. My software in both my imac and the apple tv are up to date.
What can I do?Welcome to the Apple Community.
If you have the Apple TV 1 this problem seems to have started around October 28, it appears to affect content purchased only on other devices but played on the Apple TV 1.
There have been other workarounds suggested from time to time, but I have found the simplest solution is to purchase something on the Apple TV 1 directly (There may be free content in some locations and this appears to work just as well).
Once the content has been purchased, it will not only play as normal, but will also allow all other content purchased on other devices after October 28 to play as well.
Some have reported that it's necessary to restart the Apple TV before and/or after purchase, but I found it worked without. -
Usage of Query Rewrite in Materialized Views
Hi,
I have a star schema with fact table and and dimensions tables.
One of the dimension tables is time_dimension and I have created
a materialized view(time_sales_mv) on it and the fact table. I
have also created a dimension(time_dim) on the
table 'time_dimension' with hierarchies and attributes.
Following are the syntaxes -
--Dimension table
CREATE TABLE TIME_DIMENSION (
TIME_KEY NUMBER(9) NOT NULL,
DAY_OF_MONTH NUMBER(9),
WEEKDAY NUMBER(9),
WEEKEND NUMBER(9),
JULIAN_DAY NUMBER(9),
JULIAN_WEEK NUMBER(9),
JULIAN_YEAR NUMBER(9),
MONTH_NUMBER NUMBER(9),
MONTH_NAME VARCHAR2(15),
WEEK_OF_THE_YEAR NUMBER(9),
WEEKDAY_NAME VARCHAR2(10),
WEEK_DAY_NUMBER NUMBER(9),
THE_YEAR NUMBER(9),
DAY_OF_THE_YEAR NUMBER(9),
THE_DATE DATE,
THE_QUARTER NUMBER(9),
PRIMARY KEY ( TIME_KEY )) ;
--Fact table
CREATE TABLE SALES_FACT (
TIME_KEY NUMBER(9) NOT NULL,
PRODUCT_KEY NUMBER(9) NOT NULL,
PROMOTION_KEY NUMBER(9) NOT NULL,
CUSTOMER_KEY NUMBER(9) NOT NULL,
DOLLAR_SALES FLOAT,
UNIT_SALES NUMBER(9),
DOLLAR_COST FLOAT)
-- Dimension created
CREATE DIMENSION Time_dim
LEVEL THE_DATE IS TIME_DIMENSION.THE_DATE
LEVEL WEEK_OF_THE_YEAR IS time_dimension.WEEK_OF_THE_YEAR
LEVEL MONTH_NUMBER IS time_dimension.MONTH_NUMBER
LEVEL THE_QUARTER IS time_dimension.THE_QUARTER
LEVEL THE_YEAR IS time_dimension.THE_YEAR
HIERARCHY calendar_rollup (
THE_DATE CHILD OF
MONTH_NUMBER CHILD OF
THE_QUARTER CHILD OF
THE_YEAR )
HIERARCHY weekly_rollup (
THE_DATE CHILD OF
WEEK_OF_THE_YEAR )
ATTRIBUTE THE_DATE DETERMINES
time_dimension_sagar.DAY_OF_MONTH
ATTRIBUTE THE_DATE DETERMINES
time_dimension_sagar.WEEKDAY
ATTRIBUTE THE_DATE DETERMINES
time_dimension_sagar.JULIAN_DAY
ATTRIBUTE THE_DATE DETERMINES
time_dimension_sagar.DAY_OF_THE_YEAR
ATTRIBUTE MONTH_NUMBER DETERMINES
time_dimension_sagar.month_name
ATTRIBUTE THE_YEAR DETERMINES
time_dimension_sagar.JULIAN_YEAR;
-- Materialized View
CREATE MATERIALIZED VIEW time_sales_mv
BUILD IMMEDIATE
REFRESH COMPLETE ON DEMAND
ENABLE QUERY REWRITE
AS
SELECT t.month_number, SUM
(dollar_sales) AS sum_dollar_sales
FROM sales_fact s,time_dimension t
WHERE t.time_key =
s.time_key GROUP BY
t.month_number
Now if I use the same query as in the MV and see the explain
plan it shows the MV is being used instead of the underlying
tables which is as expected. But if I change 'month_number'
to 'month_name' in the above query, the explain plan does not
use the MV which is not as expected. Since 'month_name' is an
attribute of 'month_number'(defined in the dimension
definition), we can use it and query rewrite feature will join
the MV to the time_dimension table. But in the actual plan, it
uses the fact table 'sales_fact' instead of the MV. Even when I
use the rewrite hint on the query it does not use the MV. I want
know why this is happening??
Query-
SELECT t.month_number, SUM(dollar_sales) AS
sum_dollar_sales FROM
sales_fact s, time_dimension t
WHERE t.time_key = s.time_key
GROUP BY t.month_number
Explain Plan -
SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=82 Bytes=2132)
TABLE ACCESS (FULL) OF TIME_SALES_MV (Cost=1 Card=82
Bytes=2132)
Query(using month_name instead of month_number)-
SELECT t.month_name, SUM(dollar_sales)
FROM sales_fact s, time_dimension t
WHERE t.time_key = s.time_key
GROUP BY t.month_name
Explain Plan -
SELECT STATEMENT Optimizer=CHOOSE (Cost=151 Card=9053
Bytes=307802)
SORT (GROUP BY) (Cost=151 Card=9053 Bytes=307802)
HASH JOIN (Cost=16 Card=9053 Bytes=307802)
TABLE ACCESS (FULL) OF TIME_DIMENSION_SAGAR (Cost=1
Card=82 Bytes=1804)
TABLE ACCESS (FULL) OF SALES_FACT (Cost=10 Card=11040
Bytes=132480)
Query (using rewrite hint in the above query) -
SELECT /*+ rewrite(time_sales_mv)*/
t.month_name, SUM
(dollar_sales)
FROM sales_fact s, time_dimension t
WHERE t.time_key = s.time_key
GROUP BY t.month_name
Explain Plan -
SELECT STATEMENT Optimizer=CHOOSE (Cost=151 Card=9053
Bytes=307802)
SORT (GROUP BY) (Cost=151 Card=9053 Bytes=307802)
HASH JOIN (Cost=16 Card=9053 Bytes=307802)
TABLE ACCESS (FULL) OF TIME_DIMENSION_SAGAR (Cost=1
Card=82 Bytes=1804)
TABLE ACCESS (FULL) OF SALES_FACT (Cost=10 Card=11040
Bytes=132480)Hi,
I have a star schema with fact table and and dimensions tables.
One of the dimension tables is time_dimension and I have created
a materialized view(time_sales_mv) on it and the fact table. I
have also created a dimension(time_dim) on the
table 'time_dimension' with hierarchies and attributes.
Following are the syntaxes -
--Dimension table
CREATE TABLE TIME_DIMENSION (
TIME_KEY NUMBER(9) NOT NULL,
DAY_OF_MONTH NUMBER(9),
WEEKDAY NUMBER(9),
WEEKEND NUMBER(9),
JULIAN_DAY NUMBER(9),
JULIAN_WEEK NUMBER(9),
JULIAN_YEAR NUMBER(9),
MONTH_NUMBER NUMBER(9),
MONTH_NAME VARCHAR2(15),
WEEK_OF_THE_YEAR NUMBER(9),
WEEKDAY_NAME VARCHAR2(10),
WEEK_DAY_NUMBER NUMBER(9),
THE_YEAR NUMBER(9),
DAY_OF_THE_YEAR NUMBER(9),
THE_DATE DATE,
THE_QUARTER NUMBER(9),
PRIMARY KEY ( TIME_KEY )) ;
--Fact table
CREATE TABLE SALES_FACT (
TIME_KEY NUMBER(9) NOT NULL,
PRODUCT_KEY NUMBER(9) NOT NULL,
PROMOTION_KEY NUMBER(9) NOT NULL,
CUSTOMER_KEY NUMBER(9) NOT NULL,
DOLLAR_SALES FLOAT,
UNIT_SALES NUMBER(9),
DOLLAR_COST FLOAT)
-- Dimension created
CREATE DIMENSION Time_dim
LEVEL THE_DATE IS TIME_DIMENSION.THE_DATE
LEVEL WEEK_OF_THE_YEAR IS time_dimension.WEEK_OF_THE_YEAR
LEVEL MONTH_NUMBER IS time_dimension.MONTH_NUMBER
LEVEL THE_QUARTER IS time_dimension.THE_QUARTER
LEVEL THE_YEAR IS time_dimension.THE_YEAR
HIERARCHY calendar_rollup (
THE_DATE CHILD OF
MONTH_NUMBER CHILD OF
THE_QUARTER CHILD OF
THE_YEAR )
HIERARCHY weekly_rollup (
THE_DATE CHILD OF
WEEK_OF_THE_YEAR )
ATTRIBUTE THE_DATE DETERMINES
time_dimension_sagar.DAY_OF_MONTH
ATTRIBUTE THE_DATE DETERMINES
time_dimension_sagar.WEEKDAY
ATTRIBUTE THE_DATE DETERMINES
time_dimension_sagar.JULIAN_DAY
ATTRIBUTE THE_DATE DETERMINES
time_dimension_sagar.DAY_OF_THE_YEAR
ATTRIBUTE MONTH_NUMBER DETERMINES
time_dimension_sagar.month_name
ATTRIBUTE THE_YEAR DETERMINES
time_dimension_sagar.JULIAN_YEAR;
-- Materialized View
CREATE MATERIALIZED VIEW time_sales_mv
BUILD IMMEDIATE
REFRESH COMPLETE ON DEMAND
ENABLE QUERY REWRITE
AS
SELECT t.month_number, SUM
(dollar_sales) AS sum_dollar_sales
FROM sales_fact s,time_dimension t
WHERE t.time_key =
s.time_key GROUP BY
t.month_number
Now if I use the same query as in the MV and see the explain
plan it shows the MV is being used instead of the underlying
tables which is as expected. But if I change 'month_number'
to 'month_name' in the above query, the explain plan does not
use the MV which is not as expected. Since 'month_name' is an
attribute of 'month_number'(defined in the dimension
definition), we can use it and query rewrite feature will join
the MV to the time_dimension table. But in the actual plan, it
uses the fact table 'sales_fact' instead of the MV. Even when I
use the rewrite hint on the query it does not use the MV. I want
know why this is happening??
Query-
SELECT t.month_number, SUM(dollar_sales) AS
sum_dollar_sales FROM
sales_fact s, time_dimension t
WHERE t.time_key = s.time_key
GROUP BY t.month_number
Explain Plan -
SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=82 Bytes=2132)
TABLE ACCESS (FULL) OF TIME_SALES_MV (Cost=1 Card=82
Bytes=2132)
Query(using month_name instead of month_number)-
SELECT t.month_name, SUM(dollar_sales)
FROM sales_fact s, time_dimension t
WHERE t.time_key = s.time_key
GROUP BY t.month_name
Explain Plan -
SELECT STATEMENT Optimizer=CHOOSE (Cost=151 Card=9053
Bytes=307802)
SORT (GROUP BY) (Cost=151 Card=9053 Bytes=307802)
HASH JOIN (Cost=16 Card=9053 Bytes=307802)
TABLE ACCESS (FULL) OF TIME_DIMENSION_SAGAR (Cost=1
Card=82 Bytes=1804)
TABLE ACCESS (FULL) OF SALES_FACT (Cost=10 Card=11040
Bytes=132480)
Query (using rewrite hint in the above query) -
SELECT /*+ rewrite(time_sales_mv)*/
t.month_name, SUM
(dollar_sales)
FROM sales_fact s, time_dimension t
WHERE t.time_key = s.time_key
GROUP BY t.month_name
Explain Plan -
SELECT STATEMENT Optimizer=CHOOSE (Cost=151 Card=9053
Bytes=307802)
SORT (GROUP BY) (Cost=151 Card=9053 Bytes=307802)
HASH JOIN (Cost=16 Card=9053 Bytes=307802)
TABLE ACCESS (FULL) OF TIME_DIMENSION_SAGAR (Cost=1
Card=82 Bytes=1804)
TABLE ACCESS (FULL) OF SALES_FACT (Cost=10 Card=11040
Bytes=132480)
Maybe you are looking for
-
How many computers can I install the disc version of PSE and Premiere Elements on?
Probably going to get the disc version, I have a laptop and a computer and I saw that there was no disc questions, so.. please help me and Thanks! -Owen
-
I want to use ATV3 to stream music to audio receiver only. How do I control w/o a TV in the loop?
-
Need help with HTTP keep-alive
Hi folks! I have this very simple web server and I would like to add keep-alive support. I've been trying to get my head around it for a while and could need some help (I found this question in the archive, but those replies didn't help)... This is m
-
SQL developer 1.2.1 timesten Plugin...my updates not working
Please direct me to a timesten plugin for sql developer 1.2.1...
-
Hi All, We have a issue in cost distribution on overtime. We use FLSA Overtime calculation in time. The OT is calculated after meeting the thershold and OT payment is paid in PY. Since the time is passing the accumulated numbers as wage type after th