Application Development and Automation 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: 
Read only

ALV problem

Former Member
0 Likes
1,182

Hi all,

I want to create an icon on the grid but i am unable to get it can tell me the solution why iam not getting icon in the grid.

REPORT zklk_temp .

CLASS lcl_event_receiver DEFINITION DEFERRED.

TABLES: sflight,disvariant.

DATA ok_code LIKE sy-ucomm.

DATA :my_container TYPE REF TO cl_gui_custom_container,

my_container1 TYPE REF TO cl_gui_custom_container,

my_grid TYPE REF TO cl_gui_alv_grid,

my_grd1 TYPE REF TO cl_gui_alv_grid.

DATA:itab TYPE TABLE OF sflight,

selected_rows TYPE TABLE OF sflight.

DATA :my_save,

my_variant TYPE disvariant.

my_save = 'A'.

my_variant-report = sy-repid.

INCLUDE <icon>.

CALL SCREEN 100.

----


  • CLASS lcl_event_receiver DEFINITION

----


*

----


CLASS lcl_event_receiver DEFINITION.

PUBLIC SECTION.

METHODS: handle_toolbar

FOR EVENT toolbar OF cl_gui_alv_grid

IMPORTING e_object e_interactive,

handle_user_command

FOR EVENT user_command OF cl_gui_alv_grid

IMPORTING e_ucomm.

PRIVATE SECTION.

ENDCLASS. "lcl_event_receiver DEFINITION

----


  • CLASS lcl_event_handler IMPLEMENTATION

----


*

----


CLASS lcl_event_receiver IMPLEMENTATION.

METHOD handle_toolbar.

DATA ls_toolbar TYPE stb_button.

  • CLEAR ls_toolbar.

  • MOVE 3 TO ls_toolbar-butn_type.

  • APPEND ls_toolbar TO e_object->mt_toolbar.

CLEAR ls_toolbar.

MOVE 0 TO ls_toolbar-butn_type.

MOVE 'TESTING' TO ls_toolbar-function.

MOVE 'ICON_DISPLAY' TO ls_toolbar-icon.

MOVE 'Show datas'(001) TO ls_toolbar-quickinfo.

MOVE ' ' TO ls_toolbar-disabled.

APPEND ls_toolbar TO e_object->mt_toolbar.

ENDMETHOD. "handle_toolbar

METHOD handle_user_command.

DATA lt_rows TYPE LVC_T_ROW.

CASE e_ucomm.

WHEN'TESTING'.

CALL METHOD my_grid->get_selected_rows

IMPORTING

et_index_rows = lt_rows.

ENDCASE.

ENDMETHOD. "handle_user_command

ENDCLASS. "lcl_event_receiver IMPLEMENTATION

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'TEST'.

SET TITLEBAR 'ALVGRID'.

PERFORM select_data.

IF my_container IS INITIAL.

CREATE OBJECT my_container

EXPORTING container_name = 'BCALVGRID'.

CREATE OBJECT my_grid

EXPORTING i_parent = my_container.

CALL METHOD my_grid->set_table_for_first_display

EXPORTING

i_structure_name = 'SFLIGHT'

is_variant = my_variant

i_save = my_save

CHANGING

it_outtab = itab.

ELSE.

CALL METHOD my_grid->refresh_table_display

EXPORTING

i_soft_refresh = 'X'.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module user_command_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

CASE ok_code.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

WHEN'CANCEL'.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE. " user_command_0100 INPUT

&----


*& Module exit_command INPUT

&----


  • text

----


MODULE exit_command INPUT.

CASE ok_code.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN OTHERS.

ENDCASE.

ENDMODULE. " exit_command INPUT

&----


*& Form select_data

&----


  • text

----


FORM select_data.

SELECT * FROM sflight INTO TABLE itab.

ENDFORM. "select_data

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
990

Hi narasimha,

also declare this.

DATA: g_event_receiver TYPE REF TO lcl_event_receiver.

i dont find these things in your <b>pbo</b> give these things.

SET HANDLER g_event_receiver->handle_user_command FOR my_grid.

SET HANDLER g_event_receiver->handle_toolbar FOR my_grid.

CALL METHOD my_grid->set_toolbar_interactive.

the above things have to give in your <b>PBO</b>

regards.

venu.

7 REPLIES 7
Read only

rainer_hbenthal
Active Contributor
0 Likes
990

use

TYPE-POOLS: SLIS, ICON.

then set the field in the fieldcatalog of type icon:

wa_fcat-icon = 'X'.

assign the iconname to your internal tablefield:

it_out-field = ICON_RED_LIGHT.

Thats all.

Read only

0 Likes
990

Hi Rainer,

Why we have to do all these things,Can you olease explain me and after implenting wa_fat-icon = 'X' its giving error wa_fcat-icon is unknown.so what i have to do

Read only

Former Member
0 Likes
991

Hi narasimha,

also declare this.

DATA: g_event_receiver TYPE REF TO lcl_event_receiver.

i dont find these things in your <b>pbo</b> give these things.

SET HANDLER g_event_receiver->handle_user_command FOR my_grid.

SET HANDLER g_event_receiver->handle_toolbar FOR my_grid.

CALL METHOD my_grid->set_toolbar_interactive.

the above things have to give in your <b>PBO</b>

regards.

venu.

Read only

0 Likes
990

hi venu,

where i have to include the statements

SET HANDLER g_event_receiver->handle_user_command FOR my_grid.

SET HANDLER g_event_receiver->handle_toolbar FOR my_grid.

Read only

0 Likes
990

Hi,

declare this also

include <icon>.

in your <b>PBO</b>you need to set the events.

your pbo means

MODULE status_0100 OUTPUT.
SET PF-STATUS 'TEST'.
SET TITLEBAR 'ALVGRID'.
PERFORM select_data.
IF my_container IS INITIAL.
CREATE OBJECT my_container
EXPORTING container_name = 'BCALVGRID'.
CREATE OBJECT my_grid
EXPORTING i_parent = my_container.
CALL METHOD my_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
is_variant = my_variant
i_save = my_save
CHANGING
it_outtab = itab.
ELSE.
CALL METHOD my_grid->refresh_table_display
EXPORTING
i_soft_refresh = 'X'.
ENDIF.

<b>here you need to declare</b>

ENDMODULE. " STATUS_0100 OUTPUT

Regards,

venu.

Read only

0 Likes
990

after implementing that as you advised to me the program is crashing

Read only

Former Member
0 Likes
990

Hi,

here you have to call event 'SET_TOOLBAR_INTERACTIVE'.

Call this event in MODULE status_0100 .

MODULE status_0100 OUTPUT.

....

..

IF my_conatainer IS INITIAL.

....

ENDIF.

CALL METHOD my_grid->set_toolbar_interactive.

ENDMODULE.

Please look at Demo Program 'BCALV_GRID_05'.

Regards,

suresh