2008 May 13 10:13 AM
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
2008 May 13 11:26 AM
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
2008 May 13 10:39 AM
If possible post your code here so we can see what is the problem in the code.
Regards
Bikas
2008 May 13 11:14 AM
hello-
Refresh itab after the output after the FM is called.
Cheers,
~Srini....
2008 May 13 11:19 AM
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.
2008 May 13 11:26 AM
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
2008 May 14 9:24 AM
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
2008 May 14 10:07 AM
2008 May 14 10:21 AM
HI,
Refer to the following link:
http://erpgenie.com/abaptips/content/view/529/61/
Hope this helps.
Reward if helpful.
Regards,
Sipra
2008 May 14 10:25 AM
hi
here some link try this
http://www.sap-img.com/abap-function.htm
http://www.saptechnical.com/Tutorials/ALV/ALVMainPage.htm
cheers
snehi chouhan