Display icons in ALV LVC grid
Hi experts,
Iam trying to display icons in one of the columns in my ALV grid.
I have created ITAB like this.
type-pools : icon,slis.
data: begin of gt_dtl occurs 0,
range(4).
include structure zbitrdtl.
data: field_style type lvc_t_styl.
data: end of gt_dtl.
And iam trying to pass ICON like this.
loop at gt_dtl.
gt_dtl-range = icon_green_light.
modify gt_dtl.
endloop.
And passing into fieldcat.
ls_fcat-fieldname = 'Range'.
ls_fcat-tabname = 'GT_DTL'.
ls_fcat-scrtext_l = 'Range'.
ls_fcat-outputlen = '10'.
ls_fcat-col_pos = 8.
ls_fcat-icon = 'X'.
append ls_fcat to gt_fieldcat.
clear ls_fcat.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_buffer_active = 'X'
i_structure_name = 'ZBITRDTL'
i_client_never_display = 'X'
i_internal_tabname = 'GT_DTL'
changing
ct_fieldcat = gt_fieldcat
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
<b>Iam able to see the ICON in the ITAB in debugging mode.</b>
But iam not getting ICON in my output of ALV.
where iam doing wrong?
Rewared guaranteed,
thanks
kaki
Hi...
copy paste the following code. And check out hte variation.
Hope this will be helpful
Thank-You.
vinsee
REPORT zrwty_wty_errors .
TYPE
TYPE-POOLS: slis, icon.
Tables
Tables : pnwtyh,
balhdr.
Data Decleration
DATA: text(1000), lv_clmno(40).
Internal table for messages ( Datewise )
DATA: BEGIN OF it_balhdr OCCURS 0,
lognumber TYPE balhdr-lognumber,
log_handle TYPE balhdr-log_handle,
END OF it_balhdr.
Internal table for PNWTYH
DATA: BEGIN OF it_pnwtyh OCCURS 0,
clmno TYPE pnwtyh-clmno,
log_message TYPE pnwtyh-log_message,
END OF it_pnwtyh.
Internal table to fetch the actual text messages
DATA: it_message LIKE balm OCCURS 0 WITH HEADER LINE.
Internal Table to handle the ALV o/p
DATA: BEGIN OF it_grid OCCURS 0,
clmno TYPE pnwtyh-clmno,
chgdat TYPE dats,
icon TYPE icon-id," BALIMSGTY
text(1000),
END OF it_grid.
Field Catelog and layout Decleration
DATA: it_fieldcat TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat OCCURS 0 WITH HEADER LINE,
x_fieldcat TYPE lvc_s_fcat OCCURS 0 WITH HEADER LINE.
DATA: x_layout TYPE lvc_s_layo.
DATA: lv_repid LIKE sy-repid.
have hotspot for a PO.
DATA: s_fieldcat LIKE LINE OF it_fieldcat.
s_fieldcat-hotspot = 'X'.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
SELECT-OPTIONS:
s_aldate FOR balhdr-aldate.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
PARAMETERS : r1 RADIOBUTTON GROUP rg DEFAULT 'X'.
PARAMETERS : r2 RADIOBUTTON GROUP rg .
SELECTION-SCREEN END OF BLOCK b2.
if s_aldate-high = '00000000'.
s_aldate-high = s_aldate-low.
endif.
FM to fetcht he messg no. based on date
CALL FUNCTION 'APPL_LOG_READ_DB'
EXPORTING
object = 'WTY'
subobject = 'CLAIMMSG'
EXTERNAL_NUMBER = ' '
date_from = s_aldate-low
date_to = s_aldate-high
TIME_FROM = '000000'
TIME_TO = '240000'
log_class = '1'
PROGRAM_NAME = '*'
TRANSACTION_CODE = '*'
USER_ID = ' '
MODE = '+'
PUT_INTO_MEMORY = ' '
IMPORTING
NUMBER_OF_LOGS =
TABLES
HEADER_DATA =
HEADER_PARAMETERS =
messages = it_message
MESSAGE_PARAMETERS =
CONTEXTS =
data: zlines type i.
describe table it_message lines zlines.
if it_message[] is initial.
message S398(00) with 'No data found.'.
exit.
endif.
IF radio button ERROR only is selected, Delete others
IF r2 = 'X' .
DELETE it_message WHERE msgty <> 'E'.
ENDIF.
fetch log_handle from BALHDR
SELECT lognumber log_handle FROM balhdr INTO TABLE it_balhdr FOR ALL
ENTRIES IN
it_message WHERE lognumber = it_message-lognumber.
Based on log _handle fetch claim no from PNWTYH
SELECT DISTINCT clmno log_message FROM pnwtyh INTO TABLE it_pnwtyh FOR
ALL ENTRIES IN it_balhdr WHERE log_message = it_balhdr-log_handle.
LOOP AT it_message.
READ TABLE it_balhdr WITH KEY lognumber = it_message-lognumber.
IF sy-subrc = 0.
READ TABLE it_pnwtyh WITH KEY log_message = it_balhdr-log_handle.
IF sy-subrc = 0.
lv_clmno = it_pnwtyh-clmno.
ENDIF.
FM to fetch the actual text message
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = it_message-msgid
lang = 'EN'
no = it_message-msgno
v1 = it_message-msgv1
v2 = it_message-msgv2
v3 = it_message-msgv3
v4 = it_message-msgv4
IMPORTING
msg = text
EXCEPTIONS
not_found = 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.
it_grid-clmno = lv_clmno.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = it_grid-clmno
IMPORTING
output = it_grid-clmno.
Local Variable to handle Date Data
DATA: l_tmstp(30) TYPE c,
l_date TYPE sydatum.
WRITE it_message-time_stmp TO l_tmstp LEFT-JUSTIFIED DECIMALS 0
NO-GROUPING.
l_date = l_tmstp(8).
it_grid-chgdat = l_date.
it_grid-text = text.
IF it_message-msgty = 'E'.
it_grid-icon = '@0A@'.
ELSEIF it_message-msgty <> 'E' AND it_message-msgty <> 'S'.
it_grid-icon = '@09@'.
ENDIF.
APPEND it_grid.
CLEAR it_grid.
CLEAR: lv_clmno, it_message, text.
ENDIF.
ENDLOOP.
PERFORM display_alv.
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
PERFORM build_field_catalog.
PERFORM build_layout.
Assign program name to variable
lv_repid = sy-repid.
Call the ALV Grid FM for Display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = lv_repid
i_grid_title = 'Wty Errors'
is_layout_lvc = x_layout
it_fieldcat_lvc = it_fieldcat
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
TABLES
t_outtab = it_grid[]
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.
ENDFORM. " display_alv
*& Form build_field_catalog
text
--> p1 text
<-- p2 text
FORM build_field_catalog .
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZWTY_ERR'
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = it_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'ICON'.
wa_fieldcat-seltext_l = 'Mssg Type'.
wa_fieldcat-seltext = 'Mssg Type'.
wa_fieldcat-icon = 'X'.
wa_fieldcat-SCRTEXT_L = 'Mssg Type'.
wa_fieldcat-outputlen = 8.
wa_fieldcat-tabname = 'IT_GRID'.
APPEND wa_fieldcat TO it_fieldcat.
MODIFY it_fieldcat FROM wa_fieldcat TRANSPORTING seltext_l WHERE
fieldname = 'ICON' .
CLEAR wa_fieldcat.
MODIFY it_fieldcat FROM wa_fieldcat TRANSPORTING seltext icon
SCRTEXT_L
WHERE
fieldname = 'ICON' .
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 2.
wa_fieldcat-fieldname = 'CHGDAT'.
wa_fieldcat-seltext_l = 'Chg Date'.
wa_fieldcat-seltext = 'Chg Date'.
wa_fieldcat-SCRTEXT_L = 'Chg Date'.
wa_fieldcat-outputlen = 10.
wa_fieldcat-tabname = 'IT_GRID'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
MODIFY it_fieldcat FROM wa_fieldcat TRANSPORTING seltext_l WHERE
fieldname = 'CHGDAT' .
CLEAR wa_fieldcat.
MODIFY it_fieldcat FROM wa_fieldcat TRANSPORTING seltext SCRTEXT_L
WHERE
fieldname = 'CHGDAT' .
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 4.
wa_fieldcat-fieldname = 'TEXT'.
wa_fieldcat-seltext_l = 'Message Text'.
wa_fieldcat-seltext = 'Message Text'.
wa_fieldcat-SCRTEXT_L = 'Chg Date'.
wa_fieldcat-outputlen = 100.
wa_fieldcat-tabname = 'IT_GRID'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
*MODIFY it_fieldcat FROM wa_fieldcat TRANSPORTING seltext_l WHERE
fieldname = 'TEXT'.
CLEAR wa_fieldcat.
MODIFY it_fieldcat FROM wa_fieldcat TRANSPORTING seltext SCRTEXT_L WHERE
fieldname = 'TEXT'.
CLEAR wa_fieldcat.
MODIFY it_fieldcat FROM s_fieldcat TRANSPORTING hotspot
WHERE fieldname = 'CLMNO'.
ENDFORM. " build_field_catalog
*& Form Build_layout
text
--> p1 text
<-- p2 text
FORM build_layout .
CLEAR x_layout.
x_layout-colwidth_optimize = 'X'.
x_layout-zebra = 'X'.
ENDFORM. " Build_layout
FORM display_detail *
--> UCOMM *
--> SELFIELD *
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm = '&IC1'.
READ TABLE it_grid INDEX selfield-tabindex.
IF sy-subrc EQ 0.
CALL 'WTY' FOR SELECTED CLAIM
CALL FUNCTION 'ZWTY_CLAIM_DISPLAY'
EXPORTING
i_clmno = it_grid-clmno
iv_from_doc = 'J'
EXCEPTIONS
not_found = 1
authority_failed = 2
no_claimtype = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "user_command
Similar Messages
-
I want to display icons in ALV
Hi friends,
I want to display icon indicators in ALV ???
can anybody tell me ??/
Thanks...Hi sturdy,
this code will help u...copy paste and run...
*& Report ZFI_TEST *
REPORT ZFI_ICON_TEST MESSAGE-ID zz .
*& TABLES DECLARATION *
TABLES: vbak.
*& TYPE POOLS DECLARATION *
TYPE-POOLS: slis.
*& INTERNAL TABLE DECLARATION *
DATA: BEGIN OF itab OCCURS 0,
icon TYPE icon-id, "itab-icon = '@08@' -> Green ; '@09@' -> Yellow ; '@0A@' -> Red
vbeln LIKE vbak-vbeln,
audat LIKE vbak-audat,
vbtyp LIKE vbak-vbtyp,
auart LIKE vbak-auart,
augru LIKE vbak-augru,
netwr LIKE vbak-netwr,
waerk LIKE vbak-waerk,
END OF itab.
*INTERNAL TABLE FOR FIELD CATALOG
DATA: wa_fieldcat TYPE slis_fieldcat_alv,
it_fieldcat TYPE slis_t_fieldcat_alv.
IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
WITH HEADER LINE,
*INTERNAL TABLE FOR EVENTS
DATA: it_event TYPE slis_t_event,
wa_event TYPE slis_alv_event,
*INTERNAL TABLE FOR SORTING
it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv,
*INTERNAL TABLE FOR LAYOUT
wa_layout TYPE slis_layout_alv.
*& VARIABLE DECLARATION *
DATA : v_repid TYPE sy-repid,
v_pagno(4) TYPE n,
v_date(8) TYPE c.
*& CONSTANTS *
CONSTANTS: c_x TYPE c VALUE 'X'.
*& SELECTION SCREEN *
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
s_vbtyp FOR vbak-vbtyp DEFAULT 'C'.
SELECTION-SCREEN: END OF BLOCK b1.
SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECTION-SCREEN : BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) text-003.
PARAMETERS: p_list RADIOBUTTON GROUP rad1 DEFAULT 'X'.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN : BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) text-004.
PARAMETERS: p_grid RADIOBUTTON GROUP rad1.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN: END OF BLOCK b2.
AT SELECTION-SCREEN.
PERFORM validate_screen.
*& START OF SELECTION *
START-OF-SELECTION.
CLEAR: itab, itab[].
V_REPID = SY-REPID.
PERFORM get_data.
PERFORM display_data.
*& END OF SELECTION *
END-OF-SELECTION.
*--DO ALV Process
v_repid = sy-repid.
*--Sort the Output Fields
PERFORM sort_fields.
*--Build Field catalog for the Output fields
PERFORM BUILD_FIELDCAT.
*--Set the Layout for ALV
PERFORM set_layout.
*& Form GET_DATA
text
TO GET THE DATA FROM TABLES INTO ITAB
FORM get_data .
SELECT vbeln
audat
vbtyp
auart
augru
netwr
waerk
INTO CORRESPONDING FIELDS OF TABLE itab
FROM vbak
WHERE vbeln IN s_vbeln AND
audat > '04.04.2005'
AND netwr > 0.
LOOP AT itab.
IF itab-netwr < 10000.
itab-icon = '@08@'.
ELSEIF itab-netwr > 10000 AND itab-netwr < 100000.
itab-icon = '@09@'.
ELSEIF itab-netwr > 100000.
itab-icon = '@0A@'.
ENDIF.
MODIFY itab INDEX sy-tabix.
ENDLOOP.
ENDFORM. " GET_DATA
*& Form sort_fields
FORM sort_fields .
CLEAR wa_sort.
wa_sort-fieldname = 'VBTYP'.
wa_sort-spos = '1'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-fieldname = 'NETWR'.
wa_sort-spos = '2'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO it_sort.
ENDFORM. " sort_fields
*& Form set_layout
FORM set_layout .
IF p_list = c_x .
wa_layout-window_titlebar = 'LIST DISPLAY'(016).
wa_layout-zebra = 'X'.
*-- ALV LIST DISPLAY
PERFORM list_display TABLES itab.
*-- ALV GRID DISPLAY
ELSEIF p_grid = c_x.
wa_layout-window_titlebar = 'GRID DISPLAY'(017).
wa_layout-zebra = 'X'.
PERFORM grid_display TABLES itab.
ENDIF.
ENDFORM. " set_layout
*& Form list_display
FORM list_display TABLES p_itab .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = wa_layout
it_fieldcat = it_fieldcat[]
it_sort = it_sort[]
i_save = 'U'
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.
ENDFORM. " list_display
*& Form GRID_DISPLAY
FORM grid_display TABLES p_itab .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = wa_layout
it_fieldcat = it_fieldcat[]
it_sort = it_sort[]
it_events = it_event
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.
ENDFORM. " GRID_DISPLAY
*& Form VALIDATE_SCREEN
text
--> p1 text
<-- p2 text
FORM validate_screen .
DATA: lv_vbeln LIKE vbak-vbeln.
IF NOT s_vbeln IS INITIAL.
SELECT vbeln
INTO lv_vbeln
UP TO 1 ROWS
FROM vbak
WHERE vbeln IN s_vbeln.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'INVALID SALES DOC'.
ENDIF.
ENDIF.
ENDFORM. " VALIDATE_SCREEN
*& Form display_data
text
--> p1 text
<-- p2 text
FORM display_data .
DEFINE m_fieldcat.
add 1 to wa_fieldcat-col_pos.
wa_fieldcat-fieldname = &1.
wa_fieldcat-ref_tabname = 'VBAK'.
wa_fieldcat-do_sum = &2.
wa_fieldcat-cfieldname = &3.
append wa_fieldcat to it_fieldcat.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
m_fieldcat 'ICON' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'AUDAT' '' ''.
m_fieldcat 'VBTYP' '' ''.
m_fieldcat 'AUART' '' ''.
m_fieldcat 'AUGRU' '' ''.
m_fieldcat 'NETWR' 'C' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
ENDFORM. " display_data[/code] -
Can we display ICONS in ALV list?
Hi,
Is it possible to display icons (ICON_GREEN_LIGHT) in the ALV list using the function module REUSE_ALV_LIST_DISPLAY.
Is there any possibility of displaying a list using object oriented ALV?
Thanks and Regards,
Lakshmi.Hi Lakshmi,
Just check this once.
REPORT Zxxx MESSAGE-ID ZZ .
*& TABLES DECLARATION *
TABLES: VBAK.
*& TYPE POOLS DECLARATION *
TYPE-POOLS: SLIS.
*& INTERNAL TABLE DECLARATION *
DATA: BEGIN OF ITAB OCCURS 0,
ICON TYPE ICON-ID,
VBELN LIKE VBAK-VBELN,
AUDAT LIKE VBAK-AUDAT,
VBTYP LIKE VBAK-VBTYP,
AUART LIKE VBAK-AUART,
AUGRU LIKE VBAK-AUGRU,
NETWR LIKE VBAK-NETWR,
WAERK LIKE VBAK-WAERK,
END OF ITAB.
*INTERNAL TABLE FOR FIELD CATALOG
DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
WITH HEADER LINE,
*INTERNAL TABLE FOR EVENTS
DATA: IT_EVENT TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT,
*INTERNAL TABLE FOR SORTING
IT_SORT TYPE SLIS_T_SORTINFO_ALV,
WA_SORT TYPE SLIS_SORTINFO_ALV,
*INTERNAL TABLE FOR LAYOUT
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
*& VARIABLE DECLARATION *
DATA : V_REPID TYPE SY-REPID,
V_PAGNO(4) TYPE N,
V_DATE(8) TYPE C.
*& CONSTANTS *
CONSTANTS: C_X TYPE C VALUE 'X'.
*& SELECTION SCREEN *
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN,
S_VBTYP FOR VBAK-VBTYP DEFAULT 'C'.
SELECTION-SCREEN: END OF BLOCK B1.
SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN : BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) TEXT-003.
PARAMETERS: P_LIST RADIOBUTTON GROUP RAD1 DEFAULT 'X'.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN : BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) TEXT-004.
PARAMETERS: P_GRID RADIOBUTTON GROUP RAD1.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN: END OF BLOCK B2.
AT SELECTION-SCREEN.
PERFORM VALIDATE_SCREEN.
*& START OF SELECTION *
START-OF-SELECTION.
CLEAR: ITAB, ITAB[].
V_REPID = SY-REPID.
PERFORM GET_DATA.
PERFORM DISPLAY_DATA.
*& END OF SELECTION *
END-OF-SELECTION.
*--DO ALV Process
V_REPID = SY-REPID.
*--Sort the Output Fields
PERFORM SORT_FIELDS.
*--Build Field catalog for the Output fields
PERFORM BUILD_FIELDCAT.
*--Set the Layout for ALV
PERFORM SET_LAYOUT.
*& Form GET_DATA
text
TO GET THE DATA FROM TABLES INTO ITAB
FORM GET_DATA .
SELECT VBELN
AUDAT
VBTYP
AUART
AUGRU
NETWR
WAERK
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM VBAK
WHERE VBELN IN S_VBELN AND
AUDAT > '04.04.2005'
AND NETWR > 0.
LOOP AT ITAB.
IF ITAB-NETWR < 10000.
ITAB-ICON = '@08@'.
ELSEIF ITAB-NETWR > 10000 AND ITAB-NETWR < 100000.
ITAB-ICON = '@09@'.
ELSEIF ITAB-NETWR > 100000.
ITAB-ICON = '@0A@'.
ENDIF.
MODIFY ITAB INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " GET_DATA
*& Form sort_fields
FORM SORT_FIELDS .
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'VBTYP'.
WA_SORT-SPOS = '1'.
WA_SORT-UP = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'NETWR'.
WA_SORT-SPOS = '2'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
ENDFORM. " sort_fields
*& Form build_fieldcat
*FORM BUILD_FIELDCAT .
IT_FIELDCAT-COL_POS = '1'.
IT_FIELDCAT-FIELDNAME = 'ICON'.
IT_FIELDCAT-KEY = 'X'.
IT_FIELDCAT-OUTPUTLEN = '10'.
IT_FIELDCAT-SELTEXT_L = 'LIGHT'.
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '2'.
IT_FIELDCAT-FIELDNAME = 'VBELN'.
IT_FIELDCAT-KEY = 'X'.
IT_FIELDCAT-OUTPUTLEN = '10'.
IT_FIELDCAT-SELTEXT_L = 'SALES DOC NUMBER'(009).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '3'.
IT_FIELDCAT-FIELDNAME = 'AUDAT'.
IT_FIELDCAT-KEY = 'X'.
IT_FIELDCAT-OUTPUTLEN = '4'.
IT_FIELDCAT-SELTEXT_L = 'DOCUMENT DATE'(010).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '4'.
IT_FIELDCAT-FIELDNAME = 'VBTYP'.
IT_FIELDCAT-KEY = 'X'.
IT_FIELDCAT-OUTPUTLEN = '4'.
IT_FIELDCAT-SELTEXT_L = 'CATEGORY'(011).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '5'.
IT_FIELDCAT-FIELDNAME = 'AUART'.
IT_FIELDCAT-OUTPUTLEN = '4'.
IT_FIELDCAT-SELTEXT_L = 'DOCUMENT TYPE'(012).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '6'.
IT_FIELDCAT-FIELDNAME = 'AUGRU'.
IT_FIELDCAT-OUTPUTLEN = '12'.
IT_FIELDCAT-SELTEXT_L = 'Order reason'(013).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '7'.
IT_FIELDCAT-FIELDNAME = 'NETWR'.
IT_FIELDCAT-OUTPUTLEN = '12'.
IT_FIELDCAT-SELTEXT_L = 'NET VALUE'(014).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '8'.
IT_FIELDCAT-FIELDNAME = 'WAERK'.
IT_FIELDCAT-OUTPUTLEN = '12'.
IT_FIELDCAT-SELTEXT_L = 'SD DOC CURR'(015).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
*ENDFORM. " build_fieldcat
*& Form set_layout
FORM SET_LAYOUT .
IF P_LIST = C_X .
WA_LAYOUT-WINDOW_TITLEBAR = 'LIST DISPLAY'(016).
WA_LAYOUT-ZEBRA = 'X'.
*-- ALV LIST DISPLAY
PERFORM LIST_DISPLAY TABLES ITAB.
*-- ALV GRID DISPLAY
ELSEIF P_GRID = C_X.
WA_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'(017).
WA_LAYOUT-ZEBRA = 'X'.
PERFORM GRID_DISPLAY TABLES ITAB.
ENDIF.
ENDFORM. " set_layout
*& Form list_display
FORM LIST_DISPLAY TABLES P_ITAB .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT[]
IT_SORT = IT_SORT[]
I_SAVE = 'U'
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.
ENDFORM. " list_display
*& Form GRID_DISPLAY
FORM GRID_DISPLAY TABLES P_ITAB .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT[]
IT_SORT = IT_SORT[]
IT_EVENTS = IT_EVENT
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.
ENDFORM. " GRID_DISPLAY
*& Form VALIDATE_SCREEN
text
--> p1 text
<-- p2 text
FORM VALIDATE_SCREEN .
DATA: LV_VBELN LIKE VBAK-VBELN.
IF NOT S_VBELN IS INITIAL.
SELECT VBELN
INTO LV_VBELN
UP TO 1 ROWS
FROM VBAK
WHERE VBELN IN S_VBELN.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'INVALID SALES DOC'.
ENDIF.
ENDIF.
ENDFORM. " VALIDATE_SCREEN
*& Form display_data
text
--> p1 text
<-- p2 text
FORM DISPLAY_DATA .
DEFINE M_FIELDCAT.
ADD 1 TO WA_FIELDCAT-COL_POS.
WA_FIELDCAT-FIELDNAME = &1.
WA_FIELDCAT-REF_TABNAME = 'VBAK'.
WA_FIELDCAT-DO_SUM = &2.
WA_FIELDCAT-CFIELDNAME = &3.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
m_fieldcat 'ICON' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'AUDAT' '' ''.
m_fieldcat 'VBTYP' '' ''.
m_fieldcat 'AUART' '' ''.
m_fieldcat 'AUGRU' '' ''.
m_fieldcat 'NETWR' 'C' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
ENDFORM. " display_data
hope it helps u
regards
laxmi -
How to display icon (like green or red circle similar to signal light) in ALV Report
Hi,
just create a separate col in alv and in the field catalog assign the property lights .
and refer to the wiki link
[http://wiki.sdn.sap.com/wiki/display/Snippets/ALVGriddisplaywithLights]
Hope this resolves the issue !
Best of Luck !!
Regards,
Ravi Aswani -
Hi,
I've already searched the forum about this topic and I didn't find any thread that helped me to display the icon.
I'll post my code below, mind you, this code is just a test code so it's kinda trashy...
INCLUDE: <icon>.
TYPE-POOLS: slis.
TYPES: BEGIN OF t_tab,
<b> icon TYPE icon-id,</b>
matnr TYPE matnr,
ersda TYPE ersda,
ernam TYPE ernam,
laeda TYPE laeda,
END OF t_tab.
DATA: i_tab TYPE STANDARD TABLE OF t_tab WITH HEADER LINE,
wa_tab TYPE t_tab.
DATA: i_fcat TYPE slis_t_fieldcat_alv,
wa_cat TYPE slis_fieldcat_alv,
wa_layout TYPE slis_layout_alv,
i_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
it_events TYPE slis_t_event,
wa_events TYPE slis_alv_event.
START-OF-SELECTION.
SELECT matnr
ersda
ernam
laeda
FROM mara
INTO CORRESPONDING FIELDS OF TABLE i_tab
WHERE ernam = 'DIEHL'.
END-OF-SELECTION.
<b>i_tab-icon = '@01@'.</b>
PERFORM fcat USING:
<b> 'ICON' 'I_TAB' 'ICON' 'Icon' 'X',</b>
'MATNR' 'I_TAB' 'MATNR' 'Material Number' space,
'ERSDA' 'I_TAB' 'ERSDA' 'Creation Date' space,
'ERNAM' 'I_TAB' 'ERNAM' 'Name of Creator' space,
'LAEDA' 'I_TAB' 'LAEDA' 'Date Last Changed' space.
wa_layout-zebra = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = wa_layout
it_fieldcat = i_fcat
TABLES
t_outtab = i_tab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
ENDIF.
*& Form fcat
text
FORM fcat USING p_fieldname TYPE any
p_tabname TYPE any
p_reffname TYPE any
p_text TYPE any
p_icon TYPE any.
CLEAR wa_cat.
wa_cat-fieldname = p_fieldname.
wa_cat-tabname = p_tabname.
wa_cat-ref_fieldname = p_reffname.
wa_cat-seltext_l = p_text.
<b> wa_cat-icon = p_icon.</b>
APPEND wa_cat TO i_fcat.
CLEAR wa_cat.
ENDFORM. " fcat
With the code above, the icon is still not displaying...
Do you think there's something missing in the code?
I've also check the ALV sample programs BCALV* but call methods are used there not FM.I've already figured out the answer!!
I was not appending the ICON in the table i_tab... hehehe -
How to display icon in alv report output
hi,
my ewquirement in in alv report in one column to diaplay the icon(tickmark) based on some codition.
how to achieve it??
condition is
Affected (Locked on Current ECM) u2013 can use symbols for affected and for changing u2013
u2022 Lock AEOI u2013 CCLCK for AE01-OBJKT (Material) lock.
Condition:
If AEOI u2013 CCLCK is activated then display symbols (tickmark) in line of their AE01-OBJKT (Material). else display
(x mark)Hi,
In field catalog of grid set
Ex--
when 'Field'.
lwa_fcat-icon = c_true.
based on your condition
set the desired icon in table.
Ex.... lwa_table-field = icon_tick. -
Hi all Good Morning.
In ALV report am inserted my own icons. But the problem is at output screen am getting only those icons which i created, remaining are not displaying in standard tool bar .
Please tell me how to solve this. I want to display all default icons with my own created icons in standard tool bar .
Regards,
Prajwal K.
Edited by: prajwal k on Jan 24, 2008 4:39 AMHi Prajwal, this code will solve ur problem.
go to SE41.
Give SAPLKKBL as program name and STANDARD_FULLSCREEN as status....
now click on Copy Status and in that give ur program and status name into To.....
now in REUSE_ALV_GRID_DISPLAY
FORM display_list.
g_f_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_f_repid
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_STAT'
it_fieldcat = g_t_fieldcat[]
it_events = g_t_events[]
TABLES
t_outtab = g_t_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.
ENDFORM. " display_list
FORM set_stat USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTAT' EXCLUDING rt_extab.
ENDFORM. "set_stat
here my status name is ZSTAT which i gave in SE41...
and in user_command form...
FORM user_command USING u_comm LIKE sy-ucomm selfield TYPE slis_selfield.
CASE u_comm.
WHEN 'DET'.
........ur logic.........
ENDCASE.
ENDFORM. "user_command
kindly reward if found helpful.
cheers,
Hema. -
Display icon in alv report ?
Hi All,
I am using class 'cl_gui_alv_grid' to generate an alv report. I want to display status icons like red, yellow and green in one of the coulmns. Please let me know how to achieve the same.
Regards,
Navneeth K.Try to follow the below code.
Add
icon TYPE icon-id, "Status
to your output table
Constants
CONSTANTS: c_green TYPE icon-id VALUE '@08@',
c_yellow TYPE icon-id VALUE '@09@',
c_red TYPE icon-id VALUE '@0A@'.
Put your condition in which you want to display which color.
IF CONDITION.
MOVE c_yellow TO wa_out-icon.
MODIFY it_out
from wa_out.
ENDIF.
Add it in your catalog
FORM populate_fieldcat USING p_table TYPE c.
**status
CLEAR wa_fieldcat.
wa_fieldcat-tabname = p_table.
wa_fieldcat-fieldname = 'ICON'.
wa_fieldcat-seltext_l = text-010.
wa_fieldcat-outputlen = 15.
wa_fieldcat-icon = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
i_structure_name = 'MARA'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
is_layout = gs_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = it_out[]
IT_FIELDCATALOG = T_FIELDCAT
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4. -
Hello.
Could You tell me how to display icon in cell of ALV Grid? MAybe You have a link to some tutorial?
I'm trying make such thing:
to my itab I'm adding
icon1 LIKE icon-id
then I fill itab, to fieldcatalog give
PERFORM append_wsfield USING
ws_field_st ws_fieldcat_st 'ICON1' '' 0 1 0 '' 2 'X' ''.
When I debug code, there is an icon in the itab, but in grid it doesnt appears.
I'd be thankful for help. Greetings. P.
Message was edited by:
Piotr WojciechowskiGo to the type pool ICON and you can find the code for each icon there. Depending on the icon that you want assign the code for that icon to the column in the ALV Grid (Icon field in the internal table). The icon will be displayed automatically.
Please mark points if the solution was useful.
Regards,
Manoj -
Microsoft Excel Icon in ALV Grid Report
Hi all,
We have a customized report. When we execute that reports, it open in ALV Grid format. When we choose "Microsoft Excel" Icon to change layout to Excel, it then shows the report in excel without any data.
Can any one please tell me that why there is no data? should i need to do any settings in excel for this?
Please respond.
Best Regards,
AIHi,
Refer these:
Microsoft Excel Icon in ALV Grid Report
Re: Not able display the Excel Icon in ALV List Display
Hope it helps
Regards
Mansi -
To Display Image in Alv Grid....
Hello Gurus,
I want to display an image/icon ( custom icon ) in the ALV grid.
I know to display standard icons in ALV. But i dont know how to store custom icons in the system.
I want to display an icon or image depending upon certain conditions. i need to display these images/icons for each row of the ALV grid.
Please let me know if i can show images or icons ( not standard ) for each row in ALV grid.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 25, 2008 10:20 AMcheck out CL_GUI_PICTURE and the demo programs
SAP_PICTURE_DEMO
SAP_PICTURE_DEMO_ICON
RSDEMO_PICTURE_CONTROL
you can fit the picture in to the control with the following modes.
DISPLAY_MODE_FIT
other options
DISPLAY_MODE_NORMAL
DISPLAY_MODE_STRETCH
DISPLAY_MODE_NORMAL_CENTER
DISPLAY_MODE_FIT_CENTER
Regards
Raja -
How to display tooltip in ALV GRID CELL?
Hello,
I'm trying to display dynamic tootips for data in ALV GRID Cells.
My ALV Gid Cells content does not display Icon or symbol or Exception but pure data (In my case dates).
Is there a way to do display a toolip that will change dynamicaly according to a rule.
I took a look at the BCALV_DEMO_TOOLTIP program
but it does not answer my expectation since it display
toltip for Icon or symbol or Exception.
Can someone help on this case.
Best regards
HarryHai Harry
icon
value set: SPACE, 'X' 'X' = column contents to be output as an icon.
The caller must consider the printability of icons.
symbol
value set: SPACE, 'X' 'X' = column contents are to be output as a symbol.
The internal output table column must be a valid symbol character.
The caller must consider the printability of symbols.
Symbols can usually be printed, but may not always be output correctly, depending on the printer configuration.
Thanks & regards
Sreenu -
Display amount in ALV Grid with different Decimal Places based on Currency
HI Experts,
Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2.
we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
AED---22.56
KWD---225.65
i need to display values like AED : 22.56HI Experts,
Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2. we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
AED---22.56
KWD---225.65 (converting this value to 22.565 using BAPI_CURRENCY_GETDECIMALS according to currency in my Report)
i need to display values like AED : 22.56
KWD---22.565 but here field is NETWR with 2 decimal.
Need to Display amount in ALV Grid with different Decimal Places based on Currency
Regards,
Dileep Kumar Reddy -
ALV Sub total texts. displayed in list not in grid.
Hi,
I am displaying data using alv and sub-totals on a particular column.
i am getting the sub-totals but i am not getting the sub-total texts when i am displaying data in a grid.
'REUSE_ALV_GRID_DISPLAY'.
i am getting subtotals and subtotal texts when i am diSplAying in list.
'REUSE_ALV_LIST_DISPLAY'.
but i want to get subtotal texts using alv grid, is it possible, if so please send me the code.
Any help in this regard is highly appreciated.
Thanks in advance for your help.Hi,
Actually i have wriitten the same code, in the alv. I am using Function modules. for the same code the sub-total and total text is appearing in the list output. but not in the grid output.
code.
wa_layout-zebra = 'X'.
wa_layout-subtotals_text = 'Total'.
wa_layout-totals_text = 'Sum of Marks'.
alv statement.
is_layout = wa_layout
Declaration.
DATA : wa_layout type slis_layout_alv.
for the same declarations (Above) list is showing the texts but not the grid.
Any help in this regard is highly appreciated. -
How to show icons in ALV grid ...
Hi guyz ,
A lill query ....
In an ALV gird ,if i need to display icons in one of the columns , say i have
a field called Status , where i need show some icons like green , yellow and
red circles , depending on some other fileds say invoice reciept date .
So can i get icons in ALV colums.
Please advise .
Thanks
JahanThis is very easy. IN your status field in your internal table, you simply write the icon to it. Make sure that the status field is defined as a character field with a length of 4. Then write the icon to it.
Type-pools: icon.
write icon_green_light as icon to itab-status.
Then when filling the field catalog, set the ICON flag. This puts the icon in the center of the cell in ALV.
xfc-icon = 'X'.
append xfc to ifc.
Regards,
Rich Heilman
Maybe you are looking for
-
Hi all, I am new to CRM consulting and now I got a vague idea of Pricing. We have created quotations in mobile sales and send to online. In CRM online the error message displayed is "PRICING Document is already locked in transaction". I see the
-
File to Idoc Scenario. Pls advice
Hi All, I have implemented File to Idoc Scenario and it worked fine. I have 2 doubts: My Scenario: File -- XI -- R/3 system named D01 1. In Configuration: In Receiver Aggrement why we put XI Business System name in Sender Service? 2. In Configu
-
I have a MacBook Pro with Snow Leopard OS 10.6.4 Was told to upgrade to the latest version of Flash Player because the version on the Safari Installed Plug-ins page shows "Shockwave Flash 10.0 r45." I see no Plug-in called Flash or Flash Player, just
-
Enterprise Manager console is not coming
Installed Oracle XE, Weblogic Server, SOA Server and ran RCU and all software's installed successfully without any errors. After that i created one Domain in Weblogic with Different servers ( Admin Server, SOA server and BAM Server) after that starte
-
hi need help with still images looked great in the viewer ,but in timeline and canvas they look too pixelated and poor quality, any ideas as to what i am doing wrong any advice ealy appreciate thankyou simon