cancel
Showing results for 
Search instead for 
Did you mean: 

Get date from Date Navigator

Former Member
0 Kudos

Hi folks ,

How to get a date from Date Navigator ,When i click a date in date navigator in my view how can i get the click date in Web dynpro ABAP .

Regards,

Amit Teja V

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks..

Former Member
0 Kudos

hi,

->bind the FirstSelectedDate Property of date navigator with a Context Attribute of Type D.

->Now make an Action for OnDaySelect of DateNavigator.

->In the OnAction , Read the Context Attribute which is binded to Date Navigator.

Reading a context Attribute is done by Code Wizard(control +F7).

Now you have the value of date in this context and you can show it in TextView or where ever you wants.

For showing the Date in TextView , set the Attribute for TextView.

Thanx

Former Member
0 Kudos

Hi ,

Thanks for response ,My requiremnt is slightly different

When i click a date the date should be populated in POP up window .

I have already created a POP up window ,But i am unable to bind the data to the POP window.

Regards,

Amit Teja V

Former Member
0 Kudos

hi,

Your req is not clear.

Is your date navigator in different window or in pop up window ?

n what you want is to click on date and date should be filled in Pop up window and pop up window is not opened yet ?

Former Member
0 Kudos

HI,

I will have two views

first view i will have calender in that when i click a date

i will move to other view through a POPwindow (this is already done ).When that view appears i want to print what date i have clicked there in first view

Regards,

Amit Teja V

Former Member
0 Kudos

hi,

If you have two views, then you can place the same attribute as you have for Date Navigator in the Component Controller. Map the Attributes of Component controller and the view.

In the second view , you can access the attribute of component controller by having same attribute in this view too.

In all, make an Attr in Comp Controller -> Map it with First View having Date Navigator ->Make similar attribute in Second View ->Bind it with Comp Controller.

Now you can access the Date in your second view.

Thanx.

Former Member
0 Kudos

Hi Amit,

You must have created an Event Handler for Event 'OnDaySelect'.

In this event handler method write the following code.

Create an importing parameter 'Day'  Type D in the event handler method.

write day to wd_comp_controller->selected_date. " selected_date is a attribute of component controller.

Now once a date is selected, the event 'OnDaySelect' will be triggered and you will get the selected date in your component controller attribute. Use this attribute in your next view.

Hope it helps.

Regards,

Radhika.

Former Member
0 Kudos

HI,

Thanks for the respomse could you please little elaborate .

When i am trying to do the same by creating selected_date in component controller and Day type d in importing parameters .

i am getting 2 Errors one is

Selected _date is Unknown

and next one is

"DAY" cannot be converted to a character-type field.

Regards,

Amit Teja V

Former Member
0 Kudos

Follow these steps :

1. Goto Component controller-> Attributes tab -> 'Selected_Date' type String

2. Goto the event handler method for 'OnDaySelect'

below wdevent create a new importing parameter 'Day' type D.

3. In this method write the following code.

data: l_date type d.

 write day to l_date.
 wd_comp_controller->selected_date = l_date.

Regards,

Radhika.

Former Member
0 Kudos

Hi,

I am getting the following error.

"DAY" cannot be converted to a character-type field.

The type of "L_DATE" cannot be converted to the type of "ME->WD_COMP_CONTROLLER->SELECTED_DATE".

former_member40425
Contributor
0 Kudos

Hi,

Create Selected_Day attribute of type D only.

You will not get error.

I hope it helps.

Regards,

Rohit

Former Member
0 Kudos

Hi,

How to pass the same data to a POP UP window

former_member40425
Contributor
0 Kudos

Hi,

Create a Context attribute (suppose name of attribute is DAY) of type D .

Then set the attribute with the Attribute selected date.

You can use following code to set the context attribute.


 DATA lo_el_context TYPE REF TO if_wd_context_element.
  DATA ls_context TYPE wd_this->element_context.
  DATA lv_day TYPE wd_this->element_context-day.
  
  lv_day = wd_comp_controller->selected_date.

* get element via lead selection
  lo_el_context = wd_context->get_element( ).

* set single attribute
  lo_el_context->set_attribute(
    name =  `DAY`
    value = lv_day ).

Now use can use this attribute to show on POP window.

Former Member
0 Kudos

Directly set the value as follows, as your variable is of type D only

lo_el_context->set_attribute(
    name =  `Attribute Name`      
    value = wd_comp_controller->selected_date ).