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 Toolbar icons as well as user icons

Former Member
0 Kudos

Hi,

I need to display few toolbar icons as well as few user icons.

How do i do? If i do this way then i exclude the complete toolbar..

gs_layout-grid_title = 'Display Alert Conditions'(100).

gs_layout-sel_mode = 'A'.

gs_layout-cwidth_opt = 'X'.

  • gs_layout-no_toolbar = 'X'.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

i_structure_name = 'ZFLP_STCUALCONDPRI'

is_layout = gs_layout

i_save = 'A'

it_toolbar_excluding = it_toolbar

CHANGING

it_outtab = gt_zflp_ttcualcond

it_fieldcatalog = gt_fieldcat.

-


If i do this way then i hide few but cannot have my own pushbuttons(or user icons..)

wa_toolbar = grid1->MC_FC_LOC_INSERT_ROW.

APPEND wa_toolbar TO it_toolbar.

wa_toolbar = grid1->MC_FC_LOC_DELETE_ROW. "Toolbar Button PASTE OVER ROW

APPEND wa_toolbar TO it_toolbar.

wa_toolbar = grid1->mc_fc_loc_paste_new_row. "Toolbar Button PASTE NEW ROW

APPEND wa_toolbar TO it_toolbar.

-


Regards

2 REPLIES 2

anversha_s
Active Contributor
0 Kudos

hi,

only this much u want to do.

IT_EXCLUDING TYPE SLIS_T_EXTAB OPTIONAL

you need to append the Fucntion codes to the it_exclude and then pass it to the parameter it_excluding.

append '&ABC' to it_excluding.

append '&BAC' to it_excluding.

.....

call function 'REUSE_ALV_LIST_DISPLAY'

....

....

IT_EXCLUDING = it_exlcuding

...

Regards

Anver

if hlped mark points

Former Member
0 Kudos

Hi Madhavi,

After excluding the toolbar icons , you can add your own function by handling two events. We use the event “toolbar” to add the button and the event “user_command” to implement the new function.

In the method handling the “toolbar” event, we define a new button by filling a structure and appending it to the table attribute “mt_toolbar” of the object to whose reference we can reach via the parameter “e_object” of the event.

FORM handle_toolbar USING i_object TYPE REF TO cl_alv_event_toolbar_set .

DATA: ls_toolbar TYPE stb_button.

CLEAR ls_toolbar.

MOVE 3 TO ls_toolbar-butn_type.

APPEND ls_toolbar TO i_object->mt_toolbar.

CLEAR ls_toolbar.

MOVE 'PER' TO ls_toolbar-function.

MOVE icon_display_text TO ls_toolbar-icon.

MOVE 'Passenger Info'(201) TO ls_toolbar-quickinfo.

MOVE 'Passenger Info'(201) TO ls_toolbar-text.

MOVE ' ' TO ls_toolbar-disabled.

APPEND ls_toolbar TO i_object->mt_toolbar.

CLEAR ls_toolbar.

MOVE 'EXCH' TO ls_toolbar-function.

MOVE 2 TO ls_toolbar-butn_type.

MOVE icon_calculation TO ls_toolbar-icon.

MOVE 'Payment in Other Currencies'(202) TO ls_toolbar-quickinfo.

MOVE ' ' TO ls_toolbar-text.

MOVE ' ' TO ls_toolbar-disabled.

APPEND ls_toolbar TO i_object->mt_toolbar.

ENDFORM .

Now, to implement what to be executed when our button is pressed or our subentry is selected we need to program our functions in the method handling the event “user_command”.

FORM handle_user_command USING i_ucomm TYPE syucomm .

DATA lt_selected_rows TYPE lvc_t_roid .

DATA ls_selected_row TYPE lvc_s_roid .

CALL METHOD gr_alvgrid->get_selected_rows

IMPORTING

et_row_no = lt_selected_rows .

READ TABLE lt_selected_rows INTO ls_selected_row INDEX 1 .

IF sy-subrc ne 0 .

MESSAGE s000(su) WITH 'Select a row!'(203) .

ENDIF .

CASE i_ucomm .

WHEN 'EXCH' .

READ TABLE gt_list INDEX ls_selected_row-row_id .

IF sy-subrc = 0 .

....

ENDIF .

WHEN 'PER' .

READ TABLE gt_list INDEX ls_selected_row-row_id .

IF sy-subrc = 0 .

......

ENDIF .

.. ..

ENDCASE .

ENDFORM .

also check the program BCALV_GRID_05

Regards,

Vidya.