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

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

  • Formatted Search Error -  Help Needed

    Hi All,
    My client has a peculiar purchase process. They are into chemical trading and do their purchase as follows:
    The vendor gives discount based on the volume and not on the quantities purchased. Thus, an item X if purchased in 250gm will cost $ 20 while the same item if purchased in 50gm may come to $15. So, the user wants to enter this values in the purchase order and want the unit price to be calculated based on this. Assuming the clients wants 1kg quantities of item X, he would like to fill  250 x gm  @ $20 in separate UDFs and based n these values, the system should calculate the unit rice for this item.
    What I did was as follows:
    a)  I created 3 UDFs each for the Base Quantity (U_BPQty), Base UoM(U_BPUnit),  Base Price (U_BasePrice). Thus the user enters 250, gm, 20 respectively as explained in the above example.
    b) I created one field  (U_UnitQty) to convert the base unit into purchasing unit. For this, I am writing a query to get the conversion factor value into the PO. Thus if the Purchasing UoM is KG and the base unit in which the supplier is charging is G, then I am populating 1000 in this field.   
    c) One more UDF to convert the base price into the unit price is captured is created. So, if 250gm cost $20 and my client wants 1kg, I am first getting the value of 4 in this UDF. This I am getting by dividing the value obtained from the step b) with the value in U_BPQty. 
    Once I get this value, I then calculate the unit price by multiplying 4 with $20 which will populate $80 in my Unit Price field through another FMS.
    I wrote a formatted search for converting this base unit to purchasing units. Given here is the FMS which is giving an error. For the sake of another functionality, I created a UDF for Purchasing UoM as well (U_UoM).
    Declare @UQty as varchar
    Declare @BPC as varchar
    set @UQty = $[POR1.U_UnitQty]
    set @BPC = SELECT
    (Case
    when $[POR1.U_UoM]  = 'kg' and $[POR1.U_BPUnit] = 'kg' then 1
    when $[POR1.U_UoM]  = 'kg' and $[POR1.U_BPUnit] = 'g' then (@UQty/$[POR1.U_BPQuantity.NUMBER])
    when $[POR1.U_UoM]  = 'kg' and $[POR1.U_BPUnit] = 'mg' then (@UQty/$[POR1.U_BPQuantity.NUMBER])
    when $[POR1.U_UoM]  = 'g' and $[POR1.U_BPUnit] = 'kg' then (@UQty/$[POR1.U_BPQuantity.NUMBER])
    when $[POR1.U_UoM]  = 'g' and $[POR1.U_BPUnit] = 'g' then 1
    when $[POR1.U_UoM]  = 'g' and $[POR1.U_BPUnit] = 'mg' then (@UQty/$[POR1.U_BPQuantity.NUMBER])
    when $[POR1.U_UoM]  = 'mg' and $[POR1.U_BPUnit] = 'g' then (@UQty/$[POR1.U_BPQuantity.NUMBER])
    when $[POR1.U_UoM]  = 'mg' and $[POR1.U_BPUnit] = 'kg' then (@UQty/$[POR1.U_BPQuantity.NUMBER])
    when $[POR1.U_UoM]  = 'mg' and $[POR1.U_BPUnit] = 'mg' then 1
    when $[POR1.U_UoM]  = 'kl' and $[POR1.U_BPUnit] = 'kl' then 1
    when $[POR1.U_UoM]  = 'kl' and $[POR1.U_BPUnit] = 'l' then (@UQty/$[POR1.U_BPQuantity.NUMBER])
    when $[POR1.U_UoM]  = 'kl' and $[POR1.U_BPUnit] = 'ml' then (@UQty/$[POR1.U_BPQuantity.NUMBER])
    when $[POR1.U_UoM]  = 'l' and $[POR1.U_BPUnit] = 'kl' then (@UQty/$[POR1.U_BPQuantity.NUMBER])
    when $[POR1.U_UoM]  = 'l' and $[POR1.U_BPUnit] = 'l' then 1
    when $[POR1.U_UoM]  = 'l' and $[POR1.U_BPUnit] = 'ml' then (@UQty/$[POR1.U_BPQuantity.NUMBER])
    when $[POR1.U_UoM]  = 'ml' and $[POR1.U_BPUnit] = 'l' then (@UQty/$[POR1.U_BPQuantity.NUMBER])
    when $[POR1.U_UoM]  = 'ml' and $[POR1.U_BPUnit] = 'kl' then (@UQty/$[POR1.U_BPQuantity.NUMBER])
    when $[POR1.U_UoM]  = 'ml' and $[POR1.U_BPUnit] = 'ml' then 1
    else 1
    end)
    Select @BPC
    I would like to know  where I am going wrong or if there is any simpler method for the above scenario?     
    Thanks and regards,
    Bharath S

    Try the third line change to:
    set @UQty = $[POR1.U_UnitQty.number]

  • 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

  • Formatted Search error

    Hi all, i don't know if this is the right place where post my question but i think that usually who write formatted search is a developer ; anyway..
    i write this formatted search but when it run in the Sales order it returns an error; the message don't show anything useful;
    when I open it for change is shown this message:
    1). [SQL Native Client][SQL Server]Sintassi non corretta in prossimità di '$38.14.0'. 2). [SQL Native Client][SQL Server]Impossibile preparare le istruzioni.  'Documento' (RDOC)
    i don't understand which could be the error.
    I post the query.
    DECLARE @PriceBefDI NUMERIC(19,6)
    DECLARE @MTXRot NUMERIC(19,6)
    SELECT  @PriceBefDI = CAST($[$38.14.0] AS NUMERIC(19,6))
    SELECT @MTXRot = CAST($[OITM.U_EXP_MT_X_ROT] AS NUMERIC(19,6))
    FROM    OITM
    WHERE  OITM.ItemCode = '$[$38.1.0]'
    SELECT ROUND(@PriceBefDI * @MTXRot,2)
    Thanks a lot, Antonio.

    Try something like this:
    DECLARE @PriceBefDI NUMERIC(19,6)
    DECLARE @MTXRot NUMERIC(19,6)
    SELECT  @PriceBefDI = $[$38.14.number]
    SELECT @MTXRot = OITM.U_EXP_MT_X_ROT
    FROM    OITM
    WHERE  OITM.ItemCode = $[$38.1.0]
    SELECT ROUND(@PriceBefDI * @MTXRot,2)

  • Formatted Search error with a different user

    I created an add-on form and assigned formatted search to some of the fields.
    When I logged in with a different user(<b>test</b>) and tried to use the FS via Shift+F2, I received an error saying "You're not permitted to define recurring postings".
    I gave that user the authentication for recurring postings, but now I receive an unclear error when I try to use the FS on the same editbox:
    "<b>You are not permitted to perform this action</b>."
    <b>Any ideas</b> ? What may be the reason for that unclear error message ?
    <u><b>Note:</b></u>
    <i>After logging on with the same test user, when I try Shift+F2 on another editbox (which is normally not assigned a FS) it works normally and I can do all FS operations like assigning a new FS, etc.</i>

    Hi!
    sometimes there are strange things with user permissions.
    i had some troubles with 2 users which have the same permissions. i solved it by 'drag'n'dropping' permission of the 1st user (which works ok) to the 2nd.
    try to do the same - drop 'good'-user permissions to 'test'-user.
    if it'll not solved problem then try to create new user and test your addon under that user.
    probubly your problem has another motive, but i have such strange behaviour and i've described you my solution.
    hope it'll help.
    sorry for my poor EN, hope it'll be better in some centuries

  • 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

  • Format search error

    Dear All
    1.I create a User-define field on OITM, Call U_D.
    2.Create a format search Query on itemcode of Item interface.
    FS: Select $[oitm.U_D]
    When the Item interface is "add" status, The FS can select data, but
    when the status is "Find" ststus, the FS can't. why?
    Is my FS query wrong?
    Glen

    Glen,
    The "$" in you FMS refers to the current record. If the form is in Find mode, there in no current record the FMS can access. If you want the FMS to retrieve all the value ever inserted in that field, use the following query
    SELECT DISTINCT T0.U_D FROM [dbo].[OITM] T0
    Regards,
    Vítor Vieira

  • How to display an error message after validation in Formatted Search?

    Hi SBO experts,
    if an error is detected on validation in a Formatted Search, how to display an error message to the user entering the data?
    Thanks & Regards,
    Raghu Iyer

    i created a formatted search query & attached it to the field 'Quantity' at Line Item level in Sales Order screen. just for testing purpose, i eneterd the following code lines in the query validating 'Quantity'
    if $[$38.11.0] > 50
    begin
    select @error = 1
    select @error_message = 'Vendor code cannot begin to X sign.'
    end
    the system throws the error : Internal error (8180) occurred [Message 131-183]
    actually, i need to display an error message to the user if Quantity is not in multiples of the OITM.SalFactor2
    if $[$38.11.0] % (SELECT T0.[SalFactor2] FROM OITM T0 WHERE T0.[ItemCode]  = $[$38.1.0]) > 0
    begin
    select @error = 1
    select @error_message = 'Error in Quantity.'
    end
    but, this expression to get the remainder itself seems to have some error
    $[$38.11.0] % (SELECT T0.[SalFactor2] FROM OITM T0 WHERE T0.[ItemCode]  = $[$38.1.0])
    i guess, % operator is used for modulo (to find the remainder of one number divided by another.) ? am i right ?
    Regards,
    Raghu Iyer

  • Getting Error Message using Formatted Search

    Hi,
    I am using formatted search for validating a particular field, and that happens fine.  Kindly let me know if I can also display error messages using the same formatted search.
    If yes, what am I to include in the formatted search, and if No, please let me know the alternative.
    Thanks in advance.
    Satish.

    Hi Satish,
    if you validate the value of a field and intend to rise an error message on detection of invalid values in a separate window or in the status line there is no way to do it with Formatted Searches (as far as I know)!
    You could use the following methods as simple workarounds if you don't want to program a solution with the SDK:
    1. Solution
    You can display the text of an error message in the field you validate; of course, the invalid data then is overwritten with your error message, but you could construct the message from fixed text parts concatenated with the data found in the field.
    Be sure to save the original data of the field in your query before you do anything else. This way you sustain the field data in case the data is valid!
    Example:
    DECLARE @save AS ....
    SET @save = $[xxxxx]
    IF $[xxxxx] test on invalid data
      SELECT 'Error: Invalid data: ' + $[xxxxx] -- in case of error
    ELSE
      SELECT $[xxxxx] -- no error - sustain valid data
    END
    2. Solution:
    You define a sepate User Defined Field (UDF) for potential error messages - that's the way I often programmed it for our own applications. Suppose that the Formatted Search is connected to this UDF and the field to validate is field 'xxxxx'. The Formatted Search is triggered (auto-refresh) on change of field 'xxxxx':
    IF $[xxxxx] test on invalid data
      SELECT 'Error: Invalid data: ' + $[xxxxx] -- in case of error
    END
    May be that there are minor syntactical errors or missing type conversions in the code above - but I hope it gives you an idea on how to solve your problem without SDK programming!
    Good luck!
    Frank Romeni

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

  • I forgot the code for my iPhone to access the Home screen I do , please help me try formatting the iphone but when I put in nfc mode and connect it to the pc recognizes it and everything when you try to format the error 3004 appears

    I forgot the code for my iPhone to access the Home screen I do , please help me
    try formatting the iphone but when I put in nfc mode and connect it to the pc recognizes it and everything when you try to format the error 3004 appears

    Hello polo-angulo,
    I apologize, I'm a bit unclear on the nature and scope of the issue you are describing. If you are saying that you are getting an error code (3004) when you try to restore your iPhone (because you could not remember your passcode), you may find the information and troubleshooting steps outlined in the following articles helpful:
    Resolve iOS update and restore errors in iTunes - Apple Support
    Get help with iOS update and restore errors - Apple Support
    Sincerely,
    - Brenden

  • 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

  • Search Help error : Invalid field format Screen error

    Hi All,
    I have attached a search help to contract field for contract no and item number. (in my own screen developed in a  report)
    The search help picks up data and assigns it to the fields,
    But after this when I click on any other button, I get error saying :
    <b>Invalid Field Format (Screen Error) !!!</b>
    Any pointers guys !!!
    Warm Regards,
    Girish

    screen checks in abapautomatically checks for format of field when u enter data....i.e date, integer etc...the problem in this case is that when u seelct a value using the help it is filling a value which is not the correct format...so check for the data types and test it again...this is definitely the problem.

  • 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

  • PDFs won't open in Safari; blank screen with Quicktime logo opens instead

    When I click on a link to a PDF file within a Safari browser window, the PDF file does not open (in Acrobat or Acrobat Reader) as desired, or as it once did. Rather, now a new window opens with a Quicktime logo showing agains an otherwise blank white

  • Doubt in oracle text

    Hi, Hi i am getting a parse error when i tried to execute the following using catsearch.      >>> CATSEARCH (item_title,'{SIGN PEN SIGN R50 (M)), 12 PCS/BOX,  RED}', null) > 0;      whereas when i use contains operator, there is no problem.      >>>

  • Keep being asked to agree End User Licence Agreement!

    I've been using Photoshop Album Starter Edition for a while, and am very happy with it. I've noticed now, though, that every time I doubleclick on a photo (I have this app as default for "Open With"), I am asked to confirm acceptance of the EULA. Tha

  • Update  Customer Equipment card in batch

    Hi Experts, Out client has around 500 equipment cards with different status. They want to change/update the status. Doing it manualy will take lot of time and also possibility of error. Is there a way to do it in batch giving a range selection for ch

  • HomeHub VOIP Phone- ASDL Filter required??

    I've had conflicting advice on this query, from BT Tech help and an actual BT Openreach engineer who repaired an outside phone line fault last week...... I use an ordinary old 900Mhz cordless phone, as my Internet 056 number VOIP phone, on my HomeHub