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: 

Creation of icon in alv toolbar

Former Member
0 Kudos

Hi All,

i need to create a icon in alv toolbar.

But i have not created any 'Z' program.

i have created one function module, through that function module i am displaying the ALV grid.

when i am copying the standard pf-status it is asking for program name. but i am using only the function module.

pls help me on this for creating the icon in alv toolbar.

thanks in advance.

7 REPLIES 7

Sandeep_Kumar
Advisor
Advisor
0 Kudos

Here you go :

DATA: ls_bar TYPE stb_button.

CLEAR ls_bar.

*add user button to the ALV toolbar

MOVE 'TRANS' TO ls_bar-function.

MOVE text-004 TO ls_bar-quickinfo.

MOVE icon_transport TO ls_bar-icon.

MOVE text-005 TO ls_bar-text.

CLEAR ls_bar-disabled.

APPEND ls_bar TO e_object->mt_toolbar.

0 Kudos

in your code wat will be the text-004 and text-005.

0 Kudos

hi sandeep,

how to declare e_object->mt_toolbar..

and how to pass this variable in alv..

0 Kudos

Please check SAP Std Demo program - BCALV_GRID_04 for reference

0 Kudos

Text-004 /005 can be anything as per your requirement.

e_object is an instance of cl_gui_alv_grid and using one of the attributes .

former_member182010
Active Participant
0 Kudos

Hello Aishvarya,

The program name that you copy to is derived by concatenating SAPL + function group name that the function module resides in. For example, if your function group name is zfunc_group, then the corresponding program name is SAPLZfunc_group.

former_member182010
Active Participant
0 Kudos

Hello Aishvarya,

Perhaps the code below will help guide you along.



FUNCTION z_alv_screen .
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  CHANGING
*"     REFERENCE(ITAB) TYPE  ZSFLIGHT_TT
*"----------------------------------------------------------------------


  DATA: gr_table TYPE REF TO cl_salv_table.
*
* ALV
*... Create Instance
  TRY.
      CALL METHOD cl_salv_table=>factory
        IMPORTING
          r_salv_table = gr_table
        CHANGING
          t_table      = itab[].
    CATCH cx_salv_msg.
  ENDTRY.

  gr_table->set_screen_status(
              pfstatus      =  'SALV_STANDARD'
              report        = 'SAPLZRAE'
              set_functions = gr_table->c_functions_all ).

*... Display Table
  gr_table->display( ).



ENDFUNCTION.

Edited by: Rae Ellen Woytowiez on Mar 21, 2011 5:17 PM