Thursday, August 17, 2017

ALV Report Refresh Timely

Sometimes we need a report which will be updated timely and the output screen will reflect with the updated data. In production department we need this kind of approach which displays timely updated data for production control. In the following example we have developed a custom table and the table has been populated data in different time. The report fetches data from that custom table and displays output in ALV. Now whenever data is updated into the table the report will display the updated record after a particular time slab. This is very useful when we deal with transnational data.

Create a table as follows:


The table contains one line of data.


The program is as follows:

REPORT zsr_test NO STANDARD PAGE HEADING.

CLASS lcl_timer DEFINITION DEFERRED.
DATA: mesg     TYPE char50,
      lv_uzeit TYPE char8,
      wa_tab   TYPE zdbtablog,
      it_tab   TYPE TABLE OF zdbtablog.

DATA: ob_grid  TYPE REF TO cl_gui_alv_grid,
      ob_recev TYPE REF TO lcl_timer,
      ob_timer TYPE REF TO cl_gui_timer.

CLASS lcl_timer DEFINITION.
  PUBLIC SECTION.
    METHODS:
      handle_finished FOR EVENT finished OF cl_gui_timer.
ENDCLASS.

CLASS lcl_timer IMPLEMENTATION.
  METHOD handle_finished.
    PERFORM refresh_data.
    CONCATENATE sy-uzeit+0(2) ':'
                sy-uzeit+2(2) ':'
                sy-uzeit+4(2)
                INTO lv_uzeit.
    CONCATENATE 'Last Update at' lv_uzeit
           INTO mesg SEPARATED BY space.
    MESSAGE mesg TYPE 'S'.
    CALL METHOD ob_timer->run.
  ENDMETHOD.                    "handle_finished
ENDCLASS.

START-OF-SELECTION.
  PERFORM select_data.

END-OF-SELECTION.
  CREATE OBJECT ob_timer.
  CREATE OBJECT ob_recev.
  SET HANDLER ob_recev->handle_finished FOR ob_timer.
  ob_timer->interval = 30.
  CALL METHOD ob_timer->run.
  PERFORM display_data.
*&---------------------------------------------------------------------*
*&      Form  SELECT_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM select_data .

  SELECT FROM zdbtablog INTO TABLE it_tab.
  IF sy-subrc = 0.
    SORT it_tab BY zmatnr.
  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  REFRESH_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM refresh_data .

  IF ob_grid IS INITIAL .
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
      IMPORTING
        e_grid = ob_grid.
  ENDIF.

  IF ob_grid IS NOT INITIAL.
    PERFORM select_data.
    CALL METHOD ob_grid->refresh_table_display.
  ENDIF.

ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  DISPLAY_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM display_data .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_callback_program = sy-repid
      i_structure_name   = 'ZDBTABLOG'
    TABLES
      t_outtab           = it_tab
    EXCEPTIONS
      program_error      = 1
      OTHERS             2.

ENDFORM.


Report Output timely:




Data is uploaded by TMG with SM30:

76 comments:

ERP Training said...

Thankyou for wonderful article. It has more Information in Your Website sap videos.

ERP Training Videos said...

Fabulous..!! Thank you.The information you provided is much usful information on sap videos.

ERP Training said...

It was so nice article.I was really satisified by seeing this article sap video tutorials.

ERP Training Videos said...

Thank you. sir, Really I like your post on sap videos.

ERP Training Videos said...

Fabulous..!! Thank you.The information you provided is much usful information on sap video.

ERP Training said...

Thankyou for wonderful article. It has more Information in Your Website sap video.

admin said...

Thanks very much . This abap code .i was looking for. You can check abap tutorial

ERP Training Videos said...

Thankyou for Sharing Great Information. It is Very Helpful Information on sapvideos.

ERP Training said...

Thank you. It is such a wonderful post. it has great information it is very useful for sapvideos.

ERP Training Videos said...

Fabulous..!! Thank you.The information you provided is much usful information on sapvideos.

ERP Training said...

Thankyou for wonderful article. It has more Information in Your Website sapvideos.

ERP Training Videos said...

Thankyou for Sharing Great Information. It is Very Helpful Information on sap hana videos.

ERP Training said...

Thank you. It is such a wonderful post. it has great information it is very useful for sap hana videos.

ERP Training Videos said...

Thank you. sir, Really I like your post on sap video tutorials.

ERP Training said...

It was so nice article.I was really satisified by seeing this article sap video tutorials.

ERP Training Videos said...

Thankyou for Sharing Great Information. It is Very Helpful Information on sap videos.

ERP Training said...

Thank you. It is such a wonderful post. it has great information it is very useful for sap videos.

ERP Training Videos said...

Thankyou for Sharing Great Information. It is Very Helpful Information on sap tutorial videos.

ERP Training said...

Thank you. It is such a wonderful post. it has great information it is very useful for sap tutorial videos.

ERP Training Videos said...

Fabulous..!! Thank you.The information you provided is much usful information on sap video tutorials.

ERP Training Videos said...

Thankyou for wonderful article. It has more Information in Your Website sap video tutorials.

ERP Training said...

It was so nice article.I was really satisified by seeing this article sapvideos.

ERP Training said...

Thank you. sir, Really I like your post on sapvideos.

ERP Training Videos said...

Thank you. sir, Really I like your post on sap hana video tutorials.

ERP Training Videos said...

It was so nice article.I was really satisified by seeing this article sap hana video tutorials.

ERP Training said...

Thankyou for wonderful article. It has more Information in Your Website sap video tutorial.

ERP Training Videos said...

Fabulous..!! Thank you.The information you provided is much usful information on sap video tutorial.

jabashree said...

Nice article..it contains great information..thanks for sharing.But one thing when data is destroyed how to recovered this?

SAP HR Training in Chennai
SAP SD Training in Chennai
BEST SAP BASIS Training in Chennai

ERP Training Videos said...

Thank you. sir, Really I like your post on sapvideos.

ERP Training Videos said...

Thankyou for Sharing Great Information. It is Very Helpful Information on sap training videos.

ERP Training said...

Thank you. It is such a wonderful post. it has great information it is very useful for sap training videos.

ERP Training Videos said...

Fabulous..!! Thank you.The information you provided is much usful information on sap video download.

ERP Training Videos said...

Thankyou for Sharing Great Information. It is Very Helpful Information on sap videos.

ERP Training said...

Thankyou for Sharing Great Information. It is Very Helpful Information on sapvideos.

ERP Training Videos said...

Thankyou for Sharing Great Information. It is Very Helpful Information on sap videos.

ERP Training said...

Thank you. It is such a wonderful post. it has great information it is very useful for sap hana training videos.

ERP Training Videos said...

Fabulous..!! Thank you.The information you provided is much usful information on sap video download.

ERP Training said...

Thankyou for wonderful article. It has more Information in Your Website sap videos.

ERP Training Videos said...

Thank you. sir, Really I like your post on sap video.

ERP Training said...

It was so nice article.I was really satisified by seeing this article sap video.

ERP Training Videos said...

Thank you. sir, Really I like your post on sap hana video tutorials.

ERP Training said...

It was so nice article.I was really satisified by seeing this article sap video tutorials.

ERP Training Videos said...

Fabulous..!! Thank you.The information you provided is much usful information on sap hana training videos.

ERP Training said...

Thankyou for wonderful article. It has more Information in Your Website sap video.

ERP Training Videos said...

Thank you. sir, Really I like your post on s4 hana training videos.

ERP Training said...

It was so nice article.I was really satisified by seeing this article sapvideos.

ERP Training Videos said...

Thankyou for Sharing Great Information. It is Very Helpful Information on sap workflow training videos.

ERP Training said...

Thank you. It is such a wonderful post. it has great information it is very useful for sapvideos.

ERP Training Videos said...

Fabulous..!! Thank you.The information you provided is much usful information on s4 hana training videos.

ERP Training said...

Thankyou for wonderful article. It has more Information in Your Website sap videos.

ERP Training Videos said...

Thank you. sir, Really I like your post on sap hana video tutorials.

ERP Training said...

It was so nice article.I was really satisified by seeing this article sapvideos.

ERP Training Videos said...

Thankyou for Sharing Great Information. It is Very Helpful Information on s4 hana training videos.

ERP Training said...

Thank you. It is such a wonderful post. it has great information it is very useful for s4 hana training videos.

ERP Training Videos said...

Thank you. sir, Really I like your post on sap hana video tutorials.

ERP Training said...

It was so nice article.I was really satisified by seeing this article sapvideos.

ERP Training Videos said...

Fabulous..!! Thank you.The information you provided is much usful information on sap workflow training videos.

ERP Training said...

Thankyou for wonderful article. It has more Information in Your Website sap tutorial videos.

ERP Training Videos said...

Fabulous..!! Thank you.The information you provided is much usful information on sap hana training videos.

ERP Training Videos said...

Thank you. sir, Really I like your post on sap wm training videos.

ERP Training said...

It was so nice article.I was really satisified by seeing this article sap hana videos.

ERP Training Videos said...

Thank you ,
Well it was nice post and very helpful information on sap fiori training videos.

ERP Training said...

It was Nice post and very useful information on sap video tutorial.

ERP Training Videos said...

Thank you ,
Well it was nice post and very helpful information on sap wm training videos.

ERP Training said...

It was Nice post and very useful information on sap hana videos.

ERP Training Videos said...

Thank you ,
Well it was nice post and very helpful information on sap workflow training videos.

ERP Training said...

It was Nice post and very useful information on sap video tutorial.

logistic-solutions said...


Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
supply diversity services

gilledashivani said...

Great information. the information provided is of great use as i got to learn new things. If you are looking for real time training in SAP ABAP, kindly contact sieve software
Sieve software offers real time training by industry experts with live projects and placement support.
SAP ABAP TRAINING IN HYDERABAD

ERP Training said...

It was so nice article.I was really satisified by seeing this article sap hana videos.

ERP Training Videos said...

Thank you. sir, Really I like your post on sap hana videos.

ERP Training Videos said...

Fabulous..!! Thank you.The information you provided is much usful information on sap videos.

ERP Training Videos said...

Thank you ,
Well it was nice post and very helpful information on sap video download.

ERP Training Videos said...

Thank you ,
Well it was nice post and very helpful information on sap training videos.

ERP Training Videos said...

Thank you. sir, Really I like your post on sap video.

ERP Training Videos said...

Thankyou for Sharing Great Information. It is Very Helpful Information on sap training videos.