Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Date Format getting Null Pointer Exception

Hi ,

I have date value in one attribute it is coming from RFC.

If I will bind the value directly to the text view ,data is getting like 10/12/2008. But whenever I am taking this value and formatting into Simple date format as October 13th,2008,I am getting "NullPointer Exception".

Code is in init() of View :

//Format Draft_Date

Date l_CreDat = wdContext.currentCtx_vn_DataElement().getCredat();

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

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

wdContext.currentContextElement().setCtx_va_Date(g_objDateFormat.format(l_CreDat));

}catch (NullPointerException e)

{

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

}

Please help me.

Thanks

Risha

replied

Hi Risha,

After setting the data into context attribute, bind the attribute with the context.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question