Skip to Content
author's profile photo
Former Member

Report Refresh

Hi All,

Is it possible to refresh a report automatically for every one minute.If yes

tell me how to do it manually through coding ?

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Oct 11, 2007 at 03:20 PM

    Dont know if this is any help but an example automatic refresh report can be found here: http://www.sapdevelopment.co.uk/reporting/rep_autorefresh.htm

    *******************************************

    *******************************************

    you can also use CL_GUI_TIMER:

    CREATE OBJECT refresh_timer

    EXCEPTIONS OTHERS = 1.

    IF sy-subrc = 0.

    SET HANDLER event_handler->handle_autorefresh FOR refresh_timer.

    refresh_timer->interval = refr_interval.

    ENDIF.

    Then the front end will wait up to refr_interval seconds.

    *************************************************

    *******************************************

    In release 620 there is Frontend Timer control that you can use. The proxy class for this control is CL_GUI_TIMER. Because the timer runs on the frontend no system resources are used up waiting for the timer to fire. Your report just has to register this timer and respond to the raised event. If you aren't on 620, but you are running the 620 SAPGui, you can back-port this useful proxy class.

    You need to create a class that inherits from the superclass CL_GUI_CONTROL and has a forward declaration for SFES. You need to declare one public constant called EVENTID_FINISHED of type I with an initial value of 1. You need to delare one Public Instance attribute of type I with an initial value of 0. You have to declare one public instance event named FINISHED with no parameters. You will create three Public Methods:

    Constructor

    Interface

    @78\QImporting@ LIFETIME TYPE I OPTIONAL Lifetime

    @78\QImporting@ VALUE( SHELLSTYLE ) TYPE I OPTIONAL Shell Style

    @78\QImporting@ VALUE( PARENT ) TYPE REF TO CL_GUI_CONTAINER OPTIONAL Parent Container

    @03\QException@ ERROR error

    method constructor.

    data clsid(80).

    data event_tab type cntl_simple_events.

    data event_tab_line type cntl_simple_event.

    if clsid is initial.

    data: return,

    guitype type i.

    guitype = 0.

    call function 'GUI_HAS_OBJECTS'

    exporting

    object_model = sfes_obj_activex

    importing

    return = return

    exceptions

    others = 1.

    if sy-subrc ne 0.

    raise error.

    endif.

    if return = 'X'.

    guitype = 1.

    endif.

    if guitype = 0.

    call function 'GUI_HAS_OBJECTS'

    exporting

    object_model = sfes_obj_javabeans

    importing

    return = return

    exceptions

    others = 1.

    if sy-subrc ne 0.

    raise error.

    endif.

    if return = 'X'.

    guitype = 2.

    endif.

    endif.

    case guitype.

    when 1.

    clsid = 'Sapgui.InfoCtrl.1'.

    when 2.

    clsid = 'com.sap.components.controls.sapImage.SapImage'.

    endcase.

    endif.

    call method super->constructor

    exporting

    clsid = clsid

    shellstyle = 0

    parent = cl_gui_container=>default_screen

    autoalign = space

    exceptions others = 1.

    if sy-subrc ne 0.

    raise error.

    endif.

    call method cl_gui_cfw=>subscribe

    exporting

    shellid = h_control-shellid

    ref = me

    exceptions others = 1.

    if sy-subrc ne 0.

    raise error.

    endif.

    • Register the events

    event_tab_line-eventid = zcl_es_gui_timer=>eventid_finished.

    append event_tab_line to event_tab.

    call method set_registered_events

    exporting

    events = event_tab.

    endmethod.

    Cancel

    Interface

    @03\QException@ ERROR Error During Method Call

    method cancel.

    call method call_method

    exporting

    method = 'SetTimer'

    p_count = 1

    p1 = -1

    queue_only = 'X'

    exceptions others = 1.

    if sy-subrc ne 0.

    raise error.

    endif.

    endmethod.

    Run

    Interface

    @03\QException@ ERROR Error

    method run.

    call method call_method

    exporting

    method = 'SetTimer'

    p_count = 1

    p1 = interval

    queue_only = 'X'

    exceptions others = 1.

    if sy-subrc ne 0.

    raise error.

    endif.

    endmethod.

    You also need on Redefinition of method Dispatch.

    Interface

    @78\QImporting@ VALUE( CARGO ) TYPE SYUCOMM Cargo

    @78\QImporting@ VALUE( EVENTID ) TYPE I Event ID

    @78\QImporting@ VALUE( IS_SHELLEVENT ) TYPE CHAR1 Shell Event

    @78\QImporting@ VALUE( IS_SYSTEMDISPATCH ) TYPE CHAR1 OPTIONAL System event

    @03\QException@ CNTL_ERROR Control No Longer Valid

    method dispatch.

    case eventid.

    when eventid_finished.

    raise event finished.

    endcase.

    endmethod.

    *******************************************

    ************************************************

    WAIT UP TO n SECONDS....will tie up a work process.

    Here is a solution.

    Create a function module like this. No parameters

    FUNCTION Z_ENQUE_SLEEP.

    CALL FUNCTION 'ENQUE_SLEEP'

    EXPORTING

    SECONDS = 1.

    ENDFUNCTION.

    Next implement the following report program.

    This is a sample....it should give you an idea of

    what you have to do in your program.

    REPORT ZRICH_0010

    no standard page heading.

    START-OF-SELECTION.

    CALL FUNCTION 'Z_ENQUE_SLEEP'

    STARTING NEW TASK 'WAIT'

    PERFORMING WHEN_FINISHED ON END OF TASK.

    Write:/ sy-datum, sy-uzeit.

    END-OF-SELECTION.

    AT USER-COMMAND.

    SY-LSIND = SY-LSIND - 1.

    CALL FUNCTION 'Z_ENQUE_SLEEP'

    STARTING NEW TASK 'INFO'

    PERFORMING WHEN_FINISHED ON END OF TASK.

    Write:/ sy-datum, sy-uzeit.

    **********************************************************

    • WHEN_FINISHED

    **********************************************************

    FORM WHEN_FINISHED USING TASKNAME.

    • Trigger an event to run the at user-command

    RECEIVE RESULTS FROM FUNCTION 'Z_ENQUE_SLEEP'.

    SET USER-COMMAND 'BUMM'.

    ENDFORM.

    *******************************************

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Vasu,

      I have tried the link you have given,it is giving error while executing the sample program.

      The error is:the main program of the function "Z_ENQUE_SLEEP" does not begin with "FUNCTIONAL-POOL".If possible help me in this regard.

      Thanks.

  • author's profile photo
    Former Member
    Oct 11, 2007 at 03:50 PM

    Hi Padmasri,

    Check out below thread...

    ABAP Development

    Hope it will help you a lot..

    Regards

    ilesh 24x7

    Add comment
    10|10000 characters needed characters exceeded