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

Automatic Refresh Report - periodically refreshes results



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> List Generation, LDB, Spool Process, SAP Query, Report Painter
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Sun Oct 14, 2007 6:45 pm    Post subject: Automatic Refresh Report - periodically refreshes results Reply with quote

The below code demonstrates how to create a simple report which automatically updates itself every 10 seconds and displays the new results on screen. This is without any intervention from the user.

Code:

* Automatic refresh report
*.......................................................................
*: Report:  ZAUTO_REFRESH                                              :
*:                                                                     :
*: Author:  SAPDev.co.uk                                               :
*:                                                                     :
*: Description: Display a report which automatically updates itself    :
*:              every 10 seconds                                       :
*:                                                                     :
*:.....................................................................:
REPORT zauto_refresh .
DATA: g_init_once,
      ok_code(20),
      g_ref_from_timer.

TYPES: BEGIN OF t_ekko,
  ebeln TYPE ekpo-ebeln,
  ebelp TYPE ekpo-ebelp,
  statu TYPE ekpo-statu,
  aedat TYPE ekpo-aedat,
  matnr TYPE ekpo-matnr,
  menge TYPE ekpo-menge,
  meins TYPE ekpo-meins,
  netpr TYPE ekpo-netpr,
  peinh TYPE ekpo-peinh,
 END OF t_ekko.

DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
      wa_ekko TYPE t_ekko.


IF g_init_once <> 'X'.
  g_init_once = 'X'.
  CALL FUNCTION 'Z_ENQUE_SLEEP'
     STARTING NEW TASK 'WAIT'
     PERFORMING when_finished ON END OF TASK.

ENDIF.

WRITE:/ 'wait for 10 sec....'.

AT USER-COMMAND.
  CASE ok_code.
    WHEN 'FCT_R'.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekko.
      WRITE:/ sy-uzeit. "Time
      LOOP AT it_ekko INTO wa_ekko.
        WRITE:/ wa_ekko-ebeln, wa_ekko-ebelp.
      ENDLOOP.
      sy-lsind = 0.
      IF g_ref_from_timer = 'X'.

        CALL FUNCTION 'Z_ENQUE_SLEEP'
          STARTING NEW TASK 'INFO'
          PERFORMING when_finished ON END OF TASK.

        g_ref_from_timer = ''.
      ENDIF.
  ENDCASE.


*---------------------------------------------------------------------*
*       FORM WHEN_FINISHED                                            *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  TASKNAME                                                      *
*---------------------------------------------------------------------*
FORM when_finished USING taskname.
  RECEIVE RESULTS FROM FUNCTION 'Z_ENQUE_SLEEP'.

  g_ref_from_timer = 'X'.

* Trigger an event to run the at user-command
  SET USER-COMMAND 'FCT_R'.
  ok_code = 'FCT_R'.
  sy-ucomm = 'FCT_R'.

ENDFORM.                    " WHEN_FINISHED

    

*Signiture for creating Function module used above
FUNCTION Z_ENQUE_SLEEP.
*"----------------------------------------------------------------------
*"*"Local interface:
*"----------------------------------------------------------------------
 wait up to 10 seconds.

ENDFUNCTION.
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 -> List Generation, LDB, Spool Process, SAP Query, Report Painter 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.