Formatted Search Rounding Issue

Hi everyone,
I have a slight issue. I have defined a formatted search on the A/R Invoice that calculates the item price based on a user defined field. The problem is whenever the formatted search runs, it rounds the figure to two decimal places. For instance; the query is supposed to divide a value you put in the user defined field by 50 if you put in 2.25 the value you get is 0.04 instead of 0.045. The query i've used is as below.
Please assist.
SELECT (CAST($[$38.U_pprf.0] AS DECIMAL)/50)

Hi Duncan,
Try this FMS in UDF2. you will be get the exact value in UDF2.
for Example:
*Create 2 UDF's
UDF Type -> Unit and Total.
UDF Structure -> Price (or) Amount.
UDF1 -> U_pprf
UDF2 -> U_Item_Price
UDF1 = 2.25
UDF2 = 2.25/50 => 0.045
SORRY Last Query is not correct because that Query will not get Exact Result.
If you want exact value. Try the below Query.
First Assign the below Setup.
->> Administration.
->> System Initialization.
->> General Setting. -> Display Tab.
Assign the Decimal Places  (0..6) value.
Price (or) Amount -> 3
IF you assign the setup of Price (or) Amount = 3 in Decimal Places.
Result: 0.045
IF you assign the setup of Price (or) Amount = 2 in Decimal Places.
Result: 0.05
Query: 2
declare @UDF as numeric(19,6)
set @UDF = $[PDN1.U_pprf]
select  (@UDF/50)
Result: 0.045
Assign this FMS in UDF2 and Auto Refresh of U_pprf
Regards,
Madhan.

Similar Messages

  • 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

  • Issue with Formatted Search and Sales BOM

    Good afternoon,
    One of our customers uses a Formatted Search on the Sales Order row to lookup the Project Code stored against the Item.
    This works very well, except for when a Sales BOM is selected.  I assume the FS lookup is working correctly, but the screen is quickly refreshed to list all the component items related to the BOM.  This process appears to overwrite the contents of the Project field.
    We wish to keep this functionality, but retain the FS lookup results in the Project column.  Could the order of the process be changed so that the BOM refresh occurs prior to the FS lookup.
    Thanks
    Greig
    Edited by: Greig Burrows on Jul 21, 2010 5:57 PM

    Hi,
    For metadata, which metadata are you not seeing? Are they custom properties within the PDF, and have you checked if you have crawled properties matching these?
    I know there's issue with last modified on PDF's (http://sharepointfieldnotes.blogspot.no/2013/05/understanding-and-getting-sharepoint.html) 
    Thanks,
    Mikael Svenson
    Search Enthusiast - SharePoint MVP/MCT/MCPD - If you find an answer useful, please up-vote it.
    http://techmikael.blogspot.com/
    Author of Working with FAST Search Server 2010 for SharePoint

  • I need one formatted search for Goods Issue

    Hi Experts
    I need one formatted search for Goods Issue
    ex. I have Issued One item  on 20/07/2011
      In Goods Issue Line Level one column LstIssDt 
    when i issue for the first Item  My document Date Will be my Ige1.LstIssDt(LastIssueDate)(linelevel)
    Now
    the Same Item Iam issuing on 23/07/2011 
    Now  In Goods Issue Line Level   LstIssDt column  shud come as 20/07/2011 when i click formatted search
    Similarly For all the Other Items
    can anyone help me in these
    Thanks  & regards
    Jenny
    Edited by: Jennifer Anderson on Jul 23, 2011 7:57 AM

    Hi Jenifer.....
    I think it should work as it is working on my DB
    Select Top 1 T0.U_LstIssDt From IGE1 T0 Where T0.ItemCode=$[IGE1.ItemCode.0]
    Order By T0.U_LstIssDt DESC
    Do execute this just save and Apply this on Goods Issue for. So when you select the Item this will bring the Last Issue Date of this Particular Item on which field you applied this FMS.......
    Is that an UDF of Last Issue Date or standard field?
    I modified above FMS and please now try.....
    Regards,
    Rahul

  • Formatted Search issue

    I have a UDF attached to a Purchase Order, Goods Receipt PO and Batch Numbers for Items.  B1 automatically carries the UDF data forward from the Purchase Order to the Goods Receipt PO.  However, I am trying to create a Formatted Search that will also bring that data into the Batches Setup transaction when a Goods Receipt PO transaction is being added.  Since the Goods Receipt PO record is not yet written when the Batches Setup screen is activated, I somehow need to access the UDF data from POR1 from the Batches Setup screen (OIBT).  I don't seem to be able to find a way of writing my query for the formatted search that is able to return the data from POR1 to my UDF in OIBT.  Any ideas of how I might be do this?

    Timothy,
    The values in the Purchase Order / Goods Receipt screen are not available in teh Batch Number screen.
    You will need to use a temp table to store the values from the Purchase Order / Goods Receipt screen.
    You will set a formatted search on one of the columns of the documents row.  Through this formatted search you will insert the data into the temp table and from the Batch screen you will read the values from this temp table
    Suda

  • Formatted search on UDF, DIAPI issue

    Hi,
    I have a formatted search on a UDF in the DETAIL of a SALES ORDER
    When I try to set a value on this UDF, the DI API doesn't give any error but the UDF doesn't get the new value.
    but all other UDF works except this one which have a formatted search on it in SAP
    Is there something I don't know ?

    Hi,
    My goal is not to make the formatted search working in DI API, as I said, I'm just trying to set a value in the UDF and because there's a FORMATTED SEARCH on this udf, it keeps the default value instead of the value I'm setting by the DI API
    And yet, I have other UDF that have formatted search, and I'm able to set a value on the UDF anyway.
    What I see different is that this UDF is numeric and the others aren't
    I just don't understand why the DI API reports no error and yet the value I put in it isn't taken but only the formatted search default value for a numeric UDF  Is this a known bug in SAP ?

  • Decimal and formatted search

    hello,
    I've defined an UDF as Price.
    Number of decimal for prices is set to 3 in the general settings.
    the actual result of my formatted search is rounded to 2 decimals although 3 decimal are displayed.
    here is a simple formatted search that illustrate the issue :
    SELECT 100 / (100+19.6)
    the displayed result is 0.840 instead of the correct value : 0.836
    How can It be solved ?
    Best regards,
    Francis

    Hi
    Please check the decimal settings of
    amount as well(general setting -display tab)
    there is one case:
    When under Adminstration -> System Initialization -> General Settings ->
    Display, the decimal for the amount is defined as 0 and the UDF is
    defined as eg.  alphanumeric or units and total amount, The UDF does not
    return the decimals and round the amount.
    base on my testing:
    if I define 2 decimal places for amount
    then the UDF result  will be 0.84
    But if I define 3 decimal places for amount
    then the UDF result will be  0.83
    Best Regards
    Helen Sun

  • Formatted Search for Sales Order

    Hi,
    I setup a formatted search in Sales Order unit price field.
    Condition required:
    If Sales Order is copied from Sales Quotation, unit price remains as per Sales Quotation unit price, else formula to calculate mininum selling price appllies.
    Here's the query:
    DECLARE @BASE_ENTRY INT
    DECLARE @PRICE NUMERIC(19,6)
    SET @BASE_ENTRY = ISNULL($[$38.45.0],0)
    SET @PRICE = $[$38.14.0]
    IF @BASE_ENTRY = 0
    BEGIN 
    SELECT T0.[AvgPrice]*(1+T0.[U_SPFactor])
    FROM OITM T0
    WHERE T0.[ItemCode]=$[$38.1.0]
    END 
    ELSE 
    BEGIN
    SELECT @PRICE
    END
    l have no issue if the Sales Order copied from Sales Quotation, however when enter the Sales Order manually the formatted search having error message:
    1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Error converting data type nvarchar to numeric.
    FMS execution failed on field '' with query name 'Get Minimum Selling Price (SO)'
    Looks like my query has error...

    Hi ,
    Try this below query and let me know your feedback,
    DECLARE @BASE_ENTRY INT
    DECLARE @PRICE NUMERIC(19,6)
    SET @BASE_ENTRY = ISNULL($[$38.45.0],0)
    SET @PRICE = $[$38.14.Number]
    IF @BASE_ENTRY = 0
    BEGIN
    SELECT T0.[AvgPrice]*(1+T0.[U_SPFactor])
    FROM OITM T0
    WHERE T0.[ItemCode]=$[$38.1.0]
    END
    ELSE
    BEGIN
    SELECT @PRICE
    END

  • How to use "insert into & select" in format search

    Hello,
    I am just wonderring whether you can help me solve this issue.
    I want to change the value of a field in the title area for a sales quotation. however, this field is not shown up on the interface.
    For example, there is a field in the title area, "OQUT.Ref1". You actually cannot see this field from the quotation interface or any other doc. Now I want to update the value of this field.
    What I am now trying to do is to create an field named "update" in the title area, use format search to update. the code for the command will be something like
    Insert into $[OQUT.Ref1.0]
    select $[OQUT.U_MFG#]
    here, U_MFG# is UDF. as you may understand, I want to copy the value in the U_MFG# to the field of "Ref1".
    However, when I run "Execute", it gives me error. I believe there is something wrong with the code of "Insert into $[OQUT.Ref1.0]
    Does anyone know how to write the code?
    many thanks
    Stanley

    Thanks both Suda and sagar. The reason I wanted to do this is because I wanted to have UDF info be shown on the  MS word-templated quotation document.
    As you know, when you click the word symbol, a word-templated doc will be generated. The client needs two completely different format of quotation printout. thus I plan to print one type from PLD and other type by clicking the Word symbol. but later, I found out that the UDF field cannot be selected on the MS word template, or only system fields.
    Thus, the only way I can do is to copy the value from udf to some unused sytem fields and then show that system fields on the MS word template.
    any idea do you have?
    I wanted to tell SAP that It is not useful if the udf fields cannot be inserted into word template.
    thanks
    Stanley

  • Formatted Search query for Vacation Accrued

    Hi Experts,
    I have a Client who needs to keep tract on the Vacation Accrued on the Employee Master Data. I have created this UDF on the Master Data, but I could not get the query for the Formatted Search right.
    This Formatted search on the UDF ( must look at the OHEM.startDate field and populate the following:
    If it is a still within year of the system date, it must populate 0,
    If it is > 1 year and < 3 years, it must populate 5,
    etc.
    Any help would be greatly appreciated.
    Marli

    Hi Experts,
    Here is what I did for the query mentioned above:
    {SELECT
    CASE
               WHEN (T0.startDate > GETDATE() -356)
                       THEN 0
               WHEN (T0.startDate > GETDATE() - 712)
                       THEN 5
    END
    As 'Vacation Accrued'
    FROM OHEM T0}
    The issue is that if I link this query to the UDF on the EMD, I get a list of 0 and 5 to choose from. I need to populate automatically.
    Thanks.
    Marli

  • Formatted search as such G/L Account name to be shown

    Dear All,
    I have added in Udf in the row level of marketing document like U_Sales A/C Name, U_Cogs A/C Name, U_Inventory Account Name.
    Stock is maintained Warehouse Wise. Now I want that in the row level for any item e.g warehouse 001 I want a formatted search which should refresh automatically and show the G/L account name of Sales A/c, Cogs A/c and Inventory A/C respectively in the individual udfs.
    I think it could be possible through formatted search but am not able to create the query for it.. Please help.
    regards,
    kamlesh

    Hi Kamlesh,
    Check the link
    How to insert G/L account name in query
    *Close the thread if issue solved.
    Regards
    Jambulingam.P

  • Rounding Issue in Sap Business One 2007A

    Hi Experts:
    Could you please assit us?: We are running Sap Business One 2007A SP01 PL08, Our client is using Rounding Method "By Document". and the option "Automatic Rounding for document" is only available for sales documents. How can we achieve to use Automatic rounding in header total fields in Purchase Documents????. Can we achieve this by a Formatted searches?
    And secondly, In all marketing documents, under the "Define tax amount distribution"  we need to round the amount field. ie: if the amount is $2250.01 to be rounded in 2250 and if the amount is 2250.89 to be rounded in 2251. Can we achieve this with a formatted search as well in the Amount field in this table?.
    Thanks very much in advance
    Claudia Gutierrez

    Hi Claudia Gutierrez,
    Have you checked Round function by query?  You may check this thread first:
    Re: Rounding Tax amount in row
    Thanks,
    Gordon

  • Formatted Search formula result in 4 digit

    Hi Experts,
    Can we round the the result of formatted search formula into 4 digits ?
    See sample below
    SELECT (325.000000 * 0.750000 ) / 100 from inv1
                    Current result       2.44*             
                     * Result should be           2.4375*
    Regards,
    Amy

    Hi,
    I think Shen Jiang refers to
    Administration -> System Initialization -> General Settings, Tab 'Display'. Here you can define the default decimal places.
    Kind regards
    Mario
    Edit: But refer also to [CHANGING DECIMAL PLACES|CHANGING DECIMAL PLACES]
    Edited by: Mario Schoenberg on Mar 31, 2009 8:20 AM

  • Extra Discount in Marketing Documents - Formatted Search

    Hello All,
    I am trying to add a UDF for "Extra Discount" in the marketing documents. I have tried to attach a formatted search on the document total to calculate the final value after this extra discount has been specified. However, the formatted search doesnt work and I get an "Internal Error".
    The scenario mentioned underneath will explain the requirement:
    <b>Default Option in SAP:</b>
    Customer                               C0001
    Item        |       Price     |        Discount       |      Tax      |     Total
    I0001      |       100         |        10%           |       VAT@4   |   90
    Total                                    90
    Discount                     5%    4.5
    Tax Amount                         3.42
    Doc Total                             88.92 
    <b>Requirement:</b>
    Customer                               C0001
    Item        |       Price    |         Discount     |        Tax        |   Total
    I0001       |      100      |           10%           |       VAT@4  |    90
    Total                                    90
    Discount                     5%    4.5
    <u>Extra Discount            2%    1.8</u>
    <b>Tax Amount                         3.348
    Doc Total                             87.048</b>
    Is it possible to have this scenario mapped in SAP Business One using formatted search without using SDK/Customization?
    Regards,
    Gyanesh Rupani

    Hello Jimmy,
    The client wants the extra cash discount to be visible on the invoice itself. I have tried creating the UDFs and assigned appropriate FS to them to change the document total. However, the issue is that the moment the document total is affected, the discount (available by default in marketing documents footer) automatically gets changed proportionally!
    So, for eg. if an invoice is for 1000 USD and I give a discount (system field) of <b>10%</b> to a customer and 5% as cash discount (UDF), with the help of FS, the invoice amt automatically gets changed to 850 USD but the discount field also automatically gets changed to <b>15%</b>!
    This is the inbuilt functionality of SBO - so if someone can help me overcome this, I will be very grateful.
    Regards,
    Gyanesh

  • 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

  • How do I set up a text message group on iphone

    How do I set up a text message group on iphone

  • Labels in pie charts overlap when the slice is very thin

    Hi, I have Crystal Reports 2008 and I am using it to create some dynamic charts but in some cases (when the slice of the pie is really thin) the labels of the pie slices overlap. It is a customer's requirement to have labels (legends) on each slice a

  • Factory calender change in Production - Urgent !!!!

    Hi, I have a question about transporting the SAP calendar from Dev to PRD. I created a new factory calendar in DEV and want to transport it to QA and PRD. When I select the transport button I get a message saying that all calendars will first be dele

  • D101 Error after moving a GW Resource

    Hi, I've seen a few posts on D101 errors, but none seem to fit my circumstances. I have a resource "Dept Calendar" owned by USERA on POA. Everything works fine. Other users can proxy to the calendar with no problems - everyone is happy. USERA then le

  • Code hint don't working

    Friends, please shed some light. I don't understand. Can I use code hint feature on symbols , that I simply drag on stage from the library and instantiate via property panel (not from 'new 'operator). As you guess, when I hit F9 (i.e. invoke Actions