Skip to Content
author's profile photo Former Member
Former Member

Addition of custom icon in ALV grid?

Hi,

I need to add an custom icon in addition to the std icons which come with the ALV grid display.Also on click of that i need to call a smartform.CAn anyone provide me with a sample code/example how this can be done?

Thanks in advance.

regards,

SRM Tech

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Oct 28, 2008 at 03:50 AM

    Hi,

    The SAP standard program BCALV_TEST_GRID_TOOLBAR has a lot of examples, it could be helpful for you. In the SAP standard package SLIS there are many example programs with ALV Grid.

    Best Regards,

    Alejandro López

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 30, 2008 at 05:39 AM

    Hi,

    Check it out..

    include : slis,

    cndp.

    DATA: event_receiver1 TYPE REF TO cl_event_receiver.

    DATA : ty_toolbar TYPE stb_button.

    *----


    • CLASS cl_event_receive Declaration

    *----


    • ALV event handler

    *----


    *

    CLASS: cl_event_receiver DEFINITION DEFERRED.

    ----


    • CLASS cl_event_receiver DEFINITION

    ----


    *

    ----


    CLASS cl_event_receiver DEFINITION.

    PUBLIC SECTION.

    • Toolbar

    METHODS handle_toolbar_set

    FOR EVENT toolbar OF cl_gui_alv_grid

    IMPORTING e_object e_interactive.

    • user command

    METHODS handle_user_command

    FOR EVENT user_command OF cl_gui_alv_grid

    IMPORTING e_ucomm .

    ENDCLASS. "cl_event_receiver DEFINITION

    ----


    • CLASS lcl_alv_toolbar IMPLEMENTATION

    ----


    • ALV event handler

    ----


    CLASS cl_event_receiver IMPLEMENTATION.

    METHOD handle_toolbar_set.

    *-- Add toolbar functionality----


    *

    PERFORM handle_toolbar USING e_object.

    ENDMETHOD. "handle_toolbar_set

    *****************Handle User Command

    METHOD handle_user_command.

    DATA: wr_data_changed TYPE REF TO cl_alv_changed_data_protocol.

    CASE e_ucomm.

    WHEN 'CREATE'.

    PERFORM add_line_item.

    WHEN 'DELETE'.

    PERFORM delete_item.

    WHEN 'CHECK'.

    CALL METHOD perform_checks

    EXPORTING

    pr_data_changed = wr_data_changed.

    ENDCASE.

    ENDMETHOD. "handle_user_command

    &----


    *& Form HANDLE_TOOLBAR

    &----


    • text

    ----


    • -->P_E_OBJECT text

    ----


    FORM handle_toolbar USING p_e_object TYPE REF TO

    cl_alv_event_toolbar_set.

    .

    *DELETE BUTTON

    CLEAR ty_toolbar.

    ty_toolbar-icon = icon_delete.

    ty_toolbar-function = 'DELETE'.

    APPEND ty_toolbar TO p_e_object->mt_toolbar.

    *CREATE BUTTON

    CLEAR ty_toolbar.

    ty_toolbar-function = 'CREATE'.

    ty_toolbar-butn_type = 0.

    ty_toolbar-icon = icon_create.

    APPEND ty_toolbar TO p_e_object->mt_toolbar.

    • Check

    CLEAR ty_toolbar.

    ty_toolbar-function = 'CHECK'.

    ty_toolbar-butn_type = 0.

    ty_toolbar-icon = icon_check.

    APPEND ty_toolbar TO p_e_object->mt_toolbar.

    ENDFORM. " HANDLE_TOOLBAR

    Thanks & Regards

    Ruchi Tiwari

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 30, 2008 at 10:22 AM

    Hi Srm_tech,

    Check out this link for Icon Display in ALV.

    [http://www.sap-img.com/abap/regarding-icon-display-in-alv.htm]

    Regards,

    Amit.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.