Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Author: Sandipan Das
Submitted: 03/26/2009

Description : This is a small sample program of List report which get automatically refreshed with the current data ,after every 5 seconds. This program may come very handy to the production line scenarios where customer may require a report to show the current data for the ongoing process.

\*&---------------------------------------------------------------------\*
\*& Report  ZNEW_LOCO_DISPLAY
\*&---------------------------------------------------------------------\*
REPORT  znew_loco_display NO STANDARD PAGE HEADING.
DATA : it_final TYPE STANDARD TABLE OF zloco_arr,
       wa_final TYPE zloco_arr.
DATA : w_equnr TYPE equi-equnr.
 
GET TIME.
PERFORM display_final_tab.
CALL FUNCTION 'Z_WAIT_5_SECS'
  STARTING NEW TASK 'IF'
  PERFORMING start_refresh ON END OF TASK.
AT USER-COMMAND.
  IF sy-ucomm = 'REFR'.
    GET TIME.
    PERFORM display_final_tab.
    CALL FUNCTION 'Z_WAIT_5_SECS'
      STARTING NEW TASK 'IF'
      PERFORMING start_refresh ON END OF TASK.
  ENDIF. 
\*---------------------------------------------------------------\-
\* Program Subroutines
\*---------------------------------------------------------------\-
FORM start_refresh USING taskname.
\* The SET USER-COMMAND initiates the communication back to the program
  SET USER-COMMAND 'REFR'.
ENDFORM.                    "START_REFRESH
\*&---------------------------------------------------------------------\*
\*&      Form  display_final_tab
FORM display_final_tab.
  REFRESH: it_final.
  sy-lsind = 0.
  SELECT equnr
         zarr_date
         zarr_time
         INTO CORRESPONDING FIELDS OF TABLE it_final
         FROM zloco_arr
         WHERE zstatus = ' '.
  IF sy-subrc <> 0.
    WRITE AT / 'No LOCOs present....'.
  ELSE.
    FREE MEMORY ID '%_LIST'.
    FREE MEMORY.
    TYPE-POOLS line.
    ULINE AT /1(52).
    WRITE:/1 sy-vline , 'Eqipment No.' COLOR 5 , 20 sy-vline , 'Arrival Date' COLOR 5 , 36 sy-vline ,
                     'Arrival Time' COLOR 5 , 52 sy-vline .
    ULINE AT /1(52).
    LOOP AT it_final INTO wa_final.
      WRITE:/1 sy-vline , wa_final-equnr COLOR 2 , 20 sy-vline , wa_final-zarr_date COLOR 2 , 36 sy-vline ,
                          wa_final-zarr_time  COLOR 2 , 52 sy-vline.
      ULINE AT /1(52).
    ENDLOOP.
  ENDIF.
ENDFORM.                    " display_final_tab
 
FUNCTION z_wait_5_secs.
\*"---------------------------------------------------------------------\-
\*"*"Local Interface:
\*"---------------------------------------------------------------------\-
  DATA: ztime LIKE sy-uzeit.
  GET TIME.
  ztime = sy-uzeit + 5.
  DO.
    GET TIME.
    IF sy-uzeit >= ztime.
      EXIT.
    ENDIF.
  ENDDO.
ENDFUNCTION.