Application Development 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: 

Adding Refresh button in ALV GRID

Former Member
0 Kudos
1,909

hi all,

i have added a refresh button in ALV GRID.

i want to refresh the data from ALV..

w_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

i_callback_program = w_repid

  • i_callback_pf_status_set = 'PF_STATUS_SET'

*begin of addition by SND on 15072008

i_callback_pf_status_set = 'REFRESH'

*end of addition by SND on 15072008

i_callback_user_command = 'USER_COMMAND'

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

is_layout = gs_layout

it_fieldcat = wa_fldcat1

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • i_save = 'X'

  • IS_VARIANT =

  • IT_EVENTS =

  • it_event_exit = lt_event_exit

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = it_ticket

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

----


  • FORM USER_COMMAND *

----


  • --> R_UCOMM *

  • --> RS_SELFIELD *

----


FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

BREAK-POINT.

CASE r_ucomm.

WHEN '&IC1'.

IF rs_selfield-fieldname = 'TICKETNO'.

REFRESH bdcdata.

READ TABLE it_ticket INDEX rs_selfield-tabindex.

PERFORM bdc_dynpro USING 'ZTMT_UPDATION_PRGM' '0100'.

PERFORM bdc_field USING 'BDC_CURSOR'

'ZTMT_TICKET-ZSYSTEM'.

PERFORM bdc_field USING 'ZTMT_TICKET-TICKETNO'

it_ticket-ticketno.

PERFORM bdc_field USING 'ZTMT_TICKET-ZSYSTEM'

it_ticket-zsystem.

PERFORM bdc_transaction USING 'ZTMT'.

ENDIF.

ENDCASE.

ENDFORM. "user_command

this is my code.

3 REPLIES 3

Former Member
0 Kudos
119

Hi,

Add the following code.

w_eventexit-ucomm = '&REFRESH'. ("Func code for Refresh)

w_eventexit-after = c_x.

APPEND w_eventexit TO lt_event_exit.

FORM uSER_COMMAND.

CASE r_ucomm.

when '&REFRESH'.

  • add your code. "Submit the same program

When '&IC1'.

endcase.

cheers

Jacks.

0 Kudos
119

hi ,

Add the following code.

w_eventexit-ucomm = '&REFRESH'. ("Func code for Refresh)

w_eventexit-after = c_x.

APPEND w_eventexit TO lt_event_exit.

where should i write the above code....??

0 Kudos
119

Hi Saurabh,

The FM REUSE_ALV_GRID_DISPLAY has the export parameter as it_event_exit along with field catalog..

DATA : 
w_eventexit  TYPE slis_event_exit,
i_event_exit    TYPE slis_event_exit  OCCURS 1.    


* Populating field structure to get the output in ALV display
  PERFORM f6100_fill_fieldcat .

* Layout for field catalog.
  PERFORM f6200_fieldcat_layout.

  clear w_eventexit.

  w_eventexit-ucomm = c_refresh.
  w_eventexit-after = c_x.

 APPEND w_eventexit TO i_event_exit.


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_bypassing_buffer       = c_x
      i_callback_program       = w_repid
      is_layout                = w_layout
      it_fieldcat              = i_fieldcat[]
      it_event_exit            = i_event_exit
      i_callback_top_of_page   = 'F6300_TOP_OF_PAGE'
      i_callback_pf_status_set = 'F6400_SETCUSTOMPFSTAUS'
      i_callback_user_command  = 'F6500_USER_COMMAND'
    TABLES
      t_outtab                 = t_alvtable
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.
IF sy-subrc EQ 0.
Endif.

*&---------------------------------------------------------------------*
*&      Form  F6300_SETCUSTOMPFSTATUS
*&---------------------------------------------------------------------*
*       Setting the customized  PF-Status for the ALV Grid
*       Including refresh button (copied from standard )
*----------------------------------------------------------------------*
FORM f6400_setcustompfstaus USING rt_extab TYPE slis_t_extab."#EC *
  SET PF-STATUS 'YSTANDARDFULLSCREEN'.
ENDFORM.                    "f3600_setcustompfstatus

*Eject
*&---------------------------------------------------------------------*
*&      Form  F6500_USER_COMMAND
*&---------------------------------------------------------------------*
*       When Refresh Button is clicked a submit report is fired with
*       existing selection screen
*----------------------------------------------------------------------*
*      -->R_UCOMM      text
*      -->RS_SELFIELD  text
*----------------------------------------------------------------------*
FORM f6500_user_command USING r_ucomm     LIKE sy-ucomm
                              rs_selfield TYPE slis_selfield."#EC *

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

  IF NOT ref_grid IS INITIAL.
    CALL METHOD ref_grid->check_changed_data.
  ENDIF.


  IF r_ucomm EQ c_refresh.

    PERFORM f6510_initialisevariables.

    PERFORM f6520_refreshedoutput.

  ENDIF. "r_ucomm

ENDFORM.                    "USER_COMMAND

Hope this helps..