cancel
Showing results for 
Search instead for 
Did you mean: 

RFC date input

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (6)

Answers (6)

former_member205363
Contributor
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

No. leads to the class cast exception..

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

Former Member
0 Kudos

Hi,

when you setting the "date" to rfc you facing problem ?

former_member192434
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

?

Former Member
0 Kudos

your problem resolved ?

Former Member
0 Kudos

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.

Former Member
0 Kudos

the provided code is correct but you need to take java.sql.date for Date type.

Former Member
0 Kudos

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