Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

REFRESH A REPORT

Former Member
0 Kudos

Hi expert,

How can we refresh our report from updating so that the user will see the most update report with log out the report and log in again? what technic can we apply?

pls guide and advise.

1 ACCEPTED SOLUTION

meikandan_krishnan2
Participant
0 Kudos

Hi ,

One solution is ,

Give a button in the output.

then ,

In At User command ,

Submit the same program with the same selection set.

Regards

Meikandan

7 REPLIES 7

Former Member
0 Kudos

Hi,

If it is an alv report.

In the user_command subroutine.. give rs_selfield-refresh = 'X'.

For normal reports. have a refresh button..then select the data again and display the screen..

Thanks

Naren

meikandan_krishnan2
Participant
0 Kudos

Hi ,

One solution is ,

Give a button in the output.

then ,

In At User command ,

Submit the same program with the same selection set.

Regards

Meikandan

0 Kudos

thank you for your reply,

can you provide some example on how to resubmit the program when refresh?

pls guide.

varma_narayana
Active Contributor
0 Kudos

Hi..

We can do this in ALV report using ABAP Objects.

By calling the method REFRESH_TABLE_DISPLAY of the Class CL_GUI_ALV_GRID.

reward if helpful.

Former Member
0 Kudos

u r report add one variable. that varable sy-user longon time or update one add on table example ztable.

that table when run the report automatical update that db table.

Former Member
0 Kudos

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.

mahaboob_pathan
Contributor
0 Kudos

Hi,

if it in bdc

u have to mention refresh bdcdata.

in loop where u r using bdcdata.

or

If it is an alv report.

In user_command subroutine give

rs_selfield-refresh = 'X'.

where as in normal reports.

we will have a refresh button.select the data and click that button and display the screen..

then refresh dat will be shown.