Strut Validation for Date

I need some ideas on how to validate date in a form in the following two situations using Struts.
a) Checking whether a particular date is a holiday.
b) For a given pair of date (say start date and end date), to validate that the end date is later than the start date.
Thanks!
Joe

In your case you can implement a service method in the VO to check if any other reservation overlaps with the new one (which is not inserted in the db).
I would use a an other VO (e.g. VODateCheck) for this. This VO has it's query build to check if a given roomid and a given startdate(time?) overlaps any other record for the roomid
select * from ReservationRoom where RoomId=:bindRoomId and ReservationEnd>=:bindReservationStartIf this query returns one or more rows you have an overlapping in the schedule and throw an error.
You call this VODateCheck from your service method in the other module before inserting the record. Set the bind variables in the VODateCheck and execute the query.
Timo

Similar Messages

  • Data validation for Date Field in Web Dynpro ABAP

    Hi ,
    In my WDA i want to perform data validation for date filed. (i.e. While creating a new record i have to check the Start Date should be always lesser than End Date.)
    If u ll enter the wrong date it should validate the Date and throw an error message.
    Please Reply soon its urgent.
    Thanks,
    Deepika

    Hi,
    First read the two attributes start date and end date.
    Then write the following condition.
    IF item_start_date > item_end_date.
    Error message.
    Endif.
    For pop up error message you need to use Create_window method of the Interface if_wd_window.
    Thanks.

  • Validation For Date,String and Date in a reports Region

    Apex 4
    Good day to all apex users How do I validate a apex_item.text if the value is string the user can only input a string value if it is number then the user can input numbers only and if it is a date the user can only input a date values?

    APEX_ITEMS are not part of the default apex gui... In fact they are just functions which returns html.
    You can however do some stuff with the attributes parameters. You can find some cool stuff over here: Re: Validation For Date,String and Date in a reports Region
    If you want apex validation you need to create a page validation and loop over your apex_items with apex_application.g_f0x
    Br,
    Nico

  • Can start date be set before valid for date for an equipment?

    Can start date be set before valid for date for an equipment?

    Hello,
    Generally when a asset/equipment  is purchased that is the valid from date and when commissioning done and it becomes operational then that date is start up date. So logically start up date should not before valid from date, it could be same.
    Can you elaborate why you want start up date before valid from date ?
    Thanks
    Naveen

  • Entity Object validation for "Date" type

    I am trying to use the Entity Object validation for a Date field type, it is a required field.
    I am using the format: MM/dd/yy HH:mm:ss
    It is a simple validation where the date value must be less than or equal to the current date/time.
    I tried using "Query Result" validation where the date is LESS THAN the query SELECT SYSDATE FROM dual.
    This throws an error:
    JBO-27011: Attribute set with value 2006-07-09 14:05:53.0 for LksrSurveyDte in LCFSReportService.LeakDetailView1 failed.
    I have be unable to find help on validating dates using validation for an Entity Object and need some help.
    Thanks in advance.

    In your case you can implement a service method in the VO to check if any other reservation overlaps with the new one (which is not inserted in the db).
    I would use a an other VO (e.g. VODateCheck) for this. This VO has it's query build to check if a given roomid and a given startdate(time?) overlaps any other record for the roomid
    select * from ReservationRoom where RoomId=:bindRoomId and ReservationEnd>=:bindReservationStartIf this query returns one or more rows you have an overlapping in the schedule and throw an error.
    You call this VODateCheck from your service method in the other module before inserting the record. Set the bind variables in the VODateCheck and execute the query.
    Timo

  • Validations for date

    Hi guys,
    I have a selection screen consisting of two fields......
    1. Master Invoice No. and
    2. Creation date
    My Requirement is when date ranges are used in selection, i need to filter only master invoices that are within this date range.
    Please help me out on this.
    Thanks and regards,
    Girish.

    hi,
    u try like this
    select * from ysdat into table itab where erdat in s_date. //// if given date field in screen is a select option
    select * from ysdat into table itab where erdat >= l_date and erdat <= h_date. // when u use two parameters for date.
    for displaying data in screen in screen goto-> [f6] properties -> add from dictionary -> give ur table name -> select all required fields from that table -> drag n drop on to screen.
    in ur flow logic.
    TABLES: ZSURESH /// declare ur table here. then it will create a work area for u and using it u can do ur requirements.
    if helpful reward some points.
    with regards,
    Suresh Aluri.

  • Validations for Date Parameter

    Hello All,
    I am working on jsp where i need to provide the user with 3 combo boxes where he/she can select the day,month,year.
    Currently i am using this code to display them.
    <select name="day" >
    <%
              String datestrTo = "";
              for (int i=1; i<=31; i++)
                   if (i<10)
                        datestrTo = "0" + i;
                   else
                        datestrTo = new Integer(i).toString();
                   if (datestrTo.equals(todaydate))
    %>
                        <option value=<%=datestrTo %> selected ><%=datestrTo%></option>
    <%
                   else
    %>
                        <option value=<%=datestrTo %> ><%=datestrTo%></option>
         <%
         %>
         </select>
         <select name="month" >
         <% String valueStrTo="";
              String selectedTo = "";
              for (int i=1; i<=12 ; i++)
                   if (i<10)
                        valueStrTo = "0" + i;
                   else
                        valueStrTo = new Integer(i).toString();     
                   if (valueStrTo.equals(todaymonth))
         %>               
                        <option value=<%= valueStrTo %> selected ><%=MonthArray[i-1]%></option>
         <%               
                   else
         %>          
                        <option value=<%= valueStrTo %> ><%=MonthArray[i-1]%></option>
         <%          
         %>
         </select>
         <select name="year">
         <%
              String yearstrTo = "";
              int currentyearTo = new Integer(todayyear).intValue( );
              for (int k = currentyearTo-2; k < currentyearTo; ++k)
                   yearstrTo = new Integer(k).toString( );
         %>
                   <option value=<%=yearstrTo %> ><%=yearstrTo%></option>
         <%
         %>          
              <option value=<%=todayyear %> selected ><%=todayyear%></option>
         </select>
         </td>
         </tr>
    But using this code user can select 30th day in February. I want to give validations for these fields. Such as when 'February' month is selected then we should have 28 days and so on.......
    Can any one help me how to solve this problem.......
    thanks in advance......................

    Why don't you write this with JSTL ?

  • PO validation for date

    Need the control to change PO line items based on PO document creation date, User can change PO line items quantity only before 14 days from PO creation date & should not allow to change after 14 days from data of creation PO.This control should be applicable to all transaction codes of PO where ever the change option PO is existing.Also change of PO should be based on PO order quantity user not allowed to reduce the PO order quantity it shall allow only to increase the PO order quantity.Please let us know if any other fields to be consider for change validation purpose. (*please give me the code for this logic*), Thanks
    Moderator message: "spec dumping", please work yourself first on your requirement.
    Moderator message: one more thread that qualifies for locking, and I will apply for deletion of your user ID.
    Edited by: Thomas Zloch on Jun 17, 2011 9:34 AM

    The gather stats program does not gather stats for global temporary tables (in Apps, these tables have the _GT suffix). Pl see ML Doc 398960.1 (Why are Statistics not Gathered for Some Purchase Order Tables?). This is normal.
    HTH
    Srini

  • Error KI222 - Cost Center Not Valid for Date

    Iu2019m having a problem goods issuing material to a cost center (movement type 201) via a call of the BAPI_GOODSMVT_CREATE BAPI (ECC 6.0).  I can post a specific material / plant / storage location / cost center combination without issue via MB1A but when attempting to call the BAPI processing the exact same data, I get the error message KI222: Cost center aaaa/ccccc does not exist on 05/14/2009.  (where aaaa = the appropriate controlling area and ccccc = the cost center).  Iu2019ve checked the validity dates on the cost center via KS03 and all looks fine (the cost center is valid until 12/31/9999).  The cost center is valid on the posting and entry date I'm passing in the BAPI header. 
    Any ideas what I may be doing wrong or if thereu2019s some field Iu2019m not appropriately selecting / flagging in the BAPI.  Iu2019m using the BAPI successfully for several other movement types (701, 702, 551, 552).
    Thanks,
    Randy

    are you sure that the posting and document dates you submit with the BAPI are correct?

  • Selection Screen validation for date

    Hi,
    I have a date in Select option s_budat which is a mandatory field
    The Criteria for validation is
    1) The start date should not be older than current date minus 8 weeks. Otherwise error message should appear:
    EN: Start date is older than 8 weeks
    2)The end date should not be more than one week ahead of date-from. Otherwise error message should appear:
    EN: Selection period is more than 1 week
    please help me to solve this
    regards
    Avi

    data : date1 like sy-datum,
           date2 like sy-datum.
    CALL FUNCTION 'HRWPC_BL_DATES_WEEK_INTERVAL'
      EXPORTING
        DATUM                = sy-datum
        WEEK_PST             = 8
        WEEK_FTR             = 0
      START_SUNDAY         =
    IMPORTING
       BEGDA                = tdate
       ENDDA                = tdate1
    EXCEPTIONS
      INVALID_VALUES       = 1
      OTHERS               = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    if s_date-low lt tdate.
    message.
    endif.
    CALL FUNCTION 'HRWPC_BL_DATES_WEEK_INTERVAL'
      EXPORTING
        DATUM                = s_date-low
        WEEK_PST             = 0
        WEEK_FTR             = 1
      START_SUNDAY         =
    IMPORTING
       BEGDA                = tdate
       ENDDA                = tdate1
    EXCEPTIONS
      INVALID_VALUES       = 1
      OTHERS               = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    if s_date-high gt tdate1.
    message.
    endif.
    regards
    shiba dutta

  • Struts validator for two fields(conditional required)

    Have a Drop down and an input field.
    When user selects "Type 1" from drop down only then the input field is required. otherwise it's not a required field.
    Looking at the validator guide in struts maybe I have to create a new validator rule which should check if drop down value "Type 1". But not sure how to code to say that the input field is required here.
    How to do this?
    Thanks.

    Yes you have to check for drop down value "Type 1".
    when you hit on submit it goes to the validation function right ...
    there add a condition. Check if tpe 1 is selected , if so proceed validation the text box , else skip that validation and come out.

  • Special validation for date valuesets

    When creating value set which format is "Standard Date" and when it is used in concurrent programs parameter this parameter is passed normally in canonical format. But when this value set is used with special validation event validate. Parameter is not passed as canonical date, but in date display format and concurrent programs cant handle that (It is not even a date anymore, but converted to string). Is there a way to pass those parameters which use "Standard Date" and special validation as canonical dates to concurrent program?

    In your case you can implement a service method in the VO to check if any other reservation overlaps with the new one (which is not inserted in the db).
    I would use a an other VO (e.g. VODateCheck) for this. This VO has it's query build to check if a given roomid and a given startdate(time?) overlaps any other record for the roomid
    select * from ReservationRoom where RoomId=:bindRoomId and ReservationEnd>=:bindReservationStartIf this query returns one or more rows you have an overlapping in the schedule and throw an error.
    You call this VODateCheck from your service method in the other module before inserting the record. Set the bind variables in the VODateCheck and execute the query.
    Timo

  • Struts Validator for Struts 1.2

    Dear all,
    I have migrated to Struts 1.2 and observed the problem with action form validation. What is strange is that every thing seems working. But if you look at the log file, you can realise that the validation did not work and there are the following exceptions. Moreover, the exception did not stop the program to continue (this gives the wrong impression that every thing working).
    Best regards,
    Pengyou
    11:31:53,463 ERROR [ValidatorForm] org.apache.struts.util.StrutsValidator
    org.apache.commons.validator.ValidatorException: org.apache.struts.util.StrutsValidator
         at org.apache.commons.validator.ValidatorAction.loadValidationClass(ValidatorAction.java:646)
         at org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:555)

    well, the only way this can be happening is if you have your ActionMessages object in request with errors in it. This sounds like something strange is happening in your LoaderAction class for that JSP. Sounds like you are executing the validate method when you are loading this page. Check your loaderAction class to ensure you are not validating upon load. You should be validating upon post. Remember, when loading, unless your loaderAction class has prepopulated some attributes on your form bean, everything is null in request. Therefore, you validate to ensure that certain fields are not null, the errors will be caught and shown on the page.

  • User-exit for ME21N: Check if outline agreement is valid (for date)

    Hopefully someone has seen this before..
    When creating a PO with ME21N, it is possible to create the PO with reference to an agreement that is not valid any more (Validity end field in ME33K is before todays date). No warning or error message is presented to the user.
    I have a list of 38 user-exits available for ME21N, but none of them seems to focus on this problem.
    I have to have EKKO-KDATE available in the exit, I think...
    Exit Name (for ME21N)
    AMPL0001 
    LMEDR001 
    LMELA002 
    LMELA010 
    LMEQR001 
    LMEXF001 
    LWSUS001 
    M06B0001 
    M06B0002 
    M06B0003 
    M06B0004 
    M06B0005 
    M06E0004 
    M06E0005 
    ME590001 
    MEETA001 
    MEFLD004 
    MELAB001 
    MEVME001 
    MM06E001 
    MM06E003 
    MM06E004 
    MM06E005 
    MM06E007 
    MM06E008 
    MM06E009 
    MM06E010 
    MMAL0001 
    MMAL0002 
    MMAL0003 
    MMAL0004 
    MMDA0001 
    MMFAB001
    MRFLB001
    LMEKO001
    LMEKO002
    MM06E011
    MEQUERY1

    Hello Helge,
    Did u try using EXIT_SAPMM06E_004. This is in the enhancement MM06E004. Use the code in the exit.
    tables: ekko.
    data: v_date like ekko-kdate,
          ebeln like ekko-ebeln.
    data: prog(30) value '(SAPLMEPO)ekko'.
    field-symbols: <fs1> type any.
    assign (prog) to <fs1>.
    ekko = <fs1>.
    *ekko-ebeln = <fs1>-ebeln.
    select single kdate into v_date from ekko
                 where ebeln = ekko-konnr.
    if v_date < sy-datum.
       message e000(zhb).
    endif.
    Try this.

  • How is it possible to extend pattern chars valid for Date formatting?

    Hi
    I need to represent Calendar.DAY_OF_MONTH and Calendar.MONTH date fields in one symbol (1,2,3,..,9,A,B,C,D..) and keep working standard patterns
    SimpleDateFormart doesn't give such possibility.
    In a result i want to have something like that:
    ExtDateFormat edf = new ExtDateFormat("yyyy/B/C"); // where B - is month in (1,2,3,..,9,A,B,C), C - is day in (1,2,3,..,9,A,B,C..)
    System.out.println(edf.format(Calendar.getInstance().getTime())); // prints something like "2008/03/D"

    You can extend the wireless range of the AirPort with a D-Link or the other way around ... BUT only if the connection between them is wired. This would be the basis of a roaming network. If you must have them interconnected by wireless, then it will NOT work.

Maybe you are looking for

  • "Previous Shutdown Cause" codes?

    Hi -- My MacBook has been experiencing some problems.. intermittently shutting itself down, and getting worse & worse until I couldn't even start the laptop up. I believe the problem was a faulty memory module (3rd party, installed myself) -- after r

  • Installing Oracle Grid control 10G fails at OMS configuration on Windows XP

    I am trying to install Oracle 10G Grid control and it fails at OMS configuration. The log file under cfgttool logs shows failed command as Oracle.sysman.emcp.oms.Omsplugin -ConfigureOms. I tried to run command manually like the following: C:\OracleHo

  • Mac os x kernel error message

    i get this message "...you need to restart the computer..." when i sleep and wake up the mac pro desktop...os is 10.5.4 when the tower reboots..it ejects the cd drive how to fix? thanks

  • Help with LAG

    I just wanted to know with the help of LAG function in Oracle, is it possible to get some previous rows instead of immediate previous.. For eg., if a table has values as follows: Col1    Col2 1         2 2         3 3         5 4         8 5        

  • Only showing contacts for required (and / or optional) attendees on appointment

    Hi, Is there any, supported, way to only show contacts when you do the lookup on required attendees on appointment. As it is now it starts with accounts which rarely are a meeting participant at least in our customer's case. It would be nice to get t