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: 

regarding ALV grid display

Former Member
0 Kudos

How to include icon in the grid display? and also how to enable row selection in the grid display?

8 REPLIES 8

former_member188829
Active Contributor
0 Kudos

Hi Naveen,

Check this Thread..

Former Member
0 Kudos

Check the BCALV sample programs. There are a lot of sample programs.

Albert

0 Kudos

Better you see the examples

it is better way to learn throug examples, try debugger with it and go step by step

its very easy to implement

Former Member
0 Kudos

hi, try the following code :

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

i_logo = 'ENJOYSAP_LOGO'.

reward points if helpful..

Former Member
0 Kudos

First you need create field catalogue with the "HOT SPOT" charateristic updated.

Then you can use the event HOTSPOT_CLICK.

EG:

CLASS ZCL_GUI_ALV_GRID DEFINITION INHERITING FROM CL_GUI_ALV_GRID.

ENDCLASS.

CLASS ZCL_GUI_ALV_GRID IMPLEMENTATION.

ENDCLASS.

Declare the class/method:

CLASS CL_EVENT_RECEIVER DEFINITION.

METHODS HOTSPOT_CLICK

FOR EVENT HOTSPOT_CLICK OF ZCL_GUI_ALV_GRID.

Implement it:

CLASS CL_EVENT_RECEIVER IMPLEMENTATION.

METHOD HOTSPOT_CLICK.

PERFORM "THE ROUTINE".

You could call the ALV grid again with the details pertaining to that line selected.

former_member199581
Active Participant
0 Kudos

Hi Naveen,

you can use the CL_SALV_TABLE model to make everything simple.


TRY.
  CL_SALV_TABLE=>FACTORY( IMPORTING r_salv_table = r_table
                          CHANGING t_table         = the_table ).
  CATCH cx_salv_msg.
ENDTRY.

r_columns = r_table->get_columns( ).
r_columns->set_optimize( abap_true ).
TRY.
  r_column ?= r_columns->get_column( 'THE_COL' ).
* // The cell MUST obviously contain an Icon field, just like ICON_DISPLAY
  r_column->set_icon( abap_true ). 
* // If you need an hotspot, checkbox, pushbutton, etc...you can use constants
* // from Interface IF_SALV_C_CELL_TYPE
  r_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
  CATCH cx_salv_msg cx_salv_not_found.
ENDTRY.

* // You can now set other parameters
r_functions = r_table->get_functions( ).
r_functions->set_all( abap_true ).
r_display = r_table->get_display_settings( ).
r_display->set_striped_pattern( abap_true ).

If you have a CHAR1 field in first position (first column) the display of row selection is automatic.

Otherwise, use methods from CL_SALV_TABLE again to set selections. For example, cell by cell, multiple cells, one row, multiple rows, etc.

Hope this helps.

R.

Former Member
0 Kudos

Just note however that the SALV* classes don't give you any EDIT or DATA ENTRY possibilities. For EDIT you still need the cl_gui_alv_grid class.

For very quick stuff the SALV* classes are fine. I hope SAP adds EDIT functionality to these in a future release.

Cheers

jimbo

0 Kudos

Hope this too!!