Skip to Content
avatar image
Former Member

RFC date input

Hi,

I am trying to execute Bapi_Bus1077_Getdetail_Input in WD

on executing it directly in R/3 it defaults to todays date but when i try to run it thru WD without passing any value (it is an optional field) it does not return the output.

this field expects an input in dd.MM.yyyy format and is not a string.

How can i pass this value using sql date ?

Thanks,

Veena.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Oct 18, 2008 at 06:29 PM

    Hi ,

    try this,

    Date date;

    DateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");

    string dateString=formatter .format(new Date(Calendar.getInstance().getTimeInMillis()));

    date = (Date)formatter.parse(dateString);

    pass the date to rfc.

    Regards,

    ramesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 19, 2008 at 07:49 AM

    Hi Ramesh,

    I tried that code

    gives the foll exception at the parse stmt.

    java.lang.ClassCastException: java.util.Date incompatible with java.sql.Date

    any other option?

    Thanks,

    Veena.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2008 at 09:10 AM

    thts right...i have used java.sql.Date

    ?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2008 at 09:25 AM

    No. leads to the class cast exception..

    java.lang.ClassCastException: java.util.Date incompatible with java.sql.Date

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi

      This piece of code works ok in JDK 1.4 and throws ClassCastException in

      1.5 on the line with compareTo call:

      for more details

      check this links

      http://www.velocityreviews.com/forums/t236893-javalangclasscastexception.html

      java.sql.Date d = (java.sql.Date)new java.util.Date();

      This will give u the same ClassCast Exception at run time.

      Without the cast to Child you would get a compile time error. The cast tells the compiler that you really mean to do this and the actual type of Parent does not get resolved until runtime. Casting down the object hierarchy is a problem, as the compiler cannot be sure what has been implemented in descendent classes. Casting up is not a problem because sub classes will have the features of the base classes. This can feel counter intuitive if you are aware that with primitives casting is allowed for widening operations (ie byte to int).

      Plz check http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#175725

      thanks

  • avatar image
    Former Member
    Oct 20, 2008 at 09:30 AM

    Hi,

    Have a workaround on the following code, it will be the answer for your question. Here I used System Date and converted to required format like Monthname-Date-Year. You change the format and workaround (like dd,mm,yyyy). My NWDS is not working so I can not try here

    try

    {

    long l = System.currentTimeMillis();

    java.sql.Date dt = new java.sql.Date(l);

    wdComponentAPI.getMessageManager().reportSuccess("Date: " + dt);

    SimpleDateFormat g_objDateFormat = new SimpleDateFormat("MMMM dd, yyyy");

    wdContext.currentContextElement().setAbc(g_objDateFormat.format(dt));

    }

    catch (NullPointerException e)

    {

    wdComponentAPI.getMessageManager().reportException(e.toString(), true);

    }

    Regards

    Raghu

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 20, 2008 at 11:33 AM

    Hi,

    We had same problem in our project, java.sql.Date is not supporting dd.MM.yyyy format, so we changed the default format of Date in R/3 System.

    Goto R/3 with your user and change the default format of Date.

    R/3 -> System -> UserDetails -> Own Data -> Defaults -> Date Format select YYYY-MM-DD.

    Now you can pass directly new java.sql.Date(System.currentMillis);

    This will resolve your problem, dont forget to give points.........

    Regards,

    Lakshmi Prasad.

    Add comment
    10|10000 characters needed characters exceeded