How to do date validation in Web Dynpro java

Hi
We have one requirement that One input field with date type is there.When we take Date type input field then in web dynpro Date navigater is appearing by default.Our requirement is if user enters the date manually in the input filed instead of chossing the date from the Date navigator then how we will do the following date validations manually:
a. If user is entering the date in any format then it should convert it to dd.mm.yy format.
b. How to do leap year validation?Suppose user is entering   29.02.20007 then it should display Invalid date.
c. How to do the follwing date validation:
    Let's say that current running hours(Text Vie
w) on a given engine is 100, entered on 10-Jun-2008(Running hour date-Text view)).
-On 15-Jun-2008(New Running Hour Date-input field), I try to enter a value of 300 hours(New running hour-input field).
-This is impossible, because only 5x24=120 hrs has passed from the previous update.
-Hence, in this case the maximum value I can enter is 100+120=220.
Can anybody help me in solving the above 3 date validation?

Hi Susmita,
For your 3 rd requirement...
Initially you will be storing the first date entered by the user right???
Say that date is D1. and user entered hours is H1.
now after some days at day D2 user again trying to enter some hours say H2. Now you have to restrict user from entering hours which are
greater than 24*D2-D1....
so now you have to get D2-D1....
For this....
long l1=youdate1.getTime();   // This will convert your Date D1 into long...
then,
Date d=new Date(System.currentTimeMillis());
long l2=d.getTime();  //which is a long value of current date...
So Now l2-l1 will give you number of days between past date and today's date...
So On Save you check for
if((l2-l1)*24<(H2-H1))
message("Please enter valied number of hours");
Hope this will help you....
Regards,
Srinivas.

Similar Messages

  • Data Validation in web dynpro

    Hi,
    Can anyone explain how to do data validation for the i/p fields in the WD View???Pleasegive an example with coding.
    Thanks!

    Hi,
    As Thomas pointed out in his reply that do the validation at WDDOBEFOREACTION method
    say you have a date to validate:
    DATA lo_nd_importing TYPE REF TO if_wd_context_node.
      DATA lo_el_importing TYPE REF TO if_wd_context_element.
      DATA ls_importing TYPE wd_this->element_importing.
      DATA lv_startdate LIKE ls_importing-startdate.
    navigate from <CONTEXT> to <IMPORTING> via lead selection
      lo_nd_importing = wd_context->get_child_node( name = wd_this->wdctx_importing ).
    get element via lead selection
      lo_el_importing = lo_nd_importing->get_element(  ).
    get single attribute
      lo_el_importing->get_attribute(
        EXPORTING
          name =  `STARTDATE`
        IMPORTING
          value = lv_startdate ).
    if lv_startdate is initial.
    get message manager
    DATA lo_api_controller     TYPE REF TO if_wd_controller.
    DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
    lo_api_controller ?= wd_this->wd_get_api( ).
    CALL METHOD lo_api_controller->get_message_manager
      RECEIVING
        message_manager = lo_message_manager
    report message
    CALL METHOD lo_message_manager->report_error_message
      EXPORTING
        message_text             = 'Please input start date'
       params                   =
       msg_user_data            =
       is_permanent             = ABAP_FALSE
       scope_permanent_msg      = CO_MSG_SCOPE_CONTROLLER
       view                     =
       show_as_popup            =
       controller_permanent_msg =
       msg_index                =
        cancel_navigation        =  'X'    "this parameter will stop the program at the same view
    endif.
    this will stop the user at the same view and will give the error message out.....
    you can also check the code wizard and try different type of methods to give out the error messages....the code wizard is right beside the external break point button...
    Thanks...
    AS.

  • How to set up environment for web dynpro Java?

    We want to develop applications in Java Web Dnpro.
    What do I need to configure in SAP R3 to use Web Dynpro Java?
    I can develop applications on the SAP NetWeaver Developer Studio and only perform a configuration  in SAP ECC ?
    Or do I need to install SAP EC Composition Environment ?
    Can I develop and set up RFC connections to integrate with my application in Web Dynpro Java?
    Please help me,
    Regards,
    Viviane

    Dear Viviane,
    In the webdynpr java application, you can use the data from SAP system. like you can use RFC's, Bapi's in your webdynpro application.
    Refer to [Linking RFC to Web Dynpro|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/761eba66-0401-0010-b982-d5f5bd9e8f90?quicklink=index&overridelayout=true] and http://wiki.sdn.sap.com/wiki/display/WDJava/WelcometoWebDynproJava%21
    Best Regards
    Arun Jaiswal

  • Validations in Web Dynpro Java

    Hello,
    I'm trying to create a lot of validations in a web dynpro App.
    Examples:
      - An inputfield must not pass 6 characters of length. (I can set the inputfield length of 6 characters but I can't force the inputfield to accept only 6 characters).
    - Some fields (inputfield, textEdit, dropdownByKey) are mandatory. (I can see the property state = "required" but I don't know how it works)
    - Some field are mandatory depending in a previous selection.
    I'm finding that adding this validation logic to the form is very heavy and implies a lot of work. I want to ask if someone knows an easy and automatically way to add this validation logic to the app, or I can't escape of programing everything.
    Please help.
    Regards
    SU

    Hi SU,
    I wrote the following code just to check if this method works or not. Well, this method does work.
    Ceate a message in the message pool and use the following code
    IWDNode node = null;
    wdControllerAPI.checkAndReportRequiredFields(node ,IMessageNew1Comp.VALIDATION__MESSAGE, new Object[]{"test"});
    " in my case the attribute bound to the input - whose state is required - is in root container.
    "That's why I am passing null as first parameter.
    Validation_Message is the message key
    "test" is the message which you could pass to the passholder
    I hope it helps.
    Edited by: Arjun Singh Thakur on Dec 9, 2011 11:32 AM

  • How to include source code in web dynpro java deployment

    Hi,
    We dont have NWDI.
    We are creating ear files out of web dynpro applications packaging them as sca files and deploying them in server.
    But the source  code is not included in ear.
    How to include source code with your ear/sca , so that when anyone downloads the sca file later, they are build the Project in the studio.
    How would they typically download? Do they require NWDI ,
    Right now we dont have NWDI in place, but we want to do is parcel the applications such that the source code should be available at a later time for download.
    This is possible with .par files , but what about web dynpro?
    Thanks,
    Deb

    If you are not using NWDI use the _comp file.

  • How to use chart engine for web dynpro java(EP) for Graphics generation.

    Hi Frndz..
    now lookiing out for different types of dynamic graphics generations according to my requirment, n i saw the followiing blog
    Testing BusinessGraphics in Web Dynpro for Java
    Itz very nice to see that we can generate planty of types, but here our server is EP 7.0(not CE 7.1) and i gone thru  these links also
    http://help.sap.com/saphelp_nwmobile71/helpdata/en/86/243f403f0a9354e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nwmobile71/helpdata/en/0b/79553b066d9414e10000000a114084/frameset.htm
    https://help.sap.com/saphelp_nw04/helpdata/en/0c/95c83956852b51e10000000a114084/frameset.htm
    here it seems to be Chart Engine n Chart Designer is mainly for BSP(R3), how best we can use this for web dyn pro java.
    Thanks in Advance
    Regards
    Rajesh

    hi
    if you want to use BusinessGraphics in WebDynpro java you have to configure IGS.
    IGS Configuration
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/4846ac90-0201-0010-099d-d3b4e271849c
    Business Graphics docs.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/3261cd90-0201-0010-268c-d8d72e358af6
    ChartDeigner Usage
    http://help.sap.com/saphelp_nw04/helpdata/en/18/d4d43fb9490c65e10000000a114b1d/frameset.htm
    Generating Gantt chart using web dynpro business graphics

  • How to Disable Portal Links with Web Dynpro Java?

    Hi all,
    I have configured some access to my apps through iviews in my portal content, each application is included in a PCD Structure inside a User Role; according the roles asigned to my users are the access to the applications the user wolud have
    For example:
    Role 1
    RootApp
         iView1.1
         iView1.2
         iView1.3
    Role 2
    RootApp
         iView2.1
         iView2.2
    Role 3
    RootApp2
         iView3.1
    My users might have one or even the 3 roles, and depending on their roles is the access to the applications that they may have.
    Now I have a requirement of the user wherein when the user logs in to the portal and clic in the RootApp link the Dynpro Application must to present an iView showing a set of terms and conditions; if the users accept the terms then they can continue using the application defined by the PCD definition, but if the users don't accept the terms, the aplication links in the portal must be disabled and the user can not use the aplications defined, but this only has to be applied to the root link selected (RootApp) in wich the user doesn't agreet the terms and conditions, however, other applications that are non dependent of the root link (RootApp) can be used (RootApp2).
    Are there any way to disable only certain portal links using a web Dynpro implementation?
    Thanks In Advance

    Hi
    IMyService portalservice=(IMyService)WDPortalUtils.getServiceRefrence(IMyService.KEY);
    portalservice.myMethod();
    This is the code to get portal service reference and call methods implemented in the service
    Also, add prtapi.jar to build path. Add sharing refernce to portal:sap.com/<Portal Application name>
    Regards,
    Yoga

  • How to use the date picker in Web dynpro java

    Hi,
    I want to add date picker to enter a date while developing webdynpro application.
    How can i do that.
    Regards,
    H.V.Swathi

    Hi,
    its very simple...
    take a input field and map it to the attribute which data type is of "date". thats it at runtime you will see a input filed with date picker.
    i.e. Add an inputField and bind the context attribute of Type Date to it
    this will show the date picker on screen.
    PradeeP

  • Comparing two GUID of ABAP raw data type in Web Dynpro

    Hello,
    I am working with a CRM application. I want to fill a table with each column from different tables.
    For that I am trying to compare the GUID of each table. But I am not successful as the GUID is of RAW data type. How can I compare them in Web Dynpro Java?.
    Thanks,
    Sunita.

    Hi,
    I have been able to get rid of the problem posed in my earlier mail about assigning values from a field symbol to an internal table. Now its back to the same old problem.
    As mentioned earlier I have a view1 in which I am populating a range (select option), which I want to display on the next view, view2.
    On view1, on click of the button, I have populated internal table I_RANGE2.
    DATA: IT_RANGE2 TYPE TABLE OF ZTTRANGE.
    ZTTRANGE is a table type in SE11 with linetype as ZRANGE (structure in SE11).
    I want to pass I_RANGE2 to the method in the component controller:
    WD_COMP_CONTROLLER->HOLD_DATA( CHANGING IT_RANGE = IT_RANGE2 ).
    In the component controller the parameter IT_RANGE has been declared as
    PARAMETER             TYPE                REFTo             Associated Type
    IT_RANGE                 Changing              u221A (Tick)                ZTTRANGE
    But I am getting an error:
    IT_RANGE2 is not type-compatible with formal parameter IT_RANGE.
    Please help resolve this error.
    Mick

  • Range validations in web dynpro

    Hi experts,
    can you please tell me How to perform Range validations in web dynpro applications ?
    Advance Thanks,
    Namrata.

    Hi Namrata,
    Create a Simple Type (Local Dictonary -> DataTypes -> SimpleTypes). Enter either Length constraints / value constraints in the simple type. Bind this simple type to the context attribute. Whenever you are performing an action framework generated error message will be displayed based on the constraints you designed in simple type.
    Thanks
    Madhu

  • Creating sales order using web dynpro JAVA

    Hello everyone,
    i am new to web dynpro. Can any one tell me how to creating sales order by web dynpro JAVA using BAPI.
    Thanks.
    Vinita Sharma

    Hi...
    you can use Adaptive RFC methodology in web dynpro java to work with BAPIs..... these are standard bapi's provided
    Here are required Bapis... select which one you want....
    BAPISDORDER_GETDETAILEDLIST Sales Order: List of All Order Data
    BAPI_ORDER_CHANGE_STATUS_GET Change status for order
    BAPI_SALESDOCU_CREATEFROMDATA Creating a Sales Document
    BAPI_SALESORDER_CHANGE Sales Order: Change Sales Order
    BAPI_SALESORDER_CREATEFROMDAT1 Sales Order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDAT2 Sales Order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDATA Create sales order, no more maintenance
    BAPI_SALESORDER_GETLIST Sales order: List of all orders for customer
    BAPI_SALESORDER_GETSTATUS Sales order: Display status
    BAPI_SALESORDER_SIMULATE Sales Order: Simulate Sales Order
    check this thread SALES ORDER creation using BAPI
    sample java program which will call SAP bapi function sales order create
    PradeeP

  • Web Dynpro Java code changes

    Hi,
    I need to put some validations in web dynpro java page which is "employee address page". I checked the BADI's but no badi exists which serve my purpsoe.
    Now I want to make the code change in web dynpro java. Pls answer the followng questions.
    1- I have installed NWDS on my local machine. Do i need to install NWDI also?
    2- How to import and export the required page and from where?
    3- How to modify the standard code, I mean in ECC we have enhancement and modification concept.
    Thanks,

    NWDI is a part of NWDS, So you would need both as mentioend
    NWDI - Netweaver Development Infrastructure is an SAP sytem for java development & change management. It's a repository for java code and change management system.
    NWDS is a developer tool to build applications similar to Eclipse. NWDS uses NWDI to check-in & check-out java code and move java changes to SAP runtime systems (like portal etc).
    Read the basics of NWDI and its utility in the below help document
    http://help.sap.com/saphelp_nwce72/helpdata/en/48/bc23b1a70a0611e10000000a42189b/frameset.htm
    Also go through how to import ESS configurations in NWDI
    ESS/MSS Customization – Make it Simple
    NWDI cookbook in SAP note : 872892
    The specified item was not found.
    Edited by: Siddharth Rajora on Nov 9, 2011 9:28 PM

  • Adding a field in Web dynpro java in Travel Request application

    Hi All,
    How to add a field in Web dynpro java in Travel Request application or can we copy the Web dynpro java application to Web dynpro ABAP and add a field. Experts, Can you please suggest me step by step in resolving the problem.
    Thanks & Regards,
    Kumar

    Hi Kumar,
    First, in order to customise the ESS webdynpro Java iViews you need to be aware that, you are about to change the SAP standard iviews. In order to avoid this you can make a copy of the SAP standard one's and then try to customise the copied one's.
    Now, you should have NetWeaver Development Infrastructure(NWDI) installed. Once it is installed you should also install the Netweaver Developer Studio (NWDS) on your computer.
    Once you have these two installed, you should deploy the ESS Business Package onto the NWDI by creating tracks. There is a cookbook available on SAP Service Marketplace for configuring NWDI for ESS.
    Once you have all the above mentioned tools, have a look at the following blog which clearly explains about the procedure of customising ESS iviews.
    /people/vinoth.murugaiyan/blog/2007/08/24/essmss-customization-150-make-it-simple
    Also check the following Wiki, this might be useful!
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/erphcm/employee%252bself%252bservice
    I hope this helps. Let me know if you have any issues.
    Dont forgett to contribute points if this is useful! All the Best.
    Regards,
    PG

  • Adobe Flash Islands + Web Dynpro Java - CE 7.1 EHP1

    Hi All,
             I am currently working on flash islands in web dynpro java(CE 7.1 EHP1  Trail version). i have done some sample projects in Flex Builder and using the complied(Flex Complier 2.0) SWF file, i was able to do data transfer between web dynpro java and Flex component. every thing works fine till this but if i complie the flex project using Flex Complier 3.0, i am able to see the Flex component rendered in web dynpro java, but data transfer dosent work.
    i have checked few thread in SDN and came to know to use WDFlashIsland30.SWC library to complie using FLex Builder 3.0.
    i got this library and complie the Flex Component using Flex Complier 3.0 and placed this WDFlashIsland30.SWC in server also but the problem exists .... the complied Flex Component is getting reddered in web dynpro java but the data transfer is not happening ???
    what could be problem ???
    1.  Is it enough to place the WDIslandLibrary30.swc libraby in CE 7.1 EHP1 version for data communication between Flex and Web Dynpro Java if so what could be the problem ?
    2. Or do i need update the Server ???
    Thanks and Regards,

    HI,
    your issue is completely independent from the server, it's a pure client problem. In general Web Dynpro Java does not care which Flex version you used to compile, as long as you used the right library.
    If you did not change anything else it should work. Are you sure you replaced the used library and changed the source-code-compliance before recompiling?
    Kind Regards,
    Carl Heckmann

  • How can I set the data binding between Web Dynpro & Database table

    Dear friend,
    I am a beginner of Web Dynpro. I want to develop my simple project like these:
    1. Create my own database table via Dictionary Project such as TAB_USER and have 3 fields: USER_ID, USER_NAME, USER_POSITION and I have already deployed & archived it.
    2. Create my own Web Dynpro Project, and create the input fields as User ID, User name, User position and icon 'Save' on the selection screen and I have deployed it already.
    For the process, I want to input data at the screen and save the data in the table, please give me the guide line like these:
    1. How can I set the data binding between Web Dynpro and Database table ?
    2.  Are there any nescessary steps that I will concern for this case?
    Sorry if my question is simple, I had try  to find solution myself, but it not found
    Thanks in advances,
    SeMs

    Hi,
    You can write your own connection class for establishing the connection with DB.
    Ex:
    public class  ConnectionClass {
    static Connection con = null;
    public static Connection getConnection() {
    try{
    Context ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("jdbc/TSPAGE");
    con = ds.getConnection();
    return con;
    }catch(Exception e){
    return null;
    You can place the above class file in src folder and you can use this class in webdynpro.
    You can have another UserInfo class for reading and writing the data into the DB .
    Regards, Anilkumar
    PS : Refer
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/simple java bean generator for database.pdf
    Message was edited by: Anilkumar Vippagunta

Maybe you are looking for

  • Iphone not recognized by itunes ? after OS upgrade

    For the first time in a while, I'm trying to sync my phone with itunes. The last time I connected it was before the OS upgrade. I'm not sure if this has something to do with it? I tried almost everything in the troubleshooting except for uninstalling

  • Unable to install iOS 8.0.2

    I'm unable to install the new update for iOS 8.0.2. It's been downloaded, but when I try to install it, a window pops up saying, "Unable to Install Update" and in smaller text, "An error occurred installing iOS 8.0.2."  What could be wrong and what c

  • UNION operator in ejb 3.0

    Hi All, I have to use UNION operator in my ejb ql. My underlying database is MySQL. My ejb ql is SELECT s from eee s where s.name like 'XXX' UNION SELECT t from eee t where t.default_id = 'XXX' union is on the same entitybean. In my eee entity bean I

  • Very critical error in migration(Hyperion 9 to Hyperion 11)

    Hi All, I am facing very critical error during the migration. I have two servers, one with Hyperion 9 and other with Hyperion 11. I migrated(Planning Application, BRs) the Planning application from Hyperion 9 to Hyperion 11. Migration went well. Ever

  • Dynamic changes in JSP .....Urgent!!!!!!!!!!

    Hi all, I am having 2 list boxes (using select tag of html)in my registration.jsp page. one select tag : main account types second select tag : sub types for each main account types. first select tag is dynamically populated from the database. i have