cancel
Showing results for 
Search instead for 
Did you mean: 

Applying ALV toolbar button funtionality in user developed button .

Former Member
0 Kudos

Can any body tell me the step by step approch of getting ALV toolbar button funtionality in user developed button in application toolbar ? That is i develop one button on application toolbar and on click on this i want any one toolbar button funtionality on my developed button . how can i do this?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

To create a button on ALV list display, Like to create a "BACK" button on your ALV tool bar,, you need to first define & create a pf status then call it in your REUSE.. fm,,

below code will explain you all the things,,

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program       = sy-repid
        i_callback_pf_status_set = 'SET_PF_STATUS'    
        i_callback_user_command  = 'USER_COMMAND'
        i_grid_title             = text-001
        is_layout                = s_layout
        it_fieldcat              = i_fcat
        i_save                   = lf_save
        is_variant               = s_disvariant
      TABLES
        t_outtab                 = i_pernr[]
      EXCEPTIONS
        program_error            = 1
        OTHERS                   = 2.

*---------------------------------------------------------------------*
*       FORM USER_COMMAND                                             *
*---------------------------------------------------------------------*
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
  CASE ucomm.
    WHEN 'BACK'.
      leave to screen 0.
  ENDCASE.
ENDFORM.                    "user_command                              " USER_COMMAND

*****************************************************************
* Form Set_pf_status
* Notes: Called by FM REUSE_ALV_GRID_DISPLAY
*****************************************************************
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'BACK_BUTTON'.
ENDFORM. "Set_pf_status

First you shuld to create a GUI status for your screen dispalying the list (For this copy a GUI status from a standard program and paste it in 'BACK_BUTTON')

then in Application Toolbar ,, Just create a button as BACK ,, Keep the FUNCTION CODE as BACK ..

I think you got the idea, how to use any GUI for ALV list ..

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks lokesh but u did't get my question . There is two toolbar in any Program one is main program toolbar and other is ALV toolbar itself. So i created a button on main program application toolbar now when i click on this button , i want any one funtionality of ALV toolbar button like sort ascending?