Query to display PO number and wip_entity_name

hi
i have this requirement as to add the following to an existing query (based on standard tables)
SELECT
     MMT.INVENTORY_ITEM_ID          DT_INVENTORY_ITEM_ID
,     MMT.ORGANIZATION_ID          DT_ORGANIZATION_ID
,     MMT.TRANSACTION_DATE          DT_TRANSACTION_DATE
,     MMT.TRANSACTION_SOURCE_ID     DT_VOUCHER_NO
,     NVL(MMT.TRANSACTION_COST,0)     DT_TRANSACTION_COST
,     MTT.TRANSACTION_TYPE_NAME     DT_TRANSACTION_TYPE_NAME
,     NVL(MMT.NEW_COST,0)          DT_NEW_COST
,     DECODE((MMT.PRIMARY_QUANTITY/ABS(MMT.PRIMARY_QUANTITY)),1,MMT.PRIMARY_QUANTITY,0)
                         DT_QTY_IN
,     DECODE((MMT.PRIMARY_QUANTITY/ABS(MMT.PRIMARY_QUANTITY)),-1,MMT.PRIMARY_QUANTITY,0) * -1
                         DT_QTY_OUT
FROM
     MTL_MATERIAL_TRANSACTIONS      MMT
,     MTL_TRANSACTION_TYPES           MTT
WHERE
     MMT.PRIMARY_QUANTITY <> 0
AND      MMT.TRANSACTION_TYPE_ID  NOT IN (101,120,80)
/*     ABOVE CONDITION TO EXCLUDE OPENING BALANCE TRANSACTIONS
     AND AVERAGE COST UPDATE
AND      MMT.SUBINVENTORY_CODE <> 'OM'
AND     MMT.TRANSACTION_TYPE_ID = MTT.TRANSACTION_TYPE_ID
AND     MMT.TRANSACTION_DATE BETWEEN :P_START_DATE AND :P_END_DATEwhenever the MTL_TRANSACTION_TYPES MTT.TRANSACTION_TYPE_NAME='PO Receipt' then display the PO number
similarly WHEN MTL_TRANSACTION_TYPES MTT.TRANSACTION_TYPE_NAME= Wip Component Issue then display wip_entity name
P_START_DATE AND :P_END_DATE i have put is 01-jan-2011 and 28-feb-2011
once i add these conditions to the query ,the query displays less amount of rows ie 2014 rows whereas the first query used to return 2357 rows
this is the modified query
SELECT
MMT.INVENTORY_ITEM_ID DT_INVENTORY_ITEM_ID,
case when MTT.TRANSACTION_TYPE_NAME='WIP component issue' then wip.WIP_ENTITY_NAME
when MTT.TRANSACTION_TYPE_NAME='WIP Component Return' then wip.WIP_ENTITY_NAME
when MTT.TRANSACTION_TYPE_NAME='NP-Material Request' then wip.WIP_ENTITY_NAME
end job_number
, MMT.ORGANIZATION_ID DT_ORGANIZATION_ID
, MMT.TRANSACTION_DATE DT_TRANSACTION_DATE
, MMT.TRANSACTION_SOURCE_ID DT_VOUCHER_NO
, NVL(MMT.TRANSACTION_COST,0) DT_TRANSACTION_COST
, MTT.TRANSACTION_TYPE_NAME DT_TRANSACTION_TYPE_NAME
, NVL(MMT.NEW_COST,0) DT_NEW_COST
, DECODE((MMT.PRIMARY_QUANTITY/ABS(MMT.PRIMARY_QUANTITY)),1,MMT.PRIMARY_QUANTITY,0)
DT_QTY_IN
, DECODE((MMT.PRIMARY_QUANTITY/ABS(MMT.PRIMARY_QUANTITY)),-1,MMT.PRIMARY_QUANTITY,0) * -1
DT_QTY_OUT
FROM
MTL_MATERIAL_TRANSACTIONS MMT
, MTL_TRANSACTION_TYPES MTT
,WIP_ENTITIES WIP
WHERE
MMT.PRIMARY_QUANTITY <> 0
AND MMT.TRANSACTION_TYPE_ID NOT IN (101,120,80)
AND MMT.TRANSACTION_SOURCE_ID = WIP.WIP_ENTITY_ID(+)
/* ABOVE CONDITION TO EXCLUDE OPENING BALANCE TRANSACTIONS
AND AVERAGE COST UPDATE
AND MMT.SUBINVENTORY_CODE <> 'OM'
AND MMT.TRANSACTION_TYPE_ID = MTT.TRANSACTION_TYPE_ID
AND MMT.TRANSACTION_DATE BETWEEN :P_START_DATE AND :P_END_DATE
union
SELECT
MMT.INVENTORY_ITEM_ID DT_INVENTORY_ITEM_ID,
case
when MTT.TRANSACTION_TYPE_NAME='PO Receipt' then PHA.SEGMENT1 end job_number
, MMT.ORGANIZATION_ID DT_ORGANIZATION_ID
, MMT.TRANSACTION_DATE DT_TRANSACTION_DATE
, MMT.TRANSACTION_SOURCE_ID DT_VOUCHER_NO
, NVL(MMT.TRANSACTION_COST,0) DT_TRANSACTION_COST
, MTT.TRANSACTION_TYPE_NAME DT_TRANSACTION_TYPE_NAME
, NVL(MMT.NEW_COST,0) DT_NEW_COST
, DECODE((MMT.PRIMARY_QUANTITY/ABS(MMT.PRIMARY_QUANTITY)),1,MMT.PRIMARY_QUANTITY,0)
DT_QTY_IN
, DECODE((MMT.PRIMARY_QUANTITY/ABS(MMT.PRIMARY_QUANTITY)),-1,MMT.PRIMARY_QUANTITY,0) * -1
DT_QTY_OUT
FROM
MTL_MATERIAL_TRANSACTIONS MMT
, MTL_TRANSACTION_TYPES MTT
,PO_HEADERS_ALL PHA
,PO_LINES_ALL POL
WHERE
MMT.PRIMARY_QUANTITY <> 0
AND MMT.TRANSACTION_TYPE_ID NOT IN (101,120,80)
AND MMT.TRANSACTION_SOURCE_ID=POL.PO_LINE_ID
AND PHA.PO_HEADER_ID=POL.PO_LINE_ID
/* ABOVE CONDITION TO EXCLUDE OPENING BALANCE TRANSACTIONS
AND AVERAGE COST UPDATE
AND MMT.SUBINVENTORY_CODE <> 'OM'
AND MMT.TRANSACTION_TYPE_ID = MTT.TRANSACTION_TYPE_ID
AND MMT.TRANSACTION_DATE BETWEEN :P_START_DATE AND :P_END_DATEkindly guide
thanking in advance

Hi,
There could be nothing wrong in your Query, as all the WiP Assembly completions, WIP Negative Component Issue ,WIP Negative Component Return etc transaction types could be there in the Mat txns table for this period. Please check them

Similar Messages

  • To display execise number and date in smartform

    Hi Abappers,
    i want to display execise number and date in smartform and by using driver program also.
    i have taken fields from vbrk,vbrp and send to final internal table,but now i want to display execise number in my Smartform also.
    Thanking u,
    sri.

    Create a window inside window create text element inside that insert field your excise number and date field names.
    Go to form interface -> import parameters declare your internal table name type vbrp/vbrk.
    In your print program smart form function module pass this table.

  • Query to separate the number and character

    Hi,
    I have the string like '1000xyza' and query should return 1000 only.
    example data:
    source string = '1000xyz'
    output = 1000
    source string = '1000 xyz'
    output = 1000
    I need to use this logic in trigger, and currently I'm checking character by character in for loop to get number and it is taking long time to execute.
    Please suggest better way
    Thanks for help
    Thanks,
    Vijay

    maybe this will somehow help.
    SQL> With virtual_table AS
      2    (Select '1000xyz' str From dual
      3     Union All
      4     Select  '1000 xyz' str From dual)
      5  select vt.str,
      6         trim(translate(vt.str,'1234567890 ',' ')) char_string,
      7         translate(vt.str,translate(vt.str,'1234567890',' '),' ') numbers
      8    from virtual_table vt;
    STR      CHAR_STRING NUMBERS
    1000xyz  xyz         1000
    1000 xyz xyz         1000
    SQL>

  • Query to display BOMs Header and Item

    Hello SAP gurus
    I am trying to create a query to display BOMs with header and item. For that I am using tables MAST, STKO and STPO.
    The table join is:
    MAST -> STKO -> STPO
    MAST - WERKS, STLNR and STLAL
    STKO - STLNR and STPOZ
    The system dont show anything...
    Can someone help me?
    Thanks in advance.
    Adelmo Silva

    Yes, it works but...
    If I have 2 alternatives, the system show everything even if i select alternative 1 or 2.
    I am missing something... because system is showing all alternatives...
    System is showing something like this:
    Material     BOM     AltBOM     BOM St     Item     ICt     Component     Valid from     Quantity     Un
    726121012     00131075     1     01     0010     L     109219     17-12-2007     0,200     KG
    726121012     00131075     1     01     0020     L     109230     17-12-2007     0,003     KG
    726121012     00131075     1     01     0030     L     109232     17-12-2007     1,166     M2
    726121012     00131075     1     01     0040     L     726004012     17-12-2007     0,120     M3
    726121012     00131075     1     01     0010     L     109526     17-12-2007     0,200     KG
    726121012     00131075     1     01     0020     L     109232     17-12-2007     1,166     M2
    726121012     00131075     1     01     0030     L     726004012     17-12-2007     0,120     M3
    Edited by: Adelmo Silva on Jan 9, 2008 9:07 AM

  • Query to display data monthwise and calculate total for first 12 months

    Hi All,
    I have a query that displays forecast data monthwise.
    This has been achieved by adding 0CALMONTH on top of key figure structure.
    Eg: -
                            APR 2011   MAY 2011    JUNE 2011   ....... NOV 2013
                            Forecast      Forecast       Forecast             Forecast
    PRODUCT 1      10                15                    20                         25 
    Now there is a requirement to include new column that displays total of first 12 months data only.
    How can I achieve this without repeating the total value for every value of 0CALMONTH?
    Eg: -
                            APR 2011   MAY 2011    JUNE 2011   .......  MAR 2011    TOTAL of     APR 2012  .......       NOV 2013
                            Forecast      Forecast       Forecast             Forecast        12 months    Forecast                   Forecast
    PRODUCT 1      10                15                    20                         25               300              10                              30
    Any inputs will be appreciated.
    Thanks & Regards
    Manisha

    Hi,
    As far as i understand your requirement is to make a new keyfigure which has to be total of 12 months and that keyfigure should not get splitted based on calmonth which you have kept above the key figure structure in columns.
    I dont think it will be possible to achieve it that way.You need to make a fixed structure which will dispaly data for say next 12 months or whatever your user requirement is and you need to make a seperate  keyfigure with month offsets and then you can make  a seperate total keyfigure(of 12 months).
    With the help of text variable type replacement path you can get the seperate month names for all your forecasted keyfigures.
    I had the same requirement but my user wanted to see the next six months data only so i made it with the help of month offsets.
    If you get any other work around to achieve your requirement then please do share the solution with us.
    Hope it helps.
    Regards,
    AL
    Edited by: AL1112 on Sep 6, 2011 9:34 AM

  • Query to display Standar Routings and Operations!

    Hello again SAP gurus...
    I'm trying to create a query to show Standard Routing and Operations.
    For this I am using PLKO -> PLAS -> PLPO. Select parameters are PLKO-WERKS only.
    The system don't show any information!!!
    Can someone help on this?
    Thanks in advance.
    Adelmo Silva

    Hi,
    pls try connect below
    PLKO-WERKS
    PLKO-PLNNR = PLAS-PLNNR and
    PLKO-PLNAL = PLAS-PLNAL
    PLAS-PLNNR = PLPO-PLNNR and
    PLAS-PLNKN = PLPO-PLNKN
    I hope this will work fine
    Regards,
    Sankaran

  • BEx Query Formating - Displaying both Sum and Average in the same report

    Hi everybody,
    I need to create a BW report in the below format,
                          Company Code                                            Total       Total Average
                                   0001            0002      0003      0004
    Doc Type
        AV                        10               10         10         10            40                 10
        RV                        20               20         20         20            80                 20
    Getting the report till the 'Total' column is easy but having the 'Total Average' as a separate column is where I am stuck.
    Having the company code in the rows, and not clolumns, would have solved the issue but I need to keep the above format. Also I do not want to
    see the Total Average for every Company Code, just that of the 'Total'.
    In the Query Designer, in the Column section I have first the 'Company Code' and then the 'Count' in a structure, so whatever I add to this structure,
    is displayed for each Company Code, that means 2 columns for each Company code. This changes the format.
    I cannot use the Cell Definition method here, as then it would be a static structure and the number of Company Codes are not fixed.
    It would be great if somebody could provide some suggestions.
    Thank you,
    Ajay

    Hi Suman,
    Thanks for the quick reply.
    I have tried this, but again this will change the format. With the way you said, I will only get the report in the below 2 formats,
    1. Company code in Free Charac, later drill down to Rows,
    Doc Type  Company Code  
        AV                 0001                10
        AV                 0002                10
        AV                 0003                10
        AV                 0004                10
        Total                                      40
        RV                 0001                20
        RV                 0002                20
        RV                 0003                20
        RV                 0004                20
        Total                                      80
    or 2. Company code in Free Charac, later drill down to Column,
                      Company Code                                       
                               0001                     0002                     0003                     0004    
                        Total    Total Avg   Total   Total Avg   Total   Total Avg  Total   Total Avg
    Doc Type
        AV             10           10             10         10           10         10           10           10
        RV             20           20             20         20           20         20           20           20
    Both the above are different from the format that I need.

  • Complex MySQL Query, Grouping By Invoice Number and Adding Multiple Values To Insert Into Database

    I have a table that looks like the above. I need to be able to update values in a database based on an ioID (the invoice number)
    The value I need to add is the hours times the uSalary, however as you will notice above the hours can and well have been added on an ongoing basis. For example:
    smarotti has added 4.5 (0.5 + 4.0) hours for the ioID 14190 (last 2 rows) for a total cost of $143.55
    So what I need is to have the value $143.55 update the record 14190 (ioID) on a new column (userCost)
    So:
    the userID - ddevries did 1 hour worth of work at the rate of $23.20 that needs to be update on the record 8026
    the userID - kmurtha did 20 (.5 + .25 + 6.5 + .25 + 6.5 + 6) hours worth of work $696 (20 * 34.80) that needs to be update on the record 9462
    make sense? anyone have any thoughts on how to go about doing this?
    Thanks
    Vern

    Okay
    assuming you add the column to your table the query would look like the below:
    UPDATE workers
                    INNER JOIN (SELECT
                                                    round(SUM(hours*uSalary),1) AS cost,
                                                    ioID,
                                                    userid
                                            FROM
                                                    workers
                                            GROUP BY ioID, userid ) b
                    ON workers.ioID = b.ioID
            SET workers.userCost=b.cost
    WHERE workers.ioid = b.ioID
    AND     workers.userID = b.userID
    Or if you would just like to query the data:
    SELECT  round(SUM(hours*uSalary),1) AS usercost,ioID,userid
    FROM workers
    GROUP BY ioID, userid

  • SQL Query to pull RMA number and corresponding sales order number info

    Hi,
    I do not have good idea on the data model. I was asked to pull Sales order info & corresponding Return order (RMA) information. Appreciate if someone can provide me the query.
    thanks.

    I believe you have to use the link_to_line_id column in oe_order_lines_all.
    For a return line, that column points to the original (i.e shipment) sales order line id.
    Hope this helps,
    Sandeep Gandhi

  • How Do I Display My Number on my Screen Permanently?

    How do I diplay My Number on my BB Curve 9700 3G?  I can't figure it out!

    Hi gmarchi and welcome to the BlackBerry Support Community Forums!
    To clarify, do you want to display your phone number on the home screen at all times?  If so, this feature is not available.  You could, however, create a background image displaying your number and use it as your wallpaper .
    Thanks!
    -CptS
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • Sales order query - display invoice date and invoice number

    I have a query that is reading information from both the ORDR and RDR1. How do I link to AR invoice to get the invoice number and invoice date if the line item of the sales order has been shipped (we do not use deliveries so the AR invoice is the next document after the sales order.
    Thanks

    Hi Keith,
    The link between ORDR and RDR1 to invoice:
    RDR1.trgetentry = OINV.DocEntry
    or
    INV1.BaseEntry = ORDR.DocEntry
    Use which is more appropriate to your query
    Regards,
    David

  • Problem in display of char. and key figure for yearly query

    Hello all,
    I got a query in which i have to do restriction on
    Calendar Day/Month in Rows under Material which is a Characteristics
    So it should be
                                                               PACKAGE QUANTITY
                                            JAN  FEB  MAR   APRIL.......DEC
    PACK1
    PACK2
    PACK3
    PACK4 for current year
    PACK4 for prior YEar
    Now the months display is not pre decided, it can be anything as per the input of user.
    So i have to restrict it on Calendar month for Material twice
    In current year , just introducing the Interval range variable
    In previous year, same restricition with offset -12
    Now the problem is while displaying it shows
                                           JAN'06 JAN'07  FEB'06 FEB'07  MAR'06 MAR'07........ 
    PACK1
    PACK2
    PACK3
    PACK4 for current year
    PACK4 for prior YEar
    Which is not desirable.
    I only want value for Jan in one column
    and for previous year and current year in different rows thats it.
    If i remove Calendar year/month from columns there is no way I CAN DISPLAY MONTHS .
    How to achieve this.
    Please suggest.

    Kartikey,
    Rusty's suggestion wont work - using two characteristics for year and month will have the same effect as the position you are in at the moment.
    ie..
    2007     Jan.07     Feb.07    Mar.07   Apr.07
    2006 -
    Jan 06  Feb 06  Mar 06
    If you have the posting period of 01 - 02 - 03  (just the period number only, no year) then your query will display
    2007-01-02-03-04
    2006-01-02-03-04
    Regards
    Gill

  • SCCM report query that displays count of cpus per host and if host is physical or virtual

    Hello,
    I have this query that displays the count of CPUs per host.  How can I add a column to show if the host a physical or virtual?
    SELECT
    DISTINCT(CPU.SystemName0) AS [System Name],
    CPU.Manufacturer0 AS Manufacturer,
    CPU.Name0 AS Name,
    COUNT(CPU.ResourceID) AS [Number of CPUs],
    CPU.NumberOfCores0 AS [Number of Cores per CPU],
    CPU.NumberOfLogicalProcessors0 AS [Logical CPU Count]
    FROM [dbo].[v_GS_PROCESSOR] CPU
    GROUP BY
    CPU.SystemName0,
    CPU.Manufacturer0,
    CPU.Name0,
    CPU.NumberOfCores0,
    CPU.NumberOfLogicalProcessors0

    I see that you have posted this exact question in another forum for CM12, however this is an CM07 forum.  
    Are you CM07 or CM12?
    If you are CM12, use my answer here.
    http://www.systemcentercentral.com/forums-archive/topic/sccm-report-query-for-cpu-cores/
    If you are CM07, this is NOT a simple how exactly do you detect that a computer is a VM? You can guess by looking at the manufacturer name but it is only a guess.
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ

  • Display Distribution Lines, Invoice Number, and the PO Number

    In Toad, I'm trying to make a query that will display the invoice number and all distribution lines as well as if it's tied to a PO or not, and if so, what is the PO number - is this possible? This is what I've made so far and I don't think the outer joins are correct.
    from ap.ap_invoices_all inv
    ,po.po_vendors vend
    ,ap.ap_invoice_distributions_all idstr
    ,gl.gl_code_combinations distr
    ,po.po_distributions_all pdstr
    ,po.po_line_locations_all shipm
    ,po.po_lines_all polin
    ,po.po_headers_all pohdr
    where vend.vendor_id = inv.vendor_id
    and inv.invoice_id = idstr.invoice_id
    and idstr.dist_code_combination_id = distr.code_combination_id
    and idstr.po_distribution_id = pdstr.po_distribution_id(+)
    and pdstr.line_location_id = shipm.line_location_id (+)
    and shipm.po_line_id = polin.po_line_id (+)
    and pohdr.po_header_id (+) = polin.po_header_id

    Hi,
    If your PO is in SRM (and replicated into R/3), and the GR is created directly in R/3, then there is no reference of this R/3 GR in SRM. The only way to get it it to read the backend PO history.
    To do this, you can try to call the BBP_PD_PO_GETDETAIL is SRM, with I_READ_BE_DATA = 'X'.
    You will get your R/3 reference (R/3 material doc number) in export tables E_HEADER_REL and E_ITMLIM_REL, and actual item values in E_ACTVAL.
    Rgds
    Christophe
    PS: please reward points for helpful answers

  • Need help in query to display lot and serial numbers for a Wip Job Component

    Hi ALL,
    I have a requirement as below.
    I need to display lot and serial numbers for a Wip Job Component, i have a xml report in that for each wip job component i need to check whether it is a lot control item or serial control item based on that i need to display some data. so can you please help me to get the query to indentify the lot and serial number for a wip job component.
    Thanks

    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.

Maybe you are looking for

  • Why don't my existing bookmark folders show up in the edit bookmark window? How do I put a new bookmark in an existing folder in one step?

    When you create a new bookmark by selecting the 'bookmark this page' command or clicking on the star next to the address, existing bookmark folders don't show up anywhere in the window. The only folder options are 'bookmarks toolbar', 'bookmarks menu

  • Help on popup window

    on standard logical database PCH selection screen, if you run it with this (*) in PCHOBJID field it popup the window message saying  " YOUR SELECTION CRITERIA  COULD RESULT IN A LONG RUNTIME DO YOU WANT TO CONTINUE PROCESSING!     YES               N

  • Creating Restricted area of Website

    How do I create the restricted area of website based on weblogic groups, for example whenever enduser invokes the URL in URL bar, I have to pop-up a small window by asking the username and password.. based upon that username I need to indentify which

  • Generate Point Q in ECIES

    Hi all I have the next code: ECPublicKeyParameters pubKey = new ECPublicKeyParameters( curve.decodePoint(Hex.decode("0262b12d60690cdcf330babab6e69763b471f994dd702d16a5")), // Q params); My question is: Is there any way to generate the string *"0262b1

  • REM planned order

    Hi, In my REM scenario, I ahve a planned order which stretches more than one month, for example start date 01.11.2009, finish data 25.12.2009. at month end of November  how will I calculate cost for this planned order?? Regards.