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

Code to refresh button on ALV grid

Former Member
0 Likes
10,130

Hi

How to add an own abap code to standard ALV refresh button?

I don't want to add a new button but use standard.

6 REPLIES 6
Read only

former_member194669
Active Contributor
0 Likes
2,459

Your question is not clear.

Do you wanted to add your own code in the standard alv refresh button ? I think sy-ucomm for refresh is &REFRESH.

Pl provide more details

a®

Read only

Former Member
0 Likes
2,459

This message was moderated.

Read only

Former Member
0 Likes
2,459

Hi,

Try this code ==>



  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program                = sy-repid
    i_callback_user_command           = 'USER_COMMAND'  " Write your subroutine for this as shown below
    it_fieldcat                       = t_fielcat_modify_data
  TABLES
    t_outtab                          = t_lineitemdisplay
  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.
  
  
  FORM user_command USING r_ucomm LIKE sy-ucomm
                          rs_selfield TYPE slis_selfield.

  CASE r_ucomm.
    WHEN '&REFRESH'.
   "----Your Code Here------"
    

    WHEN OTHERS.
  ENDCASE.

Read only

Former Member
0 Likes
2,459

Hi,

I think you remove the standard Referesh Button from the PF Status. Add your own button and write the logic in the PAI Event.

Regards

Sunil

Read only

Former Member
0 Likes
2,459

Hi Kosmo,

you can achieve that very easily by using the events table if you are using 'REUSE_ALV_GRID_DISPLAY' function module to display the ALV grid....

declare and fill the events table this way...

data t_events type table of SLIS_T_EVENT.
data fs_events like line of t_events.

fs_events-name = 'REFRESH'.
FS_EVENTS-FORM = 'USER_COMMAND'.

Now in the function module REUSE_ALV_GRID_DISPLAY

under theexporting parameter mention

IT_EVENTS                         = t_events

also note that you must have the subroutine with the name user_command

Regards,

Siddarth

Read only

Former Member
0 Likes
2,459

Hi Kosmo,

Use this link to solve your problem.

Regards,

Vijay