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: 

ALV Toolbar

Former Member
0 Kudos
161

Can I add some buttons in ALV standard Toolbar? How?

4 REPLIES 4

Former Member
0 Kudos
80

Hi

In order modify PF_STATUS of ALV grid report you need to perform the following steps:

1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include:

i_callback_pf_status_set = 'SET_PF_STATUS' statement.

2. Create 'SET_PF_STATUS' FORM

3. Create pf_status (i.e. 'ZNEWSTATUS').

- It is recommend that you copy standard status'STANDARD' from function group SALV

and modify it accordingly. ALV standard function codes always start with '&'.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP-OF-PAGE'

i_callback_pf_status_set = 'SET_PF_STATUS' "see FORM

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

i_save = 'X'

tables

t_outtab = it_ekko

exceptions

program_error = 1

others = 2.

----


  • FORM SET_PF_STATUS *

----


FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'ZNEWSTATUS'.

"Copy of 'STANDARD' pf_status from fgroup SALV

ENDFORM.

In order to add user command functioality to the ALV grid you need to perform the following steps:

1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'USER_COMMAND' FORM

2. Create 'USER_COMMAND' FORM

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP-OF-PAGE'

I_callback_user_command = 'USER_COMMAND' "see FORM

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

i_save = 'X'

tables

t_outtab = it_ekko

exceptions

program_error = 1

others = 2.

----


  • FORM USER_COMMAND *

----


  • --> R_UCOMM *

  • --> RS_SELFIELD *

----


FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

  • Check function code

CASE r_ucomm.

WHEN '&IC1'.

  • Check field clicked on within ALVgrid report

IF rs_selfield-fieldname = 'EBELN'.

  • Read data table, using index of row user clicked on

READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.

  • Set parameter ID for transaction screen field

SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.

  • Sxecute transaction ME23N, and skip initial data entry screen

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

ENDFORM.

Former Member
0 Kudos
80

Hope you know SE41 to crate the menu painter.

go to that transaction.

Create teh gui status to your report and activate it.

Create the buttons on your status.

Mention the same in your reuse_alv_grid_display like as follows.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

is_layout = g_layout

i_callback_pf_status_set = 'ALVMENU'

i_save = 'X'

it_fieldcat = g_fieldcat_tab[]

it_sort = g_sort

it_events = g_events[]

TABLES

t_outtab = it_ZRO_DPMENT_TCL

EXCEPTIONS

program_error = 1

OTHERS = 2.

.

FORM alvmenu USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'MENU'.

ENDFORM. "ALVMENU

Hope you will get the required info.

Regards,

Madan.

asik_shameem
Active Contributor
0 Kudos
80

Hi

Goto SE41.

Program: BALVBT01

Status: STANDARD.

Press Ctrl+F6 or Copy Status Button. There give yer New Z program name and status name. For example ZABC and STATUS_NEW.

Again goto SE41,

Program: ZABC

Status: STATUS_NEW -> Change

There add your additional buttons.

And in the ALV FM REUSE_ALV_GRID_DISPLAY,

set I_CALLBACK_PF_STATUS_SET = 'STATUS_NEW'.

Former Member
0 Kudos
80

Hi,

Yes we can buttons to alv.

Go to this link your problem will be solved.

http://www.saptechnical.com/Tutorials/ALV/Toolbar/buttons.htm

Reward some points.

Regards,

Anomitro