cancel
Showing results for 
Search instead for 
Did you mean: 

UI Element that can automatically execute action once?

Former Member
0 Kudos

Hello experts.

I want to trigger action automatically only once at screen starts.

I found out there's Timed Trigger which triggers action every delay seconds.

So I set delay to 1 second. But this triggers action every second.

Is there any UI Element to trigger action only once?

And please let me know if there is proper setting of Timed Trigger that can execute action only once(at start of the screen).

thanks

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi KT,

"I want to trigger action automatically only once at screen starts."

You could use the view's WDDOINIT method, which is executed upon initialization of the view or method WDDOMODIFYVIEW which is executed each time the view refreshes. Method WDDOMODIFYVIEW has a parameter, first_time, that you could check to ensure the logic is executed only once.

IF first_time = abap_true.

        ...

ENDIF.

Cheers,

Amy

Former Member
0 Kudos

Thank you for simple solution!

Answers (3)

Answers (3)

Former Member
0 Kudos

WHY DONT YOU WRITE THE CODE ON wDOMODIFY IN A CONDITION IF FIRST_TIME = TRUE.

Former Member
0 Kudos

Hi,

I guess you can achieve what you want with the help of Time triggered UI element itself. While creating the timed triggered UI element you can create an action method for it. Create a context attribute or view attribute as an indicator and set it to default 1.

At the starting of method check the count = 1 and proceed with the action you want to do and at the end increment the count or clear the count. so next when the event handler method for timed trigger executes the action will fail the condition and skip further processing.

Best Regards,

Arun Krishnamoorthy

guillaume-hrc
Active Contributor
0 Kudos

Hi,

Bind the delay of your TimedTrigger to context attribute that you set to 0 the first time the action is triggered.

Best regards,

Guillaume