Date field in Webdynpro Java

Hi, I am trying to hardcode date field in a project with date say "21.11.2007", the rfc takes only date in java.sql form. can you please help me how can I do so. Plz help me out.
Regards
Umang

I have used the following code for importing the date value to a rfc the I have checked that the code for date is fine but still I am not getting any output. I think that its the issue of the date format. Because while testing the RFC, it is not accepting date in   dd-mm-yyyy format but is only accepting in the format dd.mm.yyyy or ddmmyyyy.
So I believe that it is the issue of date format. or might be possible that there would be some error in the way I am executing the RFC.
Even after setting the debugger in RFC, the the RFC is not coming into picture i.e, the project is not hitting the RFC  might be because of the wrong format of date .
Could you please refer to the code and suggest something.
Rp_Get_Pernr_From_Userid is the name of RFC.
     try
            Rp_Get_Pernr_From_Userid_Input inp = new Rp_Get_Pernr_From_Userid_Input();
            wdContext.nodeRp_Get_Pernr_From_Userid_Input().bind(inp);     
wdContext.currentRp_Get_Pernr_From_Userid_InputElement().setBegda(new java.sql.Date((new java.util.Date()).getTime()));
wdContext.currentRp_Get_Pernr_From_Userid_InputElement().setUsrid(wdContext.currentContextElement().getUserid());
String dateInput = "9999.12.31";
       SimpleDateFormat sdf = new SimpleDateFormat( "yyyy.MM.dd" ) ;
            java.sql.Date dt = null;
            try {
                dt = new java.sql.Date( sdf.parse(dateInput).getTime()) ;
            catch(Exception io)
             io.printStackTrace();
          wdContext.currentRp_Get_Pernr_From_Userid_InputElement().setEndda(dt);
wdContext.currentRp_Get_Pernr_From_Userid_InputElement().modelObject().execute();
catch (Exception e)
                                         wdContext.currentContextElement().setTest(e.toString());

Similar Messages

  • Date Field in Webdynpro

    Hi there,
    I have a attribute that is Date and have binded it with an UI field in webdynpro.
    However, the format of date input in ABAP is yyyymmdd but the one used by webdynpro is something like 01/01/09. Is there a way I can change the format of the date being captured in the field to suit the format of ABAP date input?
    Pls advise me!

    Hi 
      I think you cant do the format of Abap in front end as showing .but you can pass the data to backend data Format as  "yyyyMMdd"  you can not shows apab format at front end side ..but its automaticaly render original format as per Web dynpro fundamental but you can save front format to abab fromat at time of data store in back end System"  as Format  string  "yyyyMMdd..using some piese of code....
                                    String inputDate="1/2/2009";
              SimpleDateFormat sdfinput = new SimpleDateFormat("dd/MM/yyyy");
              java.util.Date output = null;
              try {
                output = sdfinput.parse(inputDate);
                  } catch (ParseException e){
                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
                          String in=sdf.format(output);
    Hope you will get the answar

  • How to design search field in webdynpro java iView

    Hi,
          I created one webdynpro (java) iView.I want to design one search fields like Google on webdynpro iView.How to achieve this requirement?Can someone explain me in steps?
    Thanks,
    Kundan
    Edited by: Kundan 2009 on Feb 26, 2010 10:06 AM

    Hi ,
    If you want to employ google search functionality in webdynpro , follow below steps.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/fd68e590-0201-0010-da89-ba631f41b3d7?QuickLink=index&overridelayout=true
    webdynpro framework dont have  standard search functionality directly.
    Regards,
    Koti Reddy

  • Date comparision in webdynpro java

    Hi,
    I am new to webdynpro java. I have a requirement. I am getting date in format "yyyymmdd"  as string and i need to compare it to todays date.
    Please help me how to do this.
    Thanks,
    Raz

    Hi,
       The way of comparing two date instances is same in WD Java as in plain Java. Assuming you already have got the date value as string from the context, use this code:
    String dateStr = "<your value from the context>"; //for example 20071231
    SimpleDateFormat f1 = new SimpleDateFormat("yyyyMMdd");
    try {
       Date d1 = f1.parse(dateStr);
       Date d2 = new Date(System.currentTimeMillis()); //today's date
       d1.compareTo(d2); // will return -ve if lhs is before rhs, +ve if ihs is after rhs & 0 if both the dates are equal.
    } catch (ParseException e) {
       e.printStackTrace();
    Regards,
    Satyajit.

  • Date field Length in Java Webdynpro

    Hi Experts,
    I have a strange case.
    I created a new filed in the infotype 0175: ZZDAT  like the standard field AUSGD  (type DATS length 8)
    I modified the ESS view and added the new fields.
    The view is working perfectly, the data is transfered between the databse and the webdynpro, the only problem is, that the user can't enter the date manually, because  last point after the day can't be entered: e.g.: 2010.01.01 instead of 2010.01.01.
    If the user uses the search help, and selects the date form the popup calendar, then the date format is correct: 2010.01.01.
    (there is a point after the DAY ) I tried to change the field length manually but still, the last point after the day can't be entered.
    Can you please help me to find out what is the problem?
    Thanks
    N.

    Unfortunatelly this doesn'T help at all.
    I reimported the data element, and restarted the server, but the result is the same. I can'T enter the date manually..
    To be honest, i'm fed up with this stupid java webdynpro.  I hope  there is a special place in hell, for the people who invented this....
    Anyway, I think the only solution here is to limit the field, capabilities. I'll try to set the Date picker as the only input way... I hope this is possible... it's easy in ABAP I just hope that java can do this the same "non-somplicated" way.
    If you have any idea how to do this I'll be very greatfull for any kind of help.
    Bye
    N.

  • How to implement AZAX call for a input field in webdynpro java.

    Hello everyone,
    I want to make a AZAX call , when I click on the input field.Anybody has already implemented this earlier, plz let me know how to do this.
    Thanks,
    Srikanta

    Undo/Redo is a pain in the neck. If I recall correctly, I usually use a javax.swing.undo.CompoundEdit to group smaller edits. Not sure if this will work but you might try starting a compound edit when a user strikes a key and ending it after a certain amount of time passes without a keystroke. This will allow rapid bursts of typing to be grouped as a single edit.

  • Validation of data fields in the Excel through webdynpro java

    Hi all,
         I have requirement as below:
                  There are data fields in the Excel File which are mandatory.When we are uploading the Excel file through webdynpro java it should validate the  mandatory data fields are filled or not.Can anybody please send the required code or any related links.
    Thanks,
    Prakash.

    Hi Surya,
    As per my info, you need to upload the file first then only web dynpro will be able to check for the mandatory fields.
    Do this, while reading the buffer from the excel, just check the size of desired columns. Hope that will help.
    Best Regards
    Chander Kararia

  • Error with date field when inserting records into sql server from webdynpro

    Dear SDN's,
    I am trying to insert the records into sql server through my webDynpro program.
    I have created a date field in a dictionary with the datatype date.
    In my webdynpro program to insert the date i am following the below format.
    String dateString = "2006/12/10";
          java.util.Date d=new java.util.Date(dateString);
          java.sql.Date <b>date</b> = new java.sql.Date(d.getTime());
    int i=stmt.executeUpdate("INSERT INTO TRAVEL_HEADER(TRQID,PROJECTID,<b>REQDT</b>,ADVCE,ETADV,PURTR) values(21, '555-1212', '" + <b>date</b> + "', 5000, '20060501','hi')");
    when i try to execute it, it gives the following error.
    <b>com.sap.sql.log.OpenSQLException: The SQL statement "INSERT INTO "TRAVEL_HEADER" ("TRQID","PROJECTID","REQDT","ADVCE","ETADV","PURTR") VALUES (21,'555-1212','2006-12-10',5000,'20060501','hi')" contains the semantics error[s]: - type check error: new value (element number 3 (CHAR)) is not assignable to column  >>REQDT<< (DATE)</b>
    Please correct me.
    Your help will be appreciated.
    Regards,
    Sireesha.B

    Hi,
    int i=stmt.executeUpdate("INSERT INTO TRAVEL_HEADER(TRQID,PROJECTID,REQDT,ADVCE,ETADV,PURTR) values(21, '555-1212', 'date', 5000, '20060501','hi')");
    try like this.
    I Think in SQL the general format to take date as input like this.
    INSERT INTO X VALUES ('10/30/56')
    thaks,
    Lohi.

  • How to fetch the xml data in webdynpro java

    Hi all,
    i have an xml data which contains the fields as 1.user type, 2. client, 3.vendor number
    in webdynpro java how i validate or fetch the details of  the user type, when ever user login's in portal i can show some data to user 'A' and invisible to user 'B', based on the xml data.
    help me in doing step by step'
    Thanks&Regards
    charan

    Hi
    Follow the steps .
    This is the XML file .
    <?xml version="1.0"?>
    <company>
         <employee>
              <firstname>Tom</firstname>
              <lastname>Cruise</lastname>
         </employee>
         <employee>
              <firstname>Paul</firstname>
              <lastname>Enderson</lastname>
         </employee>
         <employee>
              <firstname>George</firstname>
              <lastname>Bush</lastname>
         </employee>
    </company>
    Java Code of this to fetch the details.
    public class XMLReader {
    public static void main(String argv[]) {
      try {
      File file = new File("c:\\MyXMLFile.xml");
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.parse(file);
      doc.getDocumentElement().normalize();
      System.out.println("Root element " + doc.getDocumentElement().getNodeName());
      NodeList nodeLst = doc.getElementsByTagName("employee");
      System.out.println("Information of all employees");
      for (int s = 0; s < nodeLst.getLength(); s++) {
        Node fstNode = nodeLst.item(s);
        if (fstNode.getNodeType() == Node.ELEMENT_NODE) {
               Element fstElmnt = (Element) fstNode;
          NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("firstname");
          Element fstNmElmnt = (Element) fstNmElmntLst.item(0);
          NodeList fstNm = fstNmElmnt.getChildNodes();
          System.out.println("First Name : "  + ((Node) fstNm.item(0)).getNodeValue());
          NodeList lstNmElmntLst = fstElmnt.getElementsByTagName("lastname");
          Element lstNmElmnt = (Element) lstNmElmntLst.item(0);
          NodeList lstNm = lstNmElmnt.getChildNodes();
          System.out.println("Last Name : " + ((Node) lstNm.item(0)).getNodeValue());
      } catch (Exception e) {
        e.printStackTrace();
    BR
    Satish Kumar

  • Inserting data into a file in Webdynpro java

    hi,
    My requirement is, i am using html code in my webdynpro application. i want to send the html code to a file(.txt file) .can any body help me how to send the data to file in webdynpro java.
    thans,
    kishore

    Hi,
    For export file in format XML, TXT, ...
    continue steps
    1) create node with name  FileResource and type binary
    2) create view and add control filedownload and properties control set data binding node FileResource
    3) create following code
      //@@begin javadoc:wdDoInit()
        /** Hook method called to initialize controller. */
      //@@end
      public void wdDoInit()
        //@@begin wdDoInit()
            IWDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute(IPrivateExportListView.IContextElement.FILE_RESOURCE);
            IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attInfo.getModifiableSimpleType();  
            binaryType.setFileName(ExportListView.FILE_NAME);
            binaryType.setMimeType(WDWebResourceType.TXT);
            try {
                String resourcePath = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), ExportListView.FILE_NAME);
                wdContext.currentContextElement().setFileResource(this.getByteArrayFromResourcePath(resourcePath));
            } catch (WDAliasResolvingException e) {
                wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage(), true);
            } catch (Exception e) {
                throw new WDRuntimeException(e);
        //@@end
    and add following code
      //@@begin others
        private byte[] getByteArrayFromResourcePath(String resourcePath) throws FileNotFoundException, IOException {
            FileInputStream in = new FileInputStream(new File(resourcePath));
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            int length;
            String Prueba = "hola esto es una prueba" + new Date().getSeconds();
            //byte[] part = new byte[10 * 1024];
            byte[] part = Prueba.getBytes();
            while ((length = in.read(part)) != -1) {
                out.write(part, 0, length);
            out.write(Prueba.getBytes());
            in.close();
            return out.toByteArray();
        // store image file name in constant FILE_NAME
        private static final String FILE_NAME = "doc.txt";
      //@@end
    4)Create file ext(txt,xml,...) in following dir of the project
    ...\_comp\src\mimes\Components\com.prueba.ReporteComp
    regards from colombia-medellín

  • Binding and displaying data to table in webdynpro java

    hi all,
    i want to know how to bind the output values to table in webdynpro java.
    i know how to bind values in context to table,but if we want to display the values from database(back end ) and display in table present in the view.
    eg: i have table in view and want to get values from backend(SQL server) and display it in that table.
    plz help me to know ..
    thanks
    sirisha

    Hi Saisirisha,
    Try this.
    1> Take a Value Node(Employee) cardinality 0..n.
    Employee Structure
    Employee
    |------Surname(Attribute)
    |------FirstName(Attribute)
    |------Category(Attribute)
    2> Bind this value node(Employee) in the View datasource of table.
    3> Try the code inside wdDoInit method.
    try {
         // Load the JDBC-ODBC bridge
         Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
         // specify the ODBC data source's URL
         String url = "jdbc:odbc:SSPer";
         // connect
         Connection con = DriverManager.getConnection(url,"North","Ken");
         // create and execute a SELECT
         Statement stmt = con.createStatement();
         ResultSet rs = stmt.executeQuery
         ("SELECT Surname,FirstName,Category FROM Per");
         while (rs.next()) {
         // get current row values
         String Surname = rs.getString(1);
         String FirstName = rs.getString(2);
         int Category = rs.getInt(3);
         //create table row and add the value in the table
         IPrivate<Put View Name>.IEmployeeElement empElm = wdContext.createEmployeeElement();
            empElm.setSurname(Surname);
         empElm.setFirstName(FirstName);
         empElm.setCategory(Category);
         wdContext.nodeEmployee().addElement(empElm);
         // close statement and connection
         stmt.close();
         con.close();
    } catch (java.lang.Exception ex) {
         wdComponentAPI.getMessageManager().reportException("Exception : "ex.getMessage()+,true);
    http://www.developer.com/java/data/article.php/3417381
    Regards,
    Mithu

  • Formatting dates in a table in webdynpro java for mutliple entries.

    Hi all,
    I have a requirement to format date values in a table for multiple entries to dd/MM/yyyy format in webdynpro java for mutiple line items in that table.
    Please help me out with the technique for the same.
    Thanks and Regards,
    Soumyadeep.

    Hi,
    here is the code for changing the formatting the date.
    Date currentDate = new Date ();
                DateFormat df =  DateFormat.getDateInstance(DateFormat.SHORT);
                String today = df.format(currentDate);
                SimpleDateFormat sdfInput = new SimpleDateFormat("dd/mm/yyyy");
                SimpleDateFormat sdfOutput = new SimpleDateFormat ("mm/dd/yyyy");
    try {
                      String dateft = sdfOutput.format((Date) sdfInput.parse(df.format(currentDate)));
                } catch (ParseException e) {

  • Date format problem in webdynpro java

    Currently, the date format that gets displayed in our webdynpro java application is MMDDYYYY...i am assuming this is because the web dynpro application has language resource set to en_US as its Current locale in the web dynpro deployed content section.  Howver i want it to display as DDMMYYYY. I have changed the default properties in visual admin for web dynpro from en to en_GB however this has no impact what so ever as the current locale is always set to en_US even after the change so am wondering this property is hidden some where else.  Now the web dynpro i am talking about is a adobe portal application. Could you give me any pointers as to where else i can look for or how i can change the current locale properly ??
    Regards
    Kalyan

    Hi.
    Also this link could help you.
    http://help.sap.com/saphelp_nw04s/helpdata/en/18/f3674039c6c549e10000000a1550b0/content.htm
    In special the table showing the order the locale is set in the web dynrpo application.
    Also it is shown in the last pages of this document, [Web Dynpro for Experts|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/58a7e390-0201-0010-abb1-8eec7eb7a2ec?quicklink=events&overridelayout=true].
    And finally you may use the sap.locale request parameter, how it's defined [here|http://help.sap.com/saphelp_nw04/helpdata/en/f4/651741f163f023e10000000a155106/frameset.htm]. You must add ?sap-locale=en_GB to url.
    Manuel Loayza.

  • How to color the mandatory fields in a Adobe WebDynpro Java form

    Hi Experts,
    How to color the mandatory fields in a Adobe WebDynpro Java form?
    This will avoid any confusion to he end user while filling the form as he would try to type something in field which is set as Read nlybut stil the cursor appears there.
    Regards,
    Shobhit

    Hi Shobhit,
    you can write something like xfa.host.setFocus(<text field name>). to set the focus or
    <text field name>.fillColor = "120,120,123";
    <text field name>.resolveNode"ui.#textEdit").border.edge.fill.color.value="120,150.200";
    to fill the color.
    Refer to adobe dev centger scripting samples to learn more on these.
    Hope these helps.
    Thanks and Regards,
    - anto.

  • How to pass data from offline form to webdynpro java

    Hi,
    Please suggest me how to pass data from offline from to webdynpro java node?
    i am using the below code to pass data from offline form(after entering values in the form) to node . i am using form upload ui element to upload offline form and after that i am providng a button to update data.But still i am not able to see data in the node.Any suggestions on this.below code is wriiten on action of the button.
    wdContext.currentContextElement().setPDFSource(null);
           try
                if(null!=wdContext.currentContextElement().getAttributePointer("Resource"))
           IWDResource fileResource = wdContext.currentContextElement().getResource();
         if("PDF".equalsIgnoreCase(fileResource.getResourceType().getFileExtension()))
           byte[] b = new byte[wdContext.currentContextElement().getResource().read(false).available()];
           wdContext.currentContextElement().getResource().read(false).read(b)                     wdContext.currentContextElement().setPDFSource(b);
           WDInteractiveFormHelper.transferPDFDataIntoContext                 (wdContext.currentContextElement().getPDFSource(), wdContext.nodeVn_TestData());                                                               
                     else
                          wdComponentAPI.getMessageManager().reportException("Please enter correct file");
                else
                     wdComponentAPI.getMessageManager().reportException("Error while uploading file"); 
           catch (Exception e) {
                wdComponentAPI.getMessageManager().reportException
                ("Error in uploading the Adobe Form :"+e.getLocalizedMessage(),false);
    Regards,
    Pavani

    If you choose the second alternative you should erase these global variables after the second form is opened
    You can erase the global variable using:
    erase('global_var')
    Greetings,
    Sim

Maybe you are looking for

  • Connectin the 7.1 Speaker system to LCD TV

    i recently got a Lg LCD tv (26 inch)....just wanted to know that can i connect the 7.1 speaker system to the and the DVD player and will it give good output......and if not.....whts the solution or the alternative to it

  • My iMac 27" is asking for a 4-digits Pin which i never had

    My iMac 27" is asking for a 4-digits Pin which i never had

  • Why won't artwork display

    The album artwork shows up in my itunes, but when I sync my iPod it won't show up. I have the tab clicked that says to show artwork. How do I get it to show up on my iPod?

  • E71 rining tone

    For a particular contact, I have set a ring tone that differs from the main ring tone. However, when that contact calls me, only the 'main' ring tone sounds, not the different one that was set. Additionally, only the number of the caller is displayed

  • When shopping for music, is there a way to play the results like playlist?

    This pertains to shopping for music on the Apple store. When I display all the songs by a particular artist, it becomes real OLD to click 100 songs. Is there a way to play them ALL in the same manner as a playlist? That is, when the 30-second sample