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

Refresh ALV grid.

Former Member
0 Likes
458

Hello, in my report programm, i want to insert a refresh button in the ALV, and when i press this, i want to execute the programm (or the perform get data).

1. How do i insert this button ?

2.What code should i write for this button to execute the perform get data again ?

Thx in advance .

code:

REPORT ZIN_TEST.

TABLES:
  EINA,
  EINE.

TYPES: BEGIN OF TS_EINAEINE,
  INFNR LIKE EINE-INFNR,
  LIFNR LIKE EINA-LIFNR,
 END OF TS_EINAEINE.

DATA:
  GT_EINAEINE TYPE TABLE OF TS_EINAEINE,
  GW_EINAEINE LIKE LINE OF GT_EINAEINE.

SELECT-OPTIONS S_LIFNR FOR EINA-LIFNR.

START-OF-SELECTION.

  PERFORM GET_DATA.

  PERFORM ALV_LIST.

FORM GET_DATA.
  SELECT

    EINA~LIFNR
    EINE~INFNR

    INTO CORRESPONDING FIELDS OF TABLE
      GT_EINAEINE

    FROM
      EINE

      INNER JOIN
        EINA
          ON
            EINA~INFNR = EINE~INFNR

            WHERE
              EINA~LIFNR IN S_LIFNR.
ENDFORM.
             " GET_DATA
FORM ALV_LIST.
*Objects
  DATA:

    GCL_ALV_GRID TYPE REF TO CL_GUI_ALV_GRID,
    GCL_TABLE TYPE REF TO CL_SALV_TABLE,
    GCL_FUNCTIONS TYPE REF TO CL_SALV_FUNCTIONS,
    GCL_DISPLAY TYPE REF TO CL_SALV_DISPLAY_SETTINGS,
    GCL_LAYOUT TYPE REF TO CL_SALV_LAYOUT,
    LV_KEY TYPE SALV_S_LAYOUT_KEY,
    GCL_ALV_COLUMN TYPE REF TO CL_SALV_COLUMN,
    GCL_ALV_COLUMNTAB TYPE REF TO CL_SALV_COLUMN_TABLE,
    GCL_ALV_COLUMNSTAB TYPE REF TO CL_SALV_COLUMNS_TABLE,
    LV_ALVX TYPE STRING,
    LX_ALV_MSG TYPE REF TO CX_SALV_MSG.

************************************************************************
      CL_SALV_TABLE=>FACTORY( IMPORTING R_SALV_TABLE = GCL_TABLE
                                CHANGING T_TABLE = GT_EINAEINE ).
************************************************************************

  GCL_FUNCTIONS = GCL_TABLE->GET_FUNCTIONS( ).
  GCL_FUNCTIONS->SET_ALL( ABAP_TRUE ).

*Display
  GCL_DISPLAY = GCL_TABLE->GET_DISPLAY_SETTINGS( ).
  GCL_DISPLAY->SET_STRIPED_PATTERN( CL_SALV_DISPLAY_SETTINGS=>TRUE ).

* display table
  GCL_TABLE->DISPLAY( ).

ENDFORM.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
410

If you don't search you will never find the useful content.

Try to Search in SCN before posting any question..

here is the one which you are looking for...

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899...

2 REPLIES 2
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
410

You can add the refresh button in the ALV toolbar using the method e.g SET HANDLER lcl_event_receiver_0100=>handle_toolbar FOR gr_alvgrid_cont_100.

and then handle the same using set handler for user command based on ucomm.

Read only

Former Member
0 Likes
411

If you don't search you will never find the useful content.

Try to Search in SCN before posting any question..

here is the one which you are looking for...

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899...