Format search with operation (+ - * /)

HI people, i have this format search working perfectly:
SELECT DISTINCT
CASE WHEN (T3.ITEMCODE= $[$38.1.0] AND T3.PRICE > $[$38.14.number] AND $[$38.14.number]>0)
THEN '1'
ELSE '0'
END
FROM OCRD T1
INNER JOIN ITM1 T3
ON T1.LISTNUM = T3.PRICELIST AND T3.ITEMCODE=$[$38.1.0]
WHERE T1.CARDCODE= $[$4.0.0]
But i need sum a % in $38.14, so i did the next:
SELECT DISTINCT
CASE WHEN (T3.ITEMCODE= $[$38.1.0] AND T3.PRICE > ($[$38.14.number]*1.20) AND $[$38.14.number]>0)
THEN '1'
ELSE '0'
END
FROM OCRD T1
INNER JOIN ITM1 T3
ON T1.LISTNUM = T3.PRICELIST AND T3.ITEMCODE=$[$38.1.0]
WHERE T1.CARDCODE= $[$4.0.0]
But this not work......how can i sum a % ???

Ok, works with this:
SELECT DISTINCT
CASE WHEN (T3.ITEMCODE= $[$38.1.0] AND T3.PRICE > ($[$38.14.number]/(0.80)) AND $[$38.14.number]>0)
THEN '1'
ELSE '0'
END
FROM OCRD T1
INNER JOIN ITM1 T3
ON T1.LISTNUM = T3.PRICELIST AND T3.ITEMCODE=$[$38.1.0]
WHERE T1.CARDCODE= $[$4.0.0]
My problem was that no quit FS from field, i meaning i must quit and the put again the FS to take the changes.

Similar Messages

  • Formatted search with Query auto update

    hi all,
    I have created 2 UDF's at title level in marketing document, and assigned Formatted search with query to it with auto refresh when posting date field changes. One UDF gets updated automatically and the other one doesnt.
    any one can guide me on this.
    regards
    salman
    Edited by: Rui Pereira on Aug 8, 2008 11:47 AM

    Hello Salman,
    I took the effort to understand you question but I am not quite sure if I have all the pieces of the puzzle yet.  I can see Jeyakanthan has already grilled you with questions and you have answered all of them.
    UDF1 - is this se to Auto Refresh - Refresh regularly - on Posting Date?
    UDF2 - On which field is this set to Auto refresh?
    UDF3 - On which field is this set to Auto refresh?
    One thing to note when you have two fields with FMS and the second one dependent on the value of the first, the second one does not auto refresh because it cannot detect the Field change on the First UDF.
    This is probably what you are experiencing.
    If you don't mind I would like to understand the business reason for the 3 UDF's and what each one is for. There might be other options to look at to achieve the same result.
    Let me know
    Suda

  • Formatted Search with like

    I'am tring to do a Formatted Search with this: SELECT     DISTINCT T0.Code, T0.Name
    FROM         T0 LEFT OUTER JOIN
                      ORDR ON T0.Name = ORDR.U_PDischar WHERE T0.Name Like '$[ORDR.U_PDISCHAR] %%' ORDER BY T0.Name
    but it not work any help... thanks
    Message was edited by: Juan F Vásquez

    Hi,
    This worked for me:
    SELECT DISTINCT T0.Code, T0.Name
    FROM T0 LEFT OUTER JOIN
    ORDR ON T0.Name = ORDR.U_PDischar WHERE T0.Name
    Like $[ORDR.U_PDISCHAR] + '%%'  ORDER BY T0.Name
    Not whit this same fields, but with others.
    Hope helps,
    Ibai Peñ

  • Create a Formatted Search with SDK?

    Hi,
    Is it possible to create an Formatted Search with the SDK? With which API???
    Thanks for Help
    Thorsten

    Hi Thorsten,
    Nowadays, there is not any standar way to do this. An approach could be to search for the tables where Formatted Searches are stored which are some.
    If you are interested, we have developed a tool that is used to carry personalizations such us Literals, Formatted Searchs, Querys, Document Editings, User Reports, UDF and UDT. It has been very helpfull for us, and we are planning to sell it to other partners. If you are interested send me an email to [email protected]
    Regards,
    Ibai Peñ

  • 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

  • Formatted Search with DI  leads to a very slow performance - HELP....

    Hello There
    I have defined some formatted search in OPCH - everything is working fine.
    I have added some logic to this form via the DI.(handlling 1 item press_event), and I get a very very slow performance - the ADDON-EXE jumps TO 230MEGA of memory, and entering values to each row in the tables/item in the form takes about 15 seconds.
    Any suggestions?
    RGDS
    HAGAI

    Hi Hagai,
    Normally an addon written using the DI would take up 60-80MBs.
    Are you filtering out all events except for the item press event for the form? If you are not filtering events then this can have quite a drastic affect on performance.
    What logic have you got behind the press event? If the addon exe is ballooning out to 230MB then it suggests that there is either a problem with a memory leak or that an error is occuring in the code. I would recommend putting try/catch clauses at suitable places in the code and maybe specifically setting objects to null and calling the .NET garbage collector to try and minimise the potential for memory leaks.
    Are you sure that it is the combination of the formatted search and the addon that is causing the problem, i.e. if you take away the formatted search but leave the addon do you still get poor performance or does everything speed up?
    Hope this helps,
    Owen

  • Formatted Search with multiple conditions

    Hi experts,
    I am using a formatted search to update the Unit price in Sales Order. Query mentioned below.
    Select      T0.ItemCode,
                   T0.ItemPrice,
    From        ITM1 T0 inner join OPLN T1 on T0.PriceList = T1.ListNum
    Where      T0.ItemCode = '[$38.1.0]'
         and     T1.u_location = '$[$38.2000002049.0]'
    But while adding Item on Sales Order, it is showing error, Incorrect Syntax near  '$[$38.2000002049.0]'.
    Note: I have added an UDF named U_LOCATION( Alphanumeric, 10) in OPLN and selecting location in Price List through another FMS which is working perfectly.
    Please help in this regards.
    Thanks in Advance.
    Nabyendu

    Hi Nabyendu Saha..
    You said the u_location as alphanumeric the why you have given 0 for the field type in the FMS...
    Select      T0.ItemCode,
                   T0.ItemPrice,
    From        ITM1 T0 inner join OPLN T1 on T0.PriceList = T1.ListNum
    Where      T0.ItemCode = '[$38.1.0]'
         and     T1.u_location = '$[$38.2000002049]'
    or
    Select      T0.ItemCode,
                   T0.ItemPrice,
    From        ITM1 T0 inner join OPLN T1 on T0.PriceList = T1.ListNum
    Where      T0.ItemCode = [$38.1.0]
         and     T1.u_location = $[ordr.u_location]
    Try the above , hope helpful
    Regards,
    Kennedy

  • How do i deduct dates using formatted search with a query

    Hi Experts,
    I would like to know how to get the date difference using query and formatted search. Below are the details:
    1. I have created 3 Header UDF's composed of 2  Date type fields and 1 Quantity field.
    2. The first one is for the Original Date, the next one is for the Payment Date and the Last one is for the No. of Days Lapsed.
    What I would like to do is automatically compute for the number of days from the original date to the payment date. What query syntax should i use to achieve this?
    Thanks,
    Yvette

    Hi Yvette,
    It should be something like;
    DATEDIFF (day, T0.[createDate], T0.[closeDate] ) as 'Aging'  This is just an example. You may add your udf's instead of dates.
    Thanks,
    Joseph
    Edited by: Joseph Antony on Jul 2, 2010 1:53 PM

  • To create a formatted search with customer ref no.

    Hi there, I am new to formatted searches and I am trying to do the following:
    on the delivery docket when the customer ref no is filled in I want this to populate a UDF called ordr_U_CAllREF
    I have the udf created and it is called Cust Ref.
    can someone please give me some tips on how to create this please?
    thank you.
    E

    Hi Edel,
    Try this.
    Select $[ORDR.NumAtCard.0]
    Save above query in query manager and go to Sales Order Form and put cursor on U_CAllREF UDF and press Alt+Shift+F2 and it will ask you to link the query by using 3rd option and simply link this FMS to U_CAllREF.
    Hope this will help you.
    Regards,
    Rahul

  • Formatted search with DI API

    Hello,
    Can formatted searches be triggered when data is added via the DI API?
    Thanks,
    Sheetal

    Hi,
    As Ad said, it is not possible. The reason is that formatted searches are triggered when UI API events are raised. Using the DI API doesn´tt make UI API events to be raised, so that´s not possible.
    Regards,
    Ibai Peñ

  • Formatted Search with data from active window

    Hi experts,
    I created a FMS on the order document. To let the FMS work, i use some data from the active order window like this $[$38.1]. In this FMS i also show some data to the user. To complete my FMS, i would have to add a where statement, with the active window the custom window i show the user. If i look into the system information, following information shows up below:Form 20000034, Item =4, Pane=0, Column = Col2, Variable =1 #000006294,Col2.
    Any idea's on how i can make a FMS with data from this active custom window?
    Kind Regards,
    Frederik

    Hello Frederik,
    Have you tried
    $[$Item.Column]
    $[$4.Col2]
    And i want to say it is possible to pick value from other not activate form .
    by using SQL syntax after add temp table.
    Thanks
    Manvendra Singh Niranjan

  • Formatted Search with user defined fields??

    Hai everyone,
    I know how to use the search.. I did like this...
    SELECT U_Discount FROM OITM WHERE ItemCode = $[$38.1.0]
    But now i want to know the other way...ie.
    SELECT U_TVal FROM OITM WHERE U_Tcode='??????'
    the where condition is to be like this -I have 2 user defined fields
    1. U_TCode
    2. U_TVal
    I want to select the U_TVal where the U_Tcode= ????
    HOW TO SPECIFY THE USER DEFINED FIELD HERE like  this one $ $38.1.0 ....or is there any other method??
    Thanks
    Vibin

    Its Same..I didnt try your way but i tried this
    select oNHand from OITW where ItemCode=$[RDR1.ItemCode]
    Here in sales order- when an item selected the Stock in different warehouse will be listed in quantity...
    Try that
    $[Tablename.FieldName]

  • Help with Formatted Search with Date

    Hi experts,
    I need help with the following query. In the PO item level, I want to take a user entered date and add 6 weeks to it. For example, after a user enters in a date in the field u_Date1, then U_date2 will populate with U_date1 + 6 weeks.
    I can get the query to copy the U_Date1 field. However, once I add 6 weeks (+42) then I get an internal error. Please advise.
    select $[por1.u_date1] + 42
    from por1 t0
    inner join t1 on t0.docentry = t1.docentry
    where t0.linenum = $[por1.linenum] and
    t1.docentry = $[opor.docentry]
    Thank you for your help.  i am on 2007A PL 47.
    Jane

    Hi Jane Liang ,
    you can try this : Select  DateAdd(day,42,$http://por1.u_date1 )  from por1 t0  .....
    regards
    H2

  • Problem with activation of Formatted Searches

    There seems to be an error in the activation of formatted searches in SAP B1.
    The following is an example to demonstrate the real situation with a minimum of complexity.
    1. We have defined 2 user defined fields, U_trigger and U_target, in the title area of documents. Both are defined as alphanumeric fields with standard length 10 and some predefined values.
    2. For sales orders we have defined for UDF 'target' that a formatted search 'getTriggerValue' is activated on changes of UDF 'trigger'.
    3. The formatted search 'getTriggerValue' reads the value of UDF 'trigger' and writes it to UDF 'target':
    DECLARE @triggerValue AS nvarchar(10)
    SET @triggerValue = $[ORDR.U_trigger]
    SELECT @triggerValue
    When we add a new document to the database, i.e. the document is in "button-mode" = 'add', there are no problems with the activation of the FS on field 'target' when the value of field 'trigger' is changed!
    After a document is already written to the database and is later displayed on the screen again, the document is in "button-mode" = 'OK'. In this situation the FS on field 'target' IS NOT ACTIVATED when the value of field 'trigger' is changed, i.e. the value of 'trigger' is not copied to 'target'.
    After this first change the document is now in "button-mode" = 'update'. If we now change the value of field 'trigger' a second time the FS on field 'target' is activated an the value is copied from 'trigger' to 'target'.
    If we define the FS of field 'target' with option 'Refresh Regularly' the FS is activated after the first change of field 'trigger' as expected.
    But we CAN NOT USE THIS OPTION AS A STANDARD SOLUTION for our problem, since some fields and their FS can not work with this option and need the standard option 'Display Saved Values' set. Otherwise some fields yield wrong values, since they are working not only with constant predefined values as in the simple example above, but with dates which are set by GETDATE() in the FS, e.g.
    Is this behaviour a bug of SAP (FS is not activated even if the value of the refresh field is changed)?
    If not, what is the idea behind this behaviour?
    And how can I get around this behaviour?
    Thank you for your support!
    Frank Romeni

    Hello Suda!
    Many thanks for your answer!
    Perhaps my explanations are a bit in confusion.
    The example in my question is just to demonstrate the behaviour of the formatted search with option 'Display Saved Values' set, i.e. in a document that is already saved to the database, only after the second change the formatted search is activated.
    I am aware that with the simple formatted search that I have shown as an example everything works fine with the option 'Refresh Regularly'.
    But what is the meaning to activate the formatted search only after the second change when option 'Display Saved Values' is set?
    The reason why we can't use option 'Refresh Regularly' is that in our real application not only constant values are copied from 'trigger' to 'target'.
    Let me give you an example which approaches the real situation more than the first example:
    DECLARE @trigger AS nvarchar(20)
    SET @trigger = $[ORDR.U_trigger]  -- U_trigger / UDF 'trigger'
    DECLARE @save AS datetime
    SET @save = $[ORDR.U_date]        -- U_date / UDF 'date'; save current date
    IF @trigger = 'getDate'
      SELECT GETDATE()
    ELSE IF @trigger = 'getDateConst'
      SELECT '01.01.2008'
    ELSE IF ...
    ELSE
      SELECT @save                    -- no value in @trigger to change date ==> reset
    Option 'Display Saved Values' set: formatted search is activated only after the second change of value of UDF 'trigger'. This is not acceptable!
    Option 'Refresh Regularly' set: Suppose the 'trigger' is set to 'getDate'. The actual date, e.g. 25.06.08, is displayed in UDF 'date'. The document is saved to database. When the document is fetched again on the next day, the formatted search is activated immediately without the change of any values, i.e. 'trigger' still is set to 'getDate'. This is evaluated in the formatted search and the function GETDATE() is called and the now actual date, 26.06.08, is written to UDF 'date'. This is wrong!
    I hope that the new example shows why we can't use option 'Refresh Regularly'!
    We need no regularly refreshed value of UDF 'date', we need an activation of the formatted search only when the value of UDF 'trigger' changes. But why is it activated only after the second change when 'Display Saved Values' is set?
    Thank you for further support!
    Frank Romeni

  • 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

Maybe you are looking for