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

button on alv application toolbar

Former Member
0 Likes
716

how can i add a command button to an alv application toolbar. i am using REUSE_ALV_GRID_DISPLAY

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
637

Hi,

Check in this thread for my reply..

https://forums.sdn.sap.com/click.jspa?searchID=3308234&messageID=3279312

Thanks

Naren

6 REPLIES 6
Read only

Former Member
0 Likes
638

Hi,

Check in this thread for my reply..

https://forums.sdn.sap.com/click.jspa?searchID=3308234&messageID=3279312

Thanks

Naren

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
637

You must copy the status from the standard in function group SALV and modify it. Then you need to pass the name of call back form routine in which you will set the new status.

For example. see in this call we are passing the SET_PF_STATUS_SDO to the i_callback_pf_status-set as well as the REPID to the i_callback_program. This tells the alv to comeback to this program to set the status.



  call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_callback_program       = repid
            i_callback_pf_status_set = 'SET_PF_STATUS_SDO'
            i_callback_user_command  = 'HANDLE_USER_COMMAND_SDO'
            is_layout                = ilayout
            it_fieldcat              = ifc
            it_sort                  = isort
            i_grid_title             = xgrid_title
       tables
            t_outtab                 = ialv_sdo
       exceptions
            program_error            = 1
            others                   = 2.

Then you need to have the FORM routine in this program.




form set_pf_status_sdo using rt_extab type slis_t_extab.

  set pf-status 'STANDARD'.

endform.

Again make sure to copy the standard ALV toolbar from the funciton group SALV into your program and modify it. Then call this status like in the FORM above.

Regards,

Rich Heilman

Read only

Former Member
Read only

Former Member
0 Likes
637

Hi

Following are the steps for the same...

1) Define the button in se41 with ur program and status name.

2) use the command set pf status <status name>

3) code as per ur requirement...

Hope this helps to solve ur problem....

<b>do reward if useful....</b>

regards

dinesh

Read only

Former Member
0 Likes
637

Hi,

follow this sample program.

call function 'REUSE_ALV_GRID_DISPLAY' 
         exporting 
                       i_callback_program = sy-repid
<b>                    I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS' 
                    I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'</b> 
                    i_grid_title       = lc_grid_title 
                    is_layout         = lc_layout 
                    it_fieldcat        = gt_fieldcat 
                    it_sort             =   sort 
                    i_save             = l_save 
                    is_reprep_id     = l_bbs_id 
                    is_variant         = l_variant 
         tables    
                    t_outtab           =  <internal-table> " output table
          exceptions 
                    program_error      = 1 
                    others             = 2.

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'ZSTANDARD'.

ENDFORM. "Set_pf_status

The parameters in capitals are the extra ones that need to be added.

<b>or</b>

follow this sample program.

<b>BCALV_GRID_08</b>

regards,

Ashokreddy.

Read only

Former Member
0 Likes
637

Willard,

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_REPID

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

FORM SET_PF_STATUS

USING P_EXTAB TYPE SLIS_T_EXTAB. "#EC CALLED

  • Set the pf status for CHG BOM button

SET PF-STATUS 'STAT1' EXCLUDING P_EXTAB.

ENDFORM. "top_of_page

FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM

P_SELFLD TYPE SLIS_SELFIELD.

case p_ucomm.

when '<FCODE for your button'.

  • do somethind

endcase.

ENDFORM.

YOu must create the pf status STAT1 in se41 by copying a pf status STANDARD of the program saplkkbl and adding an extra button to the copied pf status.

Don't forget to reward if useful...