on 03-03-2008 11:30 AM
Hi colleagues,
I'm facing an issue, when I'd like to use two timers on my view. The problem is, that only the event of the timer is triggered, which has the shortest delay. It seems, that as soon as the event handler method for the earliest one is called, it "resets" the another timer as well...
Is this correct behavior?
Cheers,
Peter
Hi Nina,
so let's take an example:
I want to events to be fired in every 30(T1) and every 50(T2) seconds.
Beginning:
T1 on, T2 off
...
30secs passed:
T1 triggered
-> T1 off
-> set T2 delay to 20 (T2 - T1)
-> T2 on
....
50secs passed
T2 triggered
->T2 off
->sett T1 delay to 10 (T1 - ( T2 - T1 )
->T1 on
...
60secs passed
T1 triggered
-> T1 off
-> T2 delay should be 40 (T2 - (T1 - ( T2 - T1 ))) this is more then the delay of T1, therefore it should be triggered first.
Is this complex like this, or I'm the one, who makes it to be complicated?
Best regards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi peter,
I am Sorry , i didn't take into consideration the problem of continuous time triggering.....
Yeah, I am afraid , we have no other option but to use maths
Let say , T1 = 30 & T2 = 50 sec.
In the context use 5 variables: *
1. Enable_T1
2. Delay1(T1)-------> D1 default 30
3.Enable_T2
4. Delay2(T2)-------> D2 default 50
5. P ...( an another variable of int type ) ... default 0.
After 30 secs, T1 is triggered.
whenever T1 is Triggered :
if D1 = D2 = 30 .......only At 150, 300, 450 seconds.
D1 = 30. ....... back to default vale
D2 = 50. ........back to default value
( and the cycle starts from the scratch ...)
endif
if (D1 not equal to D2.)
> if P = 0
1. x = 50 - D1. ...... x is local variable.
2. if x < 30
T1 is Disabled.=> T2 is Enabled.
D2 = x.
else if x > 30
D1 = 30.
P = x.
( T1 remains enabled & T2 Disabled ).
else if x = 30. .......( at 150 seconds)
D1 = D2 = 30.
T1 & T2 both enabled.
>endif.
else if (P not equal to 0.)
D2 = 50 - P.
T1 is Disabled. => T2 is Enabled.
endif.
endif. .........(for D1 not equal to D2 )
3. Rest of the code.
whenever T2 is Triggered :
if D1 Not equal to D2.
1. D1 = 30 - D2.
T2 Disabled => T1 Enabled.
2. P = 0 .
endif.
else. T2 is Disabled. ......... at 150, 300 ,450 seconds.
3. Rest of the code.
I know this is a bit complex, but let me know if this helps...
if u find something more useful then let me know.
Regards......
Aditya Parab
Edited by: aditya parab on Mar 7, 2008 8:33 AM
Edited by: aditya parab on Mar 7, 2008 8:34 AM
Edited by: aditya parab on Mar 7, 2008 8:44 AM
Dear Peter,
Whenever the timed trigger ( t t )with shortest delay is triggered, the other " t t" will automatically get reset.
To avoid this use 'enable' property of the ui-element.
As soon as 1st trigger-event is fired, set its Enable property to abap_false and set Enable property of 2nd trigger to abap_true.
Note that the 'Delay' timing of 2nd needs to be adjusted accordingly.( u can even assign delay dynamically using context binding)
When 2nd trigger-event is fired , do exactly opposit of this.
this will solve your problem.
Regards,
Aditya Parab.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.