10-16-2008 10:19 AM
hi, all
i am just wondering if i can set the traffic light column position.
and what i mean is : now it is clear that the exception column is always displayed as the first column in the alv grid , can we display the exception column in other position ?
e.g :
is it possible to display like this:
column 1 column 2 traffic_light_column
10-16-2008 10:23 AM
try giving column position for each column in fieldcatalog.
For ex.
t_fieldcat-col_pos = 1. "For col1
.... "append fieldcat
t_fieldcat-col_pos = 2. "For col2
... "append fieldcat
t_fieldcat-col_pos = 3. "For traffic_light.
... "append fieldcat
Hope this helps!
10-16-2008 10:23 AM
try giving column position for each column in fieldcatalog.
For ex.
t_fieldcat-col_pos = 1. "For col1
.... "append fieldcat
t_fieldcat-col_pos = 2. "For col2
... "append fieldcat
t_fieldcat-col_pos = 3. "For traffic_light.
... "append fieldcat
Hope this helps!
10-16-2008 10:25 AM
10-16-2008 10:46 AM
10-16-2008 11:02 AM
could you pls write your code here?
normally if in internal table(output) and fieldcatalog you declare it in middle, the traffic light comes in the middle column. If in the output table, you have declared the Icon field as first field then it(icon field) will always be displayed as first column.
10-16-2008 11:06 AM
hi, Saba Sayed
i declared the light field in the last of the fieldcatalog and output table, but it comes to be that the light column is still the first column .
10-16-2008 11:45 AM
chk this sample code:
TYPE-POOLS:slis, icon.
TABLES:ekko,ekpo,kna1,bseg.
DATA:BEGIN OF itab OCCURS 0 ,
bukrs LIKE bseg-bukrs,
belnr LIKE bseg-belnr,
icon TYPE icon-id,
ebeln LIKE bseg-gjahr,
buzei LIKE bseg-buzei,
END OF itab.
DATA: cat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
PARAMETERS: s_ebeln LIKE bseg-bukrs.
SELECT bukrs belnr gjahr buzei FROM bseg INTO CORRESPONDING FIELDS OF TABLE itab up to 1 rows WHERE bukrs = s_ebeln.
itab-icon = '@08@'.
MODIFY itab index sy-tabix transporting icon.
PERFORM catalog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZALV2_GRID'
it_fieldcat = cat[]
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.
*
*&----
**& Form CATALOG
*&----
text
----
--> p1 text
<-- p2 text
----
FORM catalog .
cat-tabname = 'ITAB'.
cat-fieldname = 'BUKRS'.
cat-seltext_l = 'DOCUMENT'.
APPEND cat.
cat-tabname = 'ITAB'.
cat-fieldname = 'BELNR'.
cat-seltext_l = 'Company Code'.
APPEND cat.
cat-tabname = 'ITAB'.
cat-fieldname = 'ICON'.
cat-seltext_l = 'Traffic Light'.
APPEND cat.
cat-tabname = 'ITAB'.
cat-fieldname = 'GJAHR'.
cat-seltext_l = 'VENDOR'.
APPEND cat.
cat-tabname = 'ITAB'.
cat-fieldname = 'BUZEI'.
cat-seltext_l = 'GROUP'.
APPEND cat.
ENDFORM. " CATALOG
10-16-2008 11:47 AM
hi,
u can assign traffic light to any column as per ur requirement...only specify specific traffic light specicifications in that particular column in the fieldcatalog..
10-16-2008 12:58 PM
Hi,
please go through following code....i hope u will get the solution..
TYPE-POOLS:SLIS.
data:begin of ITAB occurs 0,
NAME(20) type C,
AGE(22) type C,
ADDRESS(30) type C,
icon(4),
end of ITAB.
data :fcat type standard table of SLIS_FIELDCAT_ALV.
data :wa_fcat like line of fcat.
data:value type string.
DATA:V_REPID LIKE SY-REPID.
V_REPID = SY-REPID.
ITAB-NAME = 'arun bajpeyee'.
ITAB-AGE = '50'.
ITAB-ADDRESS = 'DElhi'.
ITAB-icon = '@0A@'.
append ITAB.
ITAB-NAME = 'taneesha bajpeyee'.
ITAB-AGE = ''.
ITAB-ADDRESS = 'banglore'.
ITAB-icon = '@0A@'.
append ITAB.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'NAME'.
wa_fcat-inttype = 'C'.
wa_fcat-SELtext_M = 'NAME'.
wa_fcat-emphasize = 'X'.
wa_fcat-fix_column = 'X'.
wa_fcat-outputlen = 25.
wa_fcat-col_pos = 1.
append wa_fcat to fcat.
clear wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'AGE'.
wa_fcat-SELtext_M = 'AGE'.
wa_fcat-emphasize = 'X'.
wa_fcat-fix_column = 'X'.
wa_fcat-outputlen = 10.
wa_fcat-col_pos = 2.
append wa_fcat to fcat.
clear wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'ADDRESS'.
wa_fcat-inttype = 'C'.
wa_fcat-emphasize = 'X'.
wa_fcat-SELtext_M = 'ADDRESS'.
wa_fcat-fix_column = 'X'.
wa_fcat-outputlen = 25.
wa_fcat-col_pos = 3.
append wa_fcat to fcat.
clear wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'ICON'.
wa_fcat-inttype = 'C'.
wa_fcat-emphasize = 'X'.
wa_fcat-SELtext_M = 'ICON'.
wa_fcat-fix_column = 'X'.
wa_fcat-outputlen = 25.
wa_fcat-col_pos = 3.
append wa_fcat to fcat.
clear wa_fcat.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
IT_FIELDCAT = FCAT
tables
T_OUTTAB = itab
.
if SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
thanks & Regards
Ashu Singh
10-17-2008 2:13 AM