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 List

Former Member
0 Likes
657

Hi

i need to insert ICON at ALV LIST in columns.

not green/red/yellow light,just an icon.

Instead of data i need to put ICON. and show it with ALV.

How can i do it?

Thanks

Good morning.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
618

hi

good

1) To get access to the icons insert the following statement in the top of the program:

TYPE-POOLS: icon.

2-MOVE icon_change TO ls_toolbar-icon

go through this link which ll give you an example

http://www.erpgenie.com/abap/controls/alvgrid.htm

thanks

mrutyun^

5 REPLIES 5
Read only

Former Member
0 Likes
618

Hi,

You have to just pass the icon name to the internal table field.

You can have a look at demo program,

BCALV_MINIALV

In that select ICONS check box, an icon is displayed in the last column in the output list.

Regards,

Raghavendra

Read only

Former Member
0 Likes
618

pass a variable which has value as icon name....now, when u display the ALV, this field automatically gets generated and displayed as icon...U have lots of examples in SAP...Try using ALV in SE38 and U will find them...

Read only

Former Member
0 Likes
618

Hi,

You can check the Nice Demo <b>BCALV_DEMO_TOOLTIP</b>

here you can see the icons in the Demo program.

Regards

vijay

Read only

Former Member
0 Likes
619

hi

good

1) To get access to the icons insert the following statement in the top of the program:

TYPE-POOLS: icon.

2-MOVE icon_change TO ls_toolbar-icon

go through this link which ll give you an example

http://www.erpgenie.com/abap/controls/alvgrid.htm

thanks

mrutyun^

Read only

dani_mn
Active Contributor
0 Likes
618

HI,

look into follwoing program. copy and paste to test.

REPORT Z_ALV_ICONS .
TYPE-POOLS: slis.
TYPE-POOLS: icon.

TABLES: BKPF, BSIS, PAYR.

TYPES: begin of itab_post_type,

           bukrs type bkpf-bukrs,
           belnr type bkpf-belnr,
           gjahr type bkpf-gjahr,

           blart type bkpf-blart,
           bstat type bkpf-bstat,

           hkont type bsis-hkont,
           shkzg type bsis-shkzg,
           wrbtr type bsis-wrbtr,



       end of itab_post_type.

DATA: begin of itab_post occurs 0,



           bukrs like bkpf-bukrs,
           belnr like bkpf-belnr,
           gjahr like bkpf-gjahr,

           blart like bkpf-blart,
           bstat like bkpf-bstat,

           hkont like bsis-hkont,
           shkzg like bsis-shkzg,
           wrbtr like bsis-wrbtr,

           icon     like icon-id,



       end of itab_post.
*DATA: itab_post type standard table of itab_post_type INITIAL SIZE 0
*with header line.
data: fm_name TYPE rs38l_fnam.

data v_repid like sy-repid.

DATA: it_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
      heading  TYPE slis_t_listheader,
      gs_layout  TYPE slis_layout_alv,
      gx_variant LIKE disvariant,
      g_variant  LIKE disvariant,
      g_exit(1) TYPE c,
      g_save(1) TYPE c,
      gt_list_top_of_page TYPE slis_t_listheader,
      gt_events   TYPE slis_t_event,
      olen TYPE i,
      pageno TYPE n,
      filename LIKE sy-repid.
DATA: IT_EXCL_BUTT type SLIS_T_EXTAB.
data: wa_excl_buttons type SLIS_EXTAB.
data: header type slis_keyinfo_alv.
data: wa_header type slis_keyinfo_alv.

v_repid = sy-repid.

"-----------------------------------------------"
" Selection screen for entering search criteria "
"-----------------------------------------------"
select-options:bukrs for bsis-bukrs,
               gjahr for bkpf-gjahr,
               prctr for bsis-prctr,
               kostl for bsis-kostl,
               belnr for bsis-belnr,
               budat for bsis-budat,
               bldat for bkpf-bldat,
               hkont for bsis-hkont,
               blart for bkpf-blart,
               uname for bkpf-usnam.

SELECT bk~bukrs bk~belnr
       bk~gjahr bk~blart
       bk~bstat bs~hkont
       bs~shkzg bs~wrbtr
*INTO TABLE itab_post
INTO    (itab_post-bukrs, itab_post-belnr,
         itab_post-gjahr, itab_post-blart,
         itab_post-bstat, itab_post-hkont,
         itab_post-shkzg, itab_post-wrbtr )

FROM bkpf as bk
JOIN bsis as bs
ON  ( bk~belnr = bs~belnr AND
      bk~bukrs = bs~bukrs AND
      bk~gjahr = bs~gjahr )
WHERE bk~belnr IN belnr AND
      bk~gjahr IN gjahr AND
      bk~bukrs IN bukrs AND
      bk~blart IN blart AND
      bk~bldat IN bldat AND
      bk~usnam IN uname AND
      bs~hkont IN hkont AND
      bs~kostl IN kostl.

  append itab_post.
ENDSELECT.


PERFORM field_catalog.



LOOP AT itab_post.

  itab_post-icon = '@01@'.
  modify itab_post.

ENDLOOP.


CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
            i_callback_program = v_repid
            i_callback_user_command = 'ITAB_USER_COMMAND'
            is_layout          = gs_layout
            i_background_id    ='CGA'
            i_grid_title       ='Employee Cheque Advice'

            it_fieldcat        = it_fieldcat[]
            i_save             = g_save
            is_variant         = g_variant
            it_events          = gt_events[]
       TABLES
            t_outtab           = itab_post
       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.



**
**ENDLOOP.
*&---------------------------------------------------------------------*
*&      Form  field_catalog
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM field_catalog.


  DATA: wa_fieldcat TYPE slis_fieldcat_alv.

  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            i_program_name     = v_repid
            i_internal_tabname = 'ITAB_POST'
            i_inclname         = v_repid
       CHANGING
            ct_fieldcat        = it_fieldcat[].



ENDFORM.                    " field_catalog



*---------------------------------------------------------------------*
*       FORM itab_user_command                                        *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  WHATCOMM                                                      *
*  -->  WHATROW                                                       *
*---------------------------------------------------------------------*
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.


ENDFORM. "ITAB_user_command