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

selection screen

Former Member
0 Likes
640

how can we get dynamic clock on selection screen?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
615

Hi,

check this one

CLOCK ON SCREEN. (Thru write statement)

(This sample code will give an insight

to many abapers who are still wondering

about the concept of TIMER IN ABAP

as compared to other programming languages)

The Code : (Just Copy Paste)

REPORT abc NO STANDARD PAGE HEADING.

DATA : wa(72) TYPE c.

*----


CLASS my DEFINITION.

PUBLIC SECTION.

METHODS : run_handler FOR EVENT finished OF cl_gui_timer.

ENDCLASS. "my DEFINITION

DATA timer TYPE REF TO cl_gui_timer.

DATA myh TYPE REF TO my.

----


  • CLASS my IMPLEMENTATION

----


*

----


CLASS my IMPLEMENTATION.

METHOD run_handler.

CALL METHOD timer->run.

PERFORM mylist.

ENDMETHOD. "run_handler

ENDCLASS. "my IMPLEMENTATION

*----


*----


Init

INITIALIZATION.

CREATE OBJECT timer.

CREATE OBJECT myh.

SET HANDLER myh->run_handler FOR ALL INSTANCES.

  • PARAMETERS : a TYPE c.

*----


End of selection

START-OF-SELECTION.

WRITE sy-uzeit TO wa.

WRITE wa.

timer->interval = '0.5'.

CALL METHOD timer->run.

*----


FORM mylist.

WRITE sy-uzeit TO wa.

MODIFY LINE 1 LINE VALUE FROM wa.

ENDFORM. "MYLIST

Also:

You want to use the function module SAPGUI_PROGRESS_INDICATOR. By using the "Percentage" parameter, it will display the clock.

Reward points if found helpful…..

Cheers,

Chandra Sekhar.

7 REPLIES 7
Read only

matt
Active Contributor
0 Likes
615

The best you can do is get a clock that will update after every event (enter pressed, or function key, or menu option or button).

To get the current time into sy-uzeit, use GET TIME.

matt

Read only

Former Member
0 Likes
616

Hi,

check this one

CLOCK ON SCREEN. (Thru write statement)

(This sample code will give an insight

to many abapers who are still wondering

about the concept of TIMER IN ABAP

as compared to other programming languages)

The Code : (Just Copy Paste)

REPORT abc NO STANDARD PAGE HEADING.

DATA : wa(72) TYPE c.

*----


CLASS my DEFINITION.

PUBLIC SECTION.

METHODS : run_handler FOR EVENT finished OF cl_gui_timer.

ENDCLASS. "my DEFINITION

DATA timer TYPE REF TO cl_gui_timer.

DATA myh TYPE REF TO my.

----


  • CLASS my IMPLEMENTATION

----


*

----


CLASS my IMPLEMENTATION.

METHOD run_handler.

CALL METHOD timer->run.

PERFORM mylist.

ENDMETHOD. "run_handler

ENDCLASS. "my IMPLEMENTATION

*----


*----


Init

INITIALIZATION.

CREATE OBJECT timer.

CREATE OBJECT myh.

SET HANDLER myh->run_handler FOR ALL INSTANCES.

  • PARAMETERS : a TYPE c.

*----


End of selection

START-OF-SELECTION.

WRITE sy-uzeit TO wa.

WRITE wa.

timer->interval = '0.5'.

CALL METHOD timer->run.

*----


FORM mylist.

WRITE sy-uzeit TO wa.

MODIFY LINE 1 LINE VALUE FROM wa.

ENDFORM. "MYLIST

Also:

You want to use the function module SAPGUI_PROGRESS_INDICATOR. By using the "Percentage" parameter, it will display the clock.

Reward points if found helpful…..

Cheers,

Chandra Sekhar.

Read only

matt
Active Contributor
0 Likes
615

Chandra - very nice! But he wants the clock on the selection screen.

matt

Read only

0 Likes
615

with this will the time move on automatically?

Read only

0 Likes
615

No. there has to be some event, like click or Hit ENTER. then only the clock will move forward.

A

Read only

matt
Active Contributor
0 Likes
615

> No. there has to be some event, like click or Hit

> ENTER. then only the clock will move forward.

>

> A

Wrong. Run the program.

matt

Read only

Former Member
0 Likes
615

Try this. note sure if you want this.

PARAMETER: p_tim TYPE uzeit MODIF ID hid.
DATA: lv TYPE uzeit.

INITIALIZATION.

  LOOP AT SCREEN.
    IF screen-group1 = 'HID'.
      screen-input = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
  GET TIME FIELD p_tim.