UDF link type and formatted search
Dear experts,
Im trying to use a formatted search to fill a UDF of the link type.
The plan is to generate a weburl voor googlemaps like the link with business partner addresses. I do this with the following query:
DECLARE @URLp1 AS VARCHAR(254)
DECLARE @Adres AS VARCHAR(254)
DECLARE @Plaats AS VARCHAR(254)
DECLARE @Postcode AS VARCHAR(254)
DECLARE @URL AS VARCHAR(254)
SET @URLp1=('http://maps.google.com/?q=')
SELECT @Adres=($[$U_Adres.1.0])
SELECT @Plaats=($[$U_Plaats.1.0])
IF LEN($[$U_Postcode.1.0])=0
BEGIN
SELECT @URL=(@URLp1+@Adres+'+'+@Plaats)
SELECT @URL
END
SELECT @Postcode=($[$U_Postcode.1.0])
SELECT @URL=(@URLp1+@Adres+'+'+@Postcode+'+'+@Plaats)
SELECT @URL=(SELECT REPLACE (@URL,' ','%20'))
SELECT @URL
The select replace doesn't work yet but that's not the real problem.
I used the following formatted search settings:
Search in Existing User-Defined Values according to Saved Query
Auto Refresh When Field Changes -> set to Adres
Refresh Regularly
When I try these settings on my UDF link style the field just stays empty.
When I use this formatted search on a Alphanumeric(100) field it more or less works. I need to manualy refresh the field to execute the query.
If I simplify the query to insert just one value like 'Opportunity No.' ($[$74.1.0]) it does auto update in both fields.
Could someone point me in the right direction what I'm missing/forgetting or give me a sollution that might even be better?
Kind regards
Edit:
PS. We are using SAP BO 8.8 PL15
I've found a topic with a similar problem but there's no solution there either...
Formatted search with Query auto update
Similar Messages
-
Convert DocTime to datetime type and format of HH:MM
Hi Experts!!
I am setting up an alert that will run every 5 minutes but would like only those docs created in the last 5 to be selected. In order to accomplish this i would like to use the DATEDIFF funtion. But have a problem in that the DocTime is a smallint (why it's not a datetime is beyond me!) How do I convert it to the proper datetime type and format?
Thx
RichardHi Richard,
check with this just change date smallint to datetime
select
(select case when len(oi.doctime)=3 then
convert (datetime,convert(varchar,( convert(varchar,oi.docdate,103) + ' '+ (left(oi.doctime,1)) + ':'+ (right(oi.doctime,2))) ,114),103) else
convert (datetime,convert(varchar,( convert(varchar,oi.docdate,103) + ' '+ (left(oi.doctime,2)) + ':'+ (right(oi.doctime,2))) ,114),103) end) as PreparationTime
from oinv oi -
hello,
I've defined an UDF as Price.
Number of decimal for prices is set to 3 in the general settings.
the actual result of my formatted search is rounded to 2 decimals although 3 decimal are displayed.
here is a simple formatted search that illustrate the issue :
SELECT 100 / (100+19.6)
the displayed result is 0.840 instead of the correct value : 0.836
How can It be solved ?
Best regards,
FrancisHi
Please check the decimal settings of
amount as well(general setting -display tab)
there is one case:
When under Adminstration -> System Initialization -> General Settings ->
Display, the decimal for the amount is defined as 0 and the UDF is
defined as eg. alphanumeric or units and total amount, The UDF does not
return the decimals and round the amount.
base on my testing:
if I define 2 decimal places for amount
then the UDF result will be 0.84
But if I define 3 decimal places for amount
then the UDF result will be 0.83
Best Regards
Helen Sun -
Selecting the Description field for a UDF when using a formatted search
I am trying to pull the Description field from a UDF on CRD1 in a formatted search in marketing documents.
Here is my current query but I do not know the correct syntax to pull the description instead of the code from the UDF.
SELECT T1.[U_ISEName] FROM OCRD T0 INNER JOIN CRD1 T1 ON T0.CardCode = T1.CardCode
Any help would be appreciated.
Thanks
SteveGordon
I tried your suggestion. On CRD1 I created a FS to pull the name from the OSLP tabel. I then used your query on the sales order to pull the stored value on CRD1.
but now I am getting this error message
1). {Microsoft]{SQL NativeClient} ][SQL Server] Invalid column name 'U_ISE'> 2) {Microsoft]{SQL NativeClient][SQL Server] Statement 'Sales Tax Codes' OSTC (s) could not be prepared.
The name appears to pull
Any suggestions.
Thanks
Steve -
Dear expert
I have a question we make deliveries and at the end of the month we use document generating wizzard to group all deliveries per customer into one invoice.
But there are formatted search made to calculate some taxes data mandatory and wehn you use the document gerating wizzard for each invocie created you must click ok for the formatted search
Is it a way to imrove the process and not having pop up window for each invoice.
Thank youHi,
I think press OK is not avoidable. Have you checked if there is no FMS?
Thanks,
Gordon -
Link colors and formats not WYSIWYG
I'm having trouble with Link colors. I have the Link Format set to a certain colors but what I see after I publish my site is a crap shoot. Sometimes the change takes sometimes it doesn't, and often what I see in Safari 4/5 or Firefox is not the same as I have set in iWeb. And yes I force a page refresh by clearing the cache and reloading the pages every time.
Any help would be greatly appreciated. So far I like how WYSIWYG iWeb is but this one problem has plagued me for some time now.
JohnWhen you set the color use the Web Safe color pallet from the color pane:
Click to view full size
OT -
Obtaining UDF form type and ID
Hi all
i want to obtain the ID and Type of a UDF form which opens as a side form for a given SBO form. question is how can i obtain the ID and Type of the UDF form thourgh code?
appreciate the help
YoavHi Yechiel
Trying with the following code:
Get ID of Item : pVal.ItemUID
Get Type of Item: oForm.Items.Item(pVal.ItemUID).Type.ToString
I hope useful for you!!
Regards -
Hi All
For my case, I have Two User Define Field (U_sysref and U_Percent) in the sales order line level. I am using the addon to input the value in one of the UDF with following code:
Dim CurrentDate As String = Date.Now.Year.ToString + Date.Now.Month.ToString + Date.Now.Day.ToString + _
Date.Now.Hour.ToString + Date.Now.Minute.ToString + Date.Now.Second.ToString + _
Date.Now.Millisecond.ToString
oMatrix.Columns.Item("U_sysref").Cells.Item(row).Specific.Value = CurrentDate
And the U_Percent can be refreshed when the U_sysref value is updated.
I have try to manually change the value in U_sysref and the field U_Percent can be refreshed.
But when I use the addon to change the value in U_sysref and the field cannot be refreshed.
Have any people know how to solve it?
Thanks
MouseHi,
FMS will only refresh by UI entry. Entry from DI directly will not trigger.
Thanks,
Gordon -
Outgoing payment and formatted search
hi
how can i write a FS that distinguish between the methods of the payment (cash, check,cc).
thanks
RafiThanks Suda for your reply.
what is the right syntax for the case statement.
i want to get an automatic journal memo, each time i make an outgoing payment.
Till now i have a FS that don't distinguish between the methods of the payment, which cause later on some confuses in our books.
the trigger for this FS is a change in the code name of the document.
my goal is to have a FS that's changed according to the methods mentioned above, and i'm afraid i won't be able to make it evoke automatically.
"Also $32.0.0.25 is incorrect. Form field references have only 3 parameters not 4 "
i put only 3 parameters, the 25 is the number of digits in the left function.
Thx
Rafi -
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,
YvetteHi 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 -
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 advanceHi,
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 -
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 shunHi 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 -
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 RomeniHello 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 -
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 -
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.
Maybe you are looking for
-
Message for Missing Parts While Creating Order
Dear Friends, While Creating & Saving The Production Order System Is Not Supporting In Giving A Warning Massage On Missing Parts In spite Of Deficit In Storage Location For Materials. The Clint Requires A Warning Massage In Case Of Materials Shortage
-
I am not reachable, but forwarded the port in AE & OSX Firewall
hi, i forwarded the port 49500 for my bittorrent client, using with macgamefiles for example, in my osx firewall and my airport admin tool. 49500 - 10.0.1.2 - 49500 my torrent client is running, when i check it at www.canyouseeme.org i get an error:
-
Can I update Power Map add-in to May 2014 version ?
Can I update Power Map add-in to May 2014 version ? I want to use May 2014 version's Power Map. I'm Office 365 subscriber, and Office 365 ProPlus. My Power Map version seems to 12 Apr 2014. Regards, Yoshihiro Kawabata
-
Project have resource which is not in enterprise resource pool
I am getting notification on project that the following assignments have been updated. The assignments you own below have changed. Assigned to: Task Name: Start: Remaining Work: Completion: etc I am not a project manager of the project neithe
-
Hi, Can anyone help me on the below query while improving performance. WHen i executed in TOAD 8.6.1 it is taking cost 8890. becoz of joins & some table are scanning fully eventhough there are some indexes on it. If possible please rewrite the below