ALV color a particular cell on meeting certain condition
hi all
i am working with ALV , my requirement is to color a particular cell if condition mate.
like .
i have two fields in my ITAB PlanedCost and ActualCost
If ACTUALCOST is >= 80% of PLANEDCOST then
ACTUALCOST cell must come in RED COLOR.
how to do so .
please guide me.
Hi Rock,
I tried a program to color a cell based on its value, but it is not working. Am pasting the code below and please can u exactly tell me what is the problem it.
*& Report ZSAPCOLV
REPORT zsapcolv.
TABLES:mara.
TYPES:BEGIN OF ty_mara,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
color1(4),
END OF ty_mara.
DATA:it_mara TYPE STANDARD TABLE OF ty_mara,
it_color TYPE TABLE OF lvc_s_scol,
wa_mara TYPE ty_mara,
wa_color TYPE lvc_s_scol,
is_layout TYPE lvc_s_layo.
DATA: t_newtable TYPE REF TO data,
t_newline TYPE REF TO data.
FIELD-SYMBOLS: <dyntab> TYPE STANDARD TABLE,
<wa_dyntab> TYPE ANY,
<gfs_wa> TYPE ANY.
TYPES: BEGIN OF ty_cmara,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
tabcolor TYPE lvc_t_scol,
END OF ty_cmara. " Cell color
DATA:it_cmara TYPE STANDARD TABLE OF ty_cmara.
DATA:
gr_table TYPE REF TO cl_salv_table,
gr_functions TYPE REF TO cl_salv_functions,
gr_display TYPE REF TO cl_salv_display_settings.
DATA: it_fcat TYPE lvc_t_fcat,
wa_fcat TYPE lvc_s_fcat.
DATA:it_fcat1 TYPE lvc_t_fcat, "with cell color
it_fcat2 TYPE lvc_t_fcat,
wa_fieldcat LIKE LINE OF it_fcat1,
wa_cellcolors TYPE lvc_s_scol,
wa_is_layout TYPE lvc_s_layo.
FIELD-SYMBOLS:<t_cellcolors> TYPE lvc_t_scol,
<w_field> TYPE ANY.
DATA:t_line TYPE REF TO data .
*-----design selection screen for plant and material type.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.
SELECT-OPTIONS:
s_matnr FOR mara-matnr. "material type
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM fetch_data.
PERFORM display_data.
*& Form fetch_data
FORM fetch_data .
DATA:wa_cmara TYPE ty_cmara.
DATA: ls_tabcolor TYPE lvc_s_scol.
SELECT
FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_mara WHERE matnr IN s_matnr.
CHECK sy-subrc EQ 0.
PERFORM build_catalog USING '1' 'MATNR' 'Material number' 'Material Number' ' ' '18'.
PERFORM build_catalog USING '1' 'MTART' 'Material type' 'Material type' ' ' '10'.
it_fcat1[] = it_fcat[].
wa_fieldcat-fieldname = 'T_CELLCOLORS'.
wa_fieldcat-ref_field = 'COLTAB'.
wa_fieldcat-ref_table = 'CALENDAR_TYPE'.
APPEND wa_fieldcat TO it_fcat.
cl_alv_table_create=>create_dynamic_table( EXPORTING it_fieldcatalog = it_fcat
IMPORTING ep_table = t_newtable ).
ASSIGN t_newtable->* TO <dyntab>.
CREATE DATA t_line LIKE LINE OF <dyntab>.
ASSIGN t_line->* TO <gfs_wa>.
PERFORM fill_data.
ENDFORM. " fetch_data
*& Form build_catalog
FORM build_catalog USING p_pos TYPE lvc_colpos
p_field TYPE lvc_fname
p_reptext TYPE reptext
p_coltext TYPE coltext
p_check TYPE lvc_checkb
p_len TYPE lvc_outlen.
wa_fcat-col_pos = p_pos.
wa_fcat-fieldname = p_field.
wa_fcat-reptext = p_reptext.
wa_fcat-checkbox = p_check.
wa_fcat-outputlen = p_len.
wa_fcat-emphasize = '6'.
IF p_check = 'X'.
wa_fcat-edit = 'X'.
ENDIF.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " catalog
*& Form fill_data
FORM fill_data .
FIELD-SYMBOLS: <wa_tmp> TYPE ANY,
<v_fld> TYPE ANY,
<color> TYPE ANY,
<wa_color> TYPE lvc_s_scol.
DATA: v_fld(20).
DATA : lv_cnt TYPE i,
t_newline1 type ref to data,
lv_cnt1 TYPE i.
FIELD-SYMBOLS: <ta_color> TYPE lvc_t_scol.
DATA : field(15) TYPE c,
col TYPE lvc_s_scol.
create data t_newline1 LIKE <wa_color>.
LOOP AT it_mara INTO wa_mara.
lv_cnt1 = lv_cnt1 + 1.
LOOP AT it_fcat INTO wa_fcat.
UNASSIGN <wa_tmp>.
ASSIGN COMPONENT wa_fcat-fieldname OF STRUCTURE <gfs_wa> TO <wa_tmp>.
CONCATENATE 'WA_MARA-' wa_fcat-fieldname INTO v_fld.
ASSIGN (v_fld) TO <v_fld>.
CHECK sy-subrc EQ 0.
IF <v_fld> = '000000000000000004'.
col-fname = wa_fcat-fieldname.
col-color-col = '5' .
col-color-int = '0' .
"ASSIGN COMPONENT wa_fcat-fieldname OF STRUCTURE <gfs_wa> TO <ta_color>.
ASSIGN COMPONENT 'T_CELLCOLORS' OF STRUCTURE <gfs_wa> TO <ta_color> .
APPEND col TO <ta_color>.
<wa_tmp> = <v_fld>.
lv_cnt = lv_cnt + 1.
ENDIF.
IF lv_cnt = 1.
APPEND <gfs_wa> TO <dyntab>.
ELSE.
MODIFY <dyntab> INDEX lv_cnt1 FROM <gfs_wa>.
ENDIF.
ENDLOOP.
lv_cnt = 0.
CLEAR wa_mara.
ENDLOOP.
ENDFORM. " fill_data
*& Form display_data
FORM display_data .
IF <dyntab> IS NOT INITIAL.
LOOP AT <dyntab> INTO <gfs_wa>.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <gfs_wa> TO <w_field>.
ASSIGN COMPONENT 'T_CELLCOLORS' OF STRUCTURE <gfs_wa> TO <t_cellcolors> .
CLEAR wa_cellcolors.
"wa_cellcolors-fname = 'MATNR'.
"IF <w_field> = '000000000000000004'.
"FORMAT INTENSIFIED COLOR = 6.
wa_cellcolors-fname = 'MATNR'.
wa_cellcolors-color-col = '7'.
wa_cellcolors-color-int = '1'.
"wa_cellcolors-color-inv = '1'.
"wa_cellcolors-NOKEYCOL = ''.
"ELSE.
"wa_cellcolors-color-col = '5'.
"ENDIF.
APPEND wa_cellcolors TO <t_cellcolors>.
MODIFY <dyntab> FROM <gfs_wa>.
ENDLOOP.
cl_salv_table=>factory( IMPORTING r_salv_table = gr_table CHANGING t_table = <dyntab> ).
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
gr_display = gr_table->get_display_settings( ).
gr_display->set_striped_pattern( cl_salv_display_settings=>true ).
gr_display->set_list_header( 'MARA DATA' ).
gr_table->display( ).
"ENDIF.
ENDFORM. " display_data
Similar Messages
-
Coloring of Particular Cells in a dynamic internal table(field symbols)
Hi,
I have a requirement to introduce color into some particular cells in a dynamic internal table(Field symbol) based on some conditions.I know that color can be introduced at cell level in the case of static internal table.But, can anybody tell me whether it is possible to introduce color to particular cells in the dynamic internal table(Field Symbol) .Please suggest me on this issue.
Thanks in advance,
RajeshHi,
This is the sample coding for the colour cell report.
Kindly go through it. It will helps u.
REPORT YMS_COLOURTEST .
DATA: BEGIN OF TP OCCURS 10, ID, NR(8), TEXT(255), END OF TP.
DATA: LENGTH TYPE I VALUE 8, " Length of list
TESTSTRING(15) TYPE C VALUE '012345678901234',
WIDTH TYPE I. " Width of list
DATA: TXT_REPORT LIKE DOKHL-OBJECT.
START-OF-SELECTION.
PERFORM HEADING.
PERFORM OUTPUT_BODY.
FORM HEADING.
FORMAT INTENSIFIED OFF. " Remove any INTENSIFIED
ULINE AT (WIDTH). " Upper frame border
FORMAT COLOR COL_HEADING INTENSIFIED." Title color
WRITE: / SY-VLINE. " Left border
WRITE: 'No |Colour |intensified |intensified off|',
'inverse' NO-GAP.
WRITE: AT WIDTH SY-VLINE. " Right border
ULINE AT (WIDTH). " Line below titles
FORMAT COLOR OFF.
ENDFORM.
FORM OUTPUT_BODY.
DO LENGTH TIMES.
PERFORM WRITE_LINE USING SY-INDEX.
ENDDO.
ENDFORM.
FORM WRITE_LINE USING COUNT TYPE I.
DATA: HELP(14) TYPE C,
COUNT1 TYPE I.
COUNT1 = SY-INDEX - 1.
WRITE: / SY-VLINE NO-GAP.
WRITE: (4) COUNT1 COLOR COL_KEY INTENSIFIED NO-GAP.
WRITE: SY-VLINE NO-GAP.
CASE COUNT1.
WHEN '0'.
HELP = 'COL_BACKGROUND'.
WHEN '1'.
HELP = 'COL_HEADING'.
WHEN '2'.
HELP = 'COL_NORMAL'.
WHEN '3'.
HELP = 'COL_TOTAL'.
WHEN '4'.
HELP = 'COL_KEY'.
WHEN '5'.
HELP = 'COL_POSITIVE'.
WHEN '6'.
HELP = 'COL_NEGATIVE'.
WHEN '7'.
HELP = 'COL_GROUP'.
ENDCASE.
WRITE: HELP COLOR COL_KEY INTENSIFIED NO-GAP.
WRITE: SY-VLINE NO-GAP.
WRITE: TESTSTRING COLOR = COUNT1 INTENSIFIED NO-GAP.
WRITE: SY-VLINE NO-GAP.
WRITE: TESTSTRING COLOR = COUNT1 INTENSIFIED OFF NO-GAP.
WRITE: SY-VLINE NO-GAP.
WRITE: TESTSTRING COLOR = COUNT1 INVERSE NO-GAP.
WRITE AT WIDTH SY-VLINE NO-GAP.
ENDFORM.
Thanks,
Shankar -
Hi,
Please find below the sample program in which tried to color a particular cell. But it is not applying the color. Please help me to resolve this issues.
Thanks in Advance,
Sunil Kumar
*& Report ZSAPCOLV
REPORT ZSAPCOLV.
TABLES:mara.
TYPES:BEGIN OF ty_mara,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
END OF ty_mara.
DATA:it_mara TYPE STANDARD TABLE OF ty_mara,
it_color type table of lvc_s_scol,
wa_mara TYPE ty_mara,
wa_color type lvc_s_scol,
is_layout type lvc_s_layo.
DATA: t_newtable TYPE REF TO data,
t_newline TYPE REF TO data.
FIELD-SYMBOLS: <dyntab> TYPE STANDARD TABLE,
<wa_dyntab> TYPE ANY,
<gfs_wa> TYPE ANY.
TYPES: BEGIN OF ty_cmara,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
tabcolor TYPE lvc_t_scol,
END OF ty_cmara. " Cell color
DATA:it_cmara TYPE STANDARD TABLE OF ty_cmara.
DATA:
gr_table TYPE REF TO cl_salv_table,
gr_functions TYPE REF TO cl_salv_functions,
gr_display TYPE REF TO cl_salv_display_settings.
DATA: it_fcat TYPE lvc_t_fcat,
wa_fcat TYPE lvc_s_fcat.
DATA:it_fcat1 TYPE lvc_t_fcat, "with cell color
it_fcat2 TYPE lvc_t_fcat,
wa_fieldcat LIKE LINE OF it_fcat1,
wa_cellcolors TYPE lvc_s_scol,
wa_is_layout TYPE lvc_s_layo.
FIELD-SYMBOLS:<t_cellcolors> TYPE lvc_t_scol,
<w_field> TYPE ANY.
DATA:t_line TYPE REF TO data .
*-----design selection screen for plant and material type.
selection-screen begin of block b1 with frame title text-b01.
select-options:
s_matnr for mara-matnr. "material type
selection-screen end of block b1.
START-OF-SELECTION.
PERFORM fetch_data.
PERFORM display_data.
*& Form fetch_data
FORM fetch_data .
DATA:wa_cmara TYPE ty_cmara.
DATA: ls_tabcolor TYPE lvc_s_scol.
SELECT
FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_mara where matnr in s_matnr.
CHECK sy-subrc EQ 0.
PERFORM build_catalog USING '1' 'MATNR' 'Material number' 'Material Number' ' ' '18'.
PERFORM build_catalog USING '1' 'MTART' 'Material type' 'Material type' ' ' '10'.
it_fcat1[] = it_fcat[].
wa_fieldcat-fieldname = 'T_CELLCOLORS'.
wa_fieldcat-ref_field = 'COLTAB'.
wa_fieldcat-ref_table = 'CALENDAR_TYPE'.
APPEND wa_fieldcat TO it_fcat.
cl_alv_table_create=>create_dynamic_table( EXPORTING it_fieldcatalog = it_fcat
IMPORTING ep_table = t_newtable ).
ASSIGN t_newtable->* TO <dyntab>.
CREATE DATA t_line LIKE LINE OF <dyntab>.
ASSIGN t_line->* TO <gfs_wa>.
PERFORM fill_data.
ENDFORM. " fetch_data
*& Form build_catalog
FORM build_catalog USING p_pos TYPE lvc_colpos
p_field TYPE lvc_fname
p_reptext TYPE reptext
p_coltext type coltext
p_check TYPE lvc_checkb
p_len TYPE lvc_outlen.
wa_fcat-col_pos = p_pos.
wa_fcat-fieldname = p_field.
wa_fcat-reptext = p_reptext.
wa_fcat-checkbox = p_check.
wa_fcat-outputlen = p_len.
IF p_check = 'X'.
wa_fcat-edit = 'X'.
ENDIF.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " catalog
*& Form fill_data
FORM fill_data .
FIELD-SYMBOLS: <wa_tmp> TYPE ANY,
<v_fld> TYPE ANY,
<color> TYPE ANY.
DATA: v_fld(20).
DATA : lv_cnt TYPE i,
lv_cnt1 TYPE i.
DATA:wa_cmara TYPE ty_cmara.
LOOP AT it_mara INTO wa_mara.
lv_cnt1 = lv_cnt1 + 1.
LOOP AT it_fcat INTO wa_fcat.
UNASSIGN <wa_tmp>.
ASSIGN COMPONENT wa_fcat-fieldname OF STRUCTURE <gfs_wa> TO <wa_tmp>.
CONCATENATE 'WA_MARA-' wa_fcat-fieldname INTO v_fld.
ASSIGN (v_fld) TO <v_fld>.
CHECK sy-subrc EQ 0.
<wa_tmp> = <v_fld>.
lv_cnt = lv_cnt + 1.
IF lv_cnt = 1.
APPEND <gfs_wa> TO <dyntab>.
ELSE.
MODIFY <dyntab> INDEX lv_cnt1 FROM <gfs_wa>.
ENDIF.
ENDLOOP.
lv_cnt = 0.
CLEAR wa_mara.
ENDLOOP.
ENDFORM. " fill_data
*& Form display_data
FORM display_data .
IF <dyntab> IS NOT INITIAL.
LOOP AT <dyntab> INTO <gfs_wa>.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <gfs_wa> TO <w_field>.
ASSIGN COMPONENT 'T_CELLCOLORS' OF STRUCTURE <gfs_wa> TO <t_cellcolors> .
CLEAR wa_cellcolors.
wa_cellcolors-fname = 'MATNR'.
IF <w_field> = '000000000100000012'.
wa_cellcolors-color-col = '6'.
wa_cellcolors-color-int = '1'.
wa_cellcolors-color-inv = '1'.
ELSE.
wa_cellcolors-color-col = '5'.
ENDIF.
APPEND wa_cellcolors TO <t_cellcolors>.
MODIFY <dyntab> FROM <gfs_wa>.
ENDLOOP.
cl_salv_table=>factory( IMPORTING r_salv_table = gr_table CHANGING t_table = <dyntab> ).
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
gr_display = gr_table->get_display_settings( ).
gr_display->set_striped_pattern( cl_salv_display_settings=>true ).
gr_display->set_list_header( 'MARA DATA' ).
gr_table->display( ).
ENDIF.
ENDFORM. " display_dataHi Sunil,
Coloring a cell is pretty simple.
1.
FORMAT COLOR 3 INTENSIFIED ON.
WRITE:/15 FS_TABLE-FIELD1.
FORMAT COLOR OFF.
Color 3 which is Yellow, begins from 0 to last letter of FIELD1.
To color up the entire row, you can mention
FORMAT COLOR 3 INTENSIFIED ON.
WRITE:/15(255) FS_TABLE-FIELD1.
FORMAT COLOR OFF.
2. Coloring a cell, carries a bit different method
LOOP..
WRITE:/ FS_TABLE-FIELD1 COLOR 3,
FS_TABLE-FIELD2-COLOR4.
ENDLOOP.
Hope this really helps you,
Courtesy: Zahackson
Edited by: Zahackson on Feb 6, 2009 10:25 AM -
Hi Techies
I have one req in which i need to color the Particular cell, Provide me the Logic for that in which only change filed should be highlight to a specific Color.
I have alogic for color the whole column and Row, but i need to color only particular cell.
Moderator message: vague, help not possible without asking return questions, what cells are we talking about, provide as much technical detail as possible when posting.
Edited by: Thomas Zloch on Feb 15, 2012Thanks Edward for ur reply...
But in Inventory In warehouse report they gave the total as in different color.How they done that?????
Regards,
Anitha -
How to color a particular cell in ALV.
hi,
I have a requirement where i need to select a particular cell of a column in ALV and upon selection , i need to change the color of the selected cell. I choose the color from the dropdown toolbar created by me.
plz help, thanks.REPORT ZTEST_DHR.
TYPE-POOLS : SLIS.
TYPES: BEGIN OF TY_MARA,
FLAG TYPE CHAR1,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
WESCH TYPE MARA-WESCH,
STYLE TYPE LVC_T_STYL,
CELLCOLR TYPE LVC_T_SCOL,
END OF TY_MARA.
DATA : IT_MARA TYPE STANDARD TABLE OF TY_MARA.
DATA : IT_MARA1 TYPE STANDARD TABLE OF TY_MARA,
WA_MARA TYPE TY_MARA,
WA_MARA1 TYPE TY_MARA.
* for reuse alv grid display
*DATA : IT_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,
* WA_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV,
* WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
* GV_REPID TYPE SY-REPID.
*for LVC Display
DATA : WA_SETTINGS TYPE LVC_S_GLAY.
DATA : WA_LAYOUT TYPE LVC_S_LAYO.
DATA : IT_FIELDCATALOG TYPE LVC_T_FCAT,
WA_FIELDCATALOG TYPE LVC_S_FCAT.
DATA REF1 TYPE REF TO CL_GUI_ALV_GRID.
DATA: LS_EDIT TYPE LVC_S_STYL,
LT_EDIT TYPE LVC_T_STYL.
DATA : LS_CELL_COLOR TYPE LVC_S_SCOL.
DATA : LT_CELL_COLOR TYPE LVC_T_SCOL.
START-OF-SELECTION.
SELECT MATNR ERSDA ERNAM WESCH
FROM MARA INTO CORRESPONDING FIELDS OF TABLE IT_MARA
UP TO 10 ROWS.
END-OF-SELECTION.
PERFORM BUILD_FIELDCATALOG.
PERFORM BUILD_LAYOUT.
PERFORM DISPLAY_ALV_REPORT.
*& Form BUILD_FIELDCATALOG
* text
FORM BUILD_FIELDCATALOG .
WA_FIELDCATALOG-FIELDNAME = 'FLAG'.
WA_FIELDCATALOG-OUTPUTLEN = 6.
WA_FIELDCATALOG-CHECKBOX = 'X'. "as checkbox
WA_FIELDCATALOG-EDIT = 'X'.
WA_FIELDCATALOG-SELTEXT = 'Check box'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-FIELDNAME = 'MATNR'.
WA_FIELDCATALOG-OUTPUTLEN = 20.
WA_FIELDCATALOG-SELTEXT = 'Mat no'.
* wa_fieldcatalog-input = 'X'.
wa_fieldcatalog-edit = 'X'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-FIELDNAME = 'ERSDA'.
WA_FIELDCATALOG-OUTPUTLEN = 15.
WA_FIELDCATALOG-SELTEXT = 'Creation Date'.
* wa_fieldcatalog-input = 'X'.
* wa_fieldcatalog-edit = 'X'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-FIELDNAME = 'ERNAM'.
WA_FIELDCATALOG-OUTPUTLEN = 20.
WA_FIELDCATALOG-SELTEXT = 'Creation Time'.
* wa_fieldcatalog-input = 'X'.
* wa_fieldcatalog-edit = 'X'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-FIELDNAME = 'WESCH'.
WA_FIELDCATALOG-OUTPUTLEN = 20.
WA_FIELDCATALOG-SELTEXT = 'Quantity'.
* wa_fieldcatalog-input = 'X'.
* wa_fieldcatalog-edit = 'X'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
ENDFORM. "build_fieldcatalog
*& Form BUILD_LAYOUT
* text
FORM BUILD_LAYOUT .
CONSTANTS : LC_X TYPE CHAR1 VALUE 'X'.
* WA_LAYOUT-NO_INPUT = LC_X.
WA_LAYOUT-CWIDTH_OPT = LC_X.
WA_LAYOUT-ZEBRA = LC_X.
WA_LAYOUT-STYLEFNAME = 'STYLE'.
WA_LAYOUT-CTAB_FNAME = 'CELLCOLR'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* text
FORM DISPLAY_ALV_REPORT .
LS_EDIT-FIELDNAME = 'FLAG'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE WA_MARA1-STYLE.
LS_CELL_COLOR-FNAME = 'MATNR'.
LS_CELL_COLOR-COLOR-COL = '7'.
LS_CELL_COLOR-COLOR-INT = '1'.
INSERT LS_CELL_COLOR into table LT_CELL_COLOR.
INSERT LINES OF LT_CELL_COLOR into TABLE WA_MARA1-CELLCOLR.
LOOP AT IT_MARA INTO WA_MARA.
IF WA_MARA-ERSDA EQ '20080625'.
MODIFY IT_MARA INDEX SY-TABIX FROM WA_MARA1 TRANSPORTING STYLE CELLCOLR.
ENDIF.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'F_SET_STATUS'
I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'Example of select and deselect'
* I_GRID_SETTINGS =
IS_LAYOUT_LVC = WA_LAYOUT
IT_FIELDCAT_LVC = IT_FIELDCATALOG
TABLES
T_OUTTAB = IT_MARA
* 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.
* CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
* EXPORTING
* I_CALLBACK_PROGRAM = GV_REPID
* I_CALLBACK_PF_STATUS_SET = 'F_SET_STATUS'
* I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
* I_GRID_TITLE = 'Example of select and deselect'
* I_GRID_SETTINGS = WA_SETTINGS
* IS_LAYOUT = WA_LAYOUT
* IT_FIELDCAT = IT_FIELDCATALOG[]
* TABLES
* T_OUTTAB = IT_MARA.
* 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_REPORT
*& Form f_set_status
* text
FORM F_SET_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STATUS1'.
ENDFORM. " f_set_status
*& Form f_user_command
* text
FORM F_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
* BREAK-POINT.
CASE R_UCOMM.
WHEN 'ASEL'.
LOOP AT IT_MARA INTO WA_MARA.
WA_MARA-FLAG = 'X'.
MODIFY IT_MARA FROM WA_MARA.
ENDLOOP.
RS_SELFIELD-REFRESH = 'X'.
WHEN 'DSEL'.
LOOP AT IT_MARA INTO WA_MARA.
WA_MARA-FLAG = ' '.
MODIFY IT_MARA FROM WA_MARA.
ENDLOOP.
RS_SELFIELD-REFRESH = 'X'.
WHEN 'DELETE'.
* BREAK-POINT.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF1.
CALL METHOD REF1->CHECK_CHANGED_DATA.
DELETE IT_MARA
WHERE FLAG = 'X'.
RS_SELFIELD-REFRESH = 'X'.
WHEN 'INSERT'.
CLEAR WA_MARA.
APPEND WA_MARA TO IT_MARA.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF1.
CALL METHOD REF1->REFRESH_TABLE_DISPLAY.
WHEN 'SAVEDB'.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF1.
CALL METHOD REF1->CHECK_CHANGED_DATA.
* CODE TO BE WRITTEN TO SAVE in DB just an insert statement
*ENDLOOP.
ENDCASE.
ENDFORM.
REPORT ZTEST_DHR.
TYPE-POOLS : SLIS.
TYPES: BEGIN OF TY_MARA,
FLAG TYPE CHAR1,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
WESCH TYPE MARA-WESCH,
STYLE TYPE LVC_T_STYL,
CELLCOLR TYPE LVC_T_SCOL,
END OF TY_MARA.
DATA : IT_MARA TYPE STANDARD TABLE OF TY_MARA.
DATA : IT_MARA1 TYPE STANDARD TABLE OF TY_MARA,
WA_MARA TYPE TY_MARA,
WA_MARA1 TYPE TY_MARA.
* for reuse alv grid display
*DATA : IT_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,
* WA_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV,
* WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
* GV_REPID TYPE SY-REPID.
*for LVC Display
DATA : WA_SETTINGS TYPE LVC_S_GLAY.
DATA : WA_LAYOUT TYPE LVC_S_LAYO.
DATA : IT_FIELDCATALOG TYPE LVC_T_FCAT,
WA_FIELDCATALOG TYPE LVC_S_FCAT.
DATA REF1 TYPE REF TO CL_GUI_ALV_GRID.
DATA: LS_EDIT TYPE LVC_S_STYL,
LT_EDIT TYPE LVC_T_STYL.
DATA : LS_CELL_COLOR TYPE LVC_S_SCOL.
DATA : LT_CELL_COLOR TYPE LVC_T_SCOL.
START-OF-SELECTION.
SELECT MATNR ERSDA ERNAM WESCH
FROM MARA INTO CORRESPONDING FIELDS OF TABLE IT_MARA
UP TO 10 ROWS.
END-OF-SELECTION.
PERFORM BUILD_FIELDCATALOG.
PERFORM BUILD_LAYOUT.
PERFORM DISPLAY_ALV_REPORT.
*& Form BUILD_FIELDCATALOG
* text
FORM BUILD_FIELDCATALOG .
WA_FIELDCATALOG-FIELDNAME = 'FLAG'.
WA_FIELDCATALOG-OUTPUTLEN = 6.
WA_FIELDCATALOG-CHECKBOX = 'X'. "as checkbox
WA_FIELDCATALOG-EDIT = 'X'.
WA_FIELDCATALOG-SELTEXT = 'Check box'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-FIELDNAME = 'MATNR'.
WA_FIELDCATALOG-OUTPUTLEN = 20.
WA_FIELDCATALOG-SELTEXT = 'Mat no'.
* wa_fieldcatalog-input = 'X'.
wa_fieldcatalog-edit = 'X'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-FIELDNAME = 'ERSDA'.
WA_FIELDCATALOG-OUTPUTLEN = 15.
WA_FIELDCATALOG-SELTEXT = 'Creation Date'.
* wa_fieldcatalog-input = 'X'.
* wa_fieldcatalog-edit = 'X'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-FIELDNAME = 'ERNAM'.
WA_FIELDCATALOG-OUTPUTLEN = 20.
WA_FIELDCATALOG-SELTEXT = 'Creation Time'.
* wa_fieldcatalog-input = 'X'.
* wa_fieldcatalog-edit = 'X'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-FIELDNAME = 'WESCH'.
WA_FIELDCATALOG-OUTPUTLEN = 20.
WA_FIELDCATALOG-SELTEXT = 'Quantity'.
* wa_fieldcatalog-input = 'X'.
* wa_fieldcatalog-edit = 'X'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
ENDFORM. "build_fieldcatalog
*& Form BUILD_LAYOUT
* text
FORM BUILD_LAYOUT .
CONSTANTS : LC_X TYPE CHAR1 VALUE 'X'.
* WA_LAYOUT-NO_INPUT = LC_X.
WA_LAYOUT-CWIDTH_OPT = LC_X.
WA_LAYOUT-ZEBRA = LC_X.
WA_LAYOUT-STYLEFNAME = 'STYLE'.
WA_LAYOUT-CTAB_FNAME = 'CELLCOLR'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* text
FORM DISPLAY_ALV_REPORT .
LS_EDIT-FIELDNAME = 'FLAG'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE WA_MARA1-STYLE.
LS_CELL_COLOR-FNAME = 'MATNR'.
LS_CELL_COLOR-COLOR-COL = '7'.
LS_CELL_COLOR-COLOR-INT = '1'.
INSERT LS_CELL_COLOR into table LT_CELL_COLOR.
INSERT LINES OF LT_CELL_COLOR into TABLE WA_MARA1-CELLCOLR.
LOOP AT IT_MARA INTO WA_MARA.
IF WA_MARA-ERSDA EQ '20080625'.
MODIFY IT_MARA INDEX SY-TABIX FROM WA_MARA1 TRANSPORTING STYLE CELLCOLR.
ENDIF.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'F_SET_STATUS'
I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'Example of select and deselect'
* I_GRID_SETTINGS =
IS_LAYOUT_LVC = WA_LAYOUT
IT_FIELDCAT_LVC = IT_FIELDCATALOG
TABLES
T_OUTTAB = IT_MARA
* 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.
* CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
* EXPORTING
* I_CALLBACK_PROGRAM = GV_REPID
* I_CALLBACK_PF_STATUS_SET = 'F_SET_STATUS'
* I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
* I_GRID_TITLE = 'Example of select and deselect'
* I_GRID_SETTINGS = WA_SETTINGS
* IS_LAYOUT = WA_LAYOUT
* IT_FIELDCAT = IT_FIELDCATALOG[]
* TABLES
* T_OUTTAB = IT_MARA.
* 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_REPORT
*& Form f_set_status
* text
FORM F_SET_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STATUS1'.
ENDFORM. " f_set_status
*& Form f_user_command
* text
FORM F_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
* BREAK-POINT.
CASE R_UCOMM.
WHEN 'ASEL'.
LOOP AT IT_MARA INTO WA_MARA.
WA_MARA-FLAG = 'X'.
MODIFY IT_MARA FROM WA_MARA.
ENDLOOP.
RS_SELFIELD-REFRESH = 'X'.
WHEN 'DSEL'.
LOOP AT IT_MARA INTO WA_MARA.
WA_MARA-FLAG = ' '.
MODIFY IT_MARA FROM WA_MARA.
ENDLOOP.
RS_SELFIELD-REFRESH = 'X'.
WHEN 'DELETE'.
* BREAK-POINT.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF1.
CALL METHOD REF1->CHECK_CHANGED_DATA.
DELETE IT_MARA
WHERE FLAG = 'X'.
RS_SELFIELD-REFRESH = 'X'.
WHEN 'INSERT'.
CLEAR WA_MARA.
APPEND WA_MARA TO IT_MARA.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF1.
CALL METHOD REF1->REFRESH_TABLE_DISPLAY.
WHEN 'SAVEDB'.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF1.
CALL METHOD REF1->CHECK_CHANGED_DATA.
* CODE TO BE WRITTEN TO SAVE in DB just an insert statement
*ENDLOOP.
ENDCASE.
ENDFORM.
About Selecting a Color From Dropdown? even i need to check for now this is the how u do cell color in alv -
How to give color of particular cell in alv list display for dynamic table
Dear Experts,
i want to give color of a particular cell in alv list display (reuse_alv_list_display). Here i am passing data through dynamic table?Hi,
Se this:
DATA: lt_color TYPE lvc_t_scol WITH HEADER LINE.
DATA: BEGIN OF data_tab OCCURS 0.
tabcolor TYPE lvc_t_scol,
END OF data_tab.
* Befone ALV call
alv_layout-coltab_fieldname = 'TABCOLOR'.
* For each row in data_tab
REFRESH: lt_color.
CLEAR: lt_color.
lt_color-color-col = 6.
lt_color-color-int = 1.
lt_color-fname = FIELD1'.
APPEND lt_color.
lt_color-color-col = 2.
lt_color-color-int = 0.
lt_color-fname = 'FIELD2'.
APPEND lt_color.
data_tab-tabcolor[] = lt_color[].
append data_tab.
Best regards,
Leandro Mengue -
Color a particular cell in ALV
Hi all,
I am working with ALV using class cl_salv_table. i can colorize a particular colomn using cl_salv_column_table->set_color method. I was able to do it. I have done it for an amount column. Now I want to show the amount in some other color if it is 0. Let me know whether that possibility is there or not. If yes, please let me know the corresponding class and method and how we can implement it.
Thank u.Hi ,
fill emphasize of field catelog
wa_fcat-emphasize = color_code eg 'C400' .
Colour code :
Colour is a 4-char field where :
- 1st char = C (color property)
- 2nd char = color code (from 0 to 7)
0 = background color
1 = blue
2 = gray
3 = yellow
4 = blue/gray
5 = green
6 = red
7 = orange
- 3rd char = intensified (0=off, 1=on)
- 4th char = inverse display (0=off, 1=on)
hope it helps ..... -
HOW TO CHANGE COLOR OF PARTICULAR CELL IN ALV
I HAVE DISPLAYED A REPORT IN ALV
I WANT TO CHANGE THE COLOR OF VBELN FIELD ON WHICH HOTSPOT IS ON?
HOW TO DO THIS?Hi Lovleen,
Check out the code
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic ALV grid, Enhanced to display each row in a different *
*& colour *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
line_color(4) type c, "Used to store row color attributes
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
Set layout field for row attributes(i.e. color)
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_ekko
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_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
data: ld_color(1) type c.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
*Populate field with color attributes
loop at it_ekko into wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
if ld_color = 8.
ld_color = 1.
endif.
concatenate 'C' ld_color '10' into wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
modify it_ekko from wa_ekko.
endloop.
endform. " DATA_RETRIEVAL
Regards,
Chandru -
Using Formulas and Variables To Count Rows That Meet Certain Conditions
I have a web intelligence report designed that shows results of shipments that arrived and departed in a given period and the mode of transport (air, ocean, motor). I've tried building formulas to give me counts for example of the number of shipments arrived via ocean, number of shipments that departed via ocean, and so on.
I tried various the Count and If functions in different ways but I can't seem to get them to work. What is the correct logical set of variables or formulas I need to build so that I can display summarized information in my report that shows:
Shipments Arrived via Ocean
Shipments Arrived via Air
Shipments Departed via Ocean
Shipments Departed via Air
Key report fields are [Shipment Identifier] , [Mode]=Ocean, Air, Motor, and [Status] = Arrive;DepartYou should be able to do one of the following:
1. Create a measure variable ShipmentCount as
=Count([Shipment Identifier])
In the report, use Mode, Status and ShipmentCount. This will give an aggregated count per Mode per Status.
2. Create a formula for each of Mode/Status combination like
=Count([Shipment Identifier]) where ([Mode] = "Ocean" and [Status] = "Arrive") -
Plug-in or Rule to prevent sending a piece of mail meeting certain conditions
I'm looking for a plug-in, rule or process that would prevent me from sending a specific piece of mail. I doubt many people have this issue but sometimes I hit send w/o scrutinizing the "TO" and "CC". It's a bad habit of typing in the start of the name then accepting the first name without inspection. I know the best way is to get into a new habit of checking but I would love to set up some send rules that include conditions that keep me from doing the bone-head move. I've looked at the Apple Mail Rules, Act-On and a few others but everyhting is about organization and recieve. Thanks in advance for any help.
Welcome to Apple Support Communities.
What about unchecking 'Automatically complete addresses' in Mail, Preferences, Composing, Addressing?
That way you MUST type in the full email address. -
Hi All,
I want to produce a report in ALV , where I have to print two diff colors in a cell..
Eg: In a cell 128(38)
128( ) in black and 38 in red.
Thanks in advance.
Balamurugan.Rhi,
see the below example which may be useful.
types: begin of ty_vbak,
Vbeln type vbeln_va,
erdat type erdat,
ernam type ernam,
cellcolors type lvc_t_scol, " table type for cell coloring
cellstyles TYPE lvc_t_styl, " table type for Style Table for Cells
end of ty_vbak.
data: t_vbak type table of ty_vbak,
w_vbak type ty_vbak.
data: gt_fieldcat type lvc_t_fcat,
gs_fieldcat like line of gt_fieldcat,
gw_layout type lvc_s_layo.
Reference to Custom container
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
G_CONTAINER TYPE SCRFNAME VALUE 'CC_ALV',
G_GRID TYPE REF TO CL_GUI_ALV_GRID,
*& Module STATUS_0001 OUTPUT
text
MODULE STATUS_0001 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING
PARENT =
CONTAINER_NAME = G_CONTAINER
STYLE =
LIFETIME = LIFETIME_DEFAULT
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT G_GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = G_CUSTOM_CONTAINER
I_APPL_EVENTS = SPACE
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
perform populate_data.
perform fieldcat.
perform populate_layout.
perform display_output.
ENDMODULE. " STATUS_0001 OUTPUT
*& Form populate_data
populating the data
--> p1 text
<-- p2 text
FORM populate_data .
data: color(1) type c.
DATA lw_cellcolor TYPE lvc_s_scol . "line type for cell coloring
select vbeln
erdat
ernam from vbak into CORRESPONDING FIELDS OF TABLE t_vbak up to 10 rows.
*coloring the particular cell.
READ TABLE t_vbak INTO w_vbak INDEX 5 .
lw_cellcolor-fname = 'ERDAT' .
lw_cellcolor-color-col = '4' .
lw_cellcolor-color-int = '1' .
APPEND lw_cellcolor TO w_vbak-cellcolors .
modify t_vbak index 5 from w_vbak.
READ TABLE t_vbak INTO w_vbak INDEX 7.
lw_cellcolor-fname = 'ERNAM' .
lw_cellcolor-color-col = '7' .
lw_cellcolor-color-int = '1' .
APPEND lw_cellcolor TO w_vbak-cellcolors .
modify t_vbak index 7 from w_vbak.
ENDFORM. " populate_data
*& Form fieldcat
populatin the fieldcat
--> p1 text
<-- p2 text
FORM fieldcat .
clear gs_fieldcat.
gs_fieldcat-fieldname = 'VBELN'.
gs_fieldcat-tabname = 'T_VBAk'.
gs_fieldcat-outputlen = '20'.
gs_fieldcat-SCRTEXT_M = 'DOCUMENT NUMBER'.
append gs_fieldcat to GT_fieldcat.
clear gs_fieldcat.
gs_fieldcat-fieldname = 'ERDAT'.
gs_fieldcat-tabname = 'T_VBAK'.
gs_fieldcat-outputlen = '20'.
gs_fieldcat-SCRTEXT_M = 'CREATED ON'.
append gs_fieldcat to GT_fieldcat.
clear gs_fieldcat.
gs_fieldcat-fieldname = 'ERNAM'.
gs_fieldcat-tabname = 'T_VBAK'.
gs_fieldcat-outputlen = '20'.
gs_fieldcat-SCRTEXT_M = 'CREATED BY'.
append gs_fieldcat to GT_fieldcat.
ENDFORM. " fieldcat
*& Form display_output
text
--> p1 text
<-- p2 text
FORM display_output .
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = gw_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING = * IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = t_vbak
IT_FIELDCATALOG = GT_fieldcat
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 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.
*& Form populate_layout
populating the layout
<--P_GW_LAYOUT internal table for the layput
FORM populate_layout." CHANGING P_GW_LAYOUT type lvc_s_layo.
gw_layout-zebra = 'X'.
gw_layout-ctab_fname = 'CELLCOLORS'. "cell coloring
*gw_layout-info_fname = 'ROW_COLOR'. "row coloring
gw_layout-stylefname = 'CELLSTYLES'. "styles
ENDFORM. " populate_layout
thanks and regards -
Coloring a table cell with swing
Hello,
I am trying to write a java program in swing. Basically I am setting up a table and adding labels to the table's cells. Rather than displaying the label, the table is inserting the labels' string value. Here is a compilable example:
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.JScrollPane;
import java.awt.*;
public class TableTest extends JFrame {
private final JTable table;
private final GridBagConstraints constraints;
private JLabel makeLabel(Color c){
JLabel lab = new JLabel(" ");
lab.setOpaque(true);
lab.setBackground(c);
//getContentPane().add(lab, constraints);
return lab;
public TableTest() {
super("Visualizer");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new GridBagLayout());
constraints = new GridBagConstraints();
constraints.insets = new Insets(3, 10, 3, 10);
String[] columnNames = {"RED","YELLOW", "BLUE"};
Object[][] data = { {makeLabel(Color.RED), makeLabel(Color.YELLOW), makeLabel(Color.BLUE) } };
table = new JTable(data, columnNames);
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
table.setFillsViewportHeight(true);
JScrollPane scrollPane = new JScrollPane(table);
//Add the scroll pane to this panel.
add(scrollPane);
pack();
setVisible(true);
public static void main(String[] args) {
new TableTest();
}How do i modify this to actually show the labels? Thanks in advance.Why are you putting labels into the table's cells?
Have a look at Sun's tutorial on tables to see how a custom renderer is used to display particular cells in a certain way. (And also for the whole rendering approach used by tables.)
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#renderer
(Swing questions are better asked in the Swing forum: http://forum.java.sun.com/forum.jspa?forumID=57) -
Coloring an individual cell in factory method
hi
i generate a report using factory method by passing one internal table ti it
now i want to color particular cells based on some condition.
color is red. any pointers...pls provide code if you have.
thnks in advance.hi,
check this..
*& Report Y_TEST
REPORT y_test.
TABLES: mara.
DATA: str1 TYPE string,
str2 TYPE string,
str3 TYPE string,
str4 TYPE lvc_title,
num TYPE i,
c1(5) TYPE c.
DATA: value1 TYPE salv_s_layout,
key TYPE salv_s_layout_key VALUE sy-repid,
tool TYPE lvc_tip,
col TYPE lvc_s_colo,
cell TYPE salv_t_cell.
DATA: gr_table TYPE REF TO cl_salv_table,
gr_functions TYPE REF TO cl_salv_functions,
gr_layout TYPE REF TO cl_salv_layout,
gr_display TYPE REF TO cl_salv_display_settings,
gr_column TYPE REF TO cl_salv_column_table,
gr_columns TYPE REF TO cl_salv_columns_table,
gr_aggregations TYPE REF TO cl_salv_aggregations,
gr_aggregation TYPE REF TO cl_salv_aggregation,
gr_selections TYPE REF TO cl_salv_selections,
gr_sorts TYPE REF TO cl_salv_sorts.
DATA: it_mseg TYPE STANDARD TABLE OF mseg WITH HEADER LINE.
SELECT * FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_mseg WHERE werks = 'KWWK' AND matnr NE ' '.
*--ALV display-------------------------------------------------*
cl_salv_table=>factory(
IMPORTING r_salv_table = gr_table
CHANGING t_table = it_mseg[] ). "gr_table Instance created
*---Setting the ALV toolbar-------------------------------------*
gr_functions = gr_table->get_functions( ). "gr_functions instance created
gr_functions->set_all( abap_true ).
*---Setting the Layout------------------------------------------*
gr_layout = gr_table->get_layout( ).
*gr_layout->set_key( key ).
gr_layout->set_save_restriction( ).
*---Setting the header------------------------------------------*
gr_display = gr_table->get_display_settings( ).
str1 = 'Display of MSEG Table'.
str2 = '-'.
DESCRIBE TABLE it_mseg LINES num.
c1 = num.
str3 = ' Rows are Selected'.
CONCATENATE str1 str2 c1 str3 INTO str4.
gr_display->set_list_header( str4 ).
*---Zebra-------------------------------------------------------*
gr_display->set_striped_pattern( 'X' ).
*---Deactivating horizontal line--------------------------------*
gr_display->set_horizontal_lines( ' ' ).
*---Deactivating vertical line----------------------------------*
*gr_display->set_vertical_lines( ' ' ).
*---Set color to Column-----------------------------------------*
*col-col = 3.
*col-int = 1.
*col-inv = 1.
*gr_columns = gr_table->get_columns( ).
*gr_column ?= gr_columns->get_column( 'LAEDA' ).
*gr_column->set_color( col ).
*col-col = 5.
*col-int = 1.
*col-inv = 1.
*gr_columns = gr_table->get_columns( ).
*gr_column ?= gr_columns->get_column( 'ERNAM' ).
*gr_column->set_color( col ).
col-col = 4.
col-int = 0.
col-inv = 1.
gr_columns = gr_table->get_columns( ).
gr_column ?= gr_columns->get_column( 'BWART' ).
gr_column->set_color( col ).
gr_column->set_alignment( '3' ).
gr_column->set_tooltip( 'helllooooo' ).
*----Set key column----------------------------------------------*
gr_columns->set_key_fixation( 'X' ).
*----Setting total-----------------------------------------------*
gr_aggregations = gr_table->get_aggregations( ).
gr_aggregation = gr_aggregations->add_aggregation( 'MENGE' ).
gr_aggregation->set( if_salv_c_aggregation=>total ).
gr_aggregations = gr_table->get_aggregations( ).
gr_aggregation = gr_aggregations->add_aggregation( 'DMBTR' ).
gr_aggregation->set( if_salv_c_aggregation=>total ).
*----Selection---------------------------------------------------*
gr_selections = gr_table->get_selections( ).
gr_selections->set_selection_mode( cl_salv_selections=>if_salv_c_selection_mode~cell ).
*----Setting of sort & subtotal column---------------------------------------*
gr_sorts = gr_table->get_sorts( ).
gr_sorts->add_sort( columnname = 'MATNR' subtotal = 'X').
*gr_sorts->get_subtotals( ).
gr_table->display( ).
Arunima -
Change the font of particular cell in matrix report
hi experts
i made a report in report 6i. now i want to change a color of particular cell which has shortest value. and
also i want to fill 0 ( zero ) value in blank column.
i have tried it from the property pallate " Value if Null " set to 0 (zero )
But it does not take the value.
Please solve the problem
regards
manojHi,
I think it will be better if you put NVL/DECODE in your main query for this column and also having second option create one placement column and store the value of the column in this placement column based on your condition criteria.
Thanks
Shishu Paul -
Color background of cell boxes
When I used to use Excel, I was able to color in the cell to a certain color. How do I do that with Numbers?
Of course, the response is available in the Help as well as in tha PDF User Guide.
It just requires the use of really complicated keyword "Background" or this more complex "color AND cell"
Yvan KOENIG (from FRANCE lundi 2 juin 2008 11:01:12)
Maybe you are looking for
-
"Disk cannot be read from or written to" when syncing iPod
HELP!!! I've an I-Pod 20Gb (just over 1 yr old) that has developed the above message in I-Tunes whenever I try to sync it now. Usually between starting and up to 1GB of files. I have done the 5 R's. I've managed to find my way into the diagnostics me
-
Downloads do not work correctly
When I download a file, i.e. a zip file a movie, or a torrent, it downloads the file with out the right name or extension. I can change the extension to open the file but it is a pain. For example when I tried to download a zip file it downloaded it
-
I've been trying to upload a nebook using itunes producer but keep getting an error message ' an error occurred saving your changes to the Apple database. This may be a transient issue on the Apple side' What's going on? It's been giving me this mesa
-
I accidently deleted ichat, how do i redownload it?
i accidently deleted ichat, emptied my trash, and do not have time machine set up. is there any way to download it?
-
How to handle Cisco AVPair Attributes
Hello, i have a little Problem, so I hope you can help me. I have an external Radius Server and an ASA5520 which submits the IP-address and the address of the DNA-Server to the registering client (with cisco-avpair = ip:addr=x.y.z.w) How can I submit