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: 

Displaying a Push button in the application toolbar for an ALV report

Former Member
0 Kudos

Hello everyone,

Query:

Is it possible to display a custom push button in the application tool bar while displaying an ALV report(1st one)?

On pressing this custom push button will I be able to display another ALV report(2nd one) based on the selection made on the current ALV report(1st one)?

1 REPLY 1

Former Member
0 Kudos

Yes u can have pushbutton on application toolbar.

You just have to use the new pf status in your report program.

You should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90 >Programming SubObjects> Gui Status.

Execute this transaction to get to next screen. select status using checkbox. click on GUI Status --> Copy.

Enter your Z program name and the name you what for this status - you can keep it as 'STANDARD' to be simple.

Then you can edit the new status to add or delete buttons. This will also bring in the standard SAP ALV functionality.

Have a look at below code for using the new status.

TYPE-POOLS: slis.

DATA: i_qmel LIKE qmel OCCURS 0.

data v_repid type repid.

SELECT * FROM qmel INTO TABLE i_qmel.

v_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = v_repid

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

i_structure_name = 'QMEL'

TABLES

t_outtab = i_qmel

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 set_pf_status using rt_extab type slis_t_extab.

set pf-status 'TEST'.

endform.

FORM user_command USING ucomm LIKE sy-ucomm

selfield TYPE slis_selfield.

data lv_ucomm type sy-ucomm.

lv_ucomm

= sy-ucomm.

CASE lv_ucomm.

WHEN 'BUTTON'. "Double Click line Item

**Write ur functinality here

endcase.

endform.

Also have a look at below links.

http://www.sap-basis-abap.com/abap/add-button-to-alv-toolbar-with-reuse-alv-list-display.htm

Best Regards,

Vibha

*Please mark all the helpful answers