FORMATTED SEARCH USING SCREEN ENTRIES

Hi ,
    i want use formatted search to do the following without using variable entry ( without the define survey variables window opening when i execute the query):
Example: When you enter a purchase order, the item search should propose only those items where the vendor entered in the Default Vendor field of the master record is the same as the vendor specified in the Vendor field of the purchase order.
i found the following explaination in the SAP B1 training material which is not all clear enough.
"To do this, you define a query that contains the Vendor field from the purchase order as the condition for the Default Vendor field. You then define this query as a formatted search for the Item no. field in the purchase order entry screen. "
i wrote a query which pretty much does what i want but , after i enter the vendor code in the purchase order header data  and go to the item field and press shift+F2, instead of just proposing only those items which the  above vendor  sells , a "define survey variables"  window opens and i will have to again choose the same vendor i just choose in the "vendor field in the header data" of the purchase order.
    can anyone plz help me out with this ???

Hi adrian,
             thank for ur reply, and plz pardon me for my ignorance..
         i tried using the query u gave me in a query generator and the wizard, but i am getting a couple of syntax errors..and not only the query u gave but any query i have used from this forum ... so i was wondering if i am doing anything wrong..so i ll explain to you how i used your your query so may be u can tell me where i am going wrong..
i went to the query generator selected the table OITM  and choose the item code and description from that table for the SELECT field and then put the cursor on the WHERE field and typed the condition in the query you gave me for the WHERE field .. and then executed it.. didnt work ..
Then in the result window of the query generator(and wizard) i went to the write mode of the SOL statments field  and copied and pasted the query you sent me... and then executed it... still doesnt work... and like i said this happens to all the queries i find here in the forum ..  
can u help??

Similar Messages

  • Creating formatted search using DI API

    Dear All,
    Please let me know if we can implement/create formatted search on a UDF textbox using DI API. Is it possible to create formatted search through code using DI API ?
    Regards,
    Noor Hussain

    Yes, it is possible. Look for the FormattedSearches object in SDK.

  • Formatted Search - Using field index to refer to UDF in many documents

    I have some UDFs in my marketing documents - say U_VALUE
    I want to write a fairly complicated formatted search and use it for the same thing across all my marketing documents.
    I don't want to use
    $[ORDR.U_VALUE]
    in my formatted search as this will only work in the sales order document.
    I want to use something like
    $[$4.0.0]
    which brings back the cardcode independant of the form we are looking at. However
    $[$U_VALUE.0.0]
    will not work!
    Hoping someone can help!
    Edited by: Daniel Abbatt on Apr 10, 2008 6:16 PM

    Yes you would have to have a UDF called VALUE on the marketing document for this example to run and even then it will error!
    That's the point, the code above will not work, SBO only seems to be able to know about ORDR in a sales order and OINV in an invoice. So if I am in a sales order, it errors on the reference to OINV, even though the code that uses the
    $[OINV.U_VALUE]
    is never actually accessed by the SQL. I guess this is because SBO does the substitutions before it executes the code.
    All I am basically trying to do is create a generic formatted search that will perform an action using the value of a UDF, say some formatting, the problem is I want it to work with any marketing document.
    The only way I can find to access a UDF though is by having to use the
    $[TABLE.U_FIELDNAME]
    way, which seems to mean by definition I can only create a formatted search to access a header UDF for a single type of document. I cannot create a generic formatted search, that reverses the string for example, and use that formatted search across all marketing documents.
    I know you can access normal fields also by their item reference, i.e.
    $[$4.0.0]
    , but this syntax does not seem to work with UDF, even though the system information shows the item reference as U_VALUE, I cannot use the
    $[$U_VALUE.0.0]
    which would be ideal...
    Edited by: Daniel Abbatt on Apr 14, 2008 12:05 PM

  • Formatted Search using SUM

    I have a user defined field called U_PRPrice which I want to be a Formatted search populated by the result of another udf U_SPrice divided by 12 and multiplied by a udf U_PRMNTH
    I can get the formatted search to fire by using
    SELECT SUM (T0.[U_SPrice]/12 *T0.[U_PRMNTH]) FROM OINS T0
    however I am struggling to pass through the dynamic values from the active record card using the $[$OINS.U_SPrice] parameter
    Can anyone point me in the right direction before I throw myself out of the window!
    Thanks

    Try this one:
    SELECT 12*$[OINS.U_SPrice\]/$[OINS.U_PRMNTH\]
    Thanks,
    Gordon

  • Formatted search using IF ELSE

    Hello.
    Im trying to do a search with two parameters. If the first one is not empty, do the first search, else do the other search. I get an error. Something about having to select from a table... Anyone?
    IF ('[%0]' != '')
    BEGIN
                              SELECT     T0.ShortName, T0.Debit, T0.Ref1, T0.Ref2
                               FROM         JDT1 T0
                               WHERE     T0.Debit > '0' AND (T0.Ref1 = '[%0]')
    END
    ELSE
    BEGIN
                              SELECT     T0.ShortName, T0.Debit, T0.Ref1, T0.Ref2
                              FROM         JDT1 T0
                              WHERE     T0.Debit > '0' AND (T0.Ref2 = '[%1]')
    END

    Hi Magnus,
    I have had the same problem previously and the only way I could solve it was by declaring variables to save the values in.  I have changed your query and tested it. I know this might look like an overkill, but please let me know if you find an easier solution!
    DECLARE @Ref1 Varchar(11)
    SELECT @Ref1 = T0.Ref1 FROM JDT1 T0 WHERE T0.Ref1 = '[%0]'
    DECLARE @Ref2 Varchar(11)
    SELECT @Ref2 = T0.Ref2 FROM JDT1 T0 WHERE T0.Ref2 = '[%1]'
    IF (@Ref1 != '')
    BEGIN
      SELECT T0.ShortName, T0.Debit, T0.Ref1, T0.Ref2
      FROM JDT1 T0
      WHERE T0.Debit > '0' AND (T0.Ref1 = @Ref1)
    END
    ELSE
    BEGIN
      SELECT T0.ShortName, T0.Debit, T0.Ref1, T0.Ref2
      FROM JDT1 T0
      WHERE T0.Debit > '0' AND (T0.Ref2 = @Ref2)
    END
    Hope it helps,
    Adele

  • Formatted Search on Service Call

    Dear All,
    Im trying to write a formatted search on the Service call screen to retrieve the email address of a queue. The queue is in the general tab of the Service call. You can add user defined fields for the service call-title, service call -solutions, service call- activities etc.
    I have added the userdefined field on the service call-title.
    My formatted searches can access all the other header details on the service call but I cannot get the queue data in the general tab.
    Kindly assist,
    Thanks,
    Indraj.

    HI Indraj,
    On the user defined fields area if you want to use the formatted search, use must have to use the table and field names inside. (also if you have any field which not represented by variables eq: hidden fields):
    $[TABLE_NAME.FIELD_NAME]
    if you use normal fields area, and you have the variable on the form:
    $[$ITEMUID.COLUID.TYPE]
    where Type is:
    0 for gerenal
    NUMBER for numbers,
    etc.
    So Your solution is:
    SELECT T1.[email] FROM OSCL T0  INNER JOIN OQUE T1 ON T0.Queue = T1.queueID WHERE
    T0.[callID] =$[OSCL.callID]
    Regards,
    J.

  • Formatted search based on screen entry

    Hi,
    I need help to create a formatted search based on a field that the user entered on the screen. For example, I want a formatted search on the Purchase Order screen where the item search will only show the items where the vendor entered in the Default Vendor field of the master record is the same as the vendor specified in the Vendor field of the purchase order.  Please advise on the correct sql statement.
    Thanks,
    Jane

    Thanks Sudah! That worked!
    However, I do not understand the syntax.  What does [dbo] mean?
    I am trying to duplicate the query for the following scenario.
    I have a user defined field U_Freight in the Business Partner Master Data (OCRD) and also in the sales order screen. I want to create a formatted search for the freight field in the sales order to automatically find the freight from the business partner master data screen based on the customer entered in the sales order.
    I have tried the following as a formatted search on the sales order screen, but it does NOT work.
    SELECT T0.U_FREIGHT FROM [dbo].[OCRD] T0
    WHERE T0.CardCode = $[$4.0.0]
    Please advise.
    Thanks!

  • Retrieving the value using formatted search

    Hi everyone. I have a question regarding on how I can get the value of the user-defined field in the title of a marketing document. I would like to get the value using formatted search and sql query.
    Here's the format I am currently using.
    $[$ <Item>.<Pane>.<Variable>]
    Is my format correct? Thanks.
    Regards,
    Omann

    Hi Omann,
    You can refer to fields in an entry screen using the syntax
    $[Table name.Field name]
    The table name is the name of the table belonging to the entry screen, for example, OINV for the A/R invoice entry screen.
    You can also use the fieldu2019s item number and fieldu2019s column number to refer to a field on the entry screen. By doing this, the query applies to all document entry screens. The syntax is then
    $[$Fieldu2019s item number.Fieldu2019s column number.NUMBER/CURRENCY/DATE/0]
    The system is able to uniquely identify each field of a document using the fieldu2019s index number and fieldu2019s column number. If you have activated the debug information under View  Debug Information, the system displays the fieldu2019s item number and the fieldu2019s column number in the status bar.
    You use the NUMBER parameter if the field concerned contains an amount and a currency key, and you want to extract the amount only. 
    You use the CURRENCY parameter if the field concerned contains an amount and a currency key, and you want to extract only the currency key.
    You use the DATE parameter if the field concerned is a date field and you want to use it for calculations.
    Regards, Yatsea

  • UDF - formatted search help using query

    I've created a UDF for 'activities' called U_BP_Link - it has a formatted search query which simply displays all data in the OCRD business partner database.  I wanted to also fill in a UDF which would display the 'description' of the BP that was selected in the U_BP_Link field.  I'm having trouble coming up with the correct syntax for the query associated with the UDF name field.  This is giving me a syntax error near $[$U_BP_Link]................
    SELECT T0.CardName FROM OCRD T0 INNER JOIN OCLG T1 ON T0.CardCode = T1.U_BP_Link Where T0.CardCode = $[$U_BP_LINK.1.0]

    Good Day,
    I don't fully understand your situation.
    I'm thinking you have 2 UDFs. One is OCLG.U_BP_Link and the second is the 'also fill in a UDF' and that is to be populated with OCRD.CardName based on data entry in OCLG.U_BP_Link
    That being the case, I would create a FMS on OCLG.U_BP_Name field to:
    1) Search in Saved Query - create query similiar to SELECT OCRD.CardName FROM OCRD, OCLG Where OCRD.CardCode = $[OCLG.U_BP_LINK] FOR BROWSE
    Create and test the query and after results are generated as expected, substitue the $[OCLG.U_BP_LINK]. The query will error in SAP but is OK for use in FMS.
    2) Auto refresh when Field Changes
    3) Based on field OCLG.U_BP_Link - actually the description for this field.
    4) Display saved values
    It could work.
    M

  • Can I reach specific line in a matrix using formatted search syntex

    I'm trying to get data  from screen in a specific line in a document. when i use $[$38.1], for example, in the formatted search it always gives the value in the row that the cursor is on., however i am trying to reach a line without requiring the user to have the cursor on that line. when i do that i always get the first line, is there a way to reach a spesific line?
    thank you,
    Sara

    Sara,
    You cannot reach a specific line.
    Regards,
    J.

  • Query using a Formatted Search

    Hi,
    I am trying to do the following but its not working and need a little help please.
    I have a series of UDF's on the Goods Receipt PO screen which I need populating on the batch transactions screen automatically.
    i.e I have a UDF called U_Width on the main Goods Receipt screen (PDN1) and when I click add on a batched item it asked me for the batch details.  I need the UDF in the Batch Screen (OIBT.U_Width) to be automatically populated with this information.
    I thought by using the following simple query and set as a formatted search would work but it doesn't seem to recognised the PDN1 table as a current document
    SELECT $[PDN1.U_Width]
    help please

    $ value will only work for current active form.  It is not possible to get the other form's value.
    Thanks,
    Gordon

  • Fill Find edit box of Formatted search screen

    Hi,
    I have an edit box and a choose button.
    when I click on that choose button I get a formatted search screen.
    I want the value typed in the edit box to be defaulted in the
    Find Edit box of the foratted search screen.
    Say I type "1" in my edit box, My formatted search screen should pop up having "1"
    in the Find edit box and results pertaining to value "1"(like wild card search)
    should be displayed in the formatteed search screen.
    Can anyone tell me as how to implement this?

    The reference to $[x.0.0] was simply meant to point you towards using the formatted search syntax for selecting fields from the current screen for use in your query.
    The two techniques I mentioned were not meant to be used together, you could either use the sendkeys, or the $[x.0.0] syntax depending on which result you wanted.
    The $[x.0.0] syntax actually goes in the query that is saved for the formatted search, you don't need to do anything with it programatically at runtime, business one does it for you.  You can get a formatted search to pick values up from the current screen by using syntax such as $[$4.0.0] or $[$OINV.CARDCODE]. This particular example will pick up the cardcode from a document screen.  Look in the standard help file under Formatted Searches for more details.
    I have attached a sample query showing how it can be used with fields based on userdatasources in custom screens.  This one can be used to show product lookups out when the user has already keyed in a partial product code.  At runtime the $[#018.UItem] reference automatically gets replaced with the value currently in the item field.
    DECLARE @Item Varchar(20)
    SET @Item = RTRIM($[#018.UItem]) + '%'
    SELECT T0.ItemCode, T0.ItemName FROM OITM T0 WHERE T0.ItemCode LIKE @Item FOR BROWSE
    If you haven't seen this type of formatted search processing before, I would recommend you try to spend a little time learning it - it sometimes eliminates the need for writing SDK code at all.
    Regards,
    John.

  • Formatted Search screen - populate multiple fields

    I have an Employee Id field in my screen.
    On clicking Choose button,I use a Formatted Search screen to populate value to that field.
    I also have other fields like employee Name,department which should be populated, once an employee Id is chosen from Formatted Search screen.
    The functionality is like that of "Purchase Order screen".
    Once a vendor Id is chosen Name,Contact Person etc get populated in "Purchase Order screen".
    How do I do that?
    Should I trap the Choose button event of Formatted Search screen?
    Please help.

    I think all you are missing is a check to make sure you don't try and re-run the lookup when you are validating the return value from a previous lookup.
    I made a minor change to my code and achieved the behaviour you described.  I have extracted the relevant  code from the application .  Unfortunately it looses its indentation when I post it, so it might be quite hard to read.  It uses recordsets for the validation as in practice most of the real validation is more complex than this cut-down sample.
    This particular example is from a screen with a Customer Code prompt, and displays the customers name below it.
    Regards,
    John.
    <b>Constant holding menu uid of Formatted Search</b>
    Public Const AZU_MNU_SEARCH             As Long = 7425
    <b>Declare a variable at module level</b>
    Dim mblnCardLookup as Boolean
    <b>Create validation routine (cut down sample included)</b>
    Sub ValidateCustomer(sboApp As SAPbouiCOM.Application, sboCompany As SAbobsCOM.Company, BubbleEvent As Boolean)
        On Error GoTo ErrorHandler
        Const AZU_PROCEDURENAME     As String = "ValidateCustomer"
        Dim sboRecordset            As SAPbobsCOM.Recordset
        Dim sboForm                 As SAPbouiCOM.Form
        Dim sboDSCard               As SAPbouiCOM.UserDataSource
        Dim sboDSName               As SAPbouiCOM.UserDataSource
        Set sboForm = sboApp.Forms(strUID)
        Set sboDSCard = sboForm.DataSources.UserDataSources("UCARD")
        Set sboDSName = sboForm.DataSources.UserDataSources("UNAME")
        If sboDSCard.value <> "" Then
            Set sboRecordset = sboCompany.GetBusinessObject(BoRecordset)
            sboRecordset.DoQuery "Select CardCode, CardName, Currency From OCRD where CardCode Like '" & sboDSCard.value & "%'"
            If sboRecordset.RecordCount < 1 Then
                If sboDSName.value <> "" Then
                    sboDSName.value = ""
                    sboForm.Items("edtName").Update
                End If
                If Not mblnCardLookup Then
                    LookupCustomer sboApp
                End If
                BubbleEvent = False
                Exit Sub
            End If
            sboRecordset.MoveFirst
            sboDSCard.value = sboRecordset.Fields(0).value
            sboDSName.value = sboRecordset.Fields(1).value
            mstrCurrency = sboRecordset.Fields(2).value
            sboForm.Items("edtName").Update
        Else
            sboDSName.value = ""
            sboForm.Items("edtName").Update
            BubbleEvent = False
        End If
        Set sboDSName = Nothing
        Set sboDSCard = Nothing
        Set sboForm = Nothing
        Set sboRecordset = Nothing
        Exit Sub
    ErrorHandler:
        Call AZU_STD_ERROR_MSGBOX(AZU_MODULENAME, AZU_PROCEDURENAME)
    End Sub
    <b>Create lookup routine (cut down sample included)</b>
    Private Sub LookupCustomer(sboApp As SAPbouiCOM.Application)
        On Error GoTo ErrorHandler
        Const AZU_PROCEDURENAME     As String = "LookupCustomer"
        Dim sboForm                 As SAPbouiCOM.Form
        Set sboForm = sboApp.Forms(strUID)
        mblnCardLookup = True
        sboApp.ActivateMenuItem AZU_MNU_SEARCH
        Set sboForm = Nothing
        Exit Sub
    ErrorHandler:
        Call AZU_STD_ERROR_MSGBOX(AZU_MODULENAME, AZU_PROCEDURENAME)
    End Sub
    <b>Add the following code to the ITEMEVENT handler</b>
        'Validate Customer Code
        If pVal.EventType = et_VALIDATE And pVal.ItemUID = "edtCard" And pVal.Before_Action = False Then
            Call ValidateCustomer(sboApp, sboCompany, BubbleEvent)
        End If
        'Customer Code Lookup on TAB Key
        If pVal.EventType = et_KEY_DOWN And pVal.ItemUID = "edtCard" And pVal.Before_Action = True And pVal.CharPressed = 9 Then
            Set sboDSCard = sboApp.Forms(strUID).DataSources.UserDataSources("UCARD")
            If sboDSCard.value = "" Then
                LookupCustomer sboApp
                BubbleEvent = False
            End If
        End If
        'Force Validation on Return from Lookup
        If pVal.EventType = et_FORM_ACTIVATE And mblnCardLookup = True Then
            sboApp.Forms(strUID).Items("edtRef").Click
            mblnCardLookup = False
        End If

  • Formatted search can we use current records values ?

    Hi.. to all,
    I have a need to get tax amount from current document at the time of entry before updating the entry by using Formatted search through saved query.
    Can any body help me to resolve it ?
    Regards..
    Chintesh Soni

    Hi,
    You can get the value at entry time (for example on an invoice) by creating a search define query such as:
    [code]SELECT $[OINV.VatSum][/code]
    Then add the search define to a UDF that gets 'Auto Refresh When Field Changes', and select an option like 'Document Total' and 'Display Saved Values'. This way the search define query will refresh the tax value in the UDF when ever the total value changes i.e qty, unit cost, discounts get altered...
    You'll need to alter the query to match different marketing documents and set the search defines on each one.
    Hope this is of help
    Kind Regards
    Matthew

  • Internal error while using Formatted Search

    Hi
    I am adding Assessable value in total amount at row level of sales document. For achieving so im using Shift +F2 on total amount field, which results in sum of assessable value and total amount. It is working properly in some of documents but throws message of internal error in some of the documents.
    Im not able to understand that why error is coming in some of the documents?
    Suggest me..
    Thanks

    1. Have the screen open where you have the Shift F2, you can manually run the query of the formatted search, it will sometimes give you more meaningful message.
    Eg:
    You have a formatted search query 'Query 1'  which is saved in Tools> User Query> Query 1 attached to field DocTotal.
    So, what you do is, instead of pressing Shift F2, you go to tools > User Query.> Query 1 to run it.
    2. Another thing could be the field you used in the formula do not have the focus when you run it.
    Eg: you use $[4.0.0] in the query.
    When you press Shift F2,  the field represents $[$4.0.0] do not have focus.

Maybe you are looking for

  • Creation of Excel files using XSLT

    Hi frnds, From the blog provided by the Michal /people/michal.krawczyk2/blog/2005/12/10/xi-generating-excel-files-without-the-java-nor-the-conversion-agent-not-possible I came to know that we can create excel files using XSLT mapping but here inthis

  • File not found Exception when zipping a file

    Hello I seem to have run into a problem when trying to zip a directory. I get the error: java.io.FileNotFoundException: C:\Users\dojo\Documents\Programming\compress (Access is denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOut

  • Very weird ORA-06502 error while creating procedure

    Hi All, i try to create the following procedure (on a 10.2 database): create or replace procedure audit_report as cursor c_audit_user (b_start_date date, b_end_date date) is select user_id , os_user , session_id , host , last_program , last_action ,

  • CISCO VPN ERROR 51, NNNOOOOOOOOO

    I am receiving the dreaded Error 51 when ever I install and try to launch the Cisco VPN Client. This is on a brand new Mac Book Pro, so this software was never previously installed. Ive been trying to install the Cisco VPN Client version 280, but I'v

  • Appleworks: word count, footnotes and text frames.

    Hi there! Does anybody know if footnotes and text boxes are automatically included in a word processing document word count? If they are, is there a way of excluding these from the word count? Am writing a 12,000 word dissertation, and footnotes and