Query on Item price

Hi Friends,
For a particular Item, the client has 10 different warehouse and different price for each warehouse which can be seen from Item master Inventory tab.
I need a query to fetch price from eg.
warehouse #1
if its blank then
warehouse # 5
if its blank then
warehouse # n and so on
The item master shows the different warehouse as different rows. How to write a query involving OITM and OITW for fetching the item cost based on above condition.
The report will have heading like this
Itemcode   /  itemname /  avgprice
The averageprice is the item cost from table OITW but based on above condition of the process of checking warehouses.
Thanks,

Hi Gordon  / Henry,
Below is my full Query.
You can see i've two new report coloumns - " LAST PUR PRICE $ " and " STANDCOST". 
I want to substract as ( " LAST PUR PRICE $ " -  " STANDCOST") and   show the result in a new coloumn in the report called " DEVIATION".  I'm getting error as these are created coloumn header and not real table header and not able to perform subtraction or addition or multiplication.
SELECT top 1000  t1.itemcode, t1.itemname,t1.lastpurprc,t1.lastpurcur, t2.whscode as "WH 00-01" ,t2.avgprice, t3.whscode as "WH 00-09" ,t3.avgprice, 
case
when (t1.lastpurcur = 'USD') then '0.974004917'
when (t1.lastpurcur = 'EUR') then '1.388466667 '
when (t1.lastpurcur = 'HKD') then '0.125095333 '
when (t1.lastpurcur = 'SEK') then '0.152933333 '
when (t1.lastpurcur = 'NTD') then '0.033560000 '
when (t1.lastpurcur = 'GPB') then '1.577862968 '
when (t1.lastpurcur = 'AUD') then '1.028033333 '
when (t1.lastpurcur = 'CNY') then '0.150833333 '
when (t1.lastpurcur = 'DKK') then '0.186283333 '
when (t1.lastpurcur = 'JPY') then '0.012246667 '
when (t1.lastpurcur = 'NOK') then '0.178016667 '
when (t1.lastpurcur = '$') then '1.0 '
end as "ExchRate",
case
*when (t1.lastpurcur = 'USD') then  0.974004917 * t1.lastpurprc*
*when (t1.lastpurcur = 'EUR') then 1.388466667 * t1.lastpurprc*
*when (t1.lastpurcur = 'HKD') then 0.125095333 * t1.lastpurprc*
*when (t1.lastpurcur = 'SEK') then 0.152933333 * t1.lastpurprc*
*when (t1.lastpurcur = 'NTD') then 0.033560000 * t1.lastpurprc*
*when (t1.lastpurcur = 'GPB') then 1.577862968 * t1.lastpurprc*
*when (t1.lastpurcur = 'AUD') then 1.028033333 * t1.lastpurprc*
*when (t1.lastpurcur = 'CNY') then 0.150833333 * t1.lastpurprc*
*when (t1.lastpurcur = 'DKK') then 0.186283333 * t1.lastpurprc*
*when (t1.lastpurcur = 'JPY') then 0.012246667 * t1.lastpurprc*
*when (t1.lastpurcur = 'NOK') then 0.178016667 * t1.lastpurprc*
*when (t1.lastpurcur = '$') then 1.0 * t1.lastpurprc*
end as "Last Pur Price $ ",
case
When t2.avgprice = 0  then t3.avgprice else t2.avgprice end as "StandCost"
FROM oitm t1
LEFT JOIN oitw t2 on t1.itemcode = t2.itemcode and  t2.whscode IN ('00-01')
LEFT JOIN oitw t3 on t1.itemcode = t3.itemcode and  t3.whscode IN ('00-09')
Thanks,

Similar Messages

  • Need query for Item - Price Change History

    I need help finding information around Price Change History by Price List. 
    Information of interest is Date of Update and By Whom.    Also, if a Datasource is 'N-Unknown', what does this generally mean?
    select
    i.itemcode,
    i.itemname,
    iphist.price,
    pl.listname,
    pl.datasource as 'ChangeSource',
    '' as 'PriceChangeUpdateDate',
    '' as 'UpdateByUser'
    from  ait1 iphist, oitm i, opln pl
    where 1=1
    and iphist.pricelist = pl.listnum
    and i.itemcode = iphist.itemcode
    and iphist.itemcode in ('1234')
    and pl.listnum in (6)
    thanks in advance...

    thanks for the quick response and i would love to spend time perusing the forum for this question but i didn't have time today.  i'll do that now though.
    what i'm mostly interested in is a chronological view (lastUpdateDate) of the change to pricing for an item in the system.  there is a lot of activity in our system around price changes for promotions and i want to keep track of when it's changed in the source system and pair that with our other downstream systems.
    i'm assuming we can add this functionality through a udf some way or maybe sp_TransNotification proc?

  • Max Item Price

    Hi Guys,
    I need some changes in the  below query.
    the query is showing correct values for opening, issue , receipt and closing stock values but the problem arising in the price calculation.
    In the query the item price is calculated from max(price) or Avg(Price) but we need the item price for that particular transaction.
    Right now we are maintaining FIFO in item price and just we need the price for each opening, issue,receipt and closing stock individually at what item price that transaction has been done.
    select a.ItemCode,a.Des, a.WareHouse , (SELECT (sum(t1.inqty - t1.outqty))
    FROM OINM t1 
    WHERE (T1.DocDate < '[%1]') and (t1.itemcode = a.itemcode) and (t1.warehouse = a.whs) ) as 'OB', a.Price,a.inqty as 'Goods Receipt',a.outqty as 'Goods Issue', (SELECT (sum(t1.inqty) - sum(t1.outqty))
    FROM OINM t1  
    WHERE (T1.DocDate <= '[%2]') and (t1.itemcode = a.itemcode) and (t1.warehouse = a.whs)) as 'Closing',
    ( a.Price *(SELECT (sum(t1.inqty) - sum(t1.outqty))
    FROM OINM t1  
    WHERE (T1.DocDate <= '[%2]') and (t1.itemcode = a.itemcode) and (t1.warehouse = a.whs)) ) as 'Closing Value'
    from (SELECT max(T0.[ItemCode]) as 'ItemCode', max(T0.[Dscription]) as 'Des',sum(T0.[InQty]) as 'InQty', sum(T0.[OutQty]) 'OutQty',t0.warehouse as 'whs' ,
    (select w1.whsname from owhs w1 where w1.whscode = t0.warehouse) as 'Warehouse',max(T0.[Price]) as 'Price'
    FROM OINM T0 
    inner join oitm o1 on o1.itemcode = t0.itemcode
    inner join oitb o2 on o2.itmsgrpcod = o1.itmsgrpcod 
    WHERE (T0.[DocDate] >= '[%1]' and  T0.[DocDate] <= '[%2]')  and
    (o2.itmsgrpnam >= '[%3]' and o2.itmsgrpnam <= '[%4]' )
    group by T0.[ItemCode],t0.warehouse)a
    Regards,
    Vamsi

    Hi Vamsi,
    You may refer to my answer from your another similar thread.
    Thanks,
    Gordon

  • Item Price in report for every transaction

    Hi Guys.i am using the below queries for Stock report and i am getting the desired output  except the price calculation.
    In that query it is calculated like max(price) or avg(price) but instead of that i need the item price for that particular transaction  and also i need the prices for opening stock , goods issue, goods receipt and closing stock seperately in each column .
    pls provide me the updated query.
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @Group nvarchar(10)
    Declare @Whse nvarchar(10)
    Set @FromDate = (Select min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]')
    Set @ToDate = (Select max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]')
    Set @Group = (Select Max(s2.ItmsGrpCod) from dbo.OITB S2 Where S2.ItmsGrpNam = 'Group B')
    Set @Whse = (Select Max(s3.Warehouse) from dbo.OINM S3 Where S3.Warehouse = '03'  )
    Select
    @Whse as 'Warehouse',     
    a.Itemcode,
    max(a.Dscription) as 'Description',MAX(a.Price) as 'Price',
    sum(a.[Opening Balance]) as [Opening Balance],
    sum(a.[IN]) as [Receipt],
    sum(a.OUT) as [Issue],
    ((sum(a.[Opening Balance]) + sum(a.[IN])) - Sum(a.OUT)) as Closing,
    ( MAX(a.Price) *  ((sum(a.[Opening Balance]) + sum(a.[IN])) - Sum(a.OUT)) ) as ClosingValue
    from(
    Select
    N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,N1.Price,
    (sum(N1.inqty)-sum(n1.outqty)) as [Opening Balance],
    0 as [IN],
    0 as OUT
    From dbo.OINM N1
    Where
    N1.DocDate < @FromDate and N1.Warehouse = @Whse
    Group By
    N1.Warehouse,N1.ItemCode,N1.Dscription,N1.Price
    Union All
    select
    N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,N1.price,
    0 as [Opening Balance],
    sum(N1.inqty) as [IN],
    0 as OUT
    From dbo.OINM N1
    Where
    N1.DocDate >= @FromDate and N1.DocDate <= @ToDate and
    N1.Inqty >0
    and N1.Warehouse = @Whse
    Group By
    N1.Warehouse,N1.ItemCode,N1.Dscription,N1.price
    Union All
    select
    N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,N1.price,
    0 as [Opening Balance],
    0 as [IN],
    sum(N1.outqty) as OUT
    From dbo.OINM N1
    Where
    N1.DocDate >= @FromDate and N1.DocDate <=@ToDate and
    N1.OutQty > 0
    and N1.Warehouse = @Whse
    Group By
    N1.Warehouse,N1.ItemCode,N1.Dscription,N1.price) a, dbo.OITM I1
    where
    a.ItemCode=I1.ItemCode and
    I1.ItmsGrpCod = @Group
    Group By
    a.Itemcode
    Having sum(a.[Opening Balance]) + sum(a.[IN]) + sum(a.OUT) > 0
    Order By a.Itemcode
    Regards,
    Vamsi

    Hi Gordon,
    We are maintaining different Price Lists  so is it possible to give the input in the query to select the report based on which price list???
    Or else  is it better to create an udf in item master data for Standard price of the item and display it in report??
    And i have another doutb that while i run the inventory audit report  and the query it is showing different values .. why is it so??
    pls give me the solution for the same,
    thanks in advance..

  • How to find average item price

    How can i find the average item price of an item throug quey or application

    Hi,
    Please review the following threads ..
    item_price
    item_price
    SQL query to display the price of an ITEM
    Re: SQL query to display the price of an ITEM
    You can also search for old threads which discuss the same topic --> [Average Item Price|http://forums.oracle.com/forums/search.jspa?threadID=&q=average+item+price&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001].
    Regards,
    Hussein

  • Sales Order line item Price after Discount

    Hi all
    How to get the line item price after discount in Sales Order Query?
    Kedalene

    Hi Kedalene,
    Please check below Query.
    SELECT T0.[DocNum], T0.[DocDate], T0.[CardName], T1.[Dscription], T1.[Quantity], T1.[Price] as Price_After_Discount, T1.[PriceBefDi] As Price_Before_Discount,T1.[DiscPrcnt],  T1.[LineTotal] FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
    Hope this help
    Regards:::::
    Atul Chakraborty

  • How to get Item Price Based on Valuation Method

    Hello All,
    I want to get the price of an item based on its Valuation method (FIFO,Moving Average) for calculation .
    Is their any Objects for getting the Item Price Based on Valuation Method or any other way around for getting the
    price.
    Thanks & Regards,
    Amit

    Hello,
    You Can receive the Moving Average price of an Item :
    MovingAveragePrice property returns the Moving average price
    AvgStdPrice property returns the standard price
    sample:
    Dim oItem As SAPbobsCOM.Items = oCompany.GetBusinessObject(BoObjectTypes.oItems)
            oItem.GetByKey("ITEMCODE")
            oItem.MovingAveragePrice
            oItem.AvgStdPrice
    Best of my known in 2007 there is no interface for FiFo prices.
    You can use OINM table to query the FiFo prices
    Regards,
    J

  • How to stop A/R Invoice from adding which is without Item Price entered in it.

    I am a beginner to SAP B1.
    A/R Invoice is getting added into the system without the item price.
    I want to that " If item price is not entered in the document, then the A/R Invoice should not get added ".
    I believe, it can be done through formatted search , But, can anybody help me regarding Query to be
    used in formatted search
    OR
    Is there any other way of achieving this ?

    Hi Nikhil D,
    Follow this step..
    1. In SQL Server, go to the SAP B1 Database you're using. 
    2. then on the Object Explorer , go to Database Folder, explode the SAP DB->Programmability->Stored Procedures->SBO_SP_TransactionNotification * the only Stored Procedure that is allowed to be edited. Just right click and modify
    3.  Try to paste this ->
    If @object_type='13' AND (@transaction_type='A' or @transaction_type='U')
    BEGIN
          IF Exists(Select * from INV1 Where DocEntry=@list_of_cols_val_tab_del and (Price='' or Price IS Null or price=0)) 
          BEGIN    
              select @error=3, @error_message='Enter Item Price'
          END
    END
    Regards..

  • HFR Issues - "5200: Error executing query: Invalid Item ID"

    Hi All,
    We are using Hyperion HFM application 11.1.1.3. Recently we have upgraded the Oralce Database to 11.2.0.2 and reconfigured the HFM application with this new database version. When I tried to run the Financial reporting through the HFR studio, I am getting error message - "5200: Error executing query: Invalid Item ID". Please could you help me to resolve this issue.
    Thanks,
    Aravindh K

    This was due to an invalid default Point of View for the user that was incompatible with the particular report.
    Change the Preferences to User Point of View Preview and run the report again.
    File > Preference > Financial Reporting > Select Preview "ON" under USer Point of View box.
    Re-run the report and select the desired POV.
    This will prompt the user to change their POV every time he or she opens a report. They can select the correct POV and the report runs correctly.
    You can turn off later. Let me know if it fixed this issue.

  • HFR - 5200: Error executing query: Invalid Item ID

    Hi All,
    We are using Hyperion HFM application 11.1.1.3. Recently we have upgraded the Oralce Database to 11.2.0.2 and reconfigured the HFM application with this new database version. When I tried to run the Financial reporting through the HFR studio, I am getting error message - "5200: Error executing query: Invalid Item ID". Please could you help me to resolve this issue.
    Thanks,
    Aravindh K

    Did anything change on the database side? Alias, member name? "Error executing query" usually is associated with a change in the database.
    Regards
    Celvin
    http://www.orahyplabs.com

  • Warning on Item price during contract and PO creation

    Hi Experts,
    When I create a contract, I put a material with mat. code and expect the system takes the standard price in the accounting tab of the material master.
    1/  Is there a way the system picks up the price auto. from the material master ?
    i.e. syst. warning during contract creation when I put the mat. code : +Effective price is 0.00, material price is 10.00 + 
    I do not understand why the syst. gives me this message (I have a standard price of 100 in MM and I put a net price of 100 during contract creation)
    2/  During PO creation, the syst. picks up the item price from the contract but I receive this message :
    Effective price is 100.00, material price is 10.00
    Again, I do not understand how the syst. indicates the mat. price at 10 (while I put 100 in MM and 100 in contract item level).
    Could anyone helps on this topic?
    Thanks in advance for your help.

    Any inputs will be much appreciated. Thanks

  • Cash Discount at header is not reducing line item price

    Hi Experts,
    While putting cash discount at header, it is not reducing price of the my total line item. I am having total line item price = 100 USD (10 USD * 10 Qty). I am entering 10 USD as cash discount at header. It is not reducing total line item price to 90. Also in my accounting document 10 USD (cash discount) is going to my tax account.
    Please advise.
    Regards,
    Kamal

    Hi,
    The cash discount case will only be applicable in connection with terms of payment.  You will have to define your customized discount condition type in M/06 and assign it to your PO pricing schema via M/08 transaction.  Make sure it shall not be set as 'Statistics' condition type.
    Cheers,
    HT

  • Item Price in warehouse is not defined. Continue!

    Hello everyone,
    I created a new User - Defined Field at Item Master Data. I entered a number in this field and pressed Update button. After that, SAP showed a system message: "Item price in warehouse is not defined. Continue?" as picture:
    I pressed Yes and Update button. But the number wasn't saved. I don't know what it is. Could you help me, please?
    Thank you very much.
    Regards,
    Dong Pham Nhat

    Hi,
    If you add item master data without item cost, then you get above system message. Refer below screen shot.
    2. Do you updating this cost from above UDF by FMS?
    Thanks & Regards,
    Nagarajan

  • WCF Service and Sharepoint Form library : How i can read a access a form libray and query a item from file name and read form xml in WCF service ?

    WCF Service and Sharepoint Form library : How i can read or access a form libray and query a item from file name and read form xml in WCF service ?
    Ahsan Ranjha

    Hi,
    In SharePoint 2013, we can take use of REST API or Client Object Model to access the SharePoint objects like Form Library.
    SharePoint 2013 REST API
    http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx
    http://blogs.technet.com/b/fromthefield/archive/2013/09/05/working-with-sharepoint-list-data-odata-rest-and-javascript.aspx
    SharePoint 2013 Client Object Model
    http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx
    http://msdn.microsoft.com/en-us/library/office/jj193041(v=office.15).aspx
    With the retrieved file, we can then use XmlDocument object to parse it and get the values you want:
    http://weblogs.asp.net/jimjackson/opening-and-reading-an-xml-file-in-a-document-library
    http://stackoverflow.com/questions/1968809/programatically-edit-infopath-form-fields
    Best regards
    Patrick Liang
    TechNet Community Support

  • Get Item price based on Price List

    Hi all,
    anyone has some sample of how to get the price for an item based on a specified price list, selected by the user, following the SAP's rules for assigning item price?
    I've used the GetItemPrice method, but it doesn't need a price list reference and i think it gives back the basic price of the item.
    I'm able to get the price list and the item code. How can i get the correspondig price (unit price) for that item?
    Thanks in advance.
    Nick

    Thanks Rasmus,
    i've done. I get the PriceList currently selected by the combo box and update the price list used by the BP, and after that i use the getitemprice.
    So it should work now, i get the correct prices related to the pricelist selected and i think that using the getitemprice the price that i obtain follows the sap B1 logic in assigning prices.
    After that i'm considering to set back the pricelist on the BP to the one that is originally stored in the BP.
    Thanks for your help

Maybe you are looking for

  • What inetd services causes port to be opened?

    Hello. I'd like to find out, what inetd-controlled service is causing a certain port to be opened by inetd. In particular, I'd like to know, why port 6112 is opened. adm@winds02 ~ $ getent services 6112 dtspc                6112/tcpThis means, that "

  • Export items from certain warehouse in SAP B1

    Hi All. I am trying to export some of the unused items from one of the warehouse in Item Master Data but don't know which tools to use? I try to use Data Import/Export but it is only for transactions export. After that, I'll import the latest item in

  • Help with HTTP protocol.

    Hi every body. How can I get HTML code from some page in the internet with GET data and POST data? OR How can use on the usualy sockets like TelNET? I saw the MXLsocket class, this is the same thing? TNX all.

  • Torch App Error 606 + Can't connect to desktop Manager

    Hi, I was backing up my blackberry torch last night and the connection was disconnected during the backup. When the phone restarted the message "App Error 606" / "Reset" came up. I can't do anything on my phone except for reset it, and pulling the ba

  • How to change the language in the firefox start menu?

    my firefox start menu bar is in Germany. Also the menu on the google apears in Germany and I want to change it to English or portuguese. I have also another problem. Have a DVDStudio software to download music and video from Youtube. I can do it from