Re:Query for Item and its first child Itemcode from BOM...!!!

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,
Revathy

Hi 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

Similar Messages

  • Query for  customer and its all the underlying sites in AR

    Hi Expert,
      Please help me to build a query for a customer and its all the underlying sites .
    Thanks

    Please check this thread:
    Running Total in QLD
    Thanks,
    Gordon

  • Query for back 2nd motnh first day and last day

    Any body please provide me the query for back 2nd month first day to back 2nd month last day?
    last month first day
    TIMESTAMPADD(SQL_TSI_MONTH,-1, TIMESTAMPADD(SQL_TSI_DAY, -(DAY(CURRENT_DATE)-1), CURRENT_DATE))
    last month last day
    TIMESTAMPADD(SQL_TSI_DAY, -(DAY(CURRENT_DATE)), CURRENT_DATE)
    anyone please provide me the queries for previous months like above queries?
    2nd back month first day --?
    2nd back month last day--?
    3rd back month first day --?
    3rd back month last day --?

    Hi,
    Check with this...
    Previous month last day -
    TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE)
    Last day of 2nd month -
    TIMESTAMPADD(SQL_TSI_MONTH,-1,TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))
    Last day of 3rd month -
    TIMESTAMPADD(SQL_TSI_MONTH,-2,TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))
    (OR)
    Previous month last day -
    TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE)
    Last day of 2nd month -
    TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))*-1,TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))
    Last day of 3rd month -
    TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))*-1,TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE)))*-1,TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))*-1,TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE)))
    Regards,
    Srikanth

  • 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 ?
    Jeyakanthan

    Hi 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 item master data

    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.
    ciao

    thanks 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..

  • I accidentally downloaded a website for coupons and its toolbar keeps popping up? I want to completely get rid of it on my internet. How do I do this?

    I accidentally downloaded a website for coupons and its toolbar keeps popping up at the top of my internet window. I went to the toolbar options and unchecked it but when I get back into the internet it is up again. I want it completely gone so that it doesn't even have a chance to be seen. I don't want it. How do I get rid of it?

    I would start off with Firefox's Add-ons page. Either:
    * Ctrl+Shift+a
    * orange Firefox button (or Tools menu) > Add-ons
    In the left column, click Extensions. Then look for unwanted extensions and try the Remove button.
    If the Remove button is missing, this usually means the extension was installed through the Windows installer. In that case, check for it in the Windows Control Panel, Uninstall a Program. Clicking the "Installed on" column header will bring the most recent additions to the top for easier spotting.
    After you get rid of it, assuming you can remove it in one of those two ways, I suggest "mopping up" with some malware removers. This article lists tools that other Firefox users have found helpful: [[Troubleshoot Firefox issues caused by malware]].
    Any luck?

  • HT201263 my ipod is asking for passcode and its disabled now I cant access it as my computer in which I had synced it is crashed

    I have ipod touch for the last two years.  I had not used it for long time now, since my computer has been changed I can not synce it as its asking for passcode and its disabled now. I had not saved the password.  I also can not format it. Pl help me.

    See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...  Be sure to Follow ALL the Steps..

  • TS1702 How do I get an app that I paid for transferred over to my iPhone? I paid for it and its not able to be used on iPad!

    How do I get an app that I paid for transferred over to my iPhone? I paid for it and its not able to be used on iPad!

    Assuming you're using the same Apple ID, just download it onto your iPhone.

  • Which table if for BADI and its implementation

    Which table if for BADI and its implementation
    I want to know which implementations have already been created and actived for one BADI.

    Hi
    check the tables for BADI
    SXC_ATTR   
    SXC_ATTRT  
    SXC_CLASS  
    SXC_COCO   
    SXC_EXIT   
    SXC_FCODE  
    SXC_FCODET 
    SXC_IMPSWH 
    SXC_SCRN   
    SXC_TABLE  
    SXC_TABLET 
    Regards
    Anji

  • BAPI to add item and its net price while creating opportunity

    is there any BAPI/FM  through which  i can add item and its net value to opportunity in CRM.
    Kindly help.
    Regards
    Sachin Yadav

    You can give a try with Customer Function like EXIT_SAPLMCB1_001

  • Urgent ! delivery items and its batch split items

    Exports:
        How to find relationship between delivery items and its batch split items. Thanks alot.

    Talk to functional guy -
    List of tables which contains CHSPL
    VBAP
    LIPS
    KNVV
    KNMT

  • Can one ask for engraving for ipad and its case in retail store or it is just an online feature?

    I am wondering if I go to an apple retail store, can I ask for engraving for ipad and its case that I bought there? Or they are doing this only for online purchases.

    Many users have found that engraving reduces the resale value of iPads.
     Cheers, Tom

  • HT201441 i got this iphone 4 off of someone for $60 and its linked to a apple account and i don't have any contact to him now do i go to apple to activate it?

    i got this iphone 4 off of someone for $60 and its linked to a apple account and i don't have any contact to him now do i go to apple to activate it?

    Hello tom,
    I understand you are having issues activating an iPhone 3G. The following article addresses the exact error message you included:
    iPhone: Troubleshooting activation issues
    http://support.apple.com/kb/TS3424
    Resolution
    - Restart the iPhone.
    - Try another means of reaching the activation server and attempt to activate.
              - Try connecting to Wi-Fi if you're unable to activate using a cellular data connection.
              - Try connecting to iTunes if you're unable to activate using Wi-Fi.
    - Restore the iPhone.
    If you receive an alert message when you attempt to activate your iPhone, try to place the iPhone in recovery mode and perform a restore.
    Thanks,
    Matt M.

  • This content requires hdcp for playback.  so I paid $100 for it and now they stop it from working?

    I have an atv 2, my tv uses componet, I have used it to rent and watch movies on it for a year at least but now it says this content requires hdcp for playback.  so I paid $100 for it and now they stop it from working?
    I also have the first atv, I get the same message

    lol, I had to go look at the back of that, I've been using it so long with componet. I started getting the hdcp message a few months ago on it. been using it for years with componet now I cant.  what I meNt on the AT2 is that when I bought it, I was able to use it, rent moves, etc. since I got it using an adaptor because of my tv. It just recently was rendered incapable along with the componet output on the AT1.
    My tv is a 65"  Hitachi rear projection,  with no hdmi. It's old, but still has a great picture

  • [svn:fx-4.0.0] 13647: this should actually fix the build - call the modified main target to call the bundle task for osmf and actually make the call from frameworks /build.xml

    Revision: 13647
    Revision: 13647
    Author:   [email protected]
    Date:     2010-01-19 17:04:22 -0800 (Tue, 19 Jan 2010)
    Log Message:
    this should actually fix the build - call the modified main target to call the bundle task for osmf and actually make the call from frameworks/build.xml
    QE notes:
    Doc notes:
    Bugs:
    Reviewer:
    Tests run:
    Is noteworthy for integration:
    Modified Paths:
        flex/sdk/branches/4.0.0/frameworks/build.xml

    Hi Renuka,
    The model classes get generated under gen_cmi folder at the time of model import.
    As far I know, the Web Dynpro build operation also re-generates these classes if reqd.
    That is why I asked you to delete the gen_* folder content & do a Project Rebuild operation.
    Or you can delete the model & try importing it again.
    If the problem persists with the generated classes then there is an issue/bug with the generation & I would recommend to raise an OSS message (WD Java component)
    Kind Regards,
    Nitin

Maybe you are looking for

  • Two i-tunes loaded on one computer

    Can I set up two accounts on one computer so when either my wifes i-pod or mine are attached it goes to the right song playlist for syncing?

  • Disc Stuck in Drive

    I have a Disc stuck in my macbook's combo drive and it doesn't eject.It also appears that it is not mounted at all. I tried pressing the mouse key at start up but that didn't work.

  • MBAM 2.5 Deployment

    hy, I have a problem with the Deployment of MBAM 2.5 I use this link: http://technet.microsoft.com/en-us/library/dn145038.aspx but I Need more regedit keys. I want to use 256 Bit for the encription (128 Bit is normal). Also I want set an identificati

  • Foreign Keys in Primary Key Class

    I am a newbie on toplink. I am getting an error when i run ejbc against the jar file with EJB2.0. One of the primary key classes two primary keys and both are foreign Keys to other tables. Primary Key class looks like this: public class LcaCyberzoneA

  • How to create a logo

    im a nophyte to this, but ive actually managed to create a website recently. my only problem is that i dont how to create a logo for my site. can anyone please tell me?