Refresh Report list by one command without going back Report selection criteria
We could have requirement to refresh report list without going back to selection parameters of report.
We could have requirement to refresh report list without going back to selection parameters of report. In our example we initiate this functionality by double-clicking on report list, but in real scenario we could bring refresh button to report status and use this one for triggering of refreshment of report list. When we try to do it standard way, SAP create new report list. If we would like to go back to the selection criteria we have to push button BACK n-times(n=how many times we run refreshment of report. Our trick gives opportunity that refreshment looks like real refreshment provided for example query, but without difficult coding. We have to just set up one system variable(sy-lsind = 0.) back to the zero, before we run write of report list. Then we could refresh n-times, but when we press button BACK, we are directly in selection criteria screen of our report. Our easy report show this functionality for report monitoring creation of new Sales order(It is not useful report, only for demonstration of functionality) User could have open report list and just by double-click on report could see new Sales order created in a time from last refreshment. The code has been tested on v.4.0B and worked perfectly.
REPORT ZHHTEST007 . ************************************* ************** DATA DECLARATION ***** ************************************* TABLES:VBAK. *Sales order header data: TVBAK like VBAK occurs 0 with header line. *Creation date select-options: CREADATE for VBAK-ERDAT. ************************************** ************** INITIALIZATION ****** ************************************** initialization. CREADATE-sign = 'I'. CREADATE-option = 'BT'. * Date range from CREADATE-LOW = sy-datum. * Date range to CREADATE-HIGH = sy-datum. append CREADATE. clear CREADATE. *************************************** ************** MAIN PROGRAM ******* *************************************** start-of-selection. *Begin of select data * Select data from VBAK for data range select * from VBAK into table TVBAK where ERDAT in CREADATE. * Sort Sales orders by number sort TVBAK by VBELN. *End of select data *Begin of printing format color 1. write:/ 'SalesOrder','Customer ', 'Total Price '. format color off. loop at TVBAK. write:/ TVBAK-VBELN, TVBAK-KUNNR, TVBAK-NETWR. endloop. *End of printing end-of-selection. **************************************** ************** DRILLDOWN ******** **************************************** at line-selection. *****************BEGIN OF TRICK PART *** * delete previous data selection refresh TVBAK. * list index sy-lsind = 0. *list index save info how many *previous lists we have for report list. *****************END OF TRICK PART **** *Begin of select data * Select data from VBAK for data range select * from VBAK into table TVBAK where ERDAT in CREADATE. * Sort Sales orders by number sort TVBAK by VBELN. *End of select data *Begin of printing format color 1. write:/ 'SalesOrder','Customer ', 'Total Price '. format color off. loop at TVBAK. write:/ TVBAK-VBELN, TVBAK-KUNNR, TVBAK-NETWR. endloop. *End of printing