Query to showed all level of BOM details, sort by create/update date

Hi expert,
I need a query to display all the level of BOM and can be sort by create / update date.
The display of query should be as below:
A (1st level) Parent BOM
B (2nd level) Child BOM 1
B (2nd level) Child BOM 2
C (3rd level)  Child BOM 2 - 1
C (3rd level)  Child BOM 2 - 2
B (2nd level) Child BOM 3
B (2nd level) Child BOM 4
Below is the BOM  query that can only display up to 2nd level and cannot sort by date.
Can someone please help to modify or there is a better query?
Thanks
Declare @BOMDetails table(TreeType Nvarchar(MAX),PItem NVARCHAR(Max),PName NVARCHAR(MAX),CItem  NVARCHAR(Max),CName NVARCHAR(MAX),[Quantity] Numeric(18,2),[UoM] NVARCHAR(MAX),[WareHouse] NVARCHAR(MAX),[IssuMethod] NVARCHAR(MAX),[PriceList] 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.Quantity ,T0.Uom ,T0.Warehouse ,T0.IssueMthd,T0.PriceList  
FROM ITT1 T0 INNER JOIN OITM T1 ON T0.Code = T1.ItemCode
             INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
Union All
SELECT ' ',T0.Father as [Parent Code], T2.ItemName AS [Parent Description], ' ', ' ', 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],Quantity,UoM,IssuMethod ,PriceList    from @BOMDetails

Hi,
Try this query and modify as per your requirement:
SELECT
T0.[Father] as
'Assembly',T0.[code] as 'Component1', t10.[ItemName]
'Description1',T1.[Code] as 'Component2', t11.[ItemName]
'Description2', T2.[Code] as 'Component3', t12.[ItemName]
'Description3', T3.[Code] as 'Component4', t13.[ItemName]
'Description4',T4.[Code] as 'Component5', t14.[ItemName]
'Description5', T5.[Code] as 'Component6', t15.[ItemName]
'Description6'
FROM
ITT1 T0 LEFT OUTER
JOIN ITT1 T1 on T0.Code = T1.Father LEFT OUTER JOIN ITT1 T2 on
T1.Code = T2.Father LEFT OUTER JOIN ITT1 T3 on T2.Code = T3.Father
LEFT OUTER JOIN ITT1 T4 on T3.Code = T4.Father LEFT OUTER JOIN ITT1
T5 on T4.Code = T5.Father LEFT OUTER JOIN ITT1 T6 on T5.Code =
T6.Father left outer join oitm t20 on t0.father = t20.itemcode left
outer join oitm t10 on t0.code = t10.itemcode left outer join oitm
t11 on t1.code = t11.itemcode left outer join oitm t12 on t2.code =
t12.itemcode left outer join oitm t13 on t3.code = t13.itemcode left
outer join oitm t14 on t4.code = t14.itemcode left outer join oitm
t15 on t5.code = t15.itemcode
Thanks & Regards,
Nagarajan

Similar Messages

  • Loading All Levels of BOM data to BW

    Hi Experts,
    I am loading all BOM data that is all levels of BOM data to BW. can anyone suggest me the steps using what should i create generic exctractor FM or view on tables (MAST,STKO,STPO) ?? please give me the detailed steps for the loading data to BW from R/3. because i want to do reporting at any level. ?
    vikrant

    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0af489e-72b1-2b10-159d-abb8058fb88d?quicklink=index&overridelayout=true
    Just check if this helps
    Prathish

  • Query to show all A/P invoices associated with a PO

    Hi,
    I need some help to create a query to show all A/P invoices associated with a PO. I would like the input to be a PO# and the output to show all the A/P invoices and be able to drill down to the A/P invoices.
    Any help would be appreciated.
    Thanks!
    Jane

    hi,
    P.O target documents query try this,
    SELECT distinct 'GRN', D0.DocNum,D0.DocDate, D0.DocDueDate, D0.DocTotal,'AP INV', I0.DocNum,I0.DocDate, I0.DocDueDate, I0.DocTotal, I0.PaidToDate
    FROM ((OPDN D0 inner Join PDN1 D1 on D0.DocEntry = D1.DocEntry) full outer join (OPCH I0 inner join PCH1 I1 on I0.DocEntry = I1.DocEntry) on (I1.BaseType=20 AND D1.DocEntry = I1.BaseEntry AND D1.LineNum=I1.BaseLine))
    WHERE (D1.BaseType=22 AND D1.BaseRef='[%0]') OR (I1.BaseType=22 AND I1.BaseRef='[%0]') OR (I1.BaseType=20 AND I1.BaseEntry IN
    (SELECT Distinct DocEntry FROM PDN1 WHERE BaseType=22 AND BaseRef='[%0]'))
    Jeyakanthan

  • Report / Query to show all texts within all customer master records

    Hi,
    Can anyone let me know if there is a report or a query to show all texts within all customer master records?
    Many Thanks
    Aries

    Hello Aries,
    I don't believe there is a standard SAP report that does this. 
    But,...
    You can see all the customer text types (Customer SD) using transaction VOTX. 
    Table TTXID contains the same info using Text Object "KNVV". 
    If you decide to have a custom ABAP developed use function READ_TEXT.  SE37 can be used to validate a test.
    Regards,
    Jim

  • Query that show all users who have access in BW cubes & Query's Owner

    Hi Experts,
    Good day !!!
    I would like to know if it's possible to create a query that tell us who has access to all the cubes in BW? This is a business requrement that we should create if possbile.  We also wonder if we may also create a query for shows us all the queries and who created them? We are doing this manually for each query. We only manually look for all the areas that I have access, but if it can be done systematically, that would save a lot of time.
    Thanks in advance guys !!!
    Best Regards,
    Marshanlou

    Hi,
    Then For this You need to create the table of your own fields with all the user names in R/3 side and Develop the report,
    Bue users will not the stay in same company , They will be changing and some user will be coming, every time u can t go enhancement.
    Regards
    Radha

  • Is there a way to base a collection from a query that shows all Distribution Points?

    Hi,
    I am able to create a query in Excel that shows all distribution points in my SCCM hierarchy:
    i.e.
    SELECT v_DistributionPointInfo.ServerName 
    FROM SMS_EY0.dbo.v_DistributionPointInfo v_DistributionPointInfo
    Is there anyway to get this query into SCCM Queries so that I can base a Collection off of the query.  This way, I will have a dynamic collection to show me all of my 630+ distribution points?
    Thanks!

    Thanks alot for the statement. In my situation it didn't worked. The probem is, that the data in SMS_DistributionPointInfo.Servername is written as FQN. In SMS_R_System.Name the Name is without FQ.
    I have successfuly tested the following query in SQL:
    Select
    * from
    v_r_system
    where
    v_r_system.Name0
    in (Select
    REPLACE(Servername,
    'FQN-String',
    '') from
    v_DistributionPointInfo)
    But this doesn't work in WQL
    Select
    * from
    SMS_R_System where
    SMS_R_System.Name
    in (Select
    REPLACE(Servername,
    'FQN-String',
    '') from
    SMS_DistributionPointInfo)
    Do you see another solution for my problem?
    Kind regards Stefan Somogyi

  • Notification Action History not showing all the approver's details.

    Hi All,
    I have a custom workflow which will require many approvals
    A1 -> A2 -> A3 ->A4 , when the notificatoin come to A2, the action history shows the from as the sender and to as the A2.
    But when it comes to A3, the old entry is not coming, getting only the current user details.
    I have chekced the checkbox "expand roles" .
    How to get all the old approver;s list in the action history.
    Thanks,
    With regards,
    Kali.
    OSSI.

    Hi,
    When the second notification is sent, that is a different one from the first, so it will have no history.
    If you want the history of all the notifications in the flow, then you will need to write something to build this dynamically and include that in the notification - populate the #HISTORY attribute on the message with the history you want to include.
    HTH,
    Matt
    Edited by: Darryl Burke -- advertisement and links removed

  • IR with Essbase(Cube Query)-retrieval of all Level 0/1/2/../n members ?

    Hi,
    Is there any way where we can retrieve or place all members in same Level/Generation to Rows/Columns in Interactive Reporting studio 9.3.1 - Cube Query ?
    Thanks in advance,
    Ajay

    Hi,
    Try this query and modify as per your requirement:
    SELECT
    T0.[Father] as
    'Assembly',T0.[code] as 'Component1', t10.[ItemName]
    'Description1',T1.[Code] as 'Component2', t11.[ItemName]
    'Description2', T2.[Code] as 'Component3', t12.[ItemName]
    'Description3', T3.[Code] as 'Component4', t13.[ItemName]
    'Description4',T4.[Code] as 'Component5', t14.[ItemName]
    'Description5', T5.[Code] as 'Component6', t15.[ItemName]
    'Description6'
    FROM
    ITT1 T0 LEFT OUTER
    JOIN ITT1 T1 on T0.Code = T1.Father LEFT OUTER JOIN ITT1 T2 on
    T1.Code = T2.Father LEFT OUTER JOIN ITT1 T3 on T2.Code = T3.Father
    LEFT OUTER JOIN ITT1 T4 on T3.Code = T4.Father LEFT OUTER JOIN ITT1
    T5 on T4.Code = T5.Father LEFT OUTER JOIN ITT1 T6 on T5.Code =
    T6.Father left outer join oitm t20 on t0.father = t20.itemcode left
    outer join oitm t10 on t0.code = t10.itemcode left outer join oitm
    t11 on t1.code = t11.itemcode left outer join oitm t12 on t2.code =
    t12.itemcode left outer join oitm t13 on t3.code = t13.itemcode left
    outer join oitm t14 on t4.code = t14.itemcode left outer join oitm
    t15 on t5.code = t15.itemcode
    Thanks & Regards,
    Nagarajan

  • My Query is showing all Zero values.

    Hello all,
    I have the recent data in my cube, but my query is not showing the values, it is only showing zero. Still yestarady it was fine , all of a sudden today it happened, what could be the problem?
    Thanks.

    Hi mohan satish
    Just a very wild guess!
    Seems like you posted your issue on 1st October and you have stated that till yesterday(means sept 30) everything was working fine.
    I guess you are working with the HR module reporting. As of my understanding, HR R/3 system records a specific period of validity for each Info type.
    Does your issue have anything to do with the Validity period?
    BR
    Prabhith

  • All contacts and calendar details are gone after updating it to iOS 7.0.6

    My contacts and important particulars in my calendar are all gone. Instead my contacts has been replace with unknown contacts which I find it strange. I've done twice restore backup from previous back up session and is still a no go. Does anyone know how to fix it?

    Im not sure if it actually affects the software updating even if i click dont trust this computer and it wasn't even syncing in it.
    I restore my phone and did a restore back up twice my contacts are missing. Even i key in manually minutes later my contacts sort of self deletes itself.

  • Query showing all values

    Hi,
    I want to build a query which shows all accounts. What I mean even if there is a 0 value for that account in that period i want to see all the values for the account number.
    Can anyone help me?
    Thanks

    Hello Abhi,
    if you set the setting "Access Type for Result Values" to "Master Data" in the properties of your account characteristic in the Query Designer you should see all the accounts from your master data table even the ones that have no values in the cube. Is this what you want to do?
    For more details please check here:
    http://help.sap.com/saphelp_nw70/helpdata/en/f0/95bc272b9e4e4b85cdcef59c37d55d/frameset.htm
    Regards,
    Maxim

  • Bex Query not passing all rows to Crystal reports

    hello experts,
    i have created a bex query that shows all employees from the master data table and links to the cats table to show absence hours...
    in bex, all employees are showing and some of the employees have hours showing for sick time. this is known as a left outer join.
    i have created a report in crystal with this bex query and it does not show rows from the master data that do not have a link to the cats table. only the rows that have a link to the cats table are showing up. (this is compared to a inner join)
    the reason i need the master data from the employee table is that the users want to divide the total hours off(sick time) per department by the total employees in that department.
    here is the sql query from crystal that was created automatically when i used the bex query to created the crystal report.
    SELECT {Measures.4J8L2TQJ3P517ISQ1R4Y8UZ36, Measures.4J9PY3UANRIW2HW15YSOED92A, Measures.4J9TLIO0NDQROSA2YONCW6HB6}
    ON COLUMNS,
    NON EMPTY
    CROSSJOIN(0EMPLOYEE.LEVEL01.MEMBERS, 0EMPLOYEE__0COMP_CODE.LEVEL01.MEMBERS)
    DIMENSION PROPERTIES 0EMPLOYEE.50COMP_CODE, 0EMPLOYEE.50MAST_CCTR ON ROWS
    FROM ZCATS_MC1/ZZCATS_MC1_Q001C
    SAP VARIABLES 0I_DAYS INCLUDING 0CALDAY.20100502 : 0CALDAY.20100903
    i am using the mdx driver, and the integration kit is 2.8.
    any thoughts?
    thanks,
    erik

    Thanks Ingo for the quick response.
    this sounds like a limitation in the integration between bex and crystal because the query shows the correct data and the crystal reports does not. i have tried to add a calculated key figure to all the rows and put a number in it but it still does not show the rows in crystal.
    my issue is that they(the business users) want to know all the employees in the employee master data along with all the sick / illness data.
    do you have a suggestion for this issue?
    do you think that the mdx driver should be updated to allow master data to flow to crystal?
    thx,
    Erik

  • Need help in query to have all items in sap with PO data on order, date

    Hello Everyone,
    I need some help in writing a query to show all items in sap db to have itemcode, itemname, onhand, sellable(onhand-committed), on order, and the delivery date when that time should be received.  I need to know what items are regular items, which ones are master and components.  For the master I need to have the deliver date of the PO for the component.
    I have written this.
    SELECT DISTINCT TOP (100) PERCENT T1.ItemCode, SUM(T1.Sellable) AS Sellable, T1.OnOrder, MAX(T1.Docduedate) AS DeliveryDate, T1.WhsCode
    FROM         (SELECT     ItemCode, Sellable, OnOrder, '1/1/1900' AS Docduedate, WhsCode
                           FROM          dbo.V_RAZ_StoreInv
                           UNION ALL
                           SELECT     TOP (100) PERCENT ItemCode, '0' AS Sellable, Quantity AS Onorder, DocDueDate, WhsCode
                           FROM         dbo.V_RAZ_OPENPOSDATA
                           ORDER BY ItemCode) AS T1 LEFT OUTER JOIN
                          dbo.V_RAZ_ItemInfo ON T1.ItemCode = dbo.V_RAZ_ItemInfo.ItemCode
    GROUP BY T1.ItemCode, T1.OnOrder, T1.WhsCode, dbo.V_RAZ_ItemInfo.OnHold
    HAVING      (dbo.V_RAZ_ItemInfo.OnHold = 'n')
    ORDER BY T1.ItemCode, T1.WhsCode
    and for the v_raz_openposdata I have the following query
    SELECT     dbo.OPOR.DocNum, dbo.OPOR.DocStatus, dbo.POR1.WhsCode, dbo.POR1.ItemCode, dbo.POR1.Dscription, dbo.POR1.Quantity, dbo.POR1.OpenQty,
                          dbo.POR1.LineStatus, dbo.OPOR.DocDueDate
    FROM         dbo.OPOR LEFT OUTER JOIN
                          dbo.POR1 ON dbo.OPOR.DocEntry = dbo.POR1.DocEntry
    WHERE     (dbo.OPOR.DocStatus = 'O')
    Any help is greatly appreciated. 
    Right now I do get the delivery date for regular items and components but the master sku for the component all of them have 1/1/1900. 
    Thank you

    Thank you for replying Gordon.  I did not remember I had asked this before.  I no longer have access to the other account. 
    What I need on the query is that I want  a list of items with the on order quantity and when we are expecting this order to be received.  The receiving date is based on the PO delivery date.  The trick here is that  I need to Master sku to show the delivery date of the component sku.  In my scenario all components have the same delivery date for the Master sku.  If there are mulitple delivery dates because each warehouse is getting them on a different date then I want to get the delivery date for that warehouse.
    Let me know if this is possible and if yes please guide towards a query for it.
    Thank you.

  • A query to get all sales processed in 2007 ?

    Hi All,
    I got a requirement from user saying
    " We have situations where "new" sales get processed against already existing or "old" sales orders. I need a query which shows all sales processed in year 2007 by sales order or whatever other identifier that is used"
    This is not making any sense to me. Can anyone help me with this ? Is there something to do with ship date or anything? Please let me know!!
    Thanks in advance
    Prathibha

    Hi Prathibha,
    The only idea that came to my mind is the following: your customer sends order in a regular interval (weekly, monthly…) under a number that represents an agreement between you and your customer.
    Under this scenario, you have one order created in the previous period from customer A that was partially shipped. In the current period, customer A sends a new order to you, but the quantity sent by your customer includes the balance. So, if new_quantity greater than old order balance, you will need to add an order with the balance.
    Still under this scenario, the report could all orders in OM posted/shipped in 2007 under this agreement.
    Just an idea, hope it helps,
    Ketter Ohnes

  • Is there any query to get all faulted instance Ids which should be recoverd

    Hi All,
    I am working on a production Environment. I have four managed servers. Since the integration involves invoking legacy systems we are encountering either the JCA error or siebel adapter error ... so we wanted to recover as soon as faulted.If i have one managed servers i can easily find out the faulted instances .. since it was having four managed servers and more than 25 soa projects ... difficult to track it .... i need to click on each of the managed servers and get the faulted instances and recover it ...
    Can we have a query which shows all faulted instances in managed servers so that i can go directly to COMPOSITE ID and recover it..instead of going to all the 25 soa managed projects...and recovering it.
    Thanks in Advance,
    Venugopal SSS Raja

    Hi Venu,
    If I can understand your use case correctly, you want to monitor the status of the WLS instances.
    If yes, then you can use WLST to connect to the server and fetch the status. You can change this script to fetch the information of all servers and display at once.
    There is an example given @ http://weblogic-wonders.com/weblogic/2011/03/16/weblogic-server-state-using-wlst/
    See if this helps.
    Thanks,
    Patrick

Maybe you are looking for

  • OSX 10.6.8 and Iomega portable hard drives

    6/12/14 I have an "Iomega eGo® Portable 500 MB Hard Drive FireWire 800/FireWire 400/USB 2.0". Is this compatible with OSX 10.6.8? I will be using it with Time Machine. Do I need to use the FireWire and if so how do I use the FireWire setup for optimu

  • WebDynpro ABAP Application - Use of REPORT_ELEMENT_T100_MESSAGE method

    Hi all, I have a WDA Application, in which I have to use the REPORT_ELEMENT_T100_MESSAGE method (class is if_wd_message_manager). I´ve created my message class at T100, the message test and so on. My code (for example) is: wa_message-MSGTY = 'E'.    

  • HT2188 How do I know what generation my ipad is?

    I just received an ipad and I want to know what generation it is.  The box just says ipad, and it has a camera on it....can someone help?

  • MacBook Pro has been running slow after installing Yosemite

    Hey, I have a MacBook Pro and recently updated from OS 10.6.8 to Yosemite. My computer has been running really slow lately. Here is my EtreCheck Report: Problem description: Mac has been running very slowly EtreCheck version: 2.1.6 (109) Report gener

  • Mdifying "Code" column in UD Master Data table

    Hi all..     is it possible to modify the length of the field "Code"(Default column crerated when a UDT-Master Data is created) in Master Data table. if it is possible,Please give me sample.. Sandeep