Production ORder Query

Can anyone tell me how to link the production order  (OWOR) table and the Item Mast Data Table (OITM) I basically want to write a query that shows any production orders that have a certain Sales Order. This query needs to show the item number of the production order, the item description (pulled through from the item master data when they are joined!) and the status of the order, along with the customer data?
Thanks
Steve

You can start from this:
Select p.Docnum,p.DueDate,p.Status,
i.ItemName,
so.CardName
From OWOR p
  inner join OITM i on i.ItemCode=p.ItemCode
  inner join ORDR so on so.DocNum=p.OriginNum
Where p.OriginNum='[%0]'

Similar Messages

  • Query to show component cost of production order

    Need help writing a query to show the component cost of a production order, using moving average valuation method.
    I understand the table oinm has all history for an item and its calculated price.
    would like to query a production order to show the cost of components at the time of receipt of that production order.
    ideas?

    I have created this query that will work:
    SELECT t0.docdate,t0.appobjtype as [Prod/Comp],t0.itemcode,t0.dscription,t0.outqty,t0.calcprice,(t0.outqty*t0.calcprice) as [Trans Value],t0.warehouse,t0.appobjabs as [Production Order] FROM OINM T0  WHERE t0.transtype='59' and T0.[AppObjAbs] =[%0] order by t0.transnum
    The prompt is where you enter the production order document number.  It will show the calculated cost of components at the time of receipt.
    Thanks for the guidance.
    Rich

  • Alert message(Query) for a Production order?

    Hi Experts,
    I want to get an alert message for the production order doucument based on the due date of it. The user must get the alert a  one day before the duedate of the document. How to write the Query for it? Urgent ,waiting for earliest reply.
    Regards ,
    Magesh.

    Create a Formatted Seach with the following Query
    SELECT T0.DocNum AS 'Document Number', T0.CreateDate AS 'Creation Date', T0.DueDate AS 'Due Date'
    FROM  [dbo].[OWOR] T0  WHERE DATEDIFF(Day,GetDate(),T0.DueDate) = 1
    Then, Create an Alert from Adminis..> Alerts Management and Give a Name, Click Open Saved Query, Select the query you saved, Tick the Int. check box against the user who gets the Alert.  Check Active. Select Frequency.
    Good luck
    Suda

  • Query based on production order,receipt for production and issue for produc

    hello  sap experts i need a query on
    this is my query but iam not getting correct result could anypne help out  any relation is wrong in this pls verify it and reply asap .
    SELECT T0.[DocNum], T0.[ItemCode], T0.[PlannedQty], T1.[ItemCode], T1.[PlannedQty], T3.[Quantity], T5.[Quantity]
    FROM OWOR T0  INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry, OIGN T2 INNER JOIN IGN1 T3 ON T2.DocEntry = T3.DocEntry, OIGE T4 INNER JOIN IGE1 T5 ON T4.DocEntry = T5.DocEntry
    WHERE T1.[ItemCode]   =  T3.[ItemCode] and  T1.[ItemCode]   =  T5.[ItemCode] and T0.[PostDate] between [%0] and [%1]
    GROUP BY T0.[DocNum], T0.[ItemCode], T0.[PlannedQty], T1.[ItemCode], T1.[PlannedQty], T3.[Quantity], T5.[Quantity]
    ORDER BY T0.[DocNum]
    regards
    Jenny

    Hi,
    Here is another suggestion.
    select t0.docnum,
    case 
    when t0.status = 'P' then 'Planned'
    when t0.status = 'R' then 'Released'
    when t0.status = 'L' then 'Closed'
    when t0.status = 'C' then 'Cancelled'
    else t0.status end as 'Production Order Status',
    t0.ItemCode as 'Parent Item', t0.PlannedQty as 'Planned Parent Item',
    T1.ItemCode as 'Component Item', T1.PlannedQty as 'Planned Component Item',
    (select T2.Quantity
    from ign1 t2
    where t0.itemcode=t2.itemcode and t0.docentry = t2.baseentry) as 'Received End Product',
    case
    when t1.issuetype = 'B' then 'Backflush'
    when t1.issuetype = 'M' then convert(varchar(15), t3.quantity)
    end as 'Issued Component Item'
    FROM OWOR T0
    INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry
    left join ige1 t3 on t1.docentry = t3.baseentry and
    t1.linenum = t3.baseline
    Somehow I get the feeling it would make more sense to have it in 2 separate reports. But if it works for you it's good.
    Let us know how it goes and if these are indeed the reports you are looking for.
    Jesper

  • Query for releasing and closing Production order ststus in bulk

    Hi
    Releasing planed to released
    1. i want to release all those production orders entered in system which are in planned status.I want to apply one query for that which should change the status of Prod orders to release in systems automatically by applying this query.Please give me that suitable query and how to use it for proper result.
    closing released to planned
    2. Same like above i want to close all those Production orders whose receipt quantity is equal to planned quantity. i.e i want one query which should change the status of production order from release to closed on condition that receipt quantity is equal to the planned quantity.Please give me that suitable query and how to use it for proper result.
    Thanks

    For point 1 and 2:  It should not be tried and using a Query does not comply with SAP Support policy.  Doing so would lead you to lose SAP Support.

  • Query on Batch Determination in Production Order

    Dear Gurus
    I have one query on batch determination in production order against the scenario given below, which need your help .
    We know that it is possible to allocate the same component batch to two concurrent production orders at the same time in SAP.  But as per the business requirement its not possible physically. So business want to update the batch selection logic to exclude the already allocated batch to any open production order.
    In my understanding it cant be done without any enhancement, but require your expert opinion before coming to any conclusion.
    If you have any idea to achieve the solution kindly let me know.
    Thanks

    Dear
    I am not sure whether you can change the Batch SELECTION logic  for concurrent production order .As far as I know batch selection is done on Batch search strategy /sort Rule
    Explore SAP Help : http://help.sap.com/printdocu/corePrint46c/en/data/pdf/LOBM/LOBM.pdf
    Refer this useful thead from expert :Userexit in Batch determination and external number ranges for batches
    Regards
    JH

  • Production Order Report - System Query

    The Production Order Report in v2005A SP01 is not implemented in v2007A.
    This report is important to some of our B1 user customers.
    If the 2005A report is copied and pasted into the Query Generator in 2007A, it appears to work correctly, but the risk is that:-
    (a) table changes which have been made have effects which aren't apparent on normal inspection, and
    (b) it will eventually be lost during upgrades and users will have to recreate it themselves, for which many don't have the expertise.
    Please verify that the functionality of the 2005A query remains correct in 2007A, and reinstate it as a system query in a future release.
    Regards,
    Mike Burmeister

    Hi,
    In SAP B1 2007A SP01 PL10, there is a change log. You can check all the differences made by user in the pass in the change log.
    the table is AWOR. The product no. is taken from OITM. You can use both table in order to find out the comparison
    JimM

  • PRODUCTION ORDER NO. DISPLAY IN QUERY REPORT

    Hello Sir,
    I need to display production order number in the following query, can you please reply that query,
    select distinct t1.DocNum,t1.DocDate,t1.NumAtCard,t1.CardName,t4.U_desc,t4.DocEntry[GRNNO],t4.U_recqun[GRN-QTY],t6.U_PREACPT[Accepted],t6.U_BALQTY[Waiting for QC]
    from OPDN t1 inner join PDN1 t2 on t1.DocEntry = t2.DocEntry inner join [@SU_SUBCONGRN] t3 on t1.DocNum= t3.U_grnno
    inner join  [@SU_SUBGRNLINES] t4 on t3.DocEntry = t4.DocEntry inner join [@TI_GRNINSPECTION] t5 on t3.DocNum = t5.U_SUBGRN
    inner join [@TI_GRNLINE]t6 on t5.DocEntry = t6.DocEntry
    where t1.DocDate>=[%0] and t1.DocDate<=[%1] and  t1.CardName=[%2]
    Reagards
    Pushpa

    Hi Pushpa......
    Is there any relation between Production Order table and any of the table taken in your query report?
    If yes then please let me know.......
    Then only you can get it linked with Production order......
    Regards,
    Rahul

  • Change Production order thru a SAP Query

    Hello,
    i have a SAP Query to recalculate some conversion factors in the routing of a production order.
    Because the header unit of the routing is M2 and the routing operation is PC for example.
    No i need a idea how it is possible to update the fields in the production order thru this query. I would like to put some codeing in an addidional field which update this values for me.
    I found this function module CLOI_CHANGES_UPL_31, but i am not sure if i can update the conversion factors with it.
    Also my ABAP knowledge is not the best so it would assist my greatly if you can give me some help.
    kind regards,
    Bernhard

    Solved.
    I use first SM35 to create a record for batch input and after this i use this record in the coding in the query.

  • Query for Exploding all production orders needed to fulfil a sales order

    I am trying to write a query that explodes all the multiple levels BOMS and brings back a list of production orders that would need to be raised to fulfil a particular sales order.
    SELECT T0.[DocNum], T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T2.[TreeType] FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode WHERE T0.[DocNum] = [%0] AND T2.[TreeType] = (N'P')
    This is what i have at the moment, this only goes down one level, i cant think how i might drill down to lower levels. Any ideas?
    Thanks

    It will be a tough query to build.
    Check this for just adding one level:
    SELECT T0.DocNum, T0.CardCode, T0.CardName, T1.ItemCode, T1.Dscription, T1.Quantity
    FROM ORDR T0
    INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
    WHERE T0.DocNum = [%0\] AND T1.ItemCode IN (SELECT Code From OITT)
    UNION ALL
    SELECT T0.DocNum, T0.CardCode, T0.CardName, T3.Code, T4.ItemName, T1.Quantity*T3.Quantity
    FROM ORDR T0
    INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OITT T2 ON T1.ItemCode = T2.Code
    INNER JOIN ITT1 T3 ON T2.Code = T3.Father AND T3.Code IN (SELECT CODE FROM OITT)
    INNER JOIN OITM T4 ON T3.Code = T4.ItemCode
    WHERE T0.DocNum = [%0\]
    Thanks,
    Gordon

  • Query items consumed on production order

    suggestions on creating a query to show items (itemcode, description, quantity, date) consumed on a production order?
    i would like it to prompt for date range and itemcode.  audit report is similiar but i want something custom and simple to run.

    Hi
    Query will depend - what consume means to you ?
    You can start with this
    SELECT T0.[DocNum], T0.[CreateDate], T1.[ItemCode],T2.[ItemName],  T1.[PlannedQty], T0.[CmpltQty], T0.[Status] FROM OWOR T0  INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode WHERE T1.[ItemCode] =[%0] and (T0.[PostDate] >=[%1] and  T0.[PostDate] <=[%2]) ORDER BY T0.[CreateDate]
    Does itemcode mean product code ... Please explain your requirement more in detail ...
    Hope this helps
    Bishal

  • Query for getting Outtanding Production Order items

    Dear Experts,
    With a query, please advice how I can get a list of outstanding Production Order items?
    Much Thanks in Advance for your advice.
    Warmest Regards,
    Chinho

    Production Reports --->Open Item List --.> Production Orders

  • Query for Alert on production order to be released

    Dear all users and experts,
    I need a query for getting an alert on production orders to be released (from planned status to release status) by whether reading the release date of production orders created from 'order recommendation window' or by reading the due date of production order and substract the lead time(days) of the item from its due date or by any means you know best.
    Thanks and best regards,
    Farhan Sufi

    Hi Gordon and Joseph,
    Thanks to both of you for giving me queries.
    Gordon, I made 3 production orders for testing from MRP order recommendation window from which 2 production orders has release date of today 9th July, 2010 (due date 12th July monday) and the 3rd one has release date of after weekend i.e. 12th July 2010 (due date is 13th July). release dates are calculated by MRP acording to the items' lead time and due date.
    Gordon, when I applied your query It gave me msg 'no data was found as a result of this selection criteria' Can you explain what your query will give me in result?
    where as Joseph, when I applied your query on alert, it gave me all 3 production orders as an alert to be released. I was expecting it will give me alert for 2 production order for today as their release date in MRP is today(9th July, 2010) and the alert for 3rd production order should come on 12th July and not today.
    what I understood your query is displaying all production orders which have status 'planned' regardless of their release date.is it?
    Joseph can you edit this query in such a way that It should consider the release date (calculated from due date and lead time in MRP order recommendation window) and display only those production orders which should be released today and exclude those which have release date in future. so that I can get alert for only those production orders which should be released today.
    I hope good response from both of you
    Thanks and best regards,
    Farhan

  • Query for Production Orders

    Hi friends
    i try to get a query report for production orders which are in closed Status like this ,
    Document No,Item Code,Actual Component Cost,Actual Additional Cost,Actual Product Cost,Total Variance,Variance Per Product,Variance %
    i could not find above fields with OWOR Table.
    can you help me to get above query report.
    thank you
    saman

    Hi......
    Please check this Query Code and do necessary changes......
    This will meet your requirement somehow.......
    SELECT T0.[DocNum] 'PO No.', T0.status 'Status',T0.POSTDATE, T0.[ItemCode], T1.[ItemName],
    T0.[PlannedQty], T2.DocEntry 'Rec Doc', T3.DocDate 'Rec Date', T2.[Quantity], T2.LineTotal 'FG Value',
    Sum(T4.LineTotal) 'RM Value' FROM OWOR T0 Inner Join OITM T1 On T0.ItemCode=T1.ItemCode
    LEFT JOIN IGN1 T2 On T0.DocNum=T2.BaseRef And T0.ItemCode=T2.ItemCode Left Join OIGN T3
    On T2.DocEntry=T3.DocEntry LEFT JOIN IGE1 T4 On T0.DocNum=T4.BaseRef Left Join OIGE T5
    On T4.DocEntry=T5.DocEntry
    --Where  T2.WhsCode='09'
    GROUP BY T0.[DocNum] , T0.[ItemCode], T1.[ItemName], T0.[PlannedQty], T2.[Quantity], T2.DocEntry,
    T0.status,T0.POSTDATE, T3.DocDate, T2.LineTotal
    Regards,
    Rahul

  • Production Order - User Query

    Hi,
    I created user query for production order and would like to use in data from the summary tab : Actual Component Cost,Additional Cost,Production Cost, Variances
    All this data exist as Varaibles. Can you please help me to calculate these fields?
    Thanks,
    Olga

    Hi Olga,
    All those data are in the OINM table. Check that table to find where can put into your query.
    Thanks,
    Gordon
    Edited by: Rui Pereira on Dec 9, 2008 5:00 PM

Maybe you are looking for