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: 

need to add icon in ALV

Former Member
0 Kudos

i had declared atype and internal table repcetively,

TYPES : BEGIN OF ty_pr ,

icon LIKE icon-id ,

banfn LIKE eban-banfn ,

txz01 LIKE eban-txz01 ,

ernam LIKE eban-ernam ,

END OF ty_pr.

DATA : it_pr TYPE STANDARD TABLE OF ty_pr

WITH HEADER LINE.

i need to add one icon(not light) in the first column of ALV.Can anyone help me.

Thks,

Manish.

2 REPLIES 2

Former Member
0 Kudos

same thread..enjoy.

Former Member
0 Kudos

Check the following example it may help u.

report z_example.

TYPE-POOLS: slis,icon.

DATA: x_fieldcat TYPE slis_fieldcat_alv,

it_fieldcat TYPE slis_t_fieldcat_alv,

l_layout TYPE slis_layout_alv.

DATA: BEGIN OF itab OCCURS 0,

vbeln LIKE vbak-vbeln,

posnr LIKE vbap-posnr,

icon(1),

END OF itab.

data:program type sy-repid.

SELECT vbeln

posnr

FROM vbap

UP TO 20 ROWS

INTO TABLE itab.

LOOP AT itab.

IF sy-tabix = 1 OR sy-tabix = 2.

itab-icon = '1'.

ELSEIF sy-tabix = 10 OR sy-tabix = 20.

itab-icon = '2'.

ELSE.

itab-icon = '3'.

ENDIF.

MODIFY itab INDEX sy-tabix.

ENDLOOP.

program = sy-repid.

x_fieldcat-fieldname = 'VBELN'.

x_fieldcat-seltext_l = 'VBELN'.

x_fieldcat-hotspot = 'X'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 1.

APPEND x_fieldcat TO it_fieldcat.

CLEAR x_fieldcat.

x_fieldcat-fieldname = 'POSNR'.

x_fieldcat-seltext_l = 'POSNR'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 2.

APPEND x_fieldcat TO it_fieldcat.

CLEAR x_fieldcat.

l_layout-lights_fieldname = 'ICON'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = program

is_layout = l_layout

it_fieldcat = it_fieldcat

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

regards