cancel
Showing results for 
Search instead for 
Did you mean: 

Another event handler for a dats input field.

Former Member
0 Kudos

Hi.

I need another event handler for a dats input field.

When i open the calendar, i select a date and then i need an event handler...

i only see on enter.

has anybody an idea???

thanks

marcus

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi. i have some problems...

i create 2 WD components. test1 and test2.

in TEST2 i create two input fields from type begda and endda.

in TEST1 i create the date navigator element on the view

Step 1-6 in WDC TEST1

###########

1. Create a new web dynpro component so that we can do component usage here. OK

2. go to the view of the component and insert a date navigator element with following properties

Months per column and months per row to 1

startswith to sy-datum OK

3. now create a context attribute which can be accessed in your main component, bind it with firstselecteddate property. I create an context attribute called "DATE" in the component controller and mapped it in the view and bind it with the firstselecteddate property

4. give an event in ondayselect and set the above attribute in this method. this is not required here... as

automatically this will be set when you select date. I set the attribute "DATE" with the importing parameter day. Where can i call the event?

5. double click on the name of the cmponent and click on the implemented interface and add this interface IWD_VALUE_HELP for value help. OK

6. a method in component controller will now appear with name SET_VALUE_HELP_LISTENER write this line of code there

wd_this->value_help_listener

= listener . if not present. listener is an importing parameter to this method with type ref to IF_WD_VALUE_HELP_LISTENER i create "value_help_listener" as an attribute in the componentcontroller and set it in the set_value_help_listener method.

Step 1-6 in WDC TEST2 ?

###########

7. now in main component do component usage

in the WD Component TEST2 i use the component TEST1 called "usage_test1" and in the componentcontroller and in the view of WD TEST2 i add the components too.

8. create an event there say ON_CAL_CLOSE method type event handler event VH_WINDOW_CLOSED and specify your used component.

*where must i create the event? in the view or in the componentcontroller? and what must i specify?

i dont understand the following steps... please help me.*

9. get the attribute here from the used component which you have used for getting date from navigator.

10. also the context attribute you are binding with your input field give its type string and input help mode OK

Freely Programmed and Input Help Component Usage your name specified for component usage. OK

Note if you want to use the same thing for endda also you have to create seprate ref of that used comonent. OK

regards

marcus ventur

pranav_nagpal2
Contributor
0 Kudos

Hi,

Please see step 4 again.

4. Create an event and selectdate and in the properties of date navigator bind this event with ondayselect.

in this event write this code

wd_comp_controller->value_help_listener->close_window( ).

till step 6 it is ok now there are two more things you need to do.

1. go to component controller of used component and click on event tab two events will come there VH_WINDOW_CLOSED and VH_WINDOW_OPENED check there corressponding interface checkbox.

2. double click on the windows you will see a window wd_value_help embed your view in this window as well.

Please see step 8 again.

8. Double click on componet controller and click on method tab. give any name say cal_close and in method type select event handler. now in under event column from f4 help select VH_WINDOW_CLOSED. now this event will be automatically called when you select date from the date navigator. so now in this event you can write your code and you can set the endda here. just get the begda from the used component context attribute you named it "DATE"

regards

Pranav

Answers (6)

Answers (6)

Former Member
0 Kudos

THANKS !!!!!!!!!!!!!!!!!!!!!!!! IT WORKS.......

Former Member
0 Kudos

hi. thanks for your reply, but that doesn't work with an date navigator element, because the date input fields are in a table......

oh, moment please.... i try it

Edited by: Marcus Ventur on Dec 16, 2008 10:57 AM

Former Member
0 Kudos

hi.

i have 2 dats fields begda and endda.

if i select an begda date, then endda must be filled with the same date too.

sy-datum->16.12.2008

so the calendar of the begda field starts in december. i scroll to august and select an date. then endda must be have the same date and so i needn scroll in the endda field from december to august again...

that is my problem.

pranav_nagpal2
Contributor
0 Kudos

Hi,

I think it will be possible through the following steps.....

1. Create a new web dynpro component so that we can do component usage here.

2. go to the view of the component and insert a date navigator element with following properties

Months per column and months per row to 1

startswith to sy-datum

3. now create a context attribute which can be accessed in your main component, bind it with firstselecteddate property.

4. give an event in ondayselect and set the above attribute in this method. this is not required here... as

automatically this will be set when you select date.

5. double click on the name of the cmponent and click on the implemented interface and add this interface IWD_VALUE_HELP for value help.

6. a method in component controller will now appear with name SET_VALUE_HELP_LISTENER write this line of code there

wd_this->value_help_listener

= listener . if not present. listener is an importing parameter to this method with type ref to IF_WD_VALUE_HELP_LISTENER

7. now in main component do component usage

8. create an event there say ON_CAL_CLOSE method type event handler event VH_WINDOW_CLOSED and specify your used component.

9. get the attribute here from the used component which you have used for getting date from navigator.

10. also the context attribute you are binding with your input field give its type string and input help mode

Freely Programmed and Input Help Component Usage your name specified for component usage.

Note if you want to use the same thing for endda also you have to create seprate ref of that used comonent.

regards

Pranav.

Edited by: Pranav Nagpal on Dec 16, 2008 10:32 AM

pranav_nagpal2
Contributor
0 Kudos

Hi Marcus,

>

> When i open the calendar, i select a date and then i need an event handler...

please specify why exactly you want an event. I had done the same thing but my requirement was that i need to display date in dd-mmm-yyyy format and not in dd-mm-yyyy.

Please see the link below for more help...

link:

Regards,

Pranav

Edited by: Pranav Nagpal on Dec 16, 2008 8:43 AM

Former Member
0 Kudos

hi ,

whn u select tht date , thn call tht on action method

Former Member
0 Kudos

what must i do and what is tht?

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I'm afriad that you only have the events that are exposed by the framework. There is no supported way to hook additional events.