Round up syntax for Formatted Search

Hi all,
I need help on writing the formatted search syntax for below scenario.
Discount % = 2 decimal place only
Unit Price = 99,376.00
Discount = 30.97%
Price After Discount = 68,599.25
I want the Price After Discount to be rounded up to 68,600. Any idea how to achieve this? Will do this round up in another UDF so that my layout will show the rounded up price to customer.
Even if the Price after discount is 600.02, i wanted the result to be always rounded up to nearest $1 as long as the original price has some amount at the decimal. For this case, should round up to 601.00.
Anyone can help? Thanks in advance.

Hi Too Mui Hwee
Will the UDF be varchar or numeric? Do you want the udf to show the currency as well?
I have done both for you. The problem with SQL 2008 & 2012 is that they don't have a roundup function. This is however in version 2014 which is not yet supported by SAP Business One.
Without currency:
SELECT CASE WHEN ROUND($[$38.17.NUMBER],0) < $[$38.17.NUMBER] THEN ROUND($[$38.17.NUMBER],0) + 1 ELSE ROUND($[$38.17.NUMBER],0) END
With currency:
SELECT CASE WHEN ROUND($[$38.17.NUMBER],0) < $[$38.17.NUMBER] THEN $[$38.17.CURRENCY] + ' ' + CAST(ROUND($[$38.17.NUMBER],0) + 1 AS VARCHAR(20)) ELSE $[$38.17.CURRENCY] + ' ' + CAST(ROUND($[$38.17.NUMBER],0) AS VARCHAR(20)) END
Kind regards
Peter Juby

Similar Messages

  • Help needed for Formatted Search

    Hai Experts,
    would like to ask you some clarification on Formatted Search. In the
    query I found $http://$44.2.1 given in the criteria part.
    In some articles it was mentioned that, the 44 meant for the table
    connected with the form and 2 is field index and so on.
    Can you please explain how to find out those numbers and field index.
    I need to work out planty of FMS to fetch data into
    UDF automatically based on user input.
    Regards
    Anand

    Hi Anand,
    You may check these threads first:
    Re: Vendor default GL FMS help
    Re: Runtime data calculation
    Thanks,
    Gordon

  • SQL query for formatted search

    Hi guys and expertise,
    I have this one problem where i need to do the formatted search,below is my example query that i  have done
    declare @itemcode varchar (20)
    set @itemcode = (select x.itemcode from OITM x where x.ItemCode=[%])
    declare @itmgrp varchar(50)
    set @itmgrp=(select y.itmsgrpnam from OITB y where y.ItmsGrpNam=[%1])
    select
    CASE
    when @itemcode = 'Item Descriptions 1' then @itmgrp
    else t0.ItmsGrpNam
    end
    from OITB t0 inner join
    OITM t1 on t0.ItmsGrpCod=t1.ItmsGrpCod
    where t1.itemcode=@itemcode
    ***correct me if i'm wrong
    the condition is :-
    whenever the user selection is 'Item Descriptions 1' user will have to select the product group name else
    if the user selection is not equal to "Item Descriptions 1", automatically the product group name will be default according
    to the item code itself.
    i wonder if it's possible?  if it is, then i suppose there should be a way,right?

    Hi Gordon...
    Thanks a lot for the answer,
    I did try some research and manage to find a way out for the query that I want, the query is as below:-
    BEGIN
    IF
    $[$38.1.0]='Item Descriptions' or $[$38.1.0]='Item Descriptions 1' or $[$38.1.0]='Item Descriptions 2' or
    $[$38.1.0]='Item Descriptions 3' or $[$38.1.0]='Item Descriptions 4'
    SELECT T0.ItmsGrpNam FROM OITB T0 inner join OITM T1 ON T0.ItmsGrpCod=T1.ItmsGrpCod
    Group By T0.ItmsGrpNam
    ELSE
    SELECT T0.ItmsGrpNam FROM OITB T0 inner join OITM T1
    ON T0.ItmsGrpCod=T1.ItmsGrpCod where T1.ItemCode=$[$38.1.0]
    END
    regards,
    Asyraf

  • Authorizations for formatted searches?

    Hello experts,
    I have created a simple formatted search so users select from the list the country of origin of a batch.
    Currently, they get an error message.
    Do you know which authorizations I should give them so they can use that formatted search query?
    Many thanks

    Hi Pam,
    In Authorisation window for the particular user who is facing the error.
    Navigate Admin > System initilisation > Authorisation > ( Select ) >
    Reports --> Query Generator -->  Execute Non - Select SQL Statement  and give  Full Authorisation.
    Is the User now able to execute FMS ?
    Regards,
    Rakesh N

  • Query for formatted search

    Hi All,
    I have a line UDF called U_PO in the sales order documents that denotes our purchase order number that particular item is ordered on.
    I have another line UDF called U_XMill which I want to populate with the corresponding PO document due date.
    What would be my query for that?
    Basically, it should be something like:
    SELECT T0.DocDueDate FROM OPOR T0 WHERE T0.DocNum=$[$38.44.0] FOR BROWSE
    However, I am sure that "38.44" is wrong.
    It should denote my current document's UDF *.U_PO.
    And I am not sure what would be the correct notation for it.
    I was wondering if there was a help document I could refer to to figure out the corresponding field numbers for the cases like this.
    Thank you for your help.

    Hello
    use FMS on matrix (tables) as
    [ItemUID.ColumnUID.Type] or [TableName.FieldName]
    where itemUID is 38
    ColumnUID is U_XMill
    Type is 0 (general).
    There is a now-to guide on service.sap.com/smb/sbo where you can find how to us FMS.
    Regards
    J

  • Formatted search query for displaying invoice items details

    hi all,
    i need to display all the items in AP invoice.kindly suggest me a query for that.
    in AP invoice
    Ex. row items
    code--descqtyprice--
    total
    I0001--XXXXXXX5--
    100 -
    500
    query should display this row as
    code--desc--
    price
    I0001--XXXXXXX--
    100
    I0001--XXXXXXX--
    100
    I0001--XXXXXXX--
    100
    I0001--XXXXXXX--
    100
    I0001--XXXXXXX--
    100
    =================================
    the query should display as the qty is 5 so it will display the same item 5 times
    kindly suggest me some query for formatted search
    its very urgent
    regards
    sandip

    Hi Sandip,
    DoQuery("Select b.ItemCode from OINV a,INV1 b Where a.DocEntry=b.DocEntry")
    Hope its help for you
    Give me reward points,
    Regards,
    G.Suresh.

  • Addition of two rows values in table  using formatted search

    hi all,
            i have created one UDF field in market document rows, now in AR invoice i need to add the values in the UDF fields of two rows, want to show it in anather outside UDF in title. kindly suggest me some query to track that.
    Ex:- i had entered two items in rows and
    for first UDF row i have given 20
    for second UDF row i have given 30.
    now i need to show sum of the two UDF in two rows in title UDF.
    kindly give me some query used for formatted search to do this task.
    regards
    sandip

    Sandip,
    To the best of myknowledge When you try to take the row value to the header the results of the Formatted Search are not consistent.
    but for your interest, I am giving below the logic to work this out.
    You need two Header level user fields.  One to copy the row user fields value and the other to store the sum.
    You can create a simple SQL "SELECT $[$38.U_UserFieldName] (substitute with row level user field name) and attach it to the first header level user field and make it Auto refresh on doc total.
    Then Attached SQL  "SELECT $[ORDR.U_HeaderUserField1] + $[ORDR.U_HeaderUserField2]"
    The results could be flaky because the header user field takes the value of the active row and sometime it only considers the first row active though you might be entering the second row of data.
    My recommendation would be to Use The Transaction Notification Stored Procedure for this by which you can be absolutely sure that the Header User field will have the sum.
    Let me know if you need directions for this.
    Regards
    Suda

  • Problem in Formatted Search

    I have added two UDFs namely ItemCode and ItemName on header level of Profit center form.
    I have attached folwing query to ItemCode for Formatted Search
          select Itemcode from oitm
    I want to display the corresponding itemname automaticaly in itemname field. So I created the folowing query:
    Select oitm.itemname from oitm where itemcode= (select $[$U_ItemCode.U_ItemCode])
    setting is that Auto refresh when field changes (ItemCode).
    Now what result I am getting is as follows:
    if I change ItemCode and goto ItemName, the itemname should change automaticaly, but it doesn't happen. However if I press Shift+F2 here on ItemName it takes the correct ItemName. I want that ItemName should be changes as ItemCode is changed automaticaly...
    I am using a Patch 01.
    plz help

    Amol,
    Please try
    SELECT T0.ItemName FROM OITM T0 WHERE T0.ItemCode = $[[OPRC.U_ItemCode]]
    NOTE: The format is $[[TableName.UserField]] .  Since you have create the User field in OPRC table I am referring to it as OPRC.U_ItemCode
    remove the http:// thats got added.
    Suda

  • Regarding formatted search

    hi,
        how to track particular query applied for formatted search.and where it applied.
    pls give solution asap.
    regards
    vishal

    Hi,
    Please check the DI API documentation for <i>FormattedSearches</i> and <i>UserQueries</i> objects.
    That should give you all information you need...
    Regards,
    Frank

  • Using Second Column of Formatted Search

    Hi All,
    i have a query for formatted Search, which goes like This
    "Select ItemName, ItemCode from oitm"
    When i press Tab on the field 'Product No.' in 'Production order',
    i get the CFL of ItemName and ItemCode.
    when i select one row from this, i need to capture the ItemCode
    in the field 'Product No.' (By Default it captures the first Column i.e ItemName)
    Any suggestion are most welcome
    Regards,
    Mahendra

    Mahendra,
    By default it will fetch the first column only. one workaround what you may not like to use is, to define a user defined field in production order form and give an FMS there. ther you show the itemname first as you have written, and give an Auto refresh FMS on production order field where you change it to itemcode when item name is selected.
    HTH,
    Regards,
    Binita

  • Formatted Search in Matrix

    How to create a query for formatted search if my variable is in the matrix(some column and some row).
    I would like the SAP user get a list of all Workorders for a Job, and Job is a cell in matrix.
    Workorder value should be shown in another cell in the same row.
    Thanks a lot,

    Hi Pavel,
    The document 'How to Define and Use Formatted Search' on the Service Market Place goes through defining and using formatted searches with queries. It also explains how to use fields in an active form in a formatted search, look at the section called 'Search by Saved Query' in the document.
    To find this document go to
    www.service.sap.com -> Channel Partner Portal -> Solutions - SAP Business One -> Support -> Additional Information - Documentation Resource Centre -> SAP Business One 2005 A SP 01 -> How to guides -> 'How to Define and Use Formatted Search'
    This document also gives some examples of the types of queries which are used in formatted searches.
    Hope this helps
    Noreen

  • Formatted Search on Inventory Posting

    Dear Experts,
    I have a FMS on inventory posting distribution rule, its supposed to display the distribution rule automatically for the items, without human intervention.  How can I set this to auto-refresh ?  since when using this form virtually no column is normally touched apart from the reconcile button.
    Edited by: Roc on Apr 8, 2010 4:27 PM

    Hi Gordan,
    we have upgraded SAP B1 2005 to 2007 - we are using old query for formatted search for items in marketing document - can in that cancelled items also reflecting - can you please correct that query where i dont want to reflect cancelled items.
    SELECT T0.[ItemCode] AS 'Item No.', T0.[ItemName] AS 'Item Description', T0.[UserText] AS 'Item Details', T0.[OnHand] AS 'In Stock' ,T0.PrchseItem,T0.SellItem FROM  [dbo].[OITM] T0  WHERE (T0.[UserText] Like N'%[%0]%'   ) AND  (T0.[UserText] Like N'%[%1]%'   ) AND  (T0.[UserText] Like N'%[%2]%'   ) AND  (T0.[UserText] Like N'%[%3]%'   )
    Thanks

  • Formatted search with UDF and syntax question

    Can you explain the syntax with when to use the dollar sign and negative in writing a query for a formatted search based on user entry?
    I now want to create a formatted search to pull values based on the user's entry into a UDF on the item master screen.
    User entry into UDF U_Customer Code
    to create Formatted search for UDF U_Rep01
    I tried the following, but it does not work.
    SELECT T0.U_REP01 FROM dbo.OCRD T0
    WHERE T0.CARDCODE = $http://$OITM.U_CUSTOMERCODE
    Thanks.
    Please advise.

    The right syntax would be like this:
    SELECT T0.U_REP01 FROM dbo.OCRD T0
    WHERE T0.CARDCODE = $[OITM.U_CUSTOMERCODE\]
    However, the logic of query may not be correct.  Select something must be already in the system and Where should also be locatable.
    Thanks,
    Gordon

  • Date Difference Query Syntax Formatted Search

    Hi Experts,
    My client renders a service(warehousing of Cargo) on time and material basis,therefore the Quantity column of the AR Invoice represents the number of days the cargo was warehoused.
    I want to create a formatted search with reference to a query on this field to help me compute the number of days automatically. The number of days is normally calculated by Subtracting the the Admission date(Serial Number Details Table "OSRI", field "InDate" from the document date of the invoice) from the AR invoice document date.
    Considering that the Item is serial number managed, the item serial number will connect the Serial Number details table to the AR Invoice table.
    Can anybody help me with the syntax of the query that will achieve the above for me.
    Waiting to hear from you .
    Thanks

    If you have many serial numbers for an item, there will be no way to identify which serial number was actually selected in the invoice till the time the Invoice is added.
    So knowing the Serial Number that was selected on that Invoice is important and what you select in the Serial number selection window on the Invoice is stored in temporary location and cannot be referencing by looking into OSRI table.
    If there are multiple serial numbers with different InDate's, how could you calculate?
    Is there a Delivery Step?  Delivery > Invoice
    OR
    Do you copy SO > AR Invoice directly
    Suda

  • Special Price + Formatted Search for Special Price.

    Hi all,
    Appreciate some help here.  Our client is using SAP B1 2007 Patch 38.  AU/NZ localization, Local Currency = AUD.
    Scenario:
    Item A, Price List 1 = $2795, Price List display = 4 decimals, Price List Currency = USD
    Special price for Item A has been set up as follows:
    Step 1 - Go to Item> Price List> Price and Volumne Discount
    Step 2 - The price and volumn discount screen opened. From the drop down, select price list and then select Item A by double clicking the line.
    Step 3 - Period Discount screen opened.  Valid from = 9th July 2008. Price = $2795.
    Step 4 - Double click the line, Volume Discount Price List open, with the following details maintained.
    Quantity=1, Discount=0, Special Price = $2795.
    Quantity = 10, Discount=7.1556, Special Price = $ 2595.0010
    Quantity = 100, Discount=10.0179, Special Price=$ 2514.9997
    Question:  we intend to put in Special price = $2595 and $2515, but SAP just does its own round up.  Is there a way to work around?
    Scenario 2:
    To deal with the problem from Question 1, we have created a formatted search in the sales order and formatted search to round up the value in Line Total.
    Column = Line Total
    Trigger by = Quantity
    Query = SELECT (case when $[$63.0.0]='USD' then Round($[$38.23.number],0) else $[$38.23.number] end)
    Column = Quantity
    Trigger by = Discount%
    Query = SELECT $[$38.11.1]
    The above set up works fine, if the user enter the quantity correctly the first time. 
    Eg:
    User enter Qty = 10, SAP will display Discount = 7.1556 % and Line Total = $25,950.00 (Round up from $25950.01).
    If user notice the quantity is wrong and then enter new quantity = 100, the discount remains at 7.1556%, it should be 10.0179%.
    Question: Is there a way to work around this?

    Hi Shawn ,
    1.First check the decimal setting
    a.Administration --> system intilisation --Document setting -- currency or by document --
    b.System initiliaisation ---> general settng --->Display
    c.Administration set up->Financial currency ---rounding --???
    Currency setting overides the rounding method of procedure B
    Scenario2
    Since your trigger is dicount percentage , You will not get the desired output from the formatted search . Try to get the trigger at quantity .
    Hope that helps
    Bishal

Maybe you are looking for

  • Black screen after login on Satellite L350-20Q (normal mode)

    My Satellite L350-20Q run Vista basic. After login that is normal I go to the turning arrow then to a permanent black screen when I start in normal mode. In safe mode I have a normal behaviour and I can work. Spybot report no malware present. But my

  • Web Service Client works from IDE, not standalone

    I'm using the Netbeans 5.5 IDE & JAX-WS 2.0 & jdk1.6. I use an Applet to call a webservice on an embedded web-server which has gSoap generated WebServices. The code works fine if I run it from the IDE. However, the following error occurs if I run it

  • How can get my old iTunes back?

    iTunes 11 is terrible, how can I go back??

  • Why is my iPad working slower since updating with IOS  7

    I have recently uploaded the new update for iPad and it is now significantly slower and I liked the old themes better,this latest update has made downloading and surfing really slow anyone else experiencing this or is it just me?

  • Can't get 10.03 update

    I bought and installed Final Cut Pro X when it first came out last june from the app store. Now I wanted to get the much awaited 10.03 update but when I go to the app store to download, I click install and it says "Final Cut Pro 10.0 is already insta