Calculation in udf

Dear all,
i need to perform the following calculation in UDF created in BOM at row level.
for eg
UDF1=10 (Structure: quanity)
UDF2=10 % (Structure: percents)
UDF3= UDF1*UDF2
Then in the quantity field of BOM i have to perform following :
Qty= UDF1+UDF3
can anyone suggets FMS for the same.

Use the next three FS:
1.
Select $[ITT1.U_Udf2]
Connect it to Udf2 refresh when exiting altered column Udf1
(This is necessary to make work the FS-s when you only change the Udf1 value)
2.
Select $[ITT1.U_Udf1.number]*$[ITT1.U_Udf2.number]/100
Connect it to Udf3 refresh when exiting altered column Udf2
3.
Select $[ITT1.U_f1.number]+$[ITT1.U_f3.number]
Connect it to Quantity refresh when exiting altered column Udf3

Similar Messages

  • Query for Auto Calculation based on input of 2 Fields

    Hi,
    I would like to write a sql query to allow for auto calculation based on the Inputs of 2 other fields before Adding the Order.
    For example. A query on Sales Order where I have Item 040634 (Code for a Flower) and Quantity 200.
    I have a UDF (Bunching) where the value is 10, 15 or 20.
    Based on the Bunching the result should be given in another UDF (Noofsleeves).
    (Quantity) 200 / (Bunching) 10 = 10 (Noofsleeves)
    The Order will be having multiple items where the Bunching can differ for each item.
    Is it also possible to remove the calculated noofSleeves from Inventory.
    I am using 2007A SP01 PL05

    Hi ,
    You may try this: Apply this fms on other udf and auto refresh on the udf mentioned in the query (in your case Bunching).
    SELECT $[RDR1.Quantity.number] / $[RDR1.U_UDF.number]
    You may check these too.
    cALCULATION OF udf ON UNIT PRICE
    FMS
    Thanks,
    joseph
    Edited by: Joseph Antony on Jul 8, 2010 12:31 PM

  • Tax Formula

    i am creating tax formula. in base amount i want to use UDF amt is it possible to use UDF amount as base amount in TAX formula .
    pls help me on that.......

    Hi Sachet......
    Unfortunately it is not possible to make calculation with UDF in Tax Formula as You can not add Tax parameters and take it into Effect......
    Regards,
    Rahul

  • Total calculation based on unit price and UDF field values

    Hi All,
    This is for a construction related company. Please find attached screen shot for details.
    My scenario is when we are creating sales order my client wants to calculate the total amount based on unit price towards the UDF fields defined. For example user will give the unit price  per sqft in Unit price ie 2800 as per screen shot column and constructed area in Sqft in he will enter the area like cons area in sqft =1500. So this 1500 need to calculate with unit price and will display in total. So in Total field it should show like 2800*1500= result. Like wise other amount values in udf needs to be calculated and displayed in total field  .
    Is this possible in SAP B1. Please help me with your valuable suggestions.

    Hi,
    Try this:
    SELECT ($[$38.U_Price.number]* $[ORDR.U_CArea.number)+ $[ORDR.U_EBexp.number]+ $[ORDR.U_RO.number]+ $[ORDR.U_Maintenance.number]+ $[ORDR.U_CorpFund.number]
    Thanks & Regards,
    Nagarajan

  • How to autopopulate UDF based on calculation

    hi,
    I am very new to SAP B1 2007B. I have created a UDF named - BAGS in row details of sales order. As I insert a Item in sales order, I want the UDF : BAGS to get auto populated with - ITEM QUANTITY * 20 as soon as I enter the Quantity. Pls give me a step by step solution. Quantity & BAGS are in table RDR1.

    Dear Rohit_Dewangan,
    I am afraid that what you are asking is not possible.
    In theory you simply create a formatted search based on a query such as:
    select sum(quantity * 20) from rdr1 where itemcode = '...' and docentry = '...'
    However, you stated that you require the UDF to be filled in in the Sales Order with this value as soon as the quantity field is filled.
    In order to create a formatted search that populates the UDF you would need the quantity value and the document number in the table, but until the user clicks ok the document is not added into the table and you will not the quantity value to use.
    I will update the thread if an alternative comes in my mind.
    I have been testing the possibility to update the value after the document is added in the system, but it is not working so far.
    Regards,
    Marcella Rivi
    SAP Business One Forums Team

  • Udf Data is not being displayed in the report

    Hi all,
    i have designed one report in which i am displaying some udf fields along with other system fields.
    i have not used any selection criteria.
    when i run report it doesn't display udf data of some random rows in the report even if data is peresent in that udf field.
    If i open sales order and press 'Shift-F2'  and update the document and now if i run report then i get that udf value in the report.
    why this happening. data is there in the udf field only its not displayed in the report with out updating the that udf.
    pls suggest some solution.
    regsrds,
    Chetan.

    Hi Ashish,
    I ran the "ZPS/!ZPS" in RSRT where ZPS is the infoset name. In Dev, it displayed the values. In QA, it displayed the below messages:
    ECharacteristic 0TCAKYFNM does not exist. Check authorizations
    WThere are calculated elements. These results are bracketed [  ]
    and below that, it displayed the values for Number of records. But, it has not displayed the values for the other figures.
    Does this has any impact in QA.
    Thanks & Regards,
    AVN Rao.

  • Need Help in writing a UDF

    Hi,
    Please help in writing a UDF for these fields in mapping, which I need for the object Iu2019m doing currently.
    The fields are like this:
    1)         batch_no = "TRUNC((GetMaxObjid('x_txn_sap_parts')-POWER(2,28))/5000)+1",
    2)         lot_id = "TRUNC((GetMaxObjid('x_txn_sap_parts')-POWER(2,28))/500)+1",
    3)        How to use JDBC connection factory class in the UDF.
    Some logic I can provide which I know i.e. Power (2, 28) means 2 to the power of 28 (2 multiplied 28 times), Trunc means truncate, X_TXN_SAP_Parts is a database table.The Target fields are Batch_no, lot_id & Objid.Actually, objid is mapped initially to a source field i.e. Object ID and in this function it is only being used for the calculation of the batch_no.
    Thanks in Advance,
    Sreedhar.

    Hi,
    Following with my query I've tried to use this code but still I'm unable to execute the mapping.
    import java.util.*;
    import com.sap.aii.mapping.lookup.*;
    import com.sap.aii.mapping.lookup.*;
    DataBaseAccessor accessor = null;
    DataBaseResult JDBCOutPayload = null;
    String BusinessSystem="clarify_dev_bizsys";
    //give your business system having channel name
    String CommunicationChannel="JDBC_TO_CDEV";
    //give your channel name
    String InputPayload= " select X_TXN_PRE_SITE_XFACE.nextval from dual;";
    //give your sql query
    try {
    Channel channel =
    LookupService.getChannel(BusinessSystem,CommunicationChannel);
    accessor = LookupService.getDataBaseAccessor(channel);     
    DataBaseResult resultSet = accessor.execute(InputPayload);
         for(Iterator rows = resultSet.getRows();rows.hasNext();){  
         Map rowMap = (Map)rows.next();
         Object cValue = rowMap.get("batchno");
    //field name of field required , as in database
          catch (Exception e) {}
          finally {
                  if (accessor != null)
                  accessor.close();
           result.addValue((String)cValue);
    --> I don't know what are the parameters to be used and how to be used in the UDF because this is the first time I'm writing a UDF.
    --> The problem in using this query is that both OBJID & BatchNo. are on the target side and the value for the OBJID is retrieved by a SELECT query from the database.
    Kindly help me how to resolve this query of mine.
    Thanks in Advance.
    Sreedhar.

  • Interest calculation in Dunning Wizard

    Hi All,
    I have a question with regard to the calculation of Interest amount via Dunning wizard.
    Let us say I have a dunning term that issues Dunning Letter 1, 30 days past the due date. Dunning Letter 2 is issued 30 days past the dunning letter 1. The interest to be charged is 10% per anum.
    Let us say I have an invoice of $1000. 30 days past the due date when I run the dunning wizard, it would show an interest of 8.33. As SAP does not post the interest amount automatically in the form of a journal entry, we manually pass this journal entry for receivables of $8.33.
    Next time, when I run the dunning wizard after 30 days of running the first dunning wizard, I will see that the date of last dunning run is updated. When I check the Interest amount, it will show me 16.67. This interest amount is a cumulative i.e 8.33 (last dunning run) and 8.33 of this run.
    Now, if we pass a journal entry for 16.67, it will be wrong as I have already passed a previous journal entry for 8.33. Is there a way we can make the system count the interest days from the last dunning run to give me the incremental interest amount of $8.33. Currently the interest days are calculated from the due date of the invoice.
    Is there a UDF that can be created in the dunning wizard and can have a formatted search assigned to it?
    Thank you very much for your input.
    Regards,
    Payal

    Hi Payal,
    Please check the following information from the Dunning documentation and see if it is of any help regarding your issue :
    The interest will be calculated as follows:
    Open Sum * Annual Interest Rate * Number of Days Overdue / (Number of days in Year * 100)
    o Open Sum u2013 This value will be calculated according to the calculation method defined in the previous window (Calculate Interest Value on Remaining Sum or Calculate Interest Value on Original Sum).
    o Annual Interest Rate u2013 This value is taken from the Annual Interest Rate field in the Define Dunning Terms window.
    o Days Overdue u2013 The number of days that passed from date of payment as defined in the Invoice to the day of running the Dunning Wizard (see explanation on the Dunning Wizard below).
    If a month passed since the defined day of payment, and a value was entered into the field Number of Days in Month (for example 30 days), this value will be taken into account as follows:
    1. If the number of days in the past month was more or
    less than the number of days defined in Number of
    Days in Month field (for example if 31 or 29 days have
    passed and 30 days were defined for a month), then the
    value defined for calculation of interest will be used (in
    the example above, the value will be calculated
    according to 30 days and not 29 days).
    2. If the number of days in the past month is less than the
    number of days defined in the Number of Days in Month
    field (for example if 29 days passed and 30 days were
    defined for a month), the value defined for calculation of
    interest will be used (in the example above, the value
    will be calculated according to 30 days and not
    according to 29 days).
    3. If a month has not yet passed from the day of payment
    and the number of days overdue is less than the
    SAP Business One Dunning System in Release 2004 A
    January 2005 Page 11 of 29
    number of days defined for that month (for example 14
    days), the calculation will be done according to the
    number of days overdue (14 days), and not number of
    days in a month.
    Check if this helps.
    Regards,
    Jitin
    SAP Business One Forum Team

  • Syntax error while creating Calculation view script based

    Hi Folks,
    I'm creating Calc view based on script and drafted a simple code but I'm getting syntax error.
    Its just fetching few coloumns from two tables products and purchaseorderitem.
    /********* Begin Procedure Script ************/
    BEGIN
      var_out = select productid , category, nameid, currency, grossamount, quantity
      FROM sap.hana.democontent.epm.data.products AS P , sap.hana.democontent.epm.data.purchaseorderitem AS B
      where P.productid = B.productid;
    END /********* End Procedure Script ************/
    Could you pls take a look and let me know what wrong I'm doing?
    Error logs are:-
    sap.hana..package.project.folder.mytest.CALCSCRIPTVIEWInternal deployment of object failed;Repository: Encountered an error in repository runtime extension;Internal Error:Deploy Calculation View: SQL: sql syntax error: incorrect syntax near "democontent": line 5 col 18 (at pos 439)nSet Schema DDL statement: set schema "SYSTEM"nType DDL: create type "_SYS_BIC"."sap.hana..package.project.folder.mytest/CALCSCRIPTVIEW/proc/tabletype/VAR_OUT" as table ("PRODUCTID" NVARCHAR(10), "CATEGORY" NVARCHAR(2), "NAMEID" NVARCHAR(10), "CURRENCY" NVARCHAR(5), "GROSSAMOUNT" DECIMAL(15,2), "QUANITYT" DECIMAL(13,3))nProcedure DDL: create procedure "_SYS_BIC"."sap.hana.package.project.folder.mytest/CALCSCRIPTVIEW/proc" ( OUT var_out "_SYS_BIC"."sap.hana.package.project.folder.mytest/CALCSCRIPTVIEW/proc/tabletype/VAR_OUT" ) language sqlscript sql security definer reads sql data as n /********* Begin Procedure Script ************/ n BEGIN n t var_out = select productid , category, nameid, currency, grossamount, quantityn t FROM sap.hana.democontent.epm.data.products AS P , sap.hana.democontent.epm.data.purchaseorderitem AS Bn t where P.productid = B.productid;nnEND /********* End Procedure Script ************/n

    Hi Rubane,
    I don't have EPM installed here but based on this Table User Defined Functions( Table UDF ) in HANA  you are not properly defining the source table.
    In your case missing 1) schema of EPM, 2) not using double quotes, 3) separation of package and view, 4) missing camel case on purchaseOrderItem:
    FROM sap.hana.democontent.epm.data.products AS P , sap.hana.democontent.epm.data.purchaseorderitem AS B
    On blog:
    from "SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::businessPartner" as a
    SAP_HANA_EPM_DEMO is the schema
    sap.hana.democontent.epm.data is the package
    businessPartner is the view
    Start simple... before the seletion try it out on Studio SQL.
    Regards, Fernando Da Rós

  • Auto update a UDF in SAP B1

    Hi, I am new to SAP Business One. I need to update automatically the value of a UDF. The value will be calculated using data from related tables. Calculation includes -summation, divide and minus etc. Could you provide guide.
    For example a new UDF should contain the suggested quantity to order. this is calculated considering the running average sales quantity as of current time for this month and deduct the available quantity on hand and also deduct the quantity already ordered (arriving soon to be delivered to warehouse). I appreciate your input.

    Continuation of this thread is in:
    SAP Business One Application

  • Purchase Order Row UDF for Received Qty

    Hi experts,
    Can someone please recommend a way to create a row UDF for purchase orders to show the qty received? We cannot use a simple calculation like Qty-Open Qty because if the row is closed manually, the open qty becomes zero. Another problem is how to prompt the PO to update this value if additional GR PO's or AP Invoices are created. Thanks.

    I should explain the circumstances more clearly. There is no problem with the standard GR PO or AP invoice receiving method. What I want is a reference field on the original PO showing the total qty received to date. For example: total of 1,000 pcs ordered -> 900 pcs received against several GR PO's -> want to see that 900 has been received back on the PO. Then let's say we want to close the PO line 100 pcs short.
    I can think of 2 ways to go about this:
    Method 1: Change the ordered qty from 1,000 to 900 -> row is closed, but lose the reference of the original order qty being 1,000.
    Method 2: Close row manually and maintain the original order qty as reference, but lose b/o qty and it is difficult to tell how many pcs where received/closed short.
    Is there another way to keep all the reference information?

  • UDF at header level will not auto refresh before & after adding the invoice.

    Hi All,
    I have a FMS query in the UDF at AR Invoice header level. I have set the FMS query to auto refresh when tax rate field changes but the UDF doesn't auto refresh when there is a tax code in the document.
    I will need to add the invoice first then open the added invoice and press shift+F2 to get the calculated amount in the UDF to update the invoice.
    How to get the UDF to auto refresh whenever the tax code has changed? Or after the invoice has added?
    The FMS query:
    SELECT sum(T0.[TotalSumSy]) FROM INV1 T0 inner join OINV t1 on t1.docentry = t0.docentry WHERE T0.VatGroup in ('SR','DS','AJS') and t1.docentry = $[OINV.docentry]
    Thanks & BR,
    Leng

    Hi,
    I solved the problem following the steps in SAP note 633285 - Printing the total Vat amounts in each Vat group, https://websmp130.sap-ag.de/sap/support/notes/0000633285
    In order to print  in the  order  the Vat amount  in each vat group Please perform  the followed stages:
    Go to Tools (in the SBO tool bar ) and chose Manage User Field
    In Marketing Documents (Rows) add new fields according to the Num of the vat groups that you are using in Orders (e.g. A1, A2 ,A4) The type : Units and Totals  - the Structure: sum in the order each column will represent the vat amounts in the line but only for certain  Vat Group
    in order that each column will display the vat amount in the line only if it belong to certain Vat group we attach a query to each column: (e.g. we have 3 columns : A1, A2, A4) .the queries are;
    SELECT $[$38.82.NUMBER]  WHERE $[$38.18.0] = 'A1' FOR BROWSE  SELECT $[$38.82.NUMBER]  WHERE $[$38.18.0] = 'A2' FOR BROWSE SELECT $[$38.82.NUMBER]  WHERE $[$38.18.0] = 'A4' FOR BROWSE Now each column will display the vat amount only if it in the relevant vat group
    in the order document printing template you need to add those Vat column in our example we add 3  data fields : the file: Order - Rows , the Field: A1/A2/A4 - you can hide (un visible ) this columns as needed
    in the Repetitive Area Footer add a calculation field for each vat groupthe Type: Column Total , the Column: Order; A1/A2/A4 in each calculate field you will get the sum amount of the vat in the relevant Vat group. (in  addition you can add text fields with a relevant description for the calculation fields)
    Thanks & BR,
    Leng

  • Payment Terms based on Value Date (UDF)

    Hi, is it possible and if how? I want to create a new Payment Term based on a value date which is maybe months ahead. So the docduedate is after this value date but the document shall already go into accounting.
    how is this easily possible?

    Hello,
    If you mean that the payment due date in the payment terms should be calculated on the basis of some date specified in a udf, it is not possible.
    But what you can do is use formatted search to calculate the due date based on the udf. apply this formatted search in due date field.
    Rahul

  • How  to  Add  Calender &  Calculator controls  on   TextBox in  SAP B1

    Hi  Experts,
    How  to  add  the calender  control  and  calculator  control  to  textbox  in  SAP B1
    Thanks,
    Y.
    Edited by: Yughandar on Jul 20, 2010 3:24 AM

    Hi,
    Textbox will automatically display calucator and calender depending on the binding.ie if we bind the textbox with UDF of type Datetime then the it will automatically display the calender..
    Regards
    Arun

  • Date and Time calculation in the Service Module

    Dear all,
    I have quite of a challenge here and i need serious guidance from your side.
    My client is in services industry and requires to calculate the date and time when the service call as to be closed. Not only it depends on the contract type the service is linked to but as well on the priority.
    The priority in Business One is unique, therefore we created a UDT (User Defined Table) to store the different 'response time' per contract/per priority. Example: a Platinum contract is always 24/7. But a gold contract priority 1 has to be closed in 240 minutes (4 workable hours) while a gold contract priority 2 has to be closed in 480 minutes (8 workable hours).
    I created 7 user defined fields on the Service Contract header that calculates the workable minutes per day. So if my coverage for Monday is from 8 AM to 4 PM, my UDF called DiffMon will show 480. For Tuesday, they start a bit later, and the coverage is 8:30 untill 16:00, therefore my UDF called DiffTue = 450.If the check box before the day in the Service Contract window is not ticked, then the UDF shows zero.
    I succeeded to calculate the expected closing time by using CASE WHEN statements as following, (all calculated in minutes):
         First, I need to check which day the Service call is created: A Monday or Thursday or... since my time coverage can change every day! I use SET DATEFIRST = 1 and compare today's date accordingly with my UDF DiffMon, DiffTue, etc.
         Then, When end of coverage time today Monday (4PM) minus the create time on the Service Call (1PM) is less then the time stored in my user defined table for that contract and that priority (i.e.480), then just add that to the create time and the create date (DateAdd(mi,...,...) ).
        When end of coverage time Monday (4PM) - Create time (1PM) + DiffTue(450) is bigger than 480, then I know I have enough time to solve my service call tomorrow Tuesday and I take the start time of Tuesday (8:30) + remaining time from yesterday (480-180 -> 180 = 3hours from 1PM to 4PM) and add that to the Create date + 1 so the end result will show Tuesday date and a time of 13:30
       Etc. untill I cover all possibilities based on which day is the service call created.
    NOW, I need to include the holiday table !!!!!!!!!!  And I can't foresee how the hell I am going to do that.
    The maximum coverage can go up to 60 hours, that means more than a working week! What happens if I have more than one bank holiday in that week period? What happens when my holiday table tells me that  date is a bank holiday but it is actually a Sunday and my contract is only running from Monday to Friday?
    Am I going straight to a big mess up?
    I will highly appreciate your comments,
    Regards,
    Frederic

    Hi,
    it is possible in query designer,
    u do the two things for getting the days between to dates
    1) in CMOD write the code for sy-datum create a customer exit variable in query as on caldate like eg zcedate
    when 'zcedate'.
    clear l_s_range.
    l_s_range-sign = 'i'.
    l_s_range-opt = 'eq'.
    l_s_range-low = sy-datum.
    append l_s_range to e_t_range.
    u write this code exit_saplrrso_001.
    it givs the sydatum
    2) then u create one more variable on zdate limit with replacement path
    then u go forto create the formula variable then it display ascreen there u select both customer exit variable and replacement path variable
    zcedate-replacementpathvariable
    it gives days i worked on this and succedded.
    like the same way fortime also u can do but here at the time of creating the customer exit varible u go for option as range here
    l_s_range-low = '20012009'
    l_s_range-high = '29012009'
    l_s_range-sign ='i'.
    l_s_range-opt = 'bt'.
    please try with the above one.
    Thanks & rEgards,
    k.sathish

Maybe you are looking for