Query for Difference in LPP of SO and Unit Price of PO

Dear Experts,
I  have the following query which gives me the link between SO and PO.
I have the Last purchase price from SO also. Below is the query
SELECT T0.[DocEntry],T0.[DocNum] as 'SONumber',T1.[GrossBuyPr] as 'Last Purchase Price',T1.[PoTrgNum] as 'PO Number',
T2.[firstName] FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OHEM T2 ON T0.OwnerCode =
T2.empID WHERE T0.[DocDate] >=[%0] AND T0.[DocDate] <=[%1]
What I want is the Unit price of the PO to appear and also difference in  value of LPP of SO and Unit Price of PO should come in separate column.
Is it possible to get Please let me know about it
Thanks&Regards
Darshan Desai

Hi,
Try this:
SELECT T0.[DocEntry], T0.[DocNum], T1.[GrossBuyPr], T2.[DocNum], T3.[Price],T1.[GrossBuyPr] - T3.[Price] FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry left join OPOR T2 on  T2.[DocNum]  =  T1.[PoTrgNum] INNER JOIN POR1 T3 ON T2.DocEntry = T3.DocEntry WHERE T1.[ItemCode]  =  T3.[ItemCode] and  T0.[DocDate] between [%0] and [%1]
Thanks & Regards,
Nagarajan

Similar Messages

  • Excel sheet for difference between EP 6.0 and EP 7.0

    Hi All,
    Wish all of you a very very Happy New Year 2008.
    Can some body send the excel sheet for difference between EP 6.0 and EP 7.0 to [email protected] asap.
    Thanks in advance
    Jyoti

    Aaaaggghhhh.
    Please could someone either get it uploaded as an article... or even easier, add it to the Portal Wiki.  It has an attachments tab!
    Then we won't have huge threads with e-mail addresses on (which bots will then pick up and send lots of spam to).
    Many Thanks
    Paul

  • R12: Disable Field Quantity and Unit Price in Line Item (AR)

    Hello,
    Is there a setup in Oracle Receivables - Transactions where I can disable the field "Quantity" and "Unit Price" on the form for line item?
    I don't have Order Management nor Inventory setup in this environment.
    Note: In AP invoices, these field are disabled.
    vik

    Hello.
    I don't think that is possible because the system uses those fields to calculate the Amount field, which cannot be filled in directly.
    Octavio

  • Find out the Selling Price and Unit Price.

    Hi All,
    Am trying to get the Selling and Unit Price Before an Order Creation and Quote , from the API of " QP_PREQ_PUB.PRICE_REQUEST " ,. based on Item ID , Quantity and two Modifiesrs(Price List ID and Order Type ID).
    i can get Selling Price and Unit from Temp table " qp_preq_lines_tmp ". after execution of Above API .
    but I am getting Unit Price correctly and about Selling Price, its dispaly the Priec as same as Unit Price only .
    I Dont' know what step i missed .
    Have anyone developed similar API for getting the Selling Price and Unit Price for an Item ?.
    Any suggestions are appreciated.
    Regards,
    Shan

    Hi Shan,
    I saw your posting on Oracle forum that is why I am sending this email to you.
    I have been using QP_PREQ_PUB.PRICE_REQUEST to pass item to get item list price thru Oracle Price Engine. I get Item list price without any issues the only thing I am stuck is when that item has multiple modifiers then item price I get is without applying modifiers.
    My case: When Item KD653 3/3MAT has 'X' price list and price of that item is set to 600.00. I have a modifier defined and that includes/qualifies above item for 10% discount. So when I pass my pameters like inv_item_id, list_header_id etc I get 600.00 not 540.00. So I am passing two lines one for regular item list price (600.00) and second for modifier that I have created for this item.
    Result: I get 600.00 Item Price but I don't get modified (10%) price applied to unit price. Also it doesn't recognize my list_header_id that I am passing for my modifier.
    I may be missing something to trigger the modifier part. If you got case details then that will be great.
    Your help will be highly appreciated in this case.
    Regards,
    Prakash

  • Query for details of  Sale order , Invoice and COGS

    I Need the report cointing following based on month & Business partner
    Sale order, Sale Amount, Due date, Invoice Amount, Last Invoice date, COGS amount

    Hi Anantha,
    Please check below link and modify according to your requirement.
    Sales Order Query for  in SAP B1
    Query - Sales Orders linked to Deliveries
    My Top SQL Queries for SAP Business One
    Hope this helps
    Regards::::
    Atul Chakraborty

  • Query  for getting records  max  reported  timestamp and 2nd max report

    query for getting records in between
    max reported timestamp and 2nd max reported timestamp
    HERE IS ALL RESULT SET
    TIME DOMAIN
    30:jun:2006:20:08:45 TOMCAT
    30:jun:2006:20:08:45 TOMCAT
    30:jun:2006:20:07:04 TOMCAT
    30:jun:2006:20:07:04 TOMCAT
    30:jun:2006:20:07:24 TOMCAT
    30:jun:2006:20:07:24 TOMCAT
    30:jun:2006:20:07:45 TOMCAT
    30:jun:2006:20:07:45 TOMCAT
    30:jun:2006:20:08:05 TOMCAT
    30:jun:2006:20:07:04 TOMCAT
    30:jun:2006:20:08:05 TOMCAT
    PD_REPORTED_TIMESTAM PD_USER
    30:jun:2006:20:08:25 TOMCAT
    30:jun:2006:20:08:25 TOMCAT
    30:jun:2006:20:08:45 TOMCAT
    30:jun:2006:20:08:45 TOMCAT
    30:jun:2006:20:07:24 TOMCAT
    30:jun:2006:20:07:04 TOMCAT
    30:jun:2006:20:07:24 TOMCAT
    30:jun:2006:20:07:45 TOMCAT
    30:jun:2006:20:07:45 TOMCAT
    30:jun:2006:20:08:05 TOMCAT
    30:jun:2006:20:08:05 TOMCAT
    PD_REPORTED_TIMESTAM PD_USER
    30:jun:2006:20:08:25 TOMCAT
    30:jun:2006:20:08:25 TOMCAT
    QUERY RESULT TO COME
    TIME DOMAIN
    TOMCAT 30:jun:2006:20:08:45
    TOMCAT 30:jun:2006:20:08:45
    TOMCAT 30:jun:2006:20:08:45
    TOMCAT 30:jun:2006:20:08:45
    Message was edited by:
    user517983

    Hi,
    can we write query like this.
    1 select pd_user,PD_REPORTED_TIMESTAMP
    2 from sp_process_detail_current spdc
    3 where host_id='DSCP02469'and pd_user='TOMCAT'
    4 and exists(
    5 select PD_REPORTED_TIMESTAMP from sp_process_detail_current
    6* having max(PD_REPORTED_TIMESTAMP)-spdc.PD_REPORTED_TIMESTAMP=0)
    SQL> /
    PD_USER PD_REPORTED_TIMESTAM
    TOMCAT 30:jun:2006:20:08:45
    TOMCAT 30:jun:2006:20:08:45
    TOMCAT 30:jun:2006:20:08:45
    TOMCAT 30:jun:2006:20:08:45

  • 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 modify select query for retrieve assets from assets tab and assets in merchandising in 10.1.2?

    Hi All,
          I need to modify the SQL for retrieving assets from assets tab and assets in merchandising in 10.1.2. I found the class for SQLQuery builder, but I want to change the SQL.
          Could you anyone please how to solve this.
    Thanks & Regards,
    Bala

    Hi All,
          I need to modify the SQL for retrieving assets from assets tab and assets in merchandising in 10.1.2. I found the class for SQLQuery builder, but I want to change the SQL.
          Could you anyone please how to solve this.
    Thanks & Regards,
    Bala

  • A/R invoice PLD for BOM items need to hide the unit price

    Dear All,
    Our customer would like to have an A/R invoice like this: if the invoice has any BOM item, the unit price of child items should be hid. That means, I need to determine, if the item is the child of its parent, hide the unit price of it. Is there any way for me to know which item is the child item in A/R invoice PLD? I cannot find a column like status of item in the table that tells me this item is a regular item and that item is the child of an item. Thanks a lot.
    Regards,
    Yuka

    Thanks for your reply. The problem is, an item in the invoice might be the child item or the regular item.
    e.g, we have item A and B, they the child item of C. In the invoice, the customer may order 5 item C then add 10 item A as well.
    Then the invoice will like this
    C    5
    A    5
    B    5
    A    10
    Then they would like to hide A 5 B 5 but display A 10 as regular item.

  • SAP Query for difference of 2 currency fields

    Hello Experts,
    I have created a SAP query in which I need to fetch data from only 1 custom table through "direct read of table" method.
    I have also added an additionl field in the query output and the field name is "Difference" (difference between 2 currency fields).
    Please help me out in writing the code for this additional field which gives the difference of 2.
    Ex: there are 5 fields A, B, C, D and E to be displayed in output of SAP query. I have added additional field X. So please help me out to write the code which gives difference of A and B fields.
    Thanks,
    Tousif

    Hi,
    By using t-code SQ02. Use option direct read from table. Then move forward. you have a code option, click on it.
    Here you declare your data as same as your report.
    On coding section, you get a option of events. use event and move you code forward as per your requirement.

  • Query for approval procedure - A/R invoice and A/R credit memo

    Dear all,
    Need one help regarding approval procedure.
    Query :- If we do A/R credit memo and days from A/R invoice to A/R credit memo are geter than 180 then A/R credit memo
                  shoild go to the approval. (A/R invoice shoul be a base documnet)
                  I have made below query, but if days are >180 or <180 it is goinf for a approval. Can any one suggest for this.
    SELECT distinct 'TRUE'
      FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    inner join RIN1 T2 on t2.BaseEntry=T0.DocEntry
    inner join ORIN T3 on T2.DocEntry = T3.DocEntry
    where  DATEDIFF(day,T0.[DocDate],T3.DocDate) > 180
    <a href="http://megaupload2.name/">megaupload</a>, <a href="http://www.btjunkie.name/">btjunkie</a>,  <a href="http://www.freedownloadgames.name/">games</a>

    Hi,
    Try:
    SELECT distinct 'TRUE'
    FROM OINV T0
    inner join RIN1 T2 on t2.BaseEntry=T0.DocEntry AND T2.BaseType = 13
    inner join ORIN T3 on T2.DocEntry = T3.DocEntry
    where DATEDIFF(day,T0.DocDate,T3.DocDate) > 180 AND T3.DocEntry=$[ORIN.DocEntry.number\]
    Thanks,
    Gordon

  • Query  for report to show Invoices, Payments and Discounts

    Hi All
    I am hoping someone can help me with this query.
    What the customer needs is the invoices for a specific date range, the payments applied to the invoices and the discount amount
    Eg...
    Invoice    payment   discount
    100         90              10   
    This would be easy to get from the ORCT and RCT2 tables.
    However, sometime the users add the payment on account and reconciles the invoices and a manual journal for the discounts.
    So it would be best to look at the OITR and ITR1 tables?
    This is what I have so far and it almost balances...
    I am using this query to create the report in crystal,
    To create the discount amount from the incoming payment window i said (T0.ReconSum - T3.TrsfrSum)
    I also took out the vat amount within that formula.
    With the amounts from the manual journal, i just took the amount as is.
    select T2.CardCode, T2.CardName, T0.SrcObjTyp, T0.SrcObjAbs, T0.ReconSum, T3.TrsfrSum, T4.ReconDate, T2.U_FundedNonFunded, (T5.Debit - T5.Credit), T6.PymntGroup
    from ITR1 T0
                 inner join OCRD T2 on T0.Shortname = T2.CardCode
                 left outer join ORCT T3 on T3.DocEntry = T0.SrcObjAbs  and T3.CardCode = T0.ShortName
                 inner join OITR T4 on T4.ReconNum = T0.ReconNum
                 left outer join JDT1 T5 on T5.TransId = T0.TransId and T5.ObjType = T0.SrcObjAbs and T0.ShortName = T5.ShortName
                 inner join OCTG T6 on T6.GroupNum = T2.GroupNum
                where T3.DocDate <= getdate() or T5.ContraAct = '1127331'
    the account 1127331 is the Discount GL account.
    Based on the example the Payment + discount = Invoices
    however not all the customers are balancing..
    any ideas? it looks like my query is getting only the invoices where a payment has been done. The amounts just dont seem to match.
    Thank you
    Jerusha

    hi
    I think your join with OJDT is wrong in this part : T5.ObjType = T0.SrcObjAbs
    you should write
    T5.ObjType = T0.SrcObjTyp
    (I think you don't need this part at all )
    try this:
    select T2.CardCode, T2.CardName, T0.SrcObjTyp, T0.SrcObjAbs, T0.ReconSum, T3.TrsfrSum, T4.ReconDate, T2.U_FundedNonFunded, (T5.Debit - T5.Credit), T6.PymntGroup
    from
    ITR1 T0
    inner
    join OITR T4 on T4.ReconNum = T0.ReconNum
    inner
    join OCRD T2 on T0.Shortname = T2.CardCode
    left
    outer join ORCT T3 on T3.DocEntry = T0.SrcObjAbs and T3.CardCode = T0.ShortName
    left
    outer join JDT1 T5 on T5.TransId = T0.TransId and T5.ObjType = T0.SrcObjTyp and T0.ShortName = T5.ShortName
    inner
    join OCTG T6 on T6.GroupNum = T2.GroupNum
    where
    T3.DocDate <= getdate() or T5.ContraAct =
    '1127331'
    please let me know if it works now
    shachar

  • Need help with SQL Query (query for certain IDs in a table and then IDs not in result set)

    OK. This is hard to explain but that may be my problem in constructing the query.
    I have a table that has a list of jobs. The jobs information in this table, among other things, is a short description of the job itself (think "title" in phrase form), date, and ID.
    So I can query the table to get all the jobs for a particular grouping of IDs (the only ones I am interested in) that ran successfully for a given time period. But what I want are all the jobs that did not succeed (or therefore are not present in the table) for this group of jobs and for a certain date range. But these are not the only job id's in the table.
    To get the successful ones I do the following:
    SELECT id,short_desc FROM my_table where
                id IN('1230', '1231', '1232', '1239', '1244', '1245',
                '1246', '1247', '1248', '1272', '1280', '1281', '1282',
                '1283', '1284', '1285', '1286', '1249', '1250', '1251',
                '1252', '1253', '1255', '1233', '1234', '1235', '1236',
                '1237', '1238', '1256', '1257','1258', '1254', '1290','1310')
                AND the_date > = SYSDATE - 23/24
                AND to_char(the_date, 'DD-MON-YYYY') = TO_CHAR(CURRENT_DATE, 'DD-MON-YYYY')
    I have tried to use another AND clause with NOT IN and the group or NOT EXISTS but that doesn't work as there are other jobs captured in this table with id's of course. I am only concerned with these id's:
    IN('1230', '1231', '1232', '1239', '1244', '1245',
                '1246', '1247', '1248', '1272', '1280', '1281', '1282',
                '1283', '1284', '1285', '1286', '1249', '1250', '1251',
                '1252', '1253', '1255', '1233', '1234', '1235', '1236',
                '1237', '1238', '1256', '1257','1258', '1254', '1290','1310')
    Someone said to use a temp table. I don't think I have permission and I haven't tried as I want to do this in one query if possible.
    After thinking about this I am at a loss. I tried to do this in the front end but it just became too messy.

    You do not need a physical temp table. You need an in-line view:
    WITH list as (
                  SELECT '1230' id FROM DUAL UNION ALL
                  SELECT '1231' FROM DUAL UNION ALL
                  SELECT '1232' FROM DUAL UNION ALL
                  SELECT '1239' FROM DUAL UNION ALL
                  SELECT '1244' FROM DUAL UNION ALL
                  SELECT '1245' FROM DUAL UNION ALL
                  SELECT '1246' FROM DUAL UNION ALL
                  SELECT '1247' FROM DUAL UNION ALL
                  SELECT '1248' FROM DUAL UNION ALL
                  SELECT '1272' FROM DUAL UNION ALL
                  SELECT '1280' FROM DUAL UNION ALL
                  SELECT '1281' FROM DUAL UNION ALL
                  SELECT '1282' FROM DUAL UNION ALL
                  SELECT '1283' FROM DUAL UNION ALL
                  SELECT '1284' FROM DUAL UNION ALL
                  SELECT '1285' FROM DUAL UNION ALL
                  SELECT '1286' FROM DUAL UNION ALL
                  SELECT '1249' FROM DUAL UNION ALL
                  SELECT '1250' FROM DUAL UNION ALL
                  SELECT '1251' FROM DUAL UNION ALL
                  SELECT '1252' FROM DUAL UNION ALL
                  SELECT '1253' FROM DUAL UNION ALL
                  SELECT '1255' FROM DUAL UNION ALL
                  SELECT '1233' FROM DUAL UNION ALL
                  SELECT '1234' FROM DUAL UNION ALL
                  SELECT '1235' FROM DUAL UNION ALL
                  SELECT '1236' FROM DUAL UNION ALL
                  SELECT '1237' FROM DUAL UNION ALL
                  SELECT '1238' FROM DUAL UNION ALL
                  SELECT '1256' FROM DUAL UNION ALL
                  SELECT '1257' FROM DUAL UNION ALL
                  SELECT '1258' FROM DUAL UNION ALL
                  SELECT '1254' FROM DUAL UNION ALL
                  SELECT '1290' FROM DUAL UNION ALL
                  SELECT '1310' FROM DUAL
    SELECT  l.id,
            nvl(short_desc,'This job failed') short_desc
      FROM      my_table m
      WHERE RIGTH JOIN
                list
              ON (
                      m.id = l.id
                  AND
                      the_date > = SYSDATE - 23/24
                  AND
                      the_date < TRUNC(SYSDATE) + 1
    SY.

  • Query for: 'jan. to cur. mth.' and 'whole year' in 2 rows

    hi,
    i try to define a query as follows:
    the query consists of a row structure with 12 columns, one for each month.
    furthermore the query has a key figure that can be restricted to "actual" or "plan" values.
    now i want to display two rows in the query result. in the first row i like
    to display the "actual" values for all columns from january to CURRENT
    month. the REMAINING columns should be EMPTY or filled with zeros.
    the second row of the query result should be filled with "plan" values for ALL columns from january to december.
    does anyone has an idea how to achieve this result without using the cell editor?
    my problem is anything i define/restrict in the columns structure affects ALL rows. if i could differentiate between the rows from the columns selections my problem would be solved. or maybe there is another way?
    thanks very much for your help!

    Hi,
    Create two structure one for rows and one for columne
    In the rows create a structure .
    in the first selection add the keyfigures and restrcit it to plan
    and name it as plan value
    in the second selection add the keyfigure and restrict it to actual and name it as actual.
    in the column  put calmonth structure .
    Hope it helps.

  • SCCM 2007 query for workstations with client status 1 and o

    Hi everybody,
    I would like to write a sql query which gives me workstations with status 1  if the client is installed and active and 0 if the client is not active.Any help please?
    Thank you.
    Regards,
    Lebalbo

    Here you go.
    Select * from v_r_system R
    where R.client0 =1 and R.active0=0
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ

Maybe you are looking for

  • I updated my ipod touch to 5.0.1 but now all my artists in my music are messed up. Help?

    I updated my ipod touch to 5.0.1., and it works great except for one thing. All my artists are messed up, it's like my ipod while it was updating, took the time to go online and look up exactly who sang what. For example i had tons of disney songs, l

  • New iTunes update (10.6) not displaying asian characters correctly.

    Just updated my iTunes to 10.6 and the new version is not displaying the asian characters in the artist or song titles. They are appearing in the album. Have restarted my computer multiple times.

  • Photoshop CC on Ativ Book 8

    I recently purchased a Samsung Ativ Book 8 which features a Radeon HD 8770M GPU. I'm getting quite a bit of lag with OpenGL rendering turned on in Photoshop CC (without it runs fine), so I am wondering if anyone else has good or bad experiences with

  • Install and Configure Oracle client in Fedora core 3

    Hi guys I am raghu , I need a help regarding Oracle client installation in Fedora core 3 can any one guide where to get oracle client and installation steps Thanks Raghu

  • DB ISSUE: DAE.DB_READ_FAILED

    Hi everyone I am experiencing an issue in terms of writing to OIM through thortec API. It should be said that I am experiencing this issue in production, on a system, that have been running smoothly for over half a year. Setup: BEA Weblogic 8.1 SP6 O