Formatted search freight variable

I was trying to figure out how to create a SELECT statement that returns true or false depending on if the Freight amount on a sales order form is Zero.  If someone could help out
Also, if anyone knows of a source to get more information on all the "$[$4.2.1]" or whatever system variables. So I may better understand them as a whole to use them in user defined queries or what not
Thanks in advance 

Hi James,
1) Something like:[code]SELECT $[ORDR.TotalExpns] = 0[/code] should do.
2) There's a quite alright doc in the SAP marketplace: "How To Define And Use Formatted Search".
Sincerely,
 OC.

Similar Messages

  • Using Form Variables in a Formatted Search

    Hi everyone, I'm relatively new to SAP B1 and just trying to get some info. I have created a few formatted searches, but I am having trouble with this one in particular.
    I am trying to get the 'Business Partner Type' Field under Business Partner Master Data (BP Type, [Form=134 Item=40 Pane=0 Variable=1 OCRD,CardType] to change the user defined fields category displayed [Form=-134 Item=9 Pane=0 Variable=62]
    For example, when CardType is Vendor ('S' value), I'd like the user defined fields category 'vendor'( '1' value) to show
    Here is my query
    SELECT CASE
    WHEN $[$40.0.1]='S' THEN '0'
    ELSE WHEN $[$40.0.1]='C' THEN '1' END
    Which is then assigned as a formatted search to that field.
    I was trying to find some sort of definitive guide on form variables and formatted search queries; if anyone can point me in the right direction, I'd appreciate it (I have seen the $[$x.y.z] variables but I am not 100% sure on their usage).
    Thanks in advance

    Hi,
    Try this:
    SELECT CASE  $[OCRD.CardType\]
    WHEN 'S' THEN '0'
    WHEN 'C' THEN '1'
    END
    Please also response for your previous open thread. You may just close it if you do not like the answer.
    Thanks,
    Gordon

  • Freight Formatted Search

    Dear All,
    I am trying to do a formatted search on the amount field in the freight screen (Table RDR3) in a sales order (Table ORDR). I have used the below query. Basically i created 2 UDF's (UDF1. a value example 100, UDF2. a discount percentage example 20%) beside the amount field. Now I want the amount field to calculate the below which is to take the 1st UDF value multiplied by the discount percentage to get the discounted value of UDF 1. The rate and currency i need to fetch from the ORDR and i think that's where the problem is.
    DECLARE @Amount AS DECIMAL(38,2)
    DECLARE @Percent AS DECIMAL(38,2)
    DECLARE @Cur AS nvarchar(3)
    DECLARE @Rate AS DECIMAL(38,2)
    SET @Amount=CAST($[rdr3.u_TransportT] AS DECIMAL(38,2))
    SET @Percent=CAST($[rdr3.u_DPerc] AS DECIMAL(38,2))
    set @cur = (select T0.DocCur from ORDR T0 where t0.DocEntry = $[rdr3.docentry] )
    set @rate =  (select T0.DocRate from ORDR T0 where t0.DocEntry = CAST($[rdr3.docentry] AS DECIMAL(38,2)))
    Select case when @cur='USD' then (@Amount * ((100 -@Percent) / 100))
    when @Cur='EUR' then ((@Amount * @Rate) * ((100 -@Percent) / 100))
    else (@Amount / @Rate * ((100 -@Percent) / 100))
    end
    The result im getting is just a 0 without any errors. Any help on this would be mush appreciated.
    If i only need to use one currency i used the below query and it works fine. I get the discounted value in amount field:
    DECLARE @Amount AS DECIMAL(38,2)
    DECLARE @Percent AS DECIMAL(38,2)
    SET @Amount=CAST($[rdr3.u_Amount] AS DECIMAL(38,2))
    SET @Percent=CAST($[rdr3.u_percent] AS DECIMAL(38,2))
    Select  (@Amount * ((100 -@Percent) / 100))
    Kindest Regards
    Jimmy

    Beni,
    Thanks for the reply.
    I am not taking the local currency into account in the above query, all of them are foreign currencies.
    If i remove the reference to the ORDR table and dont use the CAST or IF statement it works fine. But that would only be useful for 1 currency.

  • Trigger Formatted Search on Freight Form

    Has anyone gotten a formatted serch to fire on the Sales Order - Freight form based on the document total changing in the main Sales Order form?
    Scenario - we set the Freight to a fixed amount $50.00.  If the document total goes over $500 then we want to set Freight=$0.00 using a formatted search (i.e. shipping is free when the order is above a certain amount).
    In troubleshooting I tried to use SELECT $[$29.0.0] and also tried SELECT $[$-29.0.0] to see if the FMS could even return the Document Total on the freight form but it doesn't seem to be linked. 
    Anyone gotten this to work?
    -Frank

    I already tried using
    SELECT $[$29.0.Number]
    Results in Internal error 3006.
    I also tried setting the FMS to SELECT '0.00' with Auto Refresh enabled on When Field Changes = Document Total just to see if the FMS would fire when the main Sales Order total changed.  FMS would not fire.
    Appears to me that the freight form is in some way disconnected from the main Sales Order form as it relates to FMS.
    Anyone gotten this to work outside of going to SDK?

  • Formatted search query with variable

    Hi
    I am trying to create a formatted search on a purchase order document.The scenario is as follows:
    The issue is that the client will on certain stock records incur a tooling cost when raising a PO. This is a once off cost when they order a particular item. For example the tooling cost on a stock item is u20AC5.50. The cost price on the item is u20AC100. If they order for example 5 of these the total cost is u20AC505.50 i.e. u20AC100*5+tooling cost of u20AC5.50.
    What we are attempting to do is pull through the tooling cost and add this on to the line total using a formatted search.
    -UDF created on item record table. This is set type 'Unit and totals' and structure is 'Price'. This is called ToolingCost
    -UDF created on marketing doc rows for ToolingCost. Again this is set to the same type and structure as the UDF on the item record.
    -We have created a UDF on marketing row for total cost and set a formatted search against this with query attached that is attempting to calculate the total cost. We cannot get this to work and the problem would appear to be that the price field is a variable and this is causing an issue on the query. Can we include a variable field in our query and if so what should the syntax be?
    Our query at the moment is 'SELECT 100*($[POR1.QTY.NUMBER])+($[POR1.U_TOOLINGCOSTS.NUMBER])
    Note 100 in query syntax above to be replaced by price on POR1 table.
    Can anyone provide assistence please.
    Derek Smith

    Hi Derek........
    Try this.....
    declare @var1_Qty as varchar(255)
    declare @var2_Pr as varchar(255)
    declare @var3 as float
    declare @var4 as float
    set @var1_Qty=$[$38.11.0]
    set @var2_Pr=$[$38.14.0]
    Set @var3=$[POR1.U_TOOLINGCOSTS.0]
    set @var4=cast(substring(replace(@var2_Pr,',',''),0,len(replace(@var2_Pr,',',''))-3) as float)
    select (@var1 * @var4)+@var3
    Hope this will help you.......
    Regards,
    Rahul

  • Formatted search on BOM how to access variable field from matrix?

    hi,
    i have assigned a formatted search to the Quantity field on the BOM. its as follows.
    declare @width numeric (19,6)
    declare @height numeric (19,6)
    declare @lenght numeric (19,6)
    set @width = Convert(numeric(19,6), $[$3.50.92])
    set @height = Convert(numeric(19,6),$[$3.51.93])
    set @length = Convert(numeric(19,9),$[$3.52.91])
    SELECT @width * @height * @length
    but when its executing i am getting internal error.
    Thanks in Advance,
    Vasu Natari.

    Hi,
    are you sure, that in @width , @height and @length is some value and not null?
    Try it as
    declare @width numeric (19,6)
    declare @height numeric (19,6)
    declare @lenght numeric (19,6)
    select @width = Convert(numeric(19,6), $http://$3.50.92)
    select @height = Convert(numeric(19,6),$http://$3.51.93)
    select @length = Convert(numeric(19,9),$http://$3.52.91)
    SELECT convert(numeric(19,6), isnull(@width,0) * isnull(@height,0) * isnull(@length,0)) as result
    Petr

  • Problem With Formatted Search.

    Hi to all,
    I have linked a formatted search to a UDF that lies at row level in AP Invoice. This field is used to display the Sales  Order Price. The requirement is that from SO we create a purchase order and subsequently create a goods receipt and AP invoice.. Now in invoice it is showin perfectly fine whether it is copied from goods receipt or purchase order.. But in the purchase order and goods receipt screen this query will not work. And the same query used in AP invoice is being linked to these documents. Is there any work around for this?? Is it possible to run queries based on the form numbers?? If so ho do i pull the form number in the formatted search query??
    Please Help!!!!
    Regards
    Aris

    I recommend creating separate queries for each document.
    ie
    1 formatted search to lookup price on sales order from AP Invoice
    1 formatted search to lookup price on sales order from GRPO
    1 formatted search to lookup price on sales order from PO
    then change the lookup to pull fields from the document that you are using as a reference.
    when you are building the formatted searhes start by returning the values that are you are using as a reference. That way you are sure that you are pulling the correct information.
    Then layer in the lookup to the sales order.
    If you get stuck I recommend that you copy and paste the formatted search in SQL Server management studio and replace the variables refereces with real values.
    In my experience troubleshooting queries is more effective when using SQL Server management studio. (the error reporting is better).

  • I canu00B4t do a formatted search in a user table

    Hye, I'm trying to do a formatted search over a user table using and I get the error -2006, why?
    I use "report generator" and my selecc is :
    SELECT T0.U_grupo, T0.U_CODE
    FROM T0
    WHERE T0.U_grupo ='[%0]' FOR BROWSE
    If I do the same with standar table ( e.j OITM),  all is right:
    SELECT T0.ItemCode, T0.ItemName
    FROM OITM T0
    WHERE T0.PrchseItem ='[%0]' FOR BROWSE
    unless, with user tables no, whyyyy?
    thank´

    I have seen this, though I don't have an official answer, I have my own theories.  SBO matches up the variable with the previous field name and looks up the description for that field.  The description for user fields is not stored in the same place as standard fields.
    In a previous thread, named "SQL Syntax in SBO" (number 7144) another user showed a way to do dummy selects with the variables to get the names of standard fields.  Then the variables can be used for the real work.
    That is awkward, and it limits you to the descriptions of standard fields.
    Bruce

  • Dynamic SQL an Form values in formatted Search

    Hi all,
    Can I create Dynamically the where clause of a query (for a Formatted Search) finding that into a UDF of another table, and then store all in a Varchar(300) variable and use that variable as parameter of an EXEC?
    Sorry for my bad explanation, it takes less time attach the query ...
    so here it is:
    declare  @pol as varchar(8)
    set @pol = $[ORDR.U_PolProj]
    declare @internal_q NVARCHAR(300)
    select  @internal_q = T0.U_CondPol
    from [@PRG_CEN_POL_PROJ] T0
    where Code = @pol
    declare  @itcode as varchar(100)
    set @itcode = $[RDR1.ItemCode]
    declare @sql NVARCHAR(300)
    select @sql = 'select  result =  count(ItemCode)
    from OITM T0
    where T0.ItemCode = ''' + @itcode +
    ''' and ' + @internal_q
    exec(@sql)
    Could someone tell me what's wrong with this formatted search?

    resolved!!! It works

  • Query - Formatted Search in a User Defined Field

    Hi,
    I am having some problems with a very simple query but it doesn't seem to work. I insert this formatted search in to my UDF I made called Cost. The query I am using is:
    SELECT  $[$34.0.0] - (I had to use variable number because this Unit Price field in the Item master data does not have a field name associated)
    It is supposed to grab the unit price from the screen, however it is always displaying zero when I query it, and when I put it in the UDF as a formatted search, it give me the internal error.
    I would greatly appreciate your help.
    Thanks

    Question 1: Where is this Cost UDF defined.  Is it at the Marketing document Header or row level?
    NOTE:
    The field reference for the Unit Price column is incorrect.  When you mouse over the Unit Price column you should see the values for Item=xx  Colunm=xx
    The syntax is $\[$Item.Column.Type].  Therefore for your case it should be $\[$38.14.Number]
    The type prefix can be 0 if you are accessing a Alphanumeric column.
    If you user field is at the Header level the Formatted Search Query might not work unless you highlight that whole row and then click on the header level UDF and press Shift+F2
    How have you set the refresh options?

  • Simple formatted search

    Hi,
    I'm trying to learn how to use formatted searches and SQL in SAP Business One. Can anyone give me some simple examples to start with?
    For example, on AR Invoice, if customer (OINV cardcode) is X, a UDF field should be populated 'Y". If customer (OINV cardcode) is not X, UDF field should be populated 'N'.
    Can you provide me the SQL code for the query to be used in the formatted search? Just looking for some examples to get started.
    thanks

    Thanks Gordon, that worked!
    How do you know that $[$4.0.0] is OINV,cardcode(BP name on AR invoice)?
    For example, if I want to use a different field intead (like Item No.) how do I know the paramater/variable to sue?
    I guess $[   ]  means a user input paramater(not yet saved to database)?

  • Formatted Search to do calculation

    Hi all,
    I have written an SQL query for my formatted search that reads
    select $|$170.12.0|
    This is to return the Total Amount Due in incoming payment form. But when I applied this to one of the UDF I created, it returns an error "Internal error (3006) occurred [message 131-183]"
    As long as it can return the total amount due, I can use it for calculation when my SQL query is developed.
    Can anyone please enlighten me?
    Thank you very much.
    Regards.

    Hi Kevin,
    I just seen your updated Thread.
    $[$-12.66.number]
    If you found that than it is Very good, But still I would really like to tell you.
    12 is 'Item', 66 is 'variable', for that field and number is to take only numeric value, i.e not to take currency sign.
    Cheer's
    Have a good day.
    Regards
    Ashutosh T

  • 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 searches and SQL functions

    Hi,
    I have made test to call a SQL function in a formatted search. It seems to be impossible?
    Is it right or not ?
    Thanks for your help.

    You don't need to put a semicolumn, and don't have to put quote's around sbo variables (from a form)...
    <b>Example</b>[code]SELECT ItemCode, ItemName FROM OITM WHERE WhsCode = $[$38.1.0] AND SellItem = 'Y' AND OnHand > 0[/code]
    Hope it helps...

  • Include the "created by" field in formatted searches

    Hello
    Very stupid question : how do you include the "created by" (usersign) field in a formatted search for marketing document ? Where do you find the variable numbers since this field is not visible on screen ?
    Thanks for your help
    Fabrice

    HI Milton Rafael Mazzali ,
    $[USER] will display user number only.
    First decided where u want to display user name. Create a formatted search for that field with this Query  "SELECT T0.U_NAME FROM OUSR T0 WHERE T0.INTERNAL_K = $[USER]" and select auto refresh when customer code/name changes.
    This will work.
    Regards
    Ramesh Kumar

Maybe you are looking for

  • Problem with writing to file

    What the program is supposed to do Print the squares of one through ten to a file whose name is typed in by the user. My Program import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; public class SquareSend      private

  • My iphone 4 does not appear on itune and each time plung it in my pc, there's a sharp rejecting sound

    Microsoft Windows XP Professional Service Pack 2 (Build 2600) Hewlett-Packard HP G60 Notebook PC iTunes 10.6.0.40 QuickTime 7.7.1 FairPlay 1.14.34 Apple Application Support 2.1.7 iPod Updater Library 10.0d2 CD Driver 2.2.0.1 CD Driver DLL 2.1.1.1 App

  • Error thrown in update task

    Hello all, An error is getting thrown in a function module in update task  and it is displayed as an Express Document. I want to trace where this error is thrown. Is there any easy way to do that other than degugging from the start. Please give sugge

  • LOV in Report - can i call a javascript on change?

    Hi i have a lov in a report. What i want to do is call a javascript on change of the value? is this possible? Many thanks in advance

  • Turning the rounded corner's filter off

    I'm working in Illustrator CS3. Recently the program has begun to do something I have never notice before. If I use the round corner's filter: Filter>Stylize>Round Cornors then every box I create after using it has rounded corners that I cannot get r