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

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

  • 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

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

  • 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

  • Formatted Search that will change the Tax code in SO.

    Hi All,
    I have a requirements that will allow me to change the Tax Code column via formatted search. Like for exmaple, i have 50 line items in SO and the tax code is ZO. If i want to change the tax code, i will select it for individual items. Anyone can help me to have an alternative solution that will prevent me to change it per item.?
    thanks and regards,
    vin

    Hi Melvin........
    You can have a work around for this....
    Just create a UDF say U_Tax at Header level...
    Just Create a FMS for Tax Code say..
    SELECT *  FROM OSTC T0
    Save this tax code FMS to thus UDF.
    When yo select a particular Tax Code in this Field through this saved FMS
    this Tax Code gets copied to each and every line say for 100 lines also.
    For this you have run other FMS which is below...
    SELECT $[ORDR.U_Tax.0]
    Save above FMS in tax Code field say in Sales Ordr form.
    Now when you do this you can see if you have 100 line items and you want to copy same tax code in a single click you have to just select single tax code via FMS in U_Tax as i suggested.
    The moment you select this Tax Other FMS will be fired and the same will be copied to other 100 lines....
    Hope this will help you.....
    Regards,
    Rahul

  • Create Formatted  Search by code in a user form

    Hi, I want to create a formated search in a user form but it doesnt work using my form id (STEC_EXTRAS) as the search.FormID.
    I created the formatted search by SAP (Shift+F2) and in the table of formatted searches the formid appears as 2000001000
    ¿Where is the relation between my id and the id SAP uses?¿Any SAP table or conversion rule?
    Thanks for the possible help.

    Hello,
    When You create a form, the id (Type) can be set up by  Add function, ..... it is staring form 2000000000 ...
    Maybe Your "ID" STEC_EXTRAS is the Unique ID of the Form...... not the Type
    Public Const WM_USERFORM As Integer = 2000000000 ' User defined forms minimum ID
    Public Const YOURFORM As Integer= WM_USERFORM + 1 ' My form id will be  2000000001 
    oForm = m_SBO_Application.Forms.Add("MYFORM", SAPbouiCOM.BoFormTypes.ft_Sizable, YOURFORM - WM_USERFORM)
    'this is the same as
    oForm = m_SBO_Application.Forms.Add("MYFORM", SAPbouiCOM.BoFormTypes.ft_Sizable, 1)
    ' or the same as
    Dim creationPackage as SAPbouiCOM.FormCreationParams
    creationPackage  = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
    creationPackage.UniqueID = "MYFORM"
    creationPackage.FormType = YOURFORM
    creationPackage.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed
    oForm = SBO_Application.Forms.AddEx(creationPackage)
    If you use  STEC_EXTRAS as FormType, You will see in the CSHS table STEC_EXTRAS as the FormId
    Dim creationPackage as SAPbouiCOM.FormCreationParams
    creationPackage  = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
    creationPackage.UniqueID = "MYFORM"
    creationPackage.FormType = "STEC_EXTRAS"
    creationPackage.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed
    oForm = SBO_Application.Forms.AddEx(creationPackage)
    Regards
    J.

  • Formated Search: Auto refresh with two conditions.

    Hi,
    I've created a Formated Search in one of my column.
    I defined my formated search as :
    - Auto refresh "When Exiting Altered Column" Item No.
    - Display Saved Values.
    Now how can I make it Auto refresh with two conditions?
    - Auto refresh "When Exiting Altered Column" Item No.
    And
    - Auto refresh "When Field Changes" Customers/Vendor Code.
    - Display Saved Values.
    Is there any way to make it work?
    Thanks In Advance.
    Bruce.

    Hi Bruce,
    You could try this trick.
    You need to execute SELECT1 in Col1 when Item No. column is altered or the Customer code is changed.
    Then, in the Item No. column asign a new Formatted Search which selects the Item No. column value (Its value) when the Customer code is changed.
    And in the Col1 asign a formatted search that acts when the Item No. column is altered.
    I think this should do the trick.
    Let us know if works.
    Regards,
    Ibai Peñ

  • 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

  • How to use "insert into & select" in format search

    Hello,
    I am just wonderring whether you can help me solve this issue.
    I want to change the value of a field in the title area for a sales quotation. however, this field is not shown up on the interface.
    For example, there is a field in the title area, "OQUT.Ref1". You actually cannot see this field from the quotation interface or any other doc. Now I want to update the value of this field.
    What I am now trying to do is to create an field named "update" in the title area, use format search to update. the code for the command will be something like
    Insert into $[OQUT.Ref1.0]
    select $[OQUT.U_MFG#]
    here, U_MFG# is UDF. as you may understand, I want to copy the value in the U_MFG# to the field of "Ref1".
    However, when I run "Execute", it gives me error. I believe there is something wrong with the code of "Insert into $[OQUT.Ref1.0]
    Does anyone know how to write the code?
    many thanks
    Stanley

    Thanks both Suda and sagar. The reason I wanted to do this is because I wanted to have UDF info be shown on the  MS word-templated quotation document.
    As you know, when you click the word symbol, a word-templated doc will be generated. The client needs two completely different format of quotation printout. thus I plan to print one type from PLD and other type by clicking the Word symbol. but later, I found out that the UDF field cannot be selected on the MS word template, or only system fields.
    Thus, the only way I can do is to copy the value from udf to some unused sytem fields and then show that system fields on the MS word template.
    any idea do you have?
    I wanted to tell SAP that It is not useful if the udf fields cannot be inserted into word template.
    thanks
    Stanley

  • How can I reference value of a field from a diffrent line in formatted search

    I want to use a formatted search for this
    I want to set a field value based on a value from a previous row. ( is this possible at all ?)
    I have a udf called Test at Line Level on AR Order
    The user enters a value for test on line 1
    he will have a lot more lines then after that. all I want is to copy the value in test ( on row 1) to row2 as the user edits say the Item code on that row.

    Hi,
    Unfortunately formatted search is for current line only , you can't reference the previous or next line .
    You can do achieve this with SDK but with FMS not possible .
    Regards

  • Dynamic SQL an Form values in formatted Search

    Hi all,
    Can I create Dynamically the where clause of a query (for a Formatted Search) finding that into a UDF of another table, and then store all in a Varchar(300) variable and use that variable as parameter of an EXEC?
    Sorry for my bad explanation, it takes less time attach the query ...
    so here it is:
    declare  @pol as varchar(8)
    set @pol = $[ORDR.U_PolProj]
    declare @internal_q NVARCHAR(300)
    select  @internal_q = T0.U_CondPol
    from [@PRG_CEN_POL_PROJ] T0
    where Code = @pol
    declare  @itcode as varchar(100)
    set @itcode = $[RDR1.ItemCode]
    declare @sql NVARCHAR(300)
    select @sql = 'select  result =  count(ItemCode)
    from OITM T0
    where T0.ItemCode = ''' + @itcode +
    ''' and ' + @internal_q
    exec(@sql)
    Could someone tell me what's wrong with this formatted search?

    resolved!!! It works

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

  • How to Fetch the Row value in SBO Formatted search

    Hi Experts,
    I have created a Sales order, in which i  have 4 UDF Fields(A,B,C,D) in the following:
    Example values:
    A  B  C  D 
    2   2   4  4
    3   2   6  10
    C=A*B
    D=1st value of D + 2nd col value of C
    i have written query for C, but how to write the Formatted search Query for generation of D values. plz reply as soon as possible.

    Magesh,
    I quite understand what you are trying to do.   If you look at the example below I added a third row to show how you want the D to be a running total of column C. RIGHT !!
    A B C D
    2 2 4 4
    3 2 6 10
    <b>4 2 8 18</b>
    Honestly, it is not going to be simple as you do not have a way in SBO to access a particular column from a row.  When you say $[$38.U_C] it refers to the context row OR the row which has the highlight OR the row which has the curson on it.
    It is not possible to say $[$38.U_C from row 2]  JUST  NOT POSSIBLE ...
    You have to write a tricky code by using a temp table referencing the value of column C.  Also you have to keep track if Rows gets deleted and a new row added. 
    I will test a sample code and will come back.
    Suda

Maybe you are looking for

  • How do I create a signature line?

    Just loaded acrobat standard on my tablet pc and I'd like to add a field that allows my customers to sign a form with a stylus. I DO NOT want to create a digital signature, just a field where the client signs the field and the the signature is entere

  • Link to specific section of different page.

    I have a drop down menu on my nav bar.  I want the different links on the drop down menu to bring me to different sections of a different page. This is the code I have used. This is the html for the nav bar: <nav id="nav">   <ul>         <li class="c

  • What's the best way to sort query results?

    Hello All, I have a standard CRUD UI that now needs the results sorted, based on input from the UI. What's the best way to sort results by entity fields? I'm familiar with the conventional Java methodology using a TreeSet and comparator. Is this the

  • Why MouseEvent doesn't work?

    Hello, everyone. I added a movieclip and named "bot_mc" in another movieclip. Then, In Action panel, I use bot_mc.addEventListener(MouseEvent.DOWN, xxxx). However, when I drag and drop the container movieclip on the main stage and compile. There is n

  • HT2490 Show Desktop" gesture query in Mountain Lion

    Can I change "Show Desktop" gesture to "swipe down with four fingers" on Mountain Lion? My muscle memory prefers swiping down when I'm designing and have a lot of programmes open but the Mountain Lion doesn't seem to allow me to edit this particular