SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Автоматическое обновление ALV-грида по таймеру



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Fri Oct 01, 2010 9:32 am    Post subject: Автоматическое обновление ALV-грида по таймеру Reply with quote

Автор: Бородин Игорь
Источник: Авто-рефрешь

Класс:
Code:
*----------------------------------------------------------------------*
*       CLASS lcl_periodic_callback DEFINITION
*----------------------------------------------------------------------*
CLASS lcl_periodic_callback DEFINITION.
  PUBLIC SECTION.
    METHODS:
      constructor      IMPORTING i_interval      TYPE int4
                                 i_performing    TYPE c,
      handle_timeout   FOR EVENT finished OF cl_gui_timer.

  PRIVATE SECTION.
    DATA:
      li_timer         TYPE REF TO cl_gui_timer,
      l_performing     TYPE char30.

ENDCLASS.                    "lcl_grid_refresher DEFINITION
*----------------------------------------------------------------------*
*       CLASS lcl_periodic_callback IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS lcl_periodic_callback IMPLEMENTATION.
  METHOD constructor.

    l_performing = i_performing.

*   таймер: инициализация
    CREATE OBJECT:  li_timer.
    li_timer->interval = i_interval.
    SET HANDLER handle_timeout FOR li_timer.

*   таймер: запуск
    li_timer->run( ).

  ENDMETHOD.                    "constructor
  METHOD handle_timeout.

*   таймер: перезапуск
    li_timer->cancel( ).
    li_timer->run( ).

*   callback
    PERFORM (l_performing) IN PROGRAM (sy-cprog) IF FOUND.

  ENDMETHOD.                    "handle_timeout
ENDCLASS.                    "lcl_periodic_callback IMPLEMENTATION


Пример использования:
Code:
DATA gi_periodic_callback TYPE REF TO lcl_periodic_callback.

CREATE OBJECT gi_periodic_callback
  EXPORTING
    i_interval   = 1                      " -->> время, в секундах
    i_performing = 'REFRESH_ALVGRID'.     " -->> ваша callback-подпрограмма


*&---------------------------------------------------------------------*
*&      Form  REFRESH_ALVGRID
*&---------------------------------------------------------------------*
*       ...а здесь вы обновляете свой грид
*----------------------------------------------------------------------*
FORM refresh_alvgrid.

ENDFORM.                    "REFRESH_ALVGRID
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.