Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

creating timer in abap

Former Member
0 Likes
6,341

Hello all,

I am writing a module pool program wherein the user has to answer a few questions in a certain period of time (say 10 minutes). At the top left hand corner, a timer has to be displayed which shows the remaining time left for the questions to be answered. Can someone please help me how to do this without using ABAP OOPS as am not familiar with it. Thanks.

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
2,827

This has nothing to do with ABAP Objects. You can write module pool programs with or without oop techniques. (I do suggest that you become familiar with ABAP Objects as it is increasingly becoming a necessary skill).

However, what you are requesting is not really possible. Web Dynpro is the sensible approach. That has a timer component. You can run web dynpro applications in SAPGui.

matt

8 REPLIES 8
Read only

matt
Active Contributor
0 Likes
2,828

This has nothing to do with ABAP Objects. You can write module pool programs with or without oop techniques. (I do suggest that you become familiar with ABAP Objects as it is increasingly becoming a necessary skill).

However, what you are requesting is not really possible. Web Dynpro is the sensible approach. That has a timer component. You can run web dynpro applications in SAPGui.

matt

Read only

Former Member
0 Likes
2,827

Check the blog below, it uses the class CL_GUI_TIMER  -

http://aaabap.blogspot.com/2011/02/abap-timer-part-3.html

Cheers!

Abhinab

Read only

0 Likes
2,827

Thanks Abhinab, but unfortunately I dont know ABAP OOPS as I mentioned before. So I cant understand the contents of the link which deals with methods, classes etc.

Read only

matt
Active Contributor
0 Likes
2,827

Well, I stand corrected. I was not aware of this class. It's nice to learn something new!

Read only

Former Member
0 Likes
2,827

Hi Manish,

You can create an FM and call it in separate task and on finish of timer you can trigger.

THIS FM should be RFC Enabled

FUNCTION ZTIMER.

DATA: ZTIME LIKE SY-UZEIT.

GET TIME.

ZTIME = SY-UZEIT + 300.

DO.

  GET TIME.

  IF SY-UZEIT >= ZTIME.

     EXIT.

   ENDIF.

ENDDO.

ENDFUNCTION.

Then in begining of your Program call this FM.

CALL FUNCTION 'ZTIMER'

   STARTING NEW TASK 'ZTIMER'

   PERFORMING END_TIMER ON END OF TASK.

Write a Perform "END_TIMER" to do what you want on finish.

Cheers

Read only

custodio_deoliveira
Active Contributor
0 Likes
2,827

Hi Manish,

You can use class CL_GUI_TIMER. Check this example:

SAP Community Network Wiki - Code Gallery - Automatic Data Refresh on Module pool Screen

Regards,

Custodio

@zcust01

Read only

custodio_deoliveira
Active Contributor
0 Likes
2,827

And you can also check standard program SAP_TIMER_DEMO.

cheers,

Custodio

@zcust01

Read only

Former Member
0 Likes
2,827

Hi

.

Use below logic.

Data:      t11 type tzonref-tstamps,

      t12 type TZONREF-TSTAMPL,

      v_t11 type tzonref-tstamps,

      v_t12 type TZONREF-TSTAMPL.

GET TIME STAMP FIELD  t11.

GET TIME STAMP FIELD  t12.

v_t11 = t1..

v_t12 = t12.

clear:t12, t11.

GET TIME STAMP FIELD  t11.

GET TIME STAMP FIELD  t12.

difference between v_t11 to t11 or v_t12 to t12.

check with session time with diff time.

After that call FM (p_time should time diff)

  CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

    EXPORTING

      percentage = p_time

      text       = p_stage.

Better put this logic in NEXT button which one you use to move question to another question.

Thanks.

NJ

Message was edited by: nagaraj j