Application Development and Automation 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: 

Automatic ALV refresh and display

Former Member
0 Kudos
1,711

HI

Im creating a ALV automatic refresh report. I have set the timer for every 10 seconds. I have set the breakpoint in the Select statement up to 5 rows and find initially , the internal table contains items 0 ,1,2,3,4 and after 10 seconds(setting the timer for 10 seconds) , itab contains items 5,6,7,8,9.

This is fine.

Im trying to display this is ALV. The initial ALV with items 0,1,2,3,4 is found wherease even after 10 secons the values in the ALV are not changing to 5,6,7,8,9. They remain in the initial state.

Kindly help me how to chnage the data in the ALV grid after refresh is happening without any USERCOMMANDS ( ie , data changed in the ALV grid every 10 seconds without any user interaction)

Thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos
708

Hi,

The following method call is used to refresh the data displayed within an ALV object grid:

CALL method gd_tree->REFRESH_TABLE_DISPLAY.

CALL METHOD gd_tree->set_table_for_first_display

EXPORTING

is_layout = gd_layout

CHANGING

it_fieldcatalog = gd_fieldcat

it_sort = it_sortcat

it_outtab = it_report.

CALL method gd_tree->REFRESH_TABLE_DISPLAY.

CALL METHOD cl_gui_cfw=>flush.

Regards,

Bhaskar

8 REPLIES 8

Former Member
0 Kudos
708

If possible post your code here so we can see what is the problem in the code.

Regards

Bikas

Former Member
0 Kudos
708

hello-

Refresh itab after the output after the FM is called.

Cheers,

~Srini....

Former Member
0 Kudos
708

Hi,

Please refer the code below:



* Automatic refresh report
*.......................................................................
*: Report:  ZAUTO_REFRESH                                              :
*:                                                                     :
*: 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.

Thanks,

Sriram Ponna.

Former Member
0 Kudos
709

Hi,

The following method call is used to refresh the data displayed within an ALV object grid:

CALL method gd_tree->REFRESH_TABLE_DISPLAY.

CALL METHOD gd_tree->set_table_for_first_display

EXPORTING

is_layout = gd_layout

CHANGING

it_fieldcatalog = gd_fieldcat

it_sort = it_sortcat

it_outtab = it_report.

CALL method gd_tree->REFRESH_TABLE_DISPLAY.

CALL METHOD cl_gui_cfw=>flush.

Regards,

Bhaskar

Former Member
0 Kudos
708

the problem still persists. the ALV gets refreshed and timer works properly still change in the display of data in the ALV grid does not happen.

I just need the contents of the ALV to change when refreshed which is not happening . I can find this happening only when i set a break point and not on the output screen . Kindly help me to solve this. Any samples

Former Member
0 Kudos
708

Please give me a sample code or a solution.

Thanks in advance

0 Kudos
708

HI,

Refer to the following link:

http://erpgenie.com/abaptips/content/view/529/61/

Hope this helps.

Reward if helpful.

Regards,

Sipra

Former Member
0 Kudos
708