on 10-18-2008 7:04 PM
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No. leads to the class cast exception..
java.lang.ClassCastException: java.util.Date incompatible with java.sql.Date
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
thts right...i have used java.sql.Date
?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.