Date Validation - End date before Start date

This may be a very simple validation but I seem to be having trouble. I've got a form which requires a date range to be selected (Date Picker fields)...a Start date, and an End date.
I've created a Function Returning Boolean validation with the code as:
begin
if :P1_END_DATE < :P1_START_DATE then
return false;
else
return true;
end if;
end;This works 99%, except when the date range spans years.
For example, when I select '21-Dec-2010' in the start date and '4-Jan-2011' in the end date. The validation fails, and thinks the end date is before the start date.
Do I need to compare the year part of the date, before doing the rest? Or is the '<' not suited for this sort of check?
Edited by: djston on Dec 20, 2010 12:13 PM

Sorry, false alarm, it looks like I had my logic a little backwards :)

Similar Messages

  • End date should not less than Start date, else CLEAR it

    Hello
    I put CONTRACT START DATE and CONTRACT END DATE fields on the form. These 2 objects (Date/Time objjects) i pulled them from Satndard tab of pallette and dropped on my layout page design, fine.
    Now, am trying to put a validation that the end dat eshould not lower than start date, so, i got a thread as below from Niall,
    http://forums.adobe.com/message/1909551
    and i did my FormCalc coding under EXIT event of END DATE field as below,
    // Pls. note this FormCalc
    // End date should not less than Start date, else CLEAR it - Begin
    var stDate
    var endDate
    stDate = xfa.resolveNode("CUSTOMER.Page31_Contracts.Con_Whole_Page.CON_Basic_Info.CON_START_DATE") .rawValue
    endDate = xfa.resolveNode("CUSTOMER.Page31_Contracts.Con_Whole_Page.CON_Basic_Info.CON_END_DATE").r awValue
    if (stDate > endDate) then
        xfa.host.messageBox("End date is lower than Start date! End date is cleared")
        xfa.resolveNode("CUSTOMER.Page31_Contracts.Con_Whole_Page.CON_Basic_Info.CON_END_DATE").r awValue = null
    endif
    // End date should not less than Start date, else CLEAR it - End
    I tried in VALIDATE, CALCULATE, CHANGE events of END DATE, but nothing working!!
    PLs. let me kow how can i achieve my requirement? I am anewbie,
    Thank you

    If you use the exit event, you will probably have to have the same code on both the start and end date fields since they have a dependancy on each other. Maybe better to try the validate event of the end date so that if either field is changed the event gets fired. You can try the following for validate event
    // Pls. note this FormCalc
    // End date should not less than Start date, else CLEAR it - Begin
    var stDate
    var endDate
    stDate = CON_START_DATE.rawValue
    endDate = $.rawValue
    if ( HasValue(endDate) ) then
        if (stDate > endDate) then
            xfa.host.messageBox("End date is lower than Start date! End date is cleared")
            $.rawValue = null
        endif
    endif
    1
    // End date should not less than Start date, else CLEAR it - End

  • Contract End date should not less than Start date, else CLEAR it

    Hello
    I put CONTRACT START DATE and CONTRACT END DATE fields on the form. These 2 objects (Date/Time objjects) i pulled them from Satndard tab of pallette and dropped on my layout page design, fine.
    Now, am trying to put a validation that the end dat eshould not lower than start date, so, i got a thread as below from Niall,
    http://forums.adobe.com/message/1909551
    and i did my FormCalc coding under EXIT event of END DATE field as below,
    // Pls. note this FormCalc
    // End date should not less than Start date, else CLEAR it - Begin
    var stDate
    var endDate
    stDate = xfa.resolveNode("CUSTOMER.Page31_Contracts.Con_Whole_Page.CON_Basic_Info.CON_START_DATE") .rawValue
    endDate = xfa.resolveNode("CUSTOMER.Page31_Contracts.Con_Whole_Page.CON_Basic_Info.CON_END_DATE").r awValue
    if (stDate > endDate) then
        xfa.host.messageBox("End date is lower than Start date! End date is cleared")
        xfa.resolveNode("CUSTOMER.Page31_Contracts.Con_Whole_Page.CON_Basic_Info.CON_END_DATE").r awValue = null
    endif
    // End date should not less than Start date, else CLEAR it - End
    I tried in VALIDATE, CALCULATE, CHANGE events of END DATE, but nothing working!!
    PLs. let me kow how can i achieve my requirement? I am anewbie,
    Thank you

    http://forums.adobe.com/message/4264933#4264933

  • Delete the records which have the Data values are NULL before load data to BPC model

    Hi Everyone,
    I am loading the data from flat file to BPC Model (10.0 Version).
    Source data (Flat file) looks like below:
    RP_Employee RPT_Currency Data
    Test                USD                   8
    Test1              USD
    Test2              USD                    6
    My user requirement is that to delete the records which have the Data values are NULL before load data to BPC model.
    So,Please let me know how can i meet to this requirement.
    I am thinking that,it is possible by using start routine BADi. If i am correct please let me know process like creation of class and BADi implementation.
    Thanks in advance!!

    Hi Nilanjan,
    Please see my source data below:
    Account      Client       Employee     Time                Data
    123              XYZ            Vishu            2014.01               300
    456                                                       2014.01
    789              ABC         Alexander      2014.02               200
    If you see the second record,
    If data value is ZULL,  then the Employee or another dimension is also NULL.
    So I want to delete second records.
    If it is Start routine please share the code and steps to do.
    Thanks in advance!!
    Regards,
    Viswanath

  • Planned order creation with PDS valid on only order start date and not finish date

    Hi All,
    We have requirement to allow creation of planned order manually if production version is valid on order start date and not finish date.  This is because lead time of order is longer. I refered OSS notes 385602. I could find out solution for this is implementation of OSS note 694140 to change validity mode at activity level to consider start date of first produce activity  in validity interval. Problem is even If I create order in APO by implementiong this note planned order is not transfered to ECC and it gets stuck with error production version not valid.
    Is there any way in ECC to control this? Any config or customization?
    Regards,
    Santosh

    Nilesh,
    I think there is a simple procedural skip happening in your business process. You are right when a planned order is created after MRP it would default assign it to the first available production version. 2options available for us,
    1. First use transaction MF50 and do the line loading and assign the quantites to the production versions/Production lines, so that the actual capacity planning is getting completed. This way you can have planned orders with both the production versions and matching to your actual line capacity.
    2. Use Quota arrangement concept, to automatically split the Planned orders during MRP for a percentage based on individual production versions.
    Now when backflush is performed S225 table is updated and Planned order qty also gets reduced.
    Hope this helps....
    Regards,
    Prasobh

  • Data Validation in IP before saving

    Dear All,
                  I need to do data validation in IP layout, before data gets saved into cube. For example, i have percentage key figures to plan, which should sum up to 100. if it is not, on clicking on save button, user should get proper error message.
                   Is there any ready made planning function available which does this simple data validation? else, please suggest any other approach to achieve this.
    Thanks,
    Harpal

    Hi Harpal,
    Create a Custom Planning function to check the Percentage and return the expected message.
    for reference : look at class : CL_RSPLFC_CREATE_CR
    it should use syntax :
          if sy-subrc <> 0.
            message enum(messageclass ) with x.
          endif.
    Please let me know if you need further help.

  • Earlier date in finish date field than the forecast start date (in Proj def

    Hi Experts
    I have foreast start and forecast finish dates maintained in Project definition. N dates in WBS elements.
    However I am able to maintain an earlier date (than forecast start date) in Finish Date field in PD.
    I believe there should be a  validation with dates.
    Please provide clues.
    Warm regards
    ramSiva

    Hi,
    Please create a validation rule with all prerequisites, check and message .Assign it to the project profile. For the running project , open the project in CJ20N ,--> Edit -->Validation and select this validation for the system to respond appropriately.
    Warm regards,
    Srinivas Potluri

  • How to perform validity checks just before form data is saved?

    hello all,
    i need to perform some checks on various fields just before data on a standard form is saved, and to eventually rollback the transaction.
    if the checks are succesful i have to perform some db operation in transaction with main data.
    solution ( if existent! )  has to be addin only -> no triggers / no procedures / no sbo_transaction thingies
    scenario:
    involved tables:
    OITM
    USERDEFINEDTABLE1
    USERDEFINEDTABLE2
    involved forms:
    Items - OITM - formtypeex = "150"
    logic:
    an user defined field U_UDFCHECKACTIVE has been added to OITM, a combo box has been added to items form containing values Y and N, bound to OITM.U_UDFCHECKACTIVE.
    when the user saves an item, if OITM.U_UDFCHECKACTIVE == Y we have to perform additional checks on USERDEFINEDTABLE1
    if the check result is true we have to save OITM current data and insert a record in USERDEFINEDTABLE2 containing itmgrp value (  )
    if the check result is false we have to block save operation
    if OITM.U_UDFCHECKACTIVE == N no check is performed and everything works normally
    we started hooking the form data event for oitm / form type 150:
    Application.SBO_Application.FormDataEvent += new SAPbouiCOM._IApplicationEvents_FormDataEventEventHandler(FormDataEventHandler.SBO_Application_FormDataEvent);
    then we filtered the event
    switch (BusinessObjectInfo.FormTypeEx)
                        case "150":
                            if (BusinessObjectInfo.BeforeAction &&
                                (BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE ||
                                    BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD))
                                BL.Items_BusinessLogic.SBO_Application_FormDataEvent(ref BusinessObjectInfo, out BubbleEvent);
    in our business logic class i don't know how to correctly check the values just before they are saved to db
    for example i tried using oitm.browser :
    if (oitm.Browser.GetByKeys(BusinessObjectInfo.ObjectKey))
                            String value =  oitm.UserFields.Fields.Item("U_UDFCHECKACTIVE ").Value as String;
                             //perform checks
                                  //if ok insert records and bubbleevent = true
                                  //if ko rollback the bubbleevent = false
    //if checks are not to be performed then bubbleevent = true....
    but it's wrong, as it populates oitm object from db, and not from the form. i have old values stored in the object, values tha are to be overwritten with those present on form.
    i tried inspecting the form for data sources but i don't know how to navigate to the right one, i found only system generated objects with SYS_##, with no clue about the related dbfield
    i tried getting the values directly from the form, but in object BusinessObjectInfo i don't have anything that identifies univocally the form i'm editing.
    i mean if i have 2 item forms open, i don't know which one is the one i'm saving.
    i'm expecting to find somewhere a temporary oitm business object containing values that are to be saved, values that i can easily check.
    so i'm asking you how to find those values in order to perform my bl checks
    thank you in advance

    Hi Christian,
    The values that are about to be saved should be in the datasources:
    form.DataSources.DBDataSources.Item("OITM");
    form.DataSources.DBDataSources.Item("ITM1");
    The form variable should be form 150.
    Best regards,
    Pedro Magueija

  • How to check the validation in UI before committing data?

    Hi,
    I'm using Jdev 11.1.2.1.0 version .
    I needed to check whether there is duplication of values in Boolean check box before committing the data into the Database.
    But this validation rule is to be checked based on the value selected in the Select One Choice drop down list in the page.
    I did it with adding a ValueChangeEvent in the drop down list and checking the values in the Boolean check box. It worked , but only in the case of earlier committed data in the database.
    How can i actually verify the data entered in the table in the page before it being committed into the DB ?
    Nigel.

    Hi,
    an improvement to your solution would be to move the major part of your code from the backing bean into a method on the ApplicationModuleImpl file (you create this from the AM editor)
      public boolean checkForDuplicate(){
           ViewObject vo = this.findViewObject("ResponseVO");
           int numRows;
           int j=0;
           numRows = vo.getRowCount();
           String rowValue = "a";
    //the part below of your code I don't like at all. Why do you need to increase a flag
    //and use an if statement ?
           for (int i=0; i<numRows; i++){
              rowValue = (String)vo.getCurrentRow().getAttribute("ResponseFlag");
              if(rowValue.equals("Y")){                           
                  j++;
                  if(j>1)
                      return true;
             return false;                           
        }This code you then expose on the AM as a client interface (same AM editor --> Java menu option)
    In the PageDef file (double click it to access the visual editor) click the plus icon next to the Bindings header. Choose "Generic Binding" --> method binding and point it to the AM and the exposed method. This creates a method binding "checkForDuplicate"
    Change your managed bean code to
      BindingContext bctx = BindingContext.getCurrent();
      BindingContainer bindings = bctx.getCurrentBindingsEntry();
      OperationBinding checkForDuplicate = (OperationBinding ) bindings.get("checkForDuplicate");
      checkForDuplicate.execute();
      boolean isDuplicate =  checkForDuplicate.getResult();            
      if(isDuplicate){
             FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, null, "Two same respones!");
             FacesContext.getCurrentInstance().addMessage(null, msg);
                                               Frank

  • Hi Gurus , I am new SAP DSIM  could please let me know what basic seeting we have to perform before starting data model?

    are

    Hi Chandra,
    there are multiple steps that need to be performed. It would be hard to mention them all in here. In general, we suggest to read the master and installation guide as well as the docu that list all of the steps necessary.
    All of the documents can be found here:
    SAP Demand Signal Management 2.0 – SAP Help Portal Page
    Best Regards,
    Anna

  • "master data deletion for requisition" before master data loading

    Hello Gurus,
             in our bw syetem , for   process chains for loading  master infoobjects, all include "u201C master data deletion for requisition" ABAP
    process  except for one process chain. my question is:
           why that process chain for master data loading is different from others as for lacking "master data deletion for requisition" in it?
    so it does not matter if you include " master data deletion for requisition" ABAP  process in process chain for master data loading ?
    Many thank.

    Hi,
    ABAP Process means some ABAP program is being executed in this particular step.
    It's possible that for all of your process chains except for that one requirement was to do some ABAP program processing.
    You can check which program is executed by following below process:
    Open your process chain in planning view -> Double click on that particular ABAP process -> Here you can see program name as well as program variant.
    Hope this helps!
    Regards,
    Nilima

  • Start and End Date Validation

    OK I am lost and searched and made changes to what I am doing, but not sure I have datasets correct or something written wrong.
    I have two date fields on my form. A Start Date and an End Date
    I put some validation that says the Start Date/Time cannot be greater than the End Date/Time or so I think that is what it is saying. But if I put and end date in the form with a time that is an hour after the start date, it throws the error
    Here are my details and maybe I am just storing data wrong or something
    ENDDATE Validation: PL/SQL Error:
    if to_date(:P6_DTGSTART) > to_date(:P6_DTGEND)
    raise_application_error (-20001,'End Date must be Greater than Start Date.');
    end if;
    When I look at the data stored in the Database in SQL Workshop this is what I see
    DTGSTART 11/29/2010
    DTGEND
    The input on the form is a Date Picker with format: DD-MON-YYYY HH24:MI
    So the entry in the form would like like:
    Start Date/Time 29-NOV-2010 09:25
    End Date/Time 29-NOV-2010 10:25
    The End date can be the same date but the time has to be greater than the start date/time
    Thanks
    Wally

    It is working better for sure, but after it is saved, I can go back and make the end date less than the start date and it accepts the save. I don't really anticipate this happening, but trying to plan for all eventualities.

  • Subtype Validity Start date Check

    Hi All,
    For one of the infotype we created a new subtype with the validity in future date say 01102010.
    Now if i go to infotype i am able to create the record for this new subtype with the start date as 01042010 which should not be allowed.
    I checked the table V_T582A and also the time contraint for the infotype.
    Time constraint for the infotype depends upon the subtype and in the subtype table it is mentioned as 2.
    I know that we have the custom check for the infotype but is it possible through stadard settings
    Pls guide me on this
    Regards,
    Umesh Chaudhari

    Hi Umesh,
    Though the subtype table for 0071 (Pension funds GB) is V_T591A; it also reads T5G30 to identify the schemes..
    Table T5G30 in turn has got various Pension Schemes with Start Date/End Date.. If you Start Date and End Date of the Plan is in Future (01102010) and if you intend to maintain the new scheme (Subtype) from 01042010; an error is displayed..."Scheme XXX is unknown for this period; check pension table entries."
    Kumarpal Jain.

  • Scheduling start date and end dates

    Hello Gurus,
    I am trying to understand the schedule start date and schedule end date functionality in Plant Maintenance. I do understand the basic start and end dates. Currently I set up u201C3.Do not adjust basic dates, dep rqmts to order startu201D and set the scheduling type as u201CForwardsu201D . Please note we donu2019t do any capacity planning or leveling.
    So my question is, why the scheduling start date is defaults to the basic  start date  for forwards and scheduling finish date defaults to basic finish date for backwards ? I tried adding couple of operations and save the work order. It did not change anything in schedule dates.
    Do we really need to care about scheduling dates if we donu2019t use capacity planning ?
    Please advise
    Mahee

    Hi,
    As per priority, final dates would be calculated as we will define the duration based on the priprity. Either current date or basic date only applied to Scheduling start date.
    You can change the scheduling start date so that based on priority, final date would be calculated.
    Regards,
    Maheswaran.

  • How to disable selection of  End Date depending on start Date.

    Hello,
    I have  2 DatePicker controls
    1) Start Date
    2) End Date
    When I select a start date  in  date picker depending on that  it should disable the  selection of  dates less than  Start date in End date Date Picker.
    Could anyone please provide solution for it.
    Thanks & regards,
    Viswanath

    You can always check UI5 core files and extend it. FYI, most of UI5 calendars are based on "MobileScroll" UI library, e.g.
    DateTimeInput - Mobiscroll - Demos and Examples - Date &amp;amp; Time - Date with min and max
    DatePicker - Mobiscroll 2.15.1 Documentation - Calendar
    Below you can find few extension examples:
    sap.m.DateTimeInput extend- JS Bin - Collaborative JavaScript Debugging&lt;/title&gt;  &lt;link rel=&quot;alternate&quot; type=&quot;application/jso…
    sap.m.DatePicker extend -> JS Bin - Collaborative JavaScript Debugging&lt;/title&gt;  &lt;link rel=&quot;alternate&quot; type=&quot;application/jso…
    Regards,
    Vladimir

Maybe you are looking for

  • HELP! New Imac user (last 2 years)

    I took my mac and had leopard and the new Ilife installed. Now it freezes almost every day. mostly when I run multiple programs, Itunes, Iphoto and safari at the same time. Sometimes like last night it froze when the screen saver came on and then aga

  • Unwanted audio in burned final idvd

    Have you ever encountered this problem in iMovie/iDVD? I recently finished editing together a wedding for friends. The timeline is a simple sequence of clips with transitions and background music that I easily imported directly from itunes. When edit

  • Video ends and last frame remains showing

    I'm playing a very short video within a page. Once the video ends, the displayed image (the one that remains on screen) is the first frame of the video  - is there a way to make the last frame of the video remain on the screen? Thanks M

  • Quicktime X ac3 + ACC issue

    Hi all, I've been slowly but surely trying to get all of my DVD's into itunes over the past few years and until everything was working wonderfully. I've been encoding for Apple TV with HB. (i'm only backing up movies which i own on DVD, which is lega

  • Why does subscript stop working?

    I use Pages a lot for making worksheets. As I'm a Chemistry teacher I use subscripts and superscripts a lot and have placed the appropriate facilities in my toolbar for Pages. I've been finding recently, though, that when I select text in text boxes