Determine minimum value

Is there a function to determine the smallest value between four columns in a select statment while creating a new column?
I have four columns (not in the table) that is equivalent to a "daysremaining" value. I am looking to compare and then dispaly the earliest daysremaining so i can calculate an estimated due date based on the earliest daysremaining.
I am working on a ASP application and have been able to define the logic using VBScript, but i am really trying to sort on the days remaining (smallest value of the three).
Thanks in advance....
Frankie

Try using "least"
SELECT LEAST('HARRY','HARRIOT','HAROLD') "LEAST"
FROM DUAL;
LEAST
HAROLD

Similar Messages

  • Minimum Values in Billing Doc - Consolidated Invoice - How to exclude items

    I have a requirement to apply a minimum charge to an invoice but the minimum amount is not to be based on the total value of the invoice.
    The invoice is used to bill a rental contract via a billing plan, via deliveries based on actual usage and other manually entered transactions. All these contribute to the minimum value.
    The invoice is also used to bill other debit notes during the period but their value MUST not be included when the minimum value is to be determined.
    The minimum pricing condition is working as standard SAP, BUT I need to exclude the value of some of the line item. I can distinguish which item are to be excluded by the preceding document type.
    Anyone has any idea of how to do this?
    Regards

    question marked as answered because it is no longer required.

  • Sales order minimum value issue

    Hello,
    Could you please provide some inforamtion regarding the sales order minimum value infoarmtion like where we can maintain that value?
    Regards|ksr

    hi
    You can specify a minimum order value for sales order processing. The following example illustrates how this function is used:
    You specify a minimum order value of USD 200.
    During sales order processing, the net value (after discounts and freight, before taxes) of an incoming order is USD 190.08.
    During pricing, the system determines that the net value falls below the minimum order value and calculates a minimum-order-value surcharge. In this example, the surcharge equals USD 9.92.
    The minimum order value and the surcharge appear as separate lines in the pricing screen. The minimum value is for information purposes only, and does not affect pricing. The system automatically adjusts the net value of the order (before taxes) to the minimum value allowed.
    If you use minimum-order-value requirements, you must create condition records for condition type AMIW. In these condition records, you specify customers and the corresponding minimum order values. During pricing, the system automatically uses these condition records as a reference for determining the relevant minimum order surcharges (condition type AMIZ). In the standard version, condition type AMIZ refers to AMIW. This means that the system automatically calculates values for AMIZ conditions; you do not need to create separate condition records.
    You may want to specify minimum order values by sales organization or division instead of by customer. In order to do this, your system administrator must define a new condition table with the appropriate fields in the table key. The condition table can then be included in the access sequence for condition type AMIW.

  • How to get all minimum values for a table of unique records?

    I need to get the list of minimum value records for a table which has the below structure and data
    create table emp (name varchar2(50),org varchar2(50),desig varchar2(50),salary number(10),year number(10));
    insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',3000,2005);
    insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',4000,2007);
    insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',7000,2007);
    insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',7000,2008);
    insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',7000,2010);
    commit;
    SELECT e.name,e.org,e.desig,min(e.year) FROM emp e,(
    SELECT e1.name,e1.org,e1.desig,e1.salary FROM emp e1
    GROUP BY (e1.name,e1.org,e1.desig,e1.salary)
    HAVING COUNT(*) >1) min_query
    WHERE min_query.name = e.name AND min_query.org = e.org AND min_query.desig =e.desig
    AND min_query.salary = e.salary
    group by (e.name,e.org,e.desig);With the above query i can get the least value year where the emp has maximum salary. It will return only one record. But i want to all the records which are minimum compare to the max year value
    Required output
    emp1     org1     mgr     7000     2008
    emp1     org1     mgr     7000     2007Please help me with this..

    Frank,
    Can I write the query like this in case of duplicates?
    Definitely there would have been a better way than the query I've written.
    WITH      got_analytics     AS
         SELECT     name, org, desig, salary, year
         ,     MAX (SALARY)  OVER ( PARTITION BY  NAME, ORG, DESIG)          AS MAX_SALARY
         ,     ROW_NUMBER () OVER ( PARTITION BY  NAME, ORG, DESIG, SALARY
                                    ORDER BY        year  DESC
                           )                              AS YEAR_NUM
           FROM    (SELECT 'emp1' AS NAME, 'org1' AS ORG, 'mgr' AS DESIG, 3000 AS SALARY, 2005 AS YEAR FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',4000,2007 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',4000,2008 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2007 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2007 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2008 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2010 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2010 FROM DUAL)
    SELECT     name, org, desig, salary, year
    FROM     got_analytics
    WHERE     salary          = max_salary
    AND     YEAR_NUM     > 1
    Result:
    emp1     org1     mgr     7000     2010
    emp1     org1     mgr     7000     2008
    emp1     org1     mgr     7000     2007
    emp1     org1     mgr     7000     2007
    WITH      got_analytics     AS
         SELECT     name, org, desig, salary, year
         ,     MAX (SALARY)  OVER ( PARTITION BY  NAME, ORG, DESIG)          AS MAX_SALARY
         ,     ROW_NUMBER () OVER ( PARTITION BY  NAME, ORG, DESIG, SALARY
                                    ORDER BY        year  DESC
                           )                              AS YEAR_NUM
      ,     ROW_NUMBER () OVER ( PARTITION BY  NAME, ORG, DESIG, SALARY, Year
                                    ORDER BY        YEAR  DESC
                           )                              AS year_num2
         FROM    (SELECT 'emp1' AS NAME, 'org1' AS ORG, 'mgr' AS DESIG, 3000 AS SALARY, 2005 AS YEAR FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',4000,2007 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',4000,2008 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2007 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2007 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2008 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2010 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2010 FROM DUAL)
    SELECT     name, org, desig, salary, year
    FROM     got_analytics
    WHERE     salary          = max_salary
    AND     YEAR_NUM     > 1
    AND YEAR_NUM2 < 2
    Result:
    emp1     org1     mgr     7000     2008
    emp1     org1     mgr     7000     2007

  • Abort Could not determine a value for variable 0DAT from the authorizations

    Hi All,
    I encountered an error '/ Abort Could not determine a value for variable 0DAT from the authorizations\' when executing my query on a multiprovider in BW 3.5.
    Can anyone help me in finding a solutionn to this issue.
    Thanks,
    Kartik.

    Hi Kartik,
    I am sorry as that note is for NW2004s. Please check if 0DAT variable installed from a business content? if not then I think thats the cause of the problem.
    Hope this helps,
    Bye...

  • Finding a minimum value in an array without using loops

    I can find a minimum value in an array using a loop, but I am unsure of how to do it without any type of of loop
    Here is what I have using a loop:
    // This method searches for the minimum value in an array
    public static int min(int a[]){
    int min = a[0];
    for(int i = 1; i < a.length; i++){
    if(a[i] < min){
    min = a;
    return min;
    How do I covert this to do the same thing, using no loops?
    Thank you for replies
    Edited by: kazmania on Feb 7, 2008 12:26 PM

    public class Test112 {
    public int recurse(int[] x, int i, int n)
    if (i==x.length-1) { return (x[i] < n) ? x[i] : n; }
    n = (n < x[++i]) ? n : x;
    return recurse(x, i, n);
    public static void main(String[] args) {
    int[] nums = {3, 1, 56, 2, 99, 34, 5, 78, -400, 2383, 201, -9, -450};
    Test112 t = new Test112();
    int min = t.recurse(nums, 0, nums[0]);
    System.out.println(min);

  • Cannot determine a value for an exit variable in the Formula fn w/p empty

    Hi All,
    We have an exit variable Z_EX_AR_VAR, the would read a hierarchy node input variable (Z_HN_AREA), which is furthur based on a hierarchy input variable (Z_HR_AREA), and wouuld return the first leaf of it.
    We have implemented a input ready query based on this exit variable and it is getting the first node and is input ready and saves the data to the database.
    It works well in the query when we have filtered the characteristic with the hier and hier node and the exit variables.
    We need to use the same value to be used in the Fox function.
    As per the requirement, the Fox function has to process the zero (empty) records.
    So, we have customized formula function to process emptry records.
    And in the function of type formula function that processes empty records, we have used the following statement.
    DATA AR type ZAREA.
    AR = VARI ( Z_HN_AREA, HIENM=Z_HR_AREA, 1).
    We are getting the following error message:
    Cannot determine a value for the variable Z_HN_AREA.
    Planning function ended with errors.
    What is that we are doing wrong here. Is it with the 'Process Empty Records' function that cannot read the variable.
    How come this variable is working in the query and it is not working in the FOX.
    We have done the variable to variable binding in the WAD also. Still the same problem.
    Any ideas? Thanks in advance.
    Best Regards,
    - Shashi
    Thanks in '

    Hi All,
    Michael Wolf from SAP confirmed that we cannot use VARiable read functions in the customized Formula function that processes the zero (empty records) as he spoke to SAP AG about the issue.
    Hence we have made a work around by creating a valid record using a dummy key figure in the Custom Formula function that processes empty records so that in the next step, the regular Formula function would get executed, where we could access the variable values by using VARV, VARI functions.
    Thanks,
    - Shashi

  • Error while setting Minimum value to  Input Number Spin Box..

    Hai
    I drag and drop a VO and created a table.In that table,i convert a column which contain an InputText field to Input Number Spin Box.At the time of page load ,the table fetches the datas from the DataBase and showing Number values in the SpinBox.After that,When i scroll the table through vertical scrollBar,the table showing *"fetching data"* and Error is throwing as *"The value must be Number"* .. In the VO,this attribute is Number.
    THIS ERROR ONLY OCCURS when i set the Minimum value of spinBox ..The purpose of setting minimum value is that i only want user to select ve value only..How can i restrict the user for selecting only ve values..?(ie,*How can i set minimum value to SpinBox?)*

    Try changing the datatype of your attribute in the EO to be Double instead of Number.

  • How to populate minimum value

    Hi
    I have an extractor with 2 primary keys, Indkey and Indcode.
    I need to get the minimum value of Indcode and populate the relevant Indkey.
    ex, Indkey   Indcode
         IND001    20
         IND002    30
         IND003     40
    I only need to get the record IND001 20, populated and not the other two. I am populating these values to a DSO in BW.
    How can I acheive this? Please give the algorithm or sample code.
    Thanks
    Sirisha

    sort table by key1 key2 and read table index1

  • Charge sales order value with a minimum value

    Dear All,
    I have one requirement where I would like to charge my sales order value with a minimum value. For example, a minimum sales order value requirements are set at $1,400.00 (the minimum values can be different based on the different materials) per order, if the value of the order exceeds $1,400.00, therefore no minimum fee is applied or displayed and the customer is charged the actual value of the order; if the value of the order is less than the minimum thus the customer is charged the minimum. We also can set the minimum as quantity.
    Is there any standard functionality through which this can be done.. or any suggestion?
    Your help is highly appreciated.
    Thanks and best regards,
    Jo

    You can maintain the Condition Record with Condition Type as AMIW wrt to Division & Price Group.You can change the Accesses as per your requirements.
    Best Regards,
    Ankur

  • Unable to determine the value of component  ''! Workflow error, please help

    Hi All:
        I am getting the error "Unable to determine the value of component  ''" and workflows are not getting processed. I found OSS notes 879100 related to this issue but I am new to workflow and not sure where to start from! Here is the notes description:
    The workflow WS20500025 ('Service Connection Order Processing') encounters an error directly after being started. The following error messages are displayed in the workflow log:
    SWP102: Error at start of an IF branch
    WL821: Work item 000000100012: Object FLOWITEM method EXECUTE cannot be executed
    SWF_RUN535: Error '9' when calling service 'SO_OBJECT_SEND'
    SWF_RUN534: Problems occurred when generating a mail
    WL863: Notification of completion cannot be generated
    SWF_EXP_001073: Unable to determine the value of component 'QUOTATION'
    SWF_EXP_001072: Error in the evaluation of expression '<???>' for item 1
    SWF_RLS_001101: Operator 'GT': The value of the left operand cannot be determined
    SWP085: Error when starting work item 000000100012
    SWP010: Error when evaluating the IF condition for node 0000000075
    Other terms
    Service connection processing, service connection workflow
    Reason and Prerequisites
    This is due to a program error.
    The checks in the workflow Basis have been made stricter. A query of the type 'Quotation.number > 0' now causes an error if the container element 'Quotation' is not set. This is always the case if the workflow is is running without quotation prcessing, for instance.
    Solution
    The error is corrected in the next Support Package.
    If you want to implement the corrections manually in your system, change the condition in step 000075 of workflow WS20500025 as follows:
        &IS-U: Kundenangebot& EX
    and &IS-U: Kundenangebot.Verkaufsbeleg& > 0
    Save and activate the workflow.
    I am new to workflow and not sure where to start from! Could someone please help me with this? Rewards assured.
    Thanks.
    Mithun

    ANy ideas? Please help me if anyone knows the answer.
    Thanks.
    Mithun

  • Dynamic determination of VALUES of an Attribute in a Mail-form

    Hi All,
    We have created a Mail Form with ceratin attributes. We have assigned a target group to a campaign.
    now, the requirement is to determine the VALUES of the attributes dynamically for the BPs in the target groups.
    please help me what should be done to meet this rquirement.

    Hi there,
    I believe the following link demostrates the whole process including your requirements:
    [http://wiki.sdn.sap.com/wiki/display/CRM/NavigationtotheCRMUIComponentfromMailFormorSmartFormsHyperLink|http://wiki.sdn.sap.com/wiki/display/CRM/NavigationtotheCRMUIComponentfromMailFormorSmartFormsHyperLink]
    Please reply if this helps.
    Regards,
    Vinamra.

  • How to determine the value of a Standard Value in a routing operation

    Dear Experts,
    Kindly guide me on how to detemine the value of my Standard Value in the  operation of my routing, or in the phase of my Master Recipe.
    I mean what determines the value that I enter for the Standard Values: Machine  and Labor in the phase of my Master Recipe?

    Hi,
    In the Routing / Master Recipe, the standard values are based on the lot size.
    For Example, if you have the lot of 100 KG, then in recipe the machine time will be 2 hr and labor time will be 2 hours, it means to make 100 KG we require 2 hrs of machine and 2 hrs of labor.
    Normaaly all production manager / supervisor will have the date for the hours. The system will calculate will respect to batch / lot size.
    If you have order for 1000 KG, then the system will assign 20 hrs for Machine and 20 hrs for labor.
    This will be used for Capacity planning and Costing.
    Capacity plan here your requirement is 20 hrs for machine and labor. If you have a reacto which wil run for 24 hrs a day, then the order will be completed in a day.
    Costing is concerned, all std. valur key will be assigned with an activity type in work center / Resources and the prices for activity type / cost center will be maintained in KP26.
    Based on the cost and hours, the system will allocate cost for the order (it will be planned cost). When you are confirming the order you will enter the actual time for the operation, then that will be your actual cost.
    Pl do a sample test scenario in your sand box, and surely you will understand more.
    The data for Routing / Recipe will be provided by the production manager of the plant and activity price will be provided by the finance team.
    Thanks,
    JK

  • How to determine the values for Model Parameters in Forecasting

    Hello Gurus,
          On basis we will determine the values  for the Model Parameter values (Alpha, Beta, Gamma, Sigma).
    Thanks,
    Siva.

    Dear Siva,
    the values are dependent from the forecast stratey and forecast model.
    The forecast strategy determines the method or the techniques that are used to create the forecast. You set the forecast strategy in the forecast profile.
    There are some settings that you must make for certain forecast strategies. The table below shows you which settings these are. You make these settings either in the univariate forecast profile or under the Model and Parameters tabs of the Forecast view on the demand planning desktop.
    Model initialization is the process by which the system determines the necessary model parameters for the chosen forecast model. These parameters are in following link:
    http://help.sap.com/saphelp_scm50/helpdata/en/ac/216b74337b11d398290000e8a49608/frameset.htm
    I hope this helps you further.
    Regards,
    Tibor

  • How to determine the value of  -D__SUNPRO_CC?

    Could any body tell me how to determine the value of -D__SUNPRO_CC? Iam now using Sun Studio 9.
    Thanks in advance.

    The C++ Users Guide describes all the predefined macros set by the compiler.
    The __SUNPRO_CC macro is a 3-digit hex number. The first digit is the C++ compiler major version number, which is 5 for all releases from WorkShop 5 in 1998 through the current release, Sun Studio 10. The second digit is the minor version number, increasing by 1 for each release in the major release series. The 3rd digit is a place holder for the very rare (none since 1994) cases when we have a micro version number. It is zero in current releases.
    The current compiler release is C++ 5.7, so __SUNPRO_CC is set to 0x570.
    You can see the macro setting by running
    CC -dryrun -c foo.cc
    and look for the -D__SUNPRO_CC =0xNNN on the ccfe command line.

Maybe you are looking for

  • HOW TO SET-UP AN EMAIL ON N81-3 (N81)Anyone can gu...

    Hi to all.. Anyone can guide me how to set-up an email for N81? Should I have an Yahoo Plus email account? I'm really appriciated to all members to guide me on this.

  • TS2755 How do I turn of imessage when i no longer have the iphone!?

    How do I turn of imessage when i no longer have the iphone it was activated on? so frustrating dont get any messages from iphone friends also it seems like there is no solution to this problem and to make it worse apple cant help without a serial num

  • Mac Mini 2012 BootCamp Windows install failing

    Hello, I have the new 2012 Mac Mini (model Macmini6,2).  I'm having difficulties installing Windows 7 with Bootcamp. I run the Bootcamp Assistant which successfully creates a Windows 7 install disk (on a USB drive).  It also successfully downloads th

  • New MacMini Server

    I've just taken delivery of a new MacMini Server - which has proved to be a trifle difficult in understanding.  Firstl I have two drives - one is labeled Macintosh HD2 and the other Macintosh Server - although I cannot see it at the moment.   Startin

  • ITunes went asian on me.  Can't fix it.

    I was burning some discs last night and my itunes suddenly froze up. I closed it and reopened it and everything was in chinese characters. Since I don't read chinese I uninstalled and reinstalled thinking it would fix it, but had no luck. It's still