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: 
Read only

ALV Report

Former Member
0 Likes
615

Hello All,

what is the Function Module to refresh the data

displayed in ALV Grid Display.

Hello All,

what is the Function Module to refresh the data

displayed in ALV Grid Display.

5 REPLIES 5
Read only

Former Member
0 Likes
591

hi,

what u want to do exactly?

Read only

Former Member
0 Likes
591

Hi,

please refer to this link

http://www.jt77.com/development1/programming-23891.html

rgds,

bharat.

Read only

dhruv_shah3
Active Contributor
0 Likes
591

HI,



REPORT z_demo_alv_refresh_button.
**********************************************************************
* REPORT Z_DEMO_ALV_REFRESH_BUTTON - ALV Grid with refresh button    *
*--------------------------------------------------------------------*
* 
**********************************************************************
CONSTANTS :
  c_x VALUE 'X'.
*---------------------------------------------------------------------*
TYPE-POOLS: slis.                      " ALV Global Types

CONSTANTS :
  gc_refresh TYPE syucomm VALUE '&REFRESH'.

TYPES:
  BEGIN OF ty_mara,
    ernam TYPE mara-ernam,
    matnr TYPE mara-matnr,
    ersda TYPE mara-ersda,
    brgew TYPE mara-brgew,
  END OF ty_mara.

DATA:
  gt_mara TYPE TABLE OF ty_mara.

*---------------------------------------------------------------------*
START-OF-SELECTION.

  PERFORM f_read_data.

*---------------------------------------------------------------------*
END-OF-SELECTION.

  PERFORM f_display_data.

*---------------------------------------------------------------------*
*       Form  f_read_data
*---------------------------------------------------------------------*
FORM f_read_data.

  STATICS :
    l_rows TYPE i.

  ADD 1 TO l_rows.
  SELECT ernam matnr ersda brgew INTO TABLE gt_mara FROM mara
                                   UP TO l_rows ROWS.

  MESSAGE s208(00) WITH 'Reading data ...'.

ENDFORM.                               " F_READ_DATA
*---------------------------------------------------------------------*
*      Form  f_display_data
*---------------------------------------------------------------------*
FORM f_display_data.

  DEFINE m_fieldcat.
    add 1 to ls_fieldcat-col_pos.
    ls_fieldcat-fieldname = &1.
    ls_fieldcat-ref_tabname = 'MARA'.
    append ls_fieldcat to lt_fieldcat.
  END-OF-DEFINITION.

  DATA :
    ls_fieldcat   TYPE slis_fieldcat_alv,
    lt_fieldcat   TYPE slis_t_fieldcat_alv,
    lt_event_exit TYPE slis_t_event_exit,
    ls_event_exit TYPE slis_event_exit.

  m_fieldcat 'ERNAM'.
  m_fieldcat 'MATNR'.
  m_fieldcat 'ERSDA'.
  m_fieldcat 'BRGEW'.

  CLEAR ls_event_exit.
  ls_event_exit-ucomm = gc_refresh.    " Refresh
  ls_event_exit-after = c_x.
  APPEND ls_event_exit TO lt_event_exit.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program       = sy-cprog
      i_callback_pf_status_set = 'PF_STATUS_SET'
      i_callback_user_command  = 'USER_COMMAND'
      it_fieldcat              = lt_fieldcat
      it_event_exit            = lt_event_exit
    TABLES
      t_outtab                 = gt_mara.

ENDFORM.                               " F_DISPLAY_DATA
*---------------------------------------------------------------------*
*       FORM USER_COMMAND                                             *
*---------------------------------------------------------------------*
FORM user_command USING u_ucomm     TYPE sy-ucomm
                        us_selfield TYPE slis_selfield.     "#EC CALLED

  CASE u_ucomm.
    WHEN gc_refresh.
      PERFORM f_read_data.             " Refresh data
      us_selfield-refresh    = c_x.
      us_selfield-col_stable = c_x.
      us_selfield-row_stable = c_x.
  ENDCASE.

ENDFORM.                    "user_command
*---------------------------------------------------------------------*
*       FORM PF_STATUS_SET                                            *
*---------------------------------------------------------------------*
FORM pf_status_set USING ut_extab TYPE slis_t_extab.        "#EC CALLED

  DELETE ut_extab WHERE fcode = gc_refresh.

  SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'
      EXCLUDING ut_extab.

ENDFORM.                    "pf_status_set

otw,

Set 'X' to selfield-refresh?


RS_SELFIELD-REFRESH = 'X'. "Structure SLIS_SELFIELD

HTH

Regards,

Dhruv Shah

Read only

Former Member
0 Likes
591

hi,

Just take one refresh button in the function menu bar,

and on its click event just

call the fetching data function and

the display data function of alv.

your purpose of refreshment wiil be solve.

like

WHEN 'REFRESH'.

REFRESH final.

PERFORM fetch_data."fetching data into final internal table

PERFORM dis_data."display function of alv

thanks

Dhatmishta

Read only

Former Member
0 Likes
591

Hi,

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

It has the syntax very similar to creating the table.

It has two parameters. In the first one, you can mention if you want to refresh only the data (the icons are not refreshed)

or

if you want to refresh only the icons around the grid (the data is not refreshed - this option is mostly not used in day to day applications).

the synatx is :-

call method grid (name of grid )->refresh_table_display

exporting

IS_STABLE = <STRUCT OF TYPE LVC_S_STBL> (THIS IS FOR DATA REFRESHING)

I_SOFT_REFRESH = <VARIABLE OF CHAR 01> (THIS IS FOR ICON REFRESHING).

Regards,

Bhaskar