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: 

Display of push button in the application tool bar in 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)?

6 REPLIES 6

amit_khare
Active Contributor
0 Kudos

Yeah, its very much possible to add a custom pushbutton on the toolbar through GUI Status. That is you have to create a custom menu bar for your program where you may attach a button.

The second functionality is also possible by catching the SELFIELD event for ALV on the click of the pushbutton.

Regards,

Amit

Former Member

anversha_s
Active Contributor
0 Kudos

hi,

chk this sample standard pgm.

BCALV_EDIT_05 This example shows how to use checkboxes within an ALV Grid Control. You learn:

(1) how to define a column for editable checkboxes for an attribute of your list

(2) how to evaluate the checked checkboxes

(3) how to switch between editable and non-editable checkboxes

rgds

anver

if hlped pls mark points

shishupalreddy
Active Contributor
0 Kudos

hi,

we can do that.

for that you need to populate the event structure with USERCOMMAND and SET_PF_STATUS formnames.

In set_pf_status form ...endform write set pf-status.

define the buttons in menupainter with OKCODES.

in form USERCOMMAND capture the OKCODES and do whatever you want .

dont forget to pass the event structure to GRID/LIST DISPLAY FM of ALV.

REGARDS,

Former Member
0 Kudos

Hiii..

I have written a sample code for You

..

<b>"Call the below FunctionModule For Displaying The List

" And see the bolded line in the Below FunctionModule

" STANDARD_02 and USER_COMMAND are the subroutine Names</b>

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

i_callback_program = sy-repid

<b>i_callback_pf_status_set = 'STANDARD_02'</b>

<b> i_callback_user_command = 'USER_COMMAND '</b>

i_structure_name = 'ZST_SCARR'

is_layout = is_layout

it_fieldcat = gt_fieldcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • is_sel_hide = is_sel_hide

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

it_events = e03_lt_events[]

  • IT_EVENT_EXIT =

  • is_print = t

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IR_SALV_LIST_ADAPTER =

  • IT_EXCEPT_QINFO =

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = it_scarr

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 PF_STATUS_SET

**----


<b>" Here Set A Button In Application Toolbar Using PF- Status</b>

FORM standard_02 USING extab TYPE slis_t_extab.

SET PF-STATUS 'STANDA02' EXCLUDING extab.

ENDFORM. "STANDARD_02

&----


*& Form USER_COMMAND

&----


  • text

----


  • -->R_UCOMM text

  • -->RS_SELFIELDtext

----


FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

<b> "menubutton with functioncode GOTO's Action</b>

WHEN 'GOTO'.

READ TABLE it_scarr INDEX rs_selfield-tabindex. "cursorposit.

IF sy-subrc = 0.

WRITE:/ it_scarr-carrid,

/ it_scarr-carrname.

ENDCASE.

ENDFORM. "USER_COMMAND<b></b>

Hope it helps..

Regards,

Simy

Former Member
0 Kudos

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 such as sorting/subtotaling etc...

When you call 'REUSE_ALV_GRID_DISPLAY' make sure you pass it the new status name.

an example of one of mine:

call function 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'ZSDBOLST_REPORT'

i_callback_pf_status_set = 'STANDARD' <----


i_callback_user_command = 'USER_COMMAND'

i_structure_name = 'I_BOLACT'

i_grid_title = 'BOL Action Report'(031)

is_layout = gs_layout

it_fieldcat = gt_fieldcat[]

i_save = 'A'

is_variant = v_variant

TABLES

t_outtab = i_bolact

EXCEPTIONS

program_error = 1

others = 2.

  • 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 'ZSTANDARD'.

ENDFORM. "Set_pf_status

Best Regards,

Vibha

*Please mark all the helpful answers