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,

I developed a report which is for all modules. Once I excuted it, displays the data. As this report shows live data, which changes contunuously... i want to refresh the report whithout changing the display screen. Is it possible to refresh the report? If yes, plz advice me..

Thanks and Regards,

Dhanunjay.

5 REPLIES 5

Former Member
0 Kudos

hi

call refresh_table_display and then write the statemnt "CALL screen 0". This would forcefully call the PBO of the same screen again and your problem will be solved.

example

In ALV, to refresh the table you have to call the method "refresh_table_display".

Check this program

&----


*& Report ZUS_SDN_TWO_ALV_GRIDS_3

*&

&----


*&

*&

&----


REPORT zus_sdn_two_alv_grids_3.

type-pools: icon.

DATA:

gd_okcode TYPE ui_func,

*

go_docking TYPE REF TO cl_gui_docking_container,

go_splitter TYPE REF TO cl_gui_splitter_container,

go_cell_top TYPE REF TO cl_gui_container,

go_cell_bottom TYPE REF TO cl_gui_container,

go_grid1 TYPE REF TO cl_gui_alv_grid,

go_grid2 TYPE REF TO cl_gui_alv_grid,

gs_layout TYPE lvc_s_layo.

DATA:

gt_knb1 TYPE STANDARD TABLE OF knb1,

gt_knvv TYPE STANDARD TABLE OF knvv.

----


  • CLASS lcl_eventhandler DEFINITION

----


*

----


CLASS lcl_eventhandler DEFINITION.

PUBLIC SECTION.

CLASS-METHODS:

  • handle_double_click FOR EVENT double_click OF cl_gui_alv_grid

  • IMPORTING

  • e_row

  • e_column

  • es_row_no

  • sender.

handle_user_command FOR EVENT user_command OF cl_gui_alv_grid

IMPORTING

e_ucomm

sender,

handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid

IMPORTING

e_object

e_interactive

sender.

ENDCLASS. "lcl_eventhandler DEFINITION

----


  • CLASS lcl_eventhandler IMPLEMENTATION

----


*

----


CLASS lcl_eventhandler IMPLEMENTATION.

METHOD handle_user_command.

  • define local data

DATA:

ls_row TYPE lvc_s_row,

ls_knb1 TYPE knb1.

CHECK ( sender = go_grid1 ).

CHECK ( e_ucomm = 'SAVE' ).

CALL METHOD go_grid1->get_current_cell

IMPORTING

es_row_id = ls_row.

READ TABLE gt_knb1 INTO ls_knb1 INDEX ls_row-index.

CHECK ( ls_knb1-kunnr IS NOT INITIAL ).

PERFORM entry_show_details.

  • Triggers PAI of the dynpro with the specified ok-code

CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).

ENDMETHOD. "handle_user_command

METHOD handle_toolbar.

  • define local data

DATA:

ls_button TYPE stb_button.

ls_button-function = 'SAVE'.

ls_button-icon = icon_system_save.

INSERT ls_button INTO e_object->mt_toolbar index 1.

ENDMETHOD. "handle_toolbar

ENDCLASS. "lcl_eventhandler IMPLEMENTATION

START-OF-SELECTION.

SELECT * FROM knb1 INTO TABLE gt_knb1

WHERE bukrs = '1000'.

  • Create docking container

CREATE OBJECT go_docking

EXPORTING

parent = cl_gui_container=>screen0

ratio = 90

EXCEPTIONS

OTHERS = 6.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Create splitter container

CREATE OBJECT go_splitter

EXPORTING

parent = go_docking

rows = 2

columns = 1

  • NO_AUTODEF_PROGID_DYNNR =

  • NAME =

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Get cell container

CALL METHOD go_splitter->get_container

EXPORTING

row = 1

column = 1

RECEIVING

container = go_cell_top.

CALL METHOD go_splitter->get_container

EXPORTING

row = 2

column = 1

RECEIVING

container = go_cell_bottom.

  • Create ALV grids

CREATE OBJECT go_grid1

EXPORTING

i_parent = go_cell_top

EXCEPTIONS

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Set event handler

SET HANDLER: lcl_eventhandler=>handle_user_command FOR go_grid1,

lcl_eventhandler=>handle_toolbar FOR go_grid1.

CREATE OBJECT go_grid2

EXPORTING

i_parent = go_cell_bottom

EXCEPTIONS

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Display data

gs_layout-grid_title = 'Customers'.

CALL METHOD go_grid1->set_table_for_first_display

EXPORTING

i_structure_name = 'KNB1'

is_layout = gs_layout

CHANGING

it_outtab = gt_knb1

EXCEPTIONS

OTHERS = 4.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

go_grid1->set_toolbar_interactive( ).

gs_layout-grid_title = 'Customers Details (Sales Areas)'.

CALL METHOD go_grid2->set_table_for_first_display

EXPORTING

i_structure_name = 'KNVV'

is_layout = gs_layout

CHANGING

it_outtab = gt_knvv " empty !!!

EXCEPTIONS

OTHERS = 4.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Link the docking container to the target dynpro

CALL METHOD go_docking->link

EXPORTING

repid = syst-repid

dynnr = '0100'

  • CONTAINER =

EXCEPTIONS

OTHERS = 4.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • NOTE: dynpro does not contain any elements

CALL SCREEN '0100'.

  • Flow logic of dynpro (does not contain any dynpro elements):

*

*PROCESS BEFORE OUTPUT.

  • MODULE STATUS_0100.

**

*PROCESS AFTER INPUT.

  • MODULE USER_COMMAND_0100.

END-OF-SELECTION.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"

  • SET TITLEBAR 'xxx'.

  • Refresh display of detail ALV list

CALL METHOD go_grid2->refresh_table_display

  • EXPORTING

  • IS_STABLE =

<b>* I_SOFT_REFRESH =</b>

EXCEPTIONS

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

CASE gd_okcode.

WHEN 'BACK' OR

'END' OR

'CANC'.

SET SCREEN 0. LEAVE SCREEN.

  • User has pushed button "Display Details"

WHEN 'DETAIL'.

    • PERFORM entry_show_details.

  • Simply pass PAI followed by PBO

WHEN OTHERS.

ENDCASE.

CLEAR: gd_okcode.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Form ENTRY_SHOW_DETAILS

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM entry_show_details .

  • define local data

DATA:

ld_row TYPE i,

ls_knb1 TYPE knb1.

CALL METHOD go_grid1->get_current_cell

IMPORTING

e_row = ld_row.

READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.

CHECK ( syst-subrc = 0 ).

SELECT * FROM knvv INTO TABLE gt_knvv

WHERE kunnr = ls_knb1-kunnr.

ENDFORM. " ENTRY_SHOW_DETAILS

<b>Reward if it useful.</b>

<b>Auto Refresh ALV List</b>

This report displays User's info (SM04) using the FM : REUSE_ALV_LIST_DISPLAY.The list is auto-refreshed (refresh

time : 5 seconds)

REPORT z_alv_auto_refresh.

>********************************************************************

  • This report displays User's info (SM04) using the FM : *

  • REUSE_ALV_LIST_DISPLAY *

  • The list is auto-refreshed (refresh time : 5 seconds) *

----


TYPE-POOLS: slis. " ALV Global Types

DATA :

gt_user LIKE uinfo OCCURS 0 WITH HEADER LINE. " User info in SM04

----


START-OF-SELECTION.

PERFORM f_read_data.

PERFORM f_display_data.

----


  • Form F_LIRE_DATA

----


<b>FORM f_read_data.

REFRESH gt_user.

  • Get User's info

CALL FUNCTION 'THUSRINFO'

TABLES

usr_tabl = gt_user.

  • Wait in a task

PERFORM f_call_rfc_wait.

ENDFORM. " F_READ_DATA</b>----


  • Form F_DISPLAY_DATA

----


FORM f_display_data.

DEFINE m_sort.

add 1 to ls_sort-spos.

ls_sort-fieldname = &1.

append ls_sort to lt_sort.

END-OF-DEFINITION.

DEFINE m_event_exit.

clear ls_event_exit.

ls_event_exit-ucomm = &1.

ls_event_exit-after = 'X'.

append ls_event_exit to lt_event_exit.

END-OF-DEFINITION.

DATA :

ls_layout TYPE slis_layout_alv,

lt_sort TYPE slis_t_sortinfo_alv,

ls_sort TYPE slis_sortinfo_alv,

lt_event_exit TYPE slis_t_event_exit,

ERPGenie.COM ABAP Tips and Tricks Database

http://erpgenie.com/abaptips Powered by Joomla for ERPGenie.COM! Generated: 20 May, 2007, 21:01

ls_event_exit TYPE slis_event_exit.

  • Build Sort Table

m_sort 'ZEIT'.

  • Build Event Exit Table

m_event_exit '&NTE'. " Refresh

ls_layout-zebra = 'X'.

ls_layout-colwidth_optimize = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

i_callback_user_command = 'USER_COMMAND'

is_layout = ls_layout

i_structure_name = 'UINFO'

it_sort = lt_sort

it_event_exit = lt_event_exit

TABLES

t_outtab = gt_user.

ENDFORM. " F_DISPLAY_DATA

----


  • FORM USER_COMMAND *

----


FORM user_command USING i_ucomm TYPE syucomm

is_selfield TYPE slis_selfield. "#EC CALLED

CASE i_ucomm.

WHEN '&NTE'.

<b>PERFORM f_read_data.</b>

is_selfield-refresh = 'X'.

SET USER-COMMAND '&OPT'. " Optimize columns width

ENDCASE.

ENDFORM. " USER_COMMAND

----


  • Form F_CALL_RFC_WAIT

----


FORM f_call_rfc_wait.

DATA lv_mssg(80). "#EC NEEDED

  • Wait in a task

CALL FUNCTION 'RFC_PING_AND_WAIT' STARTING NEW TASK '001'

PERFORMING f_task_end ON END OF TASK

EXPORTING

seconds = 5 " Refresh time

busy_waiting = space

EXCEPTIONS

RESOURCE_FAILURE = 1

communication_failure = 2 MESSAGE lv_mssg

system_failure = 3 MESSAGE lv_mssg

OTHERS = 4.

ENDFORM. " F_CALL_RFC_WAIT

----


  • Form F_TASK_END

----


FORM f_task_end USING u_taskname.

DATA lv_mssg(80). "#EC NEEDED

  • Receiving task results

ERPGenie.COM ABAP Tips and Tricks Database

http://erpgenie.com/abaptips Powered by Joomla for ERPGenie.COM! Generated: 20 May, 2007, 21:01

RECEIVE RESULTS FROM FUNCTION 'RFC_PING_AND_WAIT'

EXCEPTIONS

RESOURCE_FAILURE = 1

communication_failure = 2 MESSAGE lv_mssg

system_failure = 3 MESSAGE lv_mssg

OTHERS = 4.

CHECK sy-subrc EQ 0.

SET USER-COMMAND '&NTE'. " Refresh

ENDFORM. " F_TASK_END

                              • END OF PROGRAM Z_ALV_AUTO_REFRESH *********************

regards

ravish

Message was edited by:

ravish goyal

Former Member
0 Kudos

Hi

Hi

you can put a menu painter then use this FM.

SALP_RVAR_REFRESH

regards

Shiva

Former Member
0 Kudos

hi

good

if you want to referesh the data than definitely it ll update your new data that is changing countineously.

go through this link

http://help.sap.com/saphelp_erp2004/helpdata/en/f1/0a55d2e09411d2acb90000e829fbfe/content.htm

thanks

mrutyun^

0 Kudos

Hi, i developed this report using Screen Painter.. all the data is showed in screens..

Former Member
0 Kudos

i solved. thanks