Problem in formatted search runing by code

Hi all, this is my problem:
I have a one formatted search in one column and i want run it in lost focus of other column. In the forun appear this code to do but something wrong occurs in my case. The formatted search seems run and in one moment the resul value appear in the matrix but in the moment dissapear and the old value remains. Why the formatted search result dissapear?
this is my code:
if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_LOST_FOCUS && pVal.ItemUID == "38" && pVal.Before_Action == false && pVal.ColUID == "U_n_formato"&&KEYDOWN_NUMERO_FORMATOS)
                oForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("38").Specific;
                try
                    oMatrix.Columns.Item("11").Cells.Item(pVal.Row).Click(SAPbouiCOM.BoCellClickType.ct_Regular,0);
                    SBO_Application.SendKeys("+{F2}");
                catch
                //oItem.Click(SAPbouiCOM.BoCellClickType.ct_Regular);
                KEYDOWN_NUMERO_FORMATOS = false;
Thank you all again.
Regards.

Hi
you can set the true value to KEYDOWN_NUMERO_FORMATOS = true.
in Got focus event of  column uid "U_n_formato"
regards
senthil

Similar Messages

  • I have this formatted search for WharHouse Code in Document

    Hello Experts,
    I have this formatted search for WharHouse Code in Document
    declare @WhsCode char(8)
    if $[ODLN.Series] = '1077' set @WhsCode = '970'
    else set @WhsCode = '01'
    select @WhsCode
    and i would like to add to it:
    If an item has a default warehouse so it is to appear in a row (when not '1077' series) and if the item does not has a default warehouse then the  warehouse  eill be 01.
    Your Help Please!
    Thank You
    Meital

    Hi Meital,
    Try this:
    SELECT CASE WHEN $[ODLN.Series\] = '1077' THEN '970' ELSE ISNULL(T0.DfltWH,'01')
    FROM dbo.OITM T0 WHERE T0.ItemCode = $[$38.1.0\]
    Thanks,
    Gordon

  • Problem with Formatted Search-Urgent

    Hi All, I have a problem as follows:
    I am trying to set up a formatted search in the Batches Setup window of GRPO document. I want to pickup the "Total Created" figure from Rows From Document grid (i.e. the upper grid) in the form. I want to add 100 to it and then to display the result in the "Batch Attribute1" Field in the lower grid i.e. Created Batches Grid.
    Please someone give me the tested query for the purpose..
    Thanks In Advance
    Amol Mangalkar

    Try the next FS:
    SELECT $[$35.38.Number]+100

  • Formatted Search on VAT Code

    Hi,
    I am trying to set a formatted search on the VAT Code field on Purchase Order; so that whenever the user selects Vendor ID SVFG00009; it will fill in VAT Code automatically as 'P22'.
    Can someone look into the below code?
    SELECT
    CASE
         WHEN $[OPOR.CardCode] = 'SVFG00009' THEN 'P22'
         ELSE (SELECT T1.VatGroupPU
                        FROM POR1 T0 JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
                             WHERE ItemCode = $[$38.1.0]
    END
    Thanks.

    Hi,
    You don't need to set up a formatted search, you can default the BP itself to use a specific VAT Code. Go to BP Accounting tab -> Tax tab and select the code you want to use.
    Regards,
    Nat

  • 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).

  • 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

  • Problem with formatted search in grid

    Hi all,
              I have a Grid with 3 columns in my user defind form. In that Grid,I used one one formatted search on column 2 based on the value of column 1.
               I mean when i was press 'SHFT+F2' on second column, it will execute the query based on value of  what we entered in the first column of the grid. How can i do this?? How can i fetch the value of first column in the formatted search??. Please help me.
    Thanx in Advance
      Oram.

    Hi
    write a query like this and assign formatted search on column2
    SELECT  ITEMNAME FROM OITM T0 WHERE T0.ITEMCODE = $[/$GRIDUID.COL1 UID.ROWNUM])
    regards
    Vishnu

  • Problem with formatted search on UDO Form

    Hi,
    I've created an UDO and in the lines I have the fields ItemCode and ItemName. In the ItemName field I have a formatted search configured the next way:
           -Search by Saved Query
               -QueryName
           -Auto refresh when existing altered column
               -ItemCode
           -Refresh regularly
    This formatted search works fine when I do <shift> + F2 in the field. But when I change the field ItemCode and get out of the field it doesn't execute the formatted search.
    Any ideas?
    Thanks in advance, regards
    Vanesa

    Hi Vanessa,
    Firstly (and I'm not giving lessons on sucking eggs) does this work when run as a query with the $ field replaced with a litteral value that you know exists in the table you're searching (surrounded by single quotes)?
    The reason I say this is that I have had a few where as opposed to giving an error I've been hitting shift+f2 with absolutely NO feedback via error messages.
    Which form is this within? How have you used the variable element in the query?
    Is it possible for you to show the query? Along with details on which form you're using it in?
    Hopefully be able to help with more info,
    Julian

  • Formatted Search - Error in code

    I have the following formatted search to calculate the Sqm Mtr Qty in SAP on my Purchase Order:
    {SELECT ($[POR1.U_QTY.NUMBER] *  ($[POR1.U_LEN.NUMBER]/1000)) * ($[POR1.Width1.NUMBER]/1000)}
    I then tried the other way via
    {SELECT (convert(float,$[POR1.U_QTY] *  (convert(float,$[POR1.U_LEN]/1000)) * (convert(float,$[POR1.Width1]/1000)}
    where
    U_QTY = Required Qty in Metres
    U_LEN = Required Length in mm's
    Width1 = Width of Item in mm's
    The formula works fantastically well provided the Width1.NUMBER  <> 1000
    when the Width1.NUMBER  = 1000 the search fails for both scripts with an error message :
    Internal error (8180) occured
    this is extremely frustrating and I don't know why it would now fail?

    Hi Suda,
    The formula will work for the following:
    U_QTY = 5
    U_LEN = 1600
    Width1 = 732
    I have all measurements in mm (Width1 is a measurement standard field)
    It fails when I do the following:
    U_QTY = 5
    U_LEN = 1600
    Width1 = 1000 or greater (apologies I had saig <> 1000 previously)
    I think the Width in MM is limited to <1000 I'm not sure, however if I run the script
    select Width1 from POR1
    and I have a width of 1200mm it returns 1200 so I'm really confused.
    Cheers
    Kevin

  • My Formatted search work wrong!!

    I'd like to get your understanding on my english ability.
    But..., Time Pressed..
    Please Help me ..
    I make a UDO and Formatted search(It Update the U_CardName whenever the U_Cardcode changes )
    After, I link a Formatted search to my form(using screen Painter and connecting UDO, it works good).
    The problem is formatted search work only When i pushed "Update" button in screen of Define Formatted Search , otherwise it doesn't work.
    so now, I work ..
       1. Form Load.
       2. Ctrl + Shift + f2 press in edittext of U_cardname
       3. (Originally, Checked "Display Saved Values"
          check "Refresh Regularly" and
          check "Display Saved Values"
       4. "Update"
    what's the my problem?
    why is it happend?

    Hi Lee,
    You have to define a Query in the cardname field indicating that the query must be executed when the value of CardCode changes.
    Now, define such a query:
    SELECT T0.CardName AS 'BP Name' FROM  [dbo].[OCRD] T0 WHERE  T0.CardCode = RTRIM($[$3.U_CardCode])
    Where "3" is the item number of the column that contains the U_CardCode. Check the one is assigned to your field using the "Debug Information" in the "View" Menu
    When you define the Formatted Search:
    - Select Search by Saved Query and choose the one that contains the statement above
    - Auto Refresh when...
    - Select here the description that match your U_CardCode field
    - Display Saved Values
    Now you have set your UFS and it works!
    Hope this helps,
    Felipe

  • Read item code from Sales Order with formatted search

    hi,
    i'm tring to read tha values of the item or items of a sales order (before save it) with a formatted search.
    i have no problem to read the value of card code or cardname but i can't read the item's value.
    i tried with this [code]Select $[RDR1.ItemCode][/code]  (i found it on the forum) but it doesn't work.
    somebody can help me ?
    thank you

    Hi, Alessandro!
    I think the trouble is that you are trying to assign a FS to the header of the document. You are getting the information of the current row, so you have to bind a formatted search to some column of the "table - part" of the document.
    And also you can try:
    SELECT $[$38.1]
    38 - the value of "Item" (when you point a mouse to the cell, information you want from)
    1 - the value of "Column" (the same...)
    It will get an info of this cell in a current row.
    HTH!

  • Problem when create auto numbering in BP master using Formatted Search

    Hi all,
    I have a problem in creating auto numbering in BP for Customer type using Formatted search
    My query is like this
    declare @tempNo as char(20)
    set @tempNo=(select  Isnull(max(REPLACE(OCRD.CardCode , LEFT(OCRD.CardCode,10),'')),0)  + 1
    from OCRD where (CardType ='C') and LEFT(OCRD.CardCode,3) = 'CU.' )
    set @tempNo='CU.'left(convert(varchar,GETDATE(),112),6)'.'+@tempNo
    select cast(@tempNo as char(20))
    It should be creating the new number for example
    CU.201101.1
    CU.201102.2
    CU.201103.3
    CU.201103.4
    The format will be like this CU.YYYYMM.autonumbering
    So if the current year is still the same it will always increase the number and it will reset the number become 1 if the current year is change.
    But when i execute the number , the number doesn't increase, still generate the last number CU.201103.4
    I have use this query in generate item number, it runs well but different format.
    Is there some thing wrong with my query?
    Thanks in advance
    Regards
    Jia shun

    Hi Jia shun,
    You have posted an identical threads. There is no such need. Please close this one and response to the one with answer already.
    Thanks,
    Gordon

  • Formatted search problem

    Hi,
    i've a problema with a formatted search:
    i want to create a serial number's substring to copy in a user Field.
    i want to launch this query automatically, and i want to update this user field when the user create serial numbers, without the user launch this query.
    this is my query:
    SELECT  DISTINCT SUBSTRING (T0.[IntrSerial], 11,9) FROM OSRI T0  INNER JOIN SRI1 T1 ON T0.SysSerial = T1.SysSerial WHERE T0.[ItemCode] = 'ST_2400_4X2_SL' and  T0.[IntrSerial] = $[$3.54.0]
    Anyone can help? thanks a lot

    Hi,
    the query i s ok, but i have to start it manually, although i want to start it automatically when the serial number field is written, how can do it? Thanks a lot

  • 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

  • Problem in implementing formatted search

    Dear All,
    I am using the below code to implement formatted search for item master itemcode textbox. But i am unable to get the formatted search icon for the itemcode text box/ screen. Please correct me where I am going wrong.
    Dim oRs As SAPbobsCOM.Recordset
                                        oRs = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                        Dim oQuery As SAPbobsCOM.UserQueries = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserQueries)
                                        oQuery.Query = "SELECT T0.[ItemCode], T0.[ItemName] FROM OITM T0" 'Query
                                        oQuery.QueryCategory = -1
                                        oQuery.QueryDescription = "GetDfltBin"
                                        oQuery.Add()
                                        Dim oFormatted As SAPbobsCOM.FormattedSearches = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oFormattedSearches)
                                        oFormatted.FormID = "150"
                                        oFormatted.ItemID = "5"
                                        oFormatted.Action = SAPbobsCOM.BoFormattedSearchActionEnum.bofsaQuery
                                        oFormatted.FieldID = "ItemCode"
                                        oFormatted.ColumnID = "-1"
                                        oRs.DoQuery("select IntrnalKey from OUQR(nolock) Where QName = 'GetDfltBin'")
                                        oFormatted.QueryID = oRs.Fields.Item("IntrnalKey").Value ''""
                                        oFormatted.Refresh = SAPbobsCOM.BoYesNoEnum.tYES
                                        oFormatted.ForceRefresh = SAPbobsCOM.BoYesNoEnum.tYES
                                        oFormatted.ByField = SAPbobsCOM.BoYesNoEnum.tYES
    Regards,
    Noor hussain
    Edited by: noor_023 on Mar 30, 2010 12:51 PM

    Dear J,
    Thanx for your post. I am gettig this error now.  "The entry already exists in the following tales odbc-2035". I am writing the above code in the page load event of item master form as below.
    If ((pVal.FormType = 150 And pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD) And (pVal.Before_Action = True)) Then
                    '// get the event sending form
                    oForm = oSboApplication.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
                    If ((pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD) And (pVal.Before_Action = True)) Then
                        Dim oRs As SAPbobsCOM.Recordset
                        oRs = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                        Dim oQuery As SAPbobsCOM.UserQueries = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserQueries)
                        oQuery.Query = "SELECT T0.[ItemCode], T0.[ItemName] FROM OITM T0" 'Query
                        oQuery.QueryCategory = -1
                        oQuery.QueryDescription = "GetDfltBin1"
                        oQuery.Add()
                        Dim oFormatted As SAPbobsCOM.FormattedSearches = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oFormattedSearches)
                        oFormatted.FormID = "150"
                        oFormatted.ItemID = "5"
                        oFormatted.Action = SAPbobsCOM.BoFormattedSearchActionEnum.bofsaQuery  'bofsaQuery  'bofsaQuery
                        oFormatted.FieldID = "5" 'ItemCode
                        oFormatted.ColumnID = "-1"
                        oRs.DoQuery("select IntrnalKey from OUQR(nolock) Where QName = 'GetDfltBin1'")
                        oFormatted.QueryID = oRs.Fields.Item("IntrnalKey").Value ''"" ' oRs.GetField
                        oFormatted.Refresh = SAPbobsCOM.BoYesNoEnum.tYES
                        oFormatted.ForceRefresh = SAPbobsCOM.BoYesNoEnum.tYES
                        oFormatted.ByField = SAPbobsCOM.BoYesNoEnum.tYES
                        oFormatted.Add()
                        If oFormatted.Add() Then ' 0 Then
                            MsgBox(oCompany.GetLastErrorDescription)
                        End If
                    End If
                End If

Maybe you are looking for

  • How do I print a pdf file from windows 8?

    I can't find a command to print a pdf file. I'm working with windows 8. can anybody tell me how do I find that command?

  • Landed costs

    Hi All, This is a question on landed costs for imported materials. I have created a PO for an item having a value of INR 650, [ex.rate u2013 48/-] qty u201310. I have created landed costs after a/p invoice. I gave freight amt as 20 usd, customs  valu

  • Application server 10g R2 taking time to load.

    hi all. i am using oracle Application server 10g R2 when i boot my windows server 2003 R2 then its taking time to load application server more than 5 min what is the problem why its taking time to load? any onw knows?

  • Why are the drivers missing for importing and burning cd's and DVD's after a new installation of the software?

    I have just downloaded iTunes for 64-bit Windows 7, 7 times and I and got this error message: "The registry settings used by the iTunes drivers for importing and burning CD's and DVD's are missing.  This can happen as a result of installing other CD

  • Probleme mit Adobe Acrobat XI Standard

    Hallo zusammen. Ich habe leider keine Beitrag gefunden der mir einen Lösungsansatz bietet. Die Ausgangssituation: Windows 7 x64 SP1 Adobe Acrobat Standard XI 11.0.3 Flashplayer 11.9.900.170 Office 2010 Beim Versuch aus Outlook heraus eine PDF von Mai