cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid date error while Selecting Date in Date Navigator

Former Member
0 Kudos

Dear Experts,

I have used Date Navigator UI element with first and lat selected date bound to two attributes of type D.

I am getting those values in the OnDay select event method and setting it to me screen fields.

But when I am selecting any Date in the Calendar i am getting error '20131212'  is an invalid date.

I tried to debug the event but it didnt went inside the method itself.

Kindly give some suggestions.

Thanks,

Nalla B.

Accepted Solutions (0)

Answers (1)

Answers (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Nalla,

As you have bound the properties "firstSelectedDate" & "lastSelectedDate"  to attributes of type D. There should not be any issue.

Could you share the snap shot of property binding and code inside "OnDaySelect" event.

It helps to analyze the issue further.

Regards,

Rama

Former Member
0 Kudos

Hi Rama,

PFA the Screen Shot of the context attribtes and the code inside my event.

And also the error screen.

I have written the below code to insert the selected dates in the table row so i have used the get table and bind table methods.

  DATA lo_nd_lp_req_cre_det TYPE REF TO if_wd_context_node.
DATA lo_el_lp_req_cre_det TYPE REF TO if_wd_context_element.
DATA ls_lp_req_cre_det TYPE wd_this->element_lp_req_cre_det.
DATA lt_lp_req_cre_det TYPE wd_this->elements_lp_req_cre_det.

lo_nd_lp_req_cre_det
= wd_context->get_child_node( name = wd_this->wdctx_lp_req_cre_det ).

IF lo_nd_lp_req_cre_det IS NOT INITIAL.
lo_el_lp_req_cre_det
= lo_nd_lp_req_cre_det->get_element( ).
ENDIF.

IF context_element IS NOT INITIAL.
context_element
->get_static_attributes( IMPORTING  static_attributes = ls_lp_req_cre_det ).
ENDIF.

IF lo_nd_lp_req_cre_det IS NOT INITIAL.
lo_nd_lp_req_cre_det
->get_static_attributes_table( IMPORTING table = lt_lp_req_cre_det ).
ENDIF.

************************************************************************
*  Selected Dates Node Declaration
************************************************************************
DATA lo_nd_lp_date_det TYPE REF TO if_wd_context_node.
DATA lo_el_lp_date_det TYPE REF TO if_wd_context_element.
DATA ls_lp_date_det TYPE wd_this->element_lp_date_det.

lo_nd_lp_date_det
= wd_context->get_child_node( name = wd_this->wdctx_lp_date_det ).

IF lo_nd_lp_date_det IS NOT INITIAL.
lo_el_lp_date_det
= lo_nd_lp_date_det->get_element( ).
ENDIF.

IF lo_el_lp_date_det IS NOT INITIAL.
lo_el_lp_date_det
->get_static_attributes( IMPORTING static_attributes = ls_lp_date_det ).
ENDIF.


ls_lp_req_cre_det
-lw_date = ls_lp_date_det-sel_begda.
ls_lp_req_cre_det
-rw_date = ls_lp_date_det-sel_endda.

************************************************************************
*  Binding the table and Work Area
************************************************************************
context_element
->set_static_attributes( static_attributes = ls_lp_req_cre_det ).

IF lo_nd_lp_req_cre_det IS NOT  INITIAL.
lo_nd_lp_req_cre_det
->bind_table( new_items = lt_lp_req_cre_det set_initial_elements = abap_true ).
ENDIF.


Kindly let me know why this error persists. The debugging is not getting triggered in my event. This standard error message is displayed before my day select event.


Thanks,

Nalla B.

ramakrishnappa
Active Contributor
0 Kudos

Hi Nalla,

Thanks for sharing the snap shots.

I got bit more clarity on whats the requiement.

I suspect the error message is not thrown from this event. Please check WDDOBEFOREACTION method in all views and try debugging the before action methods and you might get into the place where the message is originating.

However, there are few corrections in the below code


Nallasivam Balu wrote:


  DATA lo_nd_lp_req_cre_det TYPE REF TO if_wd_context_node.
DATA lo_el_lp_req_cre_det TYPE REF TO if_wd_context_element.
DATA ls_lp_req_cre_det TYPE wd_this->element_lp_req_cre_det.
DATA lt_lp_req_cre_det TYPE wd_this->elements_lp_req_cre_det.

lo_nd_lp_req_cre_det
= wd_context->get_child_node( name = wd_this->wdctx_lp_req_cre_det ).

IF lo_nd_lp_req_cre_det IS NOT INITIAL.
lo_el_lp_req_cre_det
= lo_nd_lp_req_cre_det->get_element( ).
ENDIF
.


" Not required , context_element is not declared
IF context_element IS NOT INITIAL.
context_element
->get_static_attributes( IMPORTING  static_attributes = ls_lp_req_cre_det ).
ENDIF
.


IF lo_nd_lp_req_cre_det IS NOT INITIAL.
lo_nd_lp_req_cre_det
->get_static_attributes_table( IMPORTING table = lt_lp_req_cre_det ).
ENDIF.

************************************************************************
*  Selected Dates Node Declaration
************************************************************************
DATA lo_nd_lp_date_det TYPE REF TO if_wd_context_node.
DATA lo_el_lp_date_det TYPE REF TO if_wd_context_element.
DATA ls_lp_date_det TYPE wd_this->element_lp_date_det.

lo_nd_lp_date_det
= wd_context->get_child_node( name = wd_this->wdctx_lp_date_det ).

IF lo_nd_lp_date_det IS NOT INITIAL.
lo_el_lp_date_det
= lo_nd_lp_date_det->get_element( ).
ENDIF.

IF lo_el_lp_date_det IS NOT INITIAL.
lo_el_lp_date_det
->get_static_attributes( IMPORTING static_attributes = ls_lp_date_det ).
ENDIF.


ls_lp_req_cre_det
-lw_date = ls_lp_date_det-sel_begda.
ls_lp_req_cre_det
-rw_date = ls_lp_date_det-sel_endda.

" add this line

append ls_lp_req_cre_det to lt_lp_req_cre_det .


************************************************************************
*  Binding the table and Work Area
************************************************************************
context_element
->set_static_attributes( static_attributes = ls_lp_req_cre_det ).

IF lo_nd_lp_req_cre_det IS NOT  INITIAL.
lo_nd_lp_req_cre_det
->bind_table( new_items = lt_lp_req_cre_det set_initial_elements = abap_true ).
ENDIF.


Let me know if any further assistance needed.

Regards,

Rama

Former Member
0 Kudos

Hi Rama,

I tried all the possibility my doubt is I am in EHP4. I tried the same logic in EHP5 system its working fine.

I doubt is there any problem with the calendar ui element in EHP4. Is there any notes available to solve this. Kindly suggest.

Thanks,

Nalla B.

ramakrishnappa
Active Contributor
0 Kudos

Hi Nalla,

I think there should be a note for fixing this issue.

Could you try creating one sample WD component with date navigator in your system and check whether it works ?

I have checked for notes on this issue but I could not get it.

I suspect  the issue is with leave request standard component, if so, you can search notes by using standard component name.

Please check whether date navigator works in your system in your sample component.

Also, check the date navigator in these standard components if it works in your system

WDR_TEST_EVENTS

WDR_TEST_UI_ELEMENTS

I will also search for notes if I get , let you know .

all the best.

Regards,

Rama

Former Member
0 Kudos

Hi,

I am also getting the same issue, please see below.

Component WDR_TEST_EVENTS in NW Release 7.0 EHP 1 (The Date is not showing the value in correct format).

But i tested Same WDR_TEST_EVENTS in NW Release 7.0 EHP 2(It shows the correct values)

Looks like the the component is different in NW release 7.0 EHP1 & EHP2.

Please advice.

Thanks & Regards,

Rumeshbabu S