0% found this document useful (0 votes)
28 views3 pages

Auto Refresh ALV Using CL - GUI - TIMER - My Experiments With ABAP

The document discusses how to implement auto-refresh functionality in ALV using the CL_GUI_TIMER class in ABAP. It outlines the steps required to set up the timer, including defining event handling methods and initializing the timer object. The blog also provides sample code demonstrating the implementation of this functionality.

Uploaded by

ANDRE DWI CAHYA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views3 pages

Auto Refresh ALV Using CL - GUI - TIMER - My Experiments With ABAP

The document discusses how to implement auto-refresh functionality in ALV using the CL_GUI_TIMER class in ABAP. It outlines the steps required to set up the timer, including defining event handling methods and initializing the timer object. The blog also provides sample code demonstrating the implementation of this functionality.

Uploaded by

ANDRE DWI CAHYA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

26/12/22 16.

56 Auto refresh ALV using CL_GUI_TIMER - My Experiments with ABAP

MY EXPERIMENTS WITH ABAP

HOME » ABAP » AUTO REFRESH ALV USING CL_GUI_TIMER


Search …

Auto refresh ALV using CL_GUI_TIMER


SUBSCRIBE TO BLOG VIA
Posted on: April 16, 2014 | By: Pawan Kesari – 1 Comment
EMAIL
Auto refresh functionality in ALV can be implemented using class CL_GUI_TIMER. In this blog I will Email Address
explain how to use this class.
SUBSCRIBE
Class CL_GUI_TIMER raises event FINISHED after the timer has completed its INTERVAL in
seconds. You can create event listener method for event FINISHED and in this method you can
code/call logic which will refresh data in ALV.
TOP POSTS & PAGES
To put in step-by-step fashion, you need to do following to implement this Auto refresh ALV CDS-Fiori Elements - Object Page Facets
functionality.
SEGW - OData MPC_EXT-DEFINE Code
Collection
1. Define reference of class CL_GUI_TIMER.
Consuming Webservice in SAP ABAP
2. Define event handling method for event FINISHED of class CL_GUI_TIMER.
3. Initialise object CL_GUI_TIMER. How to upload Excel to SAP(using ABAP)

4. Bind event handling method to object of CL_GUI_TIMER Call Transaction MM03 with Specific Tab

5. Set interval for timer.


6. Call method RUN of CL_GUI_TIMER.
RECENT POSTS
7. Your event handing method will be call after interval has reached. In event handling method
once you have refreshed ALV data call RUN method of CL_GUI_TIMER again to activate SAP Classification System – CDS Modelling
timer. Note that timer doesn’t automatically repeat itself you will have to call RUN if you
OData Query for Parameterised CDS
want it going.
SAP CDS Cyclic Dependency
Below is working code where you can see all this in action. SAP Fiori Application Translation

SAP Fiori Variant Management


1 REPORT zpwauthorefresh.
2
3 TABLES : spfli.
4 TYPES: tr_carrid TYPE RANGE OF spfli-carrid .
5
6 *--------------------------------------------------------------------*
RECENT COMMENTS
7 * Data
8 *--------------------------------------------------------------------* kapil on How to upload Excel to SAP(using
9 ABAP)
10 *----------------------------------------------------------------------*
11 * CLASS cl_spfli DEFINITION vamsi on Upload General Journal Entries
12 *----------------------------------------------------------------------*
13 * Manish on SAP Fiori Application
14 *----------------------------------------------------------------------*
15 CLASS cl_spfli DEFINITION .
Translation
16
17 PUBLIC SECTION . Lucky on SAP Fiori Application Translation
18 * 1. Define reference of class CL_GUI_TIMER.
19 DATA : ob_timer TYPE REF TO cl_gui_timer . Peter Roehlen on CDS Code Generator for
20 METHODS : set_filter IMPORTING filter TYPE tr_carrid , Domain Fixed Values
21 display_report ,
22 * 2. Define event handling method for event FINISHED of class Aman on SAP List Report Filter Bar Date
23 timer_event FOR EVENT finished OF cl_gui_timer. Format
24
25 PRIVATE SECTION .
26 DATA : r_carrid TYPE tr_carrid , SAP ABAP – Generate HTML - Nhà M.Ò.I - Cửa
27 i_spfli TYPE TABLE OF spfli . Hàng Tiện Lợi on SAP ABAP – Generate
28 HTML
29 DATA : ob_grid TYPE REF TO cl_gui_alv_grid .
30 Önder Öğretmen on How to Implement
31 METHODS : get_data . Manage Cookie Consent
32 ENDCLASS . "cl_spfli DEFINITION Value Help using Smartfield and Odata
33 Annotation
To provide the best experiences, we use technologies like cookies to store and/or
34 access device information. Consenting to these technologies will allow us to process
*----------------------------------------------------------------------*
35 * CLASS cl_spfli IMPLEMENTATION Mohit
data such as browsing behavior Sharma
or unique IDs on Upload
on this General
site. Not Journal
consenting or
36 withdrawing consent, may adversely
*----------------------------------------------------------------------* Entriesaffect certain features and functions.
37 *
38 *----------------------------------------------------------------------* anildasari7 on Upload General Journal
39 CLASS cl_spfli IMPLEMENTATION . ACCEPT DENY VIEW PREFERENCES
40 Entries
41 METHOD set_filter .
Cookie Policy Site Map 
42 me->r_carrid = filter .

https://www.samplecodeabap.com/auto-refresh-alv/#:~:text=Auto refresh functionality in ALV,completed its INTERVAL in seconds. 1/3


26/12/22 16.56 Auto refresh ALV using CL_GUI_TIMER - My Experiments with ABAP
43 ENDMETHOD . "set_filter
44
45 METHOD get_data .
46 SELECT *
47 INTO TABLE i_spfli
48 FROM spfli
49 WHERE carrid IN r_carrid .
50 ENDMETHOD . "get_data
51
52 METHOD timer_event .
53
54 me->get_data( ) .
55
56 IF me->ob_grid IS INITIAL .
57 CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
58 IMPORTING
59 e_grid = ob_grid.
60 ENDIF.
61
62 CALL METHOD ob_grid->check_changed_data .
63
64 MESSAGE sy-uzeit TYPE 'S' .
65
66 * 7. Call RUN method of CL_GUI_TIMER again to activate timer
67 me->ob_timer->run( ) .
68
69 ENDMETHOD . "timer_event
70
71 METHOD display_report .
72
73 me->get_data( ) .
74
75 CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
76 EXPORTING
77 i_structure_name = 'SPFLI'
78 TABLES
79 t_outtab = me->i_spfli.
80 ENDMETHOD . "display_report
81
82
83 ENDCLASS . "cl_spfli IMPLEMENTATION
84
85 DATA : ob_spfli TYPE REF TO cl_spfli ,
86 ob_timer TYPE REF TO cl_gui_timer .
87
88 *--------------------------------------------------------------------*
89 * Selection Screen
90 *--------------------------------------------------------------------*
91 SELECT-OPTIONS s_carrid FOR spfli-carrid .
92 PARAMETERS : p_refres TYPE char01 AS CHECKBOX ,
93 p_int TYPE i .
94
95 *--------------------------------------------------------------------*
96 * Start of Selection
97 *--------------------------------------------------------------------*
98 START-OF-SELECTION .
99
100 * Create main object
101 CREATE OBJECT ob_spfli .
102 ob_spfli->set_filter( s_carrid[] ) .
103
104 * If Auto refresh required then initialise timer object
105 * Bind event listner method to object
106 * Set interval and call method run
107 IF p_refres IS NOT INITIAL .
108 * 3. Initialise object CL_GUI_TIMER.
109 CREATE OBJECT ob_spfli->ob_timer .
110
111 * 4. Bind event handling method to object of CL_GUI_TIMER
112 SET HANDLER ob_spfli->timer_event FOR ob_spfli->ob_timer .
113
114 * 5. Set interval for timer
115 ob_spfli->ob_timer->interval = p_int .
116
117 * 6. Call method RUN of CL_GUI_TIMER.
118 ob_spfli->ob_timer->run( ) .
119 ENDIF.
120
121 * Display ALV report
122 ob spfli >display report( )

Filed Under: ABAP


Tagged With: alv, auto refresh, code library, report, timer
Manage Cookie Consent

To provide the best experiences, we use technologies like cookies to store and/or
access device information. Consenting to these technologies will allow us to process
« Duplicate Sales Order Check Implement Duplicate Vendor Invoice check
data such as browsing behavior or unique IDs on this site. Not consenting or
during Inbound EDI Processing » may adversely affect certain features and functions.
withdrawing consent,

Cookie Policy Site Map 

https://www.samplecodeabap.com/auto-refresh-alv/#:~:text=Auto refresh functionality in ALV,completed its INTERVAL in seconds. 2/3


26/12/22 16.56 Auto refresh ALV using CL_GUI_TIMER - My Experiments with ABAP

RELATED ARTICLES
SAP Classification System – SAP Fiori Variant Find PFCG Role
CDS Modelling Management

ONE REPLY TO “AUTO REFRESH ALV USING CL_GUI_TIMER”

marcodallolio March 11, 2021 at 9:12 pm

thanks!!!
REPLY

LEAVE A REPLY

Enter your comment here...

COPYRIGHT TAGS META


Abap Oo ACT Adobe Alv Annotation Log in

This work is licensed under a Creative Call Transaction Cds Cdsview Entries feed
Commons Attribution 4.0 International ChartUIBB Class Code Library
License. Comments feed
Customising Dictionary
Dynamic Programming EDI Email WordPress.org
This means you are free to copy,
distribute, or transmit any of this blog’s Enhancement Excel Field Symbols
content. However, you must attribute the Fiori-Elements FPM Function Module
content to me in some easily identifiable Implicit Enhancement Module Pool
way (preferably with a link back to the post
Number Range Odata Output Control
from which the content originated).
Performance Portal Report S4cloud
The statements and opinions expressed S4hana Sap Basis SAP Fiori Sap Note
within this blog site are mine and not of Sapom Sapscript Sapui5
any of my employer.
Select Option Smartforms Snippet
Spad Spro Ui5 Value Help

© 2022 My Experiments with ABAP. All Rights Reserved. Cookie Policy (UK) Site Map

Manage Cookie Consent

To provide the best experiences, we use technologies like cookies to store and/or
access device information. Consenting to these technologies will allow us to process
data such as browsing behavior or unique IDs on this site. Not consenting or
withdrawing consent, may adversely affect certain features and functions.

Cookie Policy Site Map 

https://www.samplecodeabap.com/auto-refresh-alv/#:~:text=Auto refresh functionality in ALV,completed its INTERVAL in seconds. 3/3

You might also like