Formatted Search Across Databases

Hi Expert,
I have a scenario where i have 2 databases lets say OEC Computers US and OEC Computers UK.  I want to write a formatted search on OEC Computers US database to pick information from OEC Computers UK for instance picking customer code where my document number in OEC Computers UK  is equal to the screen document number in OEC Computers US. I have started the query as below but still getting an error. Please assist.
SELECT a1.cardcode FROM SBODemoUK.dbo.ordr a1 WHERE a1.DocNum=$[ORDR.U_DelNo]
Regards

Hi,
Have you tried:
SELECT a1.cardcode FROM SBODemoUK.dbo.ordr a1 WHERE a1.DocNum=$[ORDR.DocNum\]
Thanks,
Gordon

Similar Messages

  • 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 not saving in database

    Dear All,
    I have created a formatted search to get the TAX Amount, and i'm using that field in Printing of invoices. After adding the document if i go back and check the user defined field value is being displayed but it won't be stored in the database as i check the print preview it shows there is no value. but the value will be displaying on that user defined field, After i select that field and click of shift F2 again and then click on Update then only it stores in the database.
    For the Formatted search i have given the condition as refresh regularly on document number.
    kindly help on this.
    Thank you in advance.
    Regards,
    Shreyas

    Hi Shreyas,
    Your FMS Query is Correct but your Auto Refresh is wrong.
    ->> put the Auto Refresh of Display Saved Values on BP Code or Remarks.
    Regards,
    Madhan.

  • SQL Query -How2bring multiple results into one field using Formatted Search

    Hi Everyone
    i am trying to bring in the results of the field dbo.Lot_ITEM.LOT using a formatted search into a row level using the following query:
    SELECT     dbo.LOT_ITEM.LOT
    FROM       dbo.DLN1 INNER JOIN dbo.LOT_ITEM ON dbo.DLN1.ItemCode = dbo.LOT_ITEM.ITEM
    WHERE     dbo.LOT_ITEM.ITEM=$[DLN1.ItemCode]
    however the result of the dbo.Lot_ITEM.LOT field could be more then one value depending on how many lots are assigned for that item
    (for example this query would be similar to assigning batch/serial numbers to an item being despatched - as you can choose multiple batches/serials depending on the quantities available and required and then move from the left to the right side of the selection window) if that makes sense!
    is it possible to bring in the multiple results into one field? and how can i amend the above query to include this?
    Thankyou in advance :o)
    Edited by: Asma Bi on Apr 23, 2008 7:22 PM
    Edited by: Asma Bi on Apr 23, 2008 7:24 PM

    Hi Suda
    Thanks for replying :o) but im not sure about the query?
    just to simplify it (as the query im working with is to do with 3rd party addons) i have used the serial/batchs field instead and used standard demo database fields from SBO 2005 sp01:
    SELECT     dbo.ixvSerialNoFact.SRI1_IntrSerial
    FROM       dbo.DLN1 INNER JOIN
                    dbo.ixvSerialNoFact ON dbo.DLN1.DocEntry = dbo.ixvSerialNoFact.SRI1_BaseEntry
    WHERE     dbo.ixvSerialNoFact.ItemCode='g1000' and dbo.ixvSerialNoFact.SRI1_BaseEntry = '193'
    The above brings me the relevant results but when i change it to be used in a formatted search:
    SELECT     dbo.ixvSerialNoFact.SRI1_IntrSerial
    FROM       dbo.DLN1 INNER JOIN
                    dbo.ixvSerialNoFact ON dbo.DLN1.DocEntry = dbo.ixvSerialNoFact.SRI1_BaseEntry
    WHERE     dbo.ixvSerialNoFact.ItemCode=$[dln1.itemcode] and dbo.ixvSerialNoFact.SRI1_BaseEntry = $[dln1.DocEntry]
    i cant seem to get it to work - now this may be because the serial number is not allocated until teh record is added to the system, however when this happens i am unable to go back in and manually trigger the query as the delivery note rows cannot be selected!
    i  think as what im originally wanting an answer for is same as this example, im wanting to know if this is even possible?
    Thanks
    Edited by: Asma Bi on Apr 24, 2008 3:53 PM
    Edited by: Asma Bi on Apr 24, 2008 3:55 PM

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

  • 2 Formatted Searches on the same field

    Good Evening
    Experts:
    I thought maybe one of you might have come across a similar need to what I have to do and could help out.  I have a screen that uses Whse id as the unique identifier for each record. I have a Formatted search on the Whse id in my screen that displays the Whse Code and Name from the OWHS table.  This is good for adding records so the User can see which ones are valid in the table OWHS. However, when I switch to Find mode,  I would like the User to see a list of records for my screen by Whse Id. 
    So, the Add needs to see all the valid Warehouses(OWHS) and the Find needs to see all records in my screen table that have been entered. 
    Do you have any suggestions how I can achieve this?
    Thanks,
    Ed

    Thanks for responding Owen...
    After re-reading my question here this morning, it appears I was not very clear in my explaining what I need to do here. 
    Table OHWS has the following records:
    Whse     Name
    01          Location 1
    02          Location 2
    03          Location 3
    04          Location 4
    I have a custom screen with a field called Whse id...it is the unique identifier for the table records in a table called "Test".
    I started with the Add on my custom screen and put a formatted search on the Whse id field(Select Whse, Name from OWHS).  This is great for the User when doing an Add so they can see all the possible Whse to pick from. 
    So, the User adds a few records to the "Test" table and they might look like:
    Whse     Item     Buyer
    01          X          Joe
    04          Z          Bob
    Now, when in Find mode for that Whse id field on my custom screen, I want the Formatted search to display the Whse's in my "Test" table that have been used  already.  So, the Formatted search would display 01 and 04 instead 01,02,03 and 04 like it would for the Add.
    Thanks,
    EJD

  • 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

  • Formatted Searches

    hello there. Is there a way to see which formatted searches are being used on a database and where it is being used?
    thanks in advance janice

    Hello Janice,
    You may check this:
    Re: How to find out where a query is used in a FMS and or Form?
    Thanks,
    Gordon

  • 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 Summation

    Dear Experts,
    I have the following formatted search to sum up all the values on a given UDF
    SELECT SUM ($[$38.U_Weight])
    It refreshes with the doc total. The problem is I keep getting an internal error 3006. What could be causing this error ?

    In an FMS you can access only database fields already stored or values from the screen on the header or the current row of the document (with the $\[ . . . type references).
    So it is impossible to get the sum of a column

  • Formatted search to update Batch attribute to match row project code

    We have extented project codes to the batch level by creading a UDF OIBT.U_ProjectCode.
    Is it possible to create a formatted search in the "Batch Setup " window to update this UDF with the project code from the corresponding row of the purchase order? Keep in mind not all rows on the purchase order may be tracked by batches.

    Hi,
    Formatted search can only get value from database or current form. There is no access to other open forms.
    Thanks,
    Gordon

  • Searching across multiple entity beans

    Hi,
    Currently we are doing a school project that involve a search function that involves multiple entity beans. Is it alright to use a SQL query to do a search across multiple entity bean? Does it violate the J2EE Specification?
    Is there any other way to do that?
    And also can the Session Bean access database directly ?
    Thanks and Regards,
    Eng Chew

    Never try that myself, but I think it would work.
    Because in your dd, you'll create 2 entry for each
    entity bean.
    For example:    <entity>
          <description>This is entity b</description>
          <ejb-name>entityA</ejb-name>
          <home>company.EntityHome</home>
          <remote>company.Entity</remote>
          <ejb-class>company.EntityA</ejb-class>
          ... etc ...
        </entity>
        <entity>
          <description>This is entity b</description>
          <ejb-name>entityB</ejb-name>
          <home>company.EntityHome</home>
          <remote>company.Entity</remote>
          <ejb-class>company.EntityB</ejb-class>
          ... etc ...
        </entity>

  • Problems using a formatted search to link order lines to order header

    Hi,
    I'm having a nightmare trying to get the main lines table to populate the header within a sales order using a formatted search.
    I have created a UDF on the header for total value, and where items entered onto the order are of a certain type I need the header UDF to be sumated.
    Basically I have three parts for packaging (PACK1, PACK2 and PACK3), and the header has a UDF called U_TotPack
    Someone did sugest the following query, but this doesn't appear to work either:
    select sum(t0.linetotal) from rdr1 t0 inner join ordr t1 on t0.docentry = t1.docentry
    where t1.docnum = $[ORDR.DocNum] and t0.itemcode in ('PACK1', 'PACK2', 'PACK3')
    If it is a problem for me to use the line total field (as it is a variable calculation) I am happy to total the quantities for the items found, but I just can't seem to build any form of relationship between the header and lines.
    Hope someone out there is able to help as this one has really got me stumped.
    Cheers,
    J

    Hi Julian,
    I'm assuming you are trying to populate the header UDF before the Order is added to the system? If yes then it is not possible to achieve this via a formatted search, only SDK. A header FS cannot properly access line information, it only works the other way around - header info to line level.
    I presume the reasoning is that which line should your header FS take a value from? The FS syntax also doesn't allow you to loop throught all lines.
    The SQL that someone else suggested would only work for a sales order already added to the database. Hope this helps.
    Regards,
    Andrew.

  • Formatted search query adding spaces

    Hello,
    I have created a table U_Items in SBO database.
    I was trying to run this query using formatted search.
    SELECT ItemDesc
    FROM U_Items T0
    WHERE T0.ItemCode = RTRIM(LTRIM('$[$38.1.0]'))
    When the query gets executed '$[$38.1.0]' is repalced
    by 'N'A00001       '' value.
    I want the value to be 'A00001' so that it can match the record in the U_Items. How can I get rid of the trailing spaces?
    Thanks,
    Sheetal

    Hello Sheetal,
    Your query,
    SELECT ItemDesc
    FROM U_Items T0
    WHERE T0.ItemCode = RTRIM(LTRIM('$[$38.1.0]'))
    I think must be
    SELECT ItemDesc
    FROM [@U_Items] T0
    WHERE T0.ItemCode = RTRIM(LTRIM($[$38.1.0]))
    if this is a user defined table.
    I think your query seems ok.  It doesn't work?

  • Formatted searches on patch levels

    Dear experts,
    I did my formatted searches on my development database they all work well. on transfering them to my production database they refused to work. I am using SAP Business One 2007 A (8.00.232)  SP: 01  PL: 07. What could be the issue cause its strange why they aint working on my production Database.
    Regards

    hi suda,
    below query works perfect on my development database but on my production i get null values
    declare @Price as decimal (13,6)
    declare @Price1 as decimal (13,6)
    declare @FromWHS as nvarchar (4)
    declare @ToWHS as nvarchar (4)
    declare @ItemCode as nvarchar(30)
    declare @TransitItem as nvarchar(30)
    declare @LocalItem as nvarchar(30)
    set @ToWhs = $[$13.15.0]
    set @itemcode = $[$13.1.0]
    select @FromWHS =  (case when isnull($[OIGN.u_FromWarehouse],'') = '' then @towhs else $[OIGN.u_FromWarehouse] end)
    select @Price = t1.[stockprice] from ige1 t1 inner join oige t2 on t2.docentry =t1.docentry where @FromWhs = t1.whscode and @itemcode = t1.itemcode and $[OIGN.U_GINumber.Number] = T2.DocNum
    select @Price1 = t1.[stockprice] from ige1 t1 inner join oige t2 on t2.docentry =t1.docentry where @FromWhs = t1.whscode and $[OIGN.U_GINumber.Number] = T2.DocNum
    select  @TransitItem  = t1.ItemCode from oitm t1 inner join ign1 t2 on t2.ItemCode = t1.itemCode where T1.[QryGroup61]='Y'
    select @LocalItem = t1.ItemCode from oitm t1 inner join ign1 t2 on t2.ItemCode = t1.itemCode where T1.[QryGroup63]='Y'
    select distinct case
    when T0.[U_FromCode] = @FromWHS and T0.[U_ToCode] = @ToWHS and $[OIGN.U_AdjustmentType] ='STX' and @itemcode = @TransitItem and $[OIGN.U_TransportType]='04'
    then (T0.[U_RateUSD]*T0.[U_ExchangeRate]) + @Price + $[OIGN.U_BioCoding]
    when T0.[U_FromCode] = @FromWHS and T0.[U_ToCode] = @ToWHS and $[OIGN.U_AdjustmentType] ='STX' and @itemcode=@LocalItem and $[OIGN.U_TransportType]='04'
    then (T0.[U_Rate]) + @Price + $[OIGN.U_BioCoding]
    when T0.[U_FromCode] = @FromWHS and T0.[U_ToCode] = $[OIGN.U_OffLoading] and $[OIGN.U_AdjustmentType] ='STX' and @itemcode = @TransitItem and $[OIGN.U_TransportType] in ('01','02','03')
    then (T0.[U_RateUSD]*T0.[U_ExchangeRate]) + @Price + $[OIGN.U_BioCoding]
    when T0.[U_FromCode] = @FromWHS and T0.[U_ToCode] = $[OIGN.U_OffLoading] and $[OIGN.U_AdjustmentType] ='STX' and @itemcode = @LocalItem and $[OIGN.U_TransportType] in ('01','02','03')
    then (T0.[U_Rate]) + @Price + $[OIGN.U_BioCoding]
    when $[OIGN.U_AdjustmentType] ='Con' then
    @Price1 + $[OIGN.U_Duty]+$[OIGN.U_BioCoding]
    when $[OIGN.U_AdjustmentType] ='Hosp' and T0.[U_FromCode] = @FromWHS and T0.[U_ToCode] = @ToWHS and @itemcode = @TransitItem then
    (T0.[U_RateUSD]*T0.[U_ExchangeRate])+@Price1 + (Select T0.U_HospitalityFee from [dbo].[@HOSPITALITY]  T0 where T0.[U_WarehouseCode] = $[IGN1.WhsCode]) + $[OIGN.U_BioCoding]
    when $[OIGN.U_AdjustmentType] ='Hosp' and T0.[U_FromCode] = @FromWHS and T0.[U_ToCode] = @ToWHS and @itemcode = @LocalItem  then
    (T0.[U_Rate])+@Price1 + (Select T0.U_HospitalityFee from [dbo].[@HOSPITALITY]  T0 where T0.[U_WarehouseCode] = $[IGN1.WhsCode]) + $[OIGN.U_BioCoding]
    end
    from [dbo].[@TRANSFERS]  T0
    order by 1 desc

Maybe you are looking for

  • Clear from Vendor open line item (FBL1N).

    Dear, I have Posted the Invoice and cancelled the same invoice which was in the Blocked status without Release.So its showing in Vendor open line item (FBL1N). Now we can not release these two docs in MRBR bcz the invoice was cancelled and also it ca

  • Unable to edit checked out file in NWDS

    A project was created in NWDS for DCs      fscm/bed/web/shared and is/uces/war. But while syncing source, or compiling, we received this error:  Apr 24, 2014 1:37:09 PM /userOut/Development Component (com.sap.ide.eclipse.component.provider.listener.D

  • Running jsp in jdeveloper

    Hi, I am just new to jdeveloper and amfacing an error while running a jsp page.I am using jdev 10g and whenI try to run the jsp page I created i get Error initializing server: XMLApplicationServerConfig::initHttp(server), cannot find application inst

  • TS3297 Every time I go to the itunes store, i get a message saying Itunes has stopped working and must close  Problem Event Name:     APPCRASH

    Every time I go to the itunes store, I get the pop up "Itunes has stopped working and must close" Under Details are : Problem Event Name:  APPCRASH

  • Creative Vision M Probl

    The other day the screen on my creative vision M froze so I hit the reset button on the bottom and continued to charge it by USB at my computer. However my mom used it the next day and told me that it seemed to not have charged at all so I decided to