ALV coloring help
Hi all,
Hi I have 2 requirements in ALV.
1) my third field is Sales Organisation.I have to make the column heading of this column intesified.
2)In the top of page I have to color a particular line.
Please suggest some solution as soon as possible as I need it very urgently...
Thanks
Nazmul
you can show the color in the Top of page .
Check this..
TOP_OF_PAGE in ALV Using CL_GUI_ALV_GRID
and also check this
report ztest_page.
tables: sflight.
data : it_flight type table of sflight with header line.
data begin of it_sel_opt occurs 0.
include structure rsparams.
data end of it_sel_opt.
select-options: s_carrid for sflight-carrid.
start-of-selection.
select * from sflight into table it_flight
where carrid in s_carrid.
end-of-selection.
call function 'RS_REFRESH_FROM_SELECTOPTIONS'
exporting
curr_report = sy-repid
tables
selection_table = it_sel_opt
exceptions
not_found = 01
no_report = 02.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_html_top_of_page = 'TOP_OF_PAGE'
i_structure_name = 'SFLIGHT'
tables
t_outtab = it_flight
exceptions
program_error = 1
others = 2.
*& Form top_of_page
* text
* -->DOCUMENT text
form top_of_page using document type ref to cl_dd_document.
data : dl_text(255) type c. "Text
* Add new-line
call method document->new_line.
call method document->new_line.
clear : dl_text.
* program ID
dl_text = 'Program Name :'.
call method document->add_gap.
call method document->add_text
exporting
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_heading_int.
clear dl_text.
dl_text = sy-repid.
call method document->add_text
exporting
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_negative_inv.
* Add new-line
call method document->new_line.
clear : dl_text.
dl_text = 'Selection Criteria'.
call method document->add_gap
exporting
width = 34.
call method document->add_text
exporting
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_negative_inv.
* Add new-line
call method document->new_line.
clear : dl_text.
concatenate 'SELECT Option' 'SIGN' 'OPTION' 'LOW' 'HIGH'
into dl_text separated by cl_abap_char_utilities=>horizontal_tab.
call method document->add_gap
exporting
width = 34.
call method document->add_text
exporting
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_negative_inv.
* Add new-line
call method document->new_line.
loop at it_sel_opt.
clear : dl_text.
concatenate it_sel_opt-selname it_sel_opt-sign
it_sel_opt-option it_sel_opt-low it_sel_opt-high
into dl_text separated by cl_abap_char_utilities=>horizontal_tab.
call method document->add_gap
exporting
width = 34.
call method document->add_text
exporting
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_negative_inv.
* Add new-line
call method document->new_line.
endloop.
endform. "top_of_page
Similar Messages
-
Problem with ALV search help Dictionary Search Help
Hello experts
I have a problem with ALV search help.
I use DDIC table ZXXX with text table ZXXX_T. I created DDIC search help form table ZXXX. In my WD application, in context on COMPONENTCONTROLLER i set on attribute: 'Input help mode' as 'Dictionary Search Help' and in 'Dictionary Search Help' I pass name of new created DDIC search help.
I create a input field from that atrribute and search help works fine (there was a value and description for value from text table). So I created ALV witch contains that attribute too.
Next I set column for this attribute in ALV as editable but on Serch help for this collumn I have only value. I DON'T HAVE TEXT DESCRIPTION FOR VALUE.
Please help me and tell me what I do wrong?
MikoHello,
Thank's for your help. I create DDic Search help for all fields from my ALV. Next I changed 'TYPE' for all ALV fields in COMPONENTCONTROLLER from ZXXX-Zfield to Zfield, and I changed 'Input help mode' from 'Automatic' to 'Dictionary Search Help'. Now I see Value and Description for value in Search Help in my ALV.
Regards
Miko -
Color help please!
When I view a file in CS5, the colors are vastly different than when I view the same file from any other program on my computer. I calibrate regularly and want to be viewing as per the calibration on CS5- are there setting I need to change in CS5 or are those accurate and I need to change the settings in my control panel?? Thank you!!So that you can be better helped,what OS/version are you running,what software/hardware do you calibrate your monitor with,and what are the Color Preference settings in Photoshop? That can be accessed with Ctrl + Shift + k in Photoshop. If you can manage a screenshot of just that Preference dialog,it will help a lot.
I'll add that Windows applications are not color managed as Photoshop is. Windows and many files you see on the web are sRGB. If Photoshop's Color Workspace is set to either Adobe RGB or Pro-Photo, a regular color graphics file will show up with the colors saturated. That's because most color files do not have a tag telling Photoshop what color space it came from and Photoshop if set to other than sRGB will not display it properly.
You could set Photoshop's Working space to sRGB (North American General Defaults 2) if your pictures are intended for the web, or if you must use Adobe RGB (commercial press work),then you must tag or Assign an sRGB profile if your file has no profile assigned. If it already has a tag other than sRGB, then you make a copy and Convert it to sRGB to display properly in Windows apps.
That's a rough guess as to why your files do not display properly in CS5. Assign Profile and Convert to Profile are both under PS's Edit Menu.
Gene -
Hi all,
Can anyone tell me how to display different colors on different coloumns of an ALV.
thankshi
check this code
An example of using linecolor (ALV).
Here you have a good example of coloring rows, columns and specific cells in alvs. It comes in an example of how to use hashed tables.
For coloured rows and cols check gp_bymat
for coloured specific rows uncheck gp_bymat.
HTH.
Horacio
ps: code:
report zuseofhashedtables.
Program: ZUseOfHashedTables **
Author: Horacio Zapettini **
Versions: 4.6b - 4.6c **
Notes: **
this program shows how we can use hashed tables to improve **
the responce time. **
It shows, **
1. how to declare hashed tables **
2. a cache-like technique to improve access to master data **
3. how to collect data using hashed tables **
4. how to avoid deletions of unwanted data **
Results: the test we run read about 31000 rows from mkpf, 150000 **
rows from mseg, 500 rows from makt and 400 from lfa1. **
it filled ht_lst with 24500 rows and displayed them in **
alv grid format. **
It took about 65 secodns to perform this task (first time **
we run it when all the db buffers are empty. **
The same program with standard tables needed 140 seconds **
to run with the same recordset and with buffers filled in **
A simmilar test over more than a million rows
Objetive: show a list that consists of all the material movements **
'101' - '901' for a certain range of dates in mkpf-budat. **
the columns to be displayed are: **
mkpf-budat, **
mkpf-mblnr, **
mseg-lifnr, **
lfa1-name1, **
mkpf-xblnr, **
mseg-zeile **
mseg-charg, **
mseg-matnr, **
makt-maktx, **
mseg-erfmg, **
mseg-erfme. **
or show a sumary list by matnr - menge **
You'll have to create a pf-status called vista - **
See form set_pf_status for details **
tables used -
tables: mkpf,
mseg,
lfa1,
makt.
global hashed tables used
data: begin of wa_mkpf, "header
mblnr like mkpf-mblnr,
mjahr like mkpf-mjahr,
budat like mkpf-budat,
xblnr like mkpf-xblnr,
end of wa_mkpf.
data: ht_mkpf like hashed table of wa_mkpf
with unique key mblnr mjahr
with header line.
data: st_mkpf like standard table of wa_mkpf
with header line.
data: begin of wa_mseg, " line items
mblnr like mseg-mblnr,
mjahr like mseg-mjahr,
zeile like mseg-zeile,
bwart like mseg-bwart,
charg like mseg-charg,
matnr like mseg-matnr,
lifnr like mseg-lifnr,
erfmg like mseg-erfmg,
erfme like mseg-erfme,
end of wa_mseg.
data ht_mseg like hashed table of wa_mseg
with unique key mblnr mjahr zeile
with header line.
data st_mseg like standard table of wa_mseg
with header line.
cache structure for lfa1 records
data: begin of wa_lfa1,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
end of wa_lfa1.
data ht_lfa1 like hashed table of wa_lfa1
with unique key lifnr
with header line.
cache structure for material related data
data: begin of wa_material,
matnr like makt-matnr,
maktx like makt-maktx,
end of wa_material.
data: ht_material like hashed table of wa_material
with unique key matnr
with header line.
result table
data: begin of wa_lst, "
budat like mkpf-budat,
mblnr like mseg-mblnr,
lifnr like mseg-lifnr,
name1 like lfa1-name1,
xblnr like mkpf-xblnr,
zeile like mseg-zeile,
charg like mseg-charg,
matnr like mseg-matnr,
maktx like makt-maktx,
erfmg like mseg-erfmg,
erfme like mseg-erfme,
mjahr like mseg-mjahr,
end of wa_lst.
data: ht_lst like hashed table of wa_lst
with unique key mblnr mjahr zeile
with header line.
data: begin of wa_lst1, " sumary by material
matnr like mseg-matnr,
maktx like makt-maktx,
erfmg like mseg-erfmg,
erfme like mseg-erfme,
color_line(4) TYPE c, " Line color
color_cell TYPE lvc_t_scol, " Cell color
celltab type LVC_T_STYL,
end of wa_lst1.
data: ht_lst1 like hashed table of wa_lst1
with unique key matnr
with header line.
structures for alv grid display.
itabs
type-pools: slis.
data: it_lst like standard table of wa_lst with header line,
it_fieldcat_lst type slis_t_fieldcat_alv with header line,
it_sort_lst type slis_t_sortinfo_alv,
it_lst1 like standard table of wa_lst1 with header line,
it_fieldcat_lst1 type slis_t_fieldcat_alv with header line,
it_sort_lst1 type slis_t_sortinfo_alv.
structures
data: wa_sort type slis_sortinfo_alv,
ls_layout type slis_layout_alv.
color management.
DATA : wa_color TYPE lvc_s_scol.
Internal table for color management.
DATA : it_color TYPE TABLE OF lvc_s_scol.
itab for input enabling.
DATA: lt_celltab TYPE lvc_t_styl. "
global varialbes
data: g_lines type i.
data: g_repid like sy-repid,
ok_code like sy-ucomm.
selection-screen
"text: Dates:
select-options: so_budat for mkpf-budat default sy-datum.
"text: Material numbers.
select-options: so_matnr for mseg-matnr.
selection-screen uline.
selection-screen skip 1.
"Text: show summary by material.
parameters: gp_bymat as checkbox default ''.
parameters: gp_hier as checkbox default 'X'.
start-of-selection.
perform get_data.
perform show_data.
end-of-selection.
FORM get_data *
form get_data.
select mblnr mjahr budat xblnr
into table ht_mkpf
from mkpf
where budat in so_budat. " make use of std index.
have we retrieved data from mkpf?
describe table ht_mkpf lines g_lines.
if g_lines > 0.
if true then retrieve all related records from mseg.
Doing this way we make sure that the access is by primary key
of mseg.
The reason is that is faster to filter them in memory
than to allow the db server to do it.
select mblnr mjahr zeile bwart charg
matnr lifnr erfmg erfme
into table ht_mseg
from mseg
for all entries in ht_mkpf
where mblnr = ht_mkpf-mblnr
and mjahr = ht_mkpf-mjahr.
endif.
fill t_lst or t_lst1 according to user's choice.
if gp_bymat = ' '.
perform fill_ht_lst.
else.
perform fill_ht_lst1.
endif.
endform.
form fill_ht_lst.
refresh ht_lst.
Example: how to discard unwanted data in an efficient way.
loop at ht_mseg.
filter unwanted data
check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
check ht_mseg-matnr in so_matnr.
read header line.
read table ht_mkpf with table key mblnr = ht_mseg-mblnr
mjahr = ht_mseg-mjahr.
clear ht_lst.
* note : this may be faster if you specify field by field.
move-corresponding ht_mkpf to ht_lst.
move-corresponding ht_mseg to ht_lst.
perform read_lfa1 using ht_mseg-lifnr changing ht_lst-name1.
perform read_material using ht_mseg-matnr changing ht_lst-maktx.
insert table ht_lst.
endloop.
endform.
form fill_ht_lst1.
data: colorear.
refresh ht_lst1.
Example: how to discard unwanted data in an efficient way.
hot to simulate a collect in a faster way
loop at ht_mseg.
filter unwanted data
check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
check ht_mseg-matnr in so_matnr.
* note : this may be faster if you specify field by field.
read table ht_lst1 with table key matnr = ht_mseg-matnr
transporting erfmg.
if sy-subrc <> 0. " if matnr doesn't exist in sumary table
" insert a new record
clear ht_lst1.
ht_lst1-matnr = ht_mseg-matnr.
perform read_material using ht_mseg-matnr changing ht_lst1-maktx.
ht_lst1-erfmg = ht_mseg-erfmg.
ht_lst1-erfme = ht_mseg-erfme.
if colorear = ''.
colorear = 'X'.
refresh it_color.
ht_lst1-color_cell[] = it_color[].
MOVE 'C410' TO ht_lst1-color_line.
else.
colorear = ' '.
refresh it_color. clear it_color.
MOVE 'MATNR' TO wa_color-fname.
MOVE '6' TO wa_color-color-col.
MOVE '1' TO wa_color-color-int.
MOVE '1' TO wa_color-color-inv.
APPEND wa_color TO it_color.
MOVE 'MAKTX' TO wa_color-fname.
MOVE '3' TO wa_color-color-col.
MOVE '1' TO wa_color-color-int.
MOVE '1' TO wa_color-color-inv.
APPEND wa_color TO it_color.
MOVE 'ERFMG' TO wa_color-fname.
MOVE '5' TO wa_color-color-col.
MOVE '1' TO wa_color-color-int.
MOVE '1' TO wa_color-color-inv.
APPEND wa_color TO it_color.
ht_lst1-color_cell[] = it_color[].
clear ht_lst1-color_line.
endif.
insert table ht_lst1.
else." a record was found.
" collect erfmg. To do so, fill in the unique key and add
" the numeric fields.
ht_lst1-matnr = ht_mseg-matnr.
add ht_mseg-erfmg to ht_lst1-erfmg.
modify table ht_lst1 transporting erfmg.
endif.
endloop.
endform.
implementation of cache for lfa1.
form read_lfa1 using p_lifnr changing p_name1.
read table ht_lfa1 with table key lifnr = p_lifnr
transporting name1.
if sy-subrc <> 0.
clear ht_lfa1.
ht_lfa1-lifnr = p_lifnr.
select single name1
into ht_lfa1-name1
from lfa1
where lifnr = p_lifnr.
if sy-subrc <> 0. ht_lfa1-name1 = 'n/a in lfa1'. endif.
insert table ht_lfa1.
endif.
p_name1 = ht_lfa1-name1.
endform.
implementation of cache for material data
form read_material using p_matnr changing p_maktx.
read table ht_material with table key matnr = p_matnr
transporting maktx.
if sy-subrc <> 0.
ht_material-matnr = p_matnr.
select single maktx into ht_material-maktx
from makt
where spras = sy-langu
and matnr = p_matnr.
if sy-subrc <> 0. ht_material-maktx = 'n/a in makt'. endif.
insert table ht_material.
endif.
p_maktx = ht_material-maktx.
endform.
form show_data.
if gp_hier = 'X'. "no anda.
perform show_hierarchicalALV.
else.
if gp_bymat = ' '.
perform show_ht_lst.
else.
perform show_ht_lst1.
endif.
endif.
endform.
form show_hierarchicalALV.
st_mkpf[] = ht_mkpf[].
st_mseg[] = ht_mseg[].
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM =
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT =
IT_FIELDCAT =
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
i_tabname_header =
i_tabname_item =
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
is_keyinfo =
IS_PRINT =
IS_REPREP_ID =
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab_header = st_mkpf
t_outtab_item = st_mseg
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.
form show_ht_lst.
"needed because the FM can't use a hashed table.
it_lst[] = ht_lst[].
perform fill_layout using 'full display'
changing ls_layout.
perform fill_columns_lst.
perform sort_lst.
g_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = g_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
is_layout = ls_layout
it_fieldcat = it_fieldcat_lst[]
it_sort = it_sort_lst
tables
t_outtab = it_lst
exceptions
program_error = 1
others = 2.
endform.
form show_ht_lst1.
"needed because the FM can't use a hashed table.
it_lst1[] = ht_lst1[].
perform fill_layout using 'Sumary by matnr'
changing ls_layout.
perform fill_columns_lst1.
perform sort_lst.
g_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = g_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
is_layout = ls_layout
it_fieldcat = it_fieldcat_lst1[]
it_sort = it_sort_lst
tables
t_outtab = it_lst1
exceptions
program_error = 1
others = 2.
endform.
form fill_layout using p_window_titlebar
changing cs_layo type slis_layout_alv.
clear cs_layo.
cs_layo-window_titlebar = p_window_titlebar.
cs_layo-edit = 'X'.
cs_layo-edit_mode = space.
MOVE 'COLOR_LINE' TO cs_layo-info_fieldname.
Field that identify cell color in inetrnal table
MOVE 'COLOR_CELL' TO cs_layo-coltab_fieldname.
move 'CELLTAB' TO cs_layo-stylefname.
endform. " armar_layout_stock
form set_pf_status using rt_extab type slis_t_extab.
create a new status
and then select extras -> adjust template -> listviewer
set pf-status 'VISTA'.
endform. "set_pf_status
define add_lst.
clear it_fieldcat_lst.
it_fieldcat_lst-fieldname = &1.
it_fieldcat_lst-outputlen = &2.
it_fieldcat_lst-ddictxt = 'L'.
it_fieldcat_lst-seltext_l = &1.
it_fieldcat_lst-seltext_m = &1.
it_fieldcat_lst-seltext_m = &1.
if &1 = 'MATNR'.
it_fieldcat_lst-emphasize = 'C111'.
endif.
append it_fieldcat_lst.
end-of-definition.
define add_lst1.
clear it_fieldcat_lst.
it_fieldcat_lst1-fieldname = &1.
it_fieldcat_lst1-outputlen = &2.
it_fieldcat_lst1-ddictxt = 'L'.
it_fieldcat_lst1-seltext_l = &1.
it_fieldcat_lst1-seltext_m = &1.
it_fieldcat_lst1-seltext_m = &1.
append it_fieldcat_lst1.
end-of-definition.
form fill_columns_lst.
set columns for output.
refresh it_fieldcat_lst.
add_lst 'BUDAT' 10.
add_lst 'MBLNR' 10.
add_lst 'LIFNR' 10.
add_lst 'NAME1' 35.
add_lst 'XBLNR' 15.
add_lst 'ZEILE' 5.
add_lst 'CHARG' 10.
add_lst 'MATNR' 18.
add_lst 'MAKTX' 30.
add_lst 'ERFMG' 17.
add_lst 'ERFME' 5.
add_lst 'MJAHR' 4.
endform.
form fill_columns_lst1.
set columns for output.
refresh it_fieldcat_lst1.
add_lst1 'MATNR' 18.
add_lst1 'MAKTX' 30.
add_lst1 'ERFMG' 17.
add_lst1 'ERFME' 5..
endform.
Horacio Zapettini
Program to Calculate FI Opening Balance
How to find the Opening balance for a given period in FI Module for a Particular GL A/c.
I was calculated opening balance, code is below maybe it will be helpful.
*find period.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = s_budat-low
i_periv = i_tab-periv "'K4'
IMPORTING
e_buper = v_donem
e_gjahr = v_gjahr
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
*calc opening balance hesabý
SELECT * FROM knc1 WHERE kunnr = i_tab-kunnr
AND bukrs = i_tab-bukrs " s_bukrs
AND gjahr EQ v_gjahr.
v_dnm = v_donem.
opening balance first calc > old year ,
WHILE v_dnm > 1.
v_dnm = v_dnm - 1.
CONCATENATE 'knc1-um' v_dnm 's' INTO v_field_name_borc.
CONCATENATE 'knc1-um' v_dnm 'h' INTO v_field_name_alacak.
ASSIGN (v_field_name_borc) TO old
add days which is from selected date-low month
IF v_donem > 1.
v_dnm = v_donem - 1.
ELSE.
v_dnm = v_donem.
ENDIF.
SELECT SINGLE * FROM t009b WHERE periv = i_tab-periv "'K4'
AND bdatj = s_budat-low+0(4)
AND poper = v_dnm.
t009b-butag = t009b-butag + 1.
IF s_budat-low+6(2) NE t009b-butag.
v_date_high = s_budat-low - 1.
IF v_donem = 1.
v_date_low = s_budat-low.
v_date_low+4(4) = '0101'.
ELSE.
CONCATENATE t009b-bdatj t009b-bumon t009b-butag INTO
v_date_low.
ENDIF.
SELECT * FROM bsad WHERE bukrs EQ i_tab-bukrs "IN s_bukrs
AND kunnr = i_tab-kunnr
AND budat BETWEEN v_date_low AND
v_date_high
AND umskz = space
AND blart IN s_blart.
IF bsad-shkzg = 'S'.
i_tab-dmbtr_s = i_tab-dmbtr_s + ( bsad-dmbtr ).
ELSEIF bsad-shkzg = 'H'.
i_tab-dmbtr_h = i_tab-dmbtr_h + ( bsad-dmbtr ).
ENDIF.
ENDSELECT.
SELECT * FROM bsid WHERE bukrs EQ i_tab-bukrs "IN s_bukrs
AND kunnr = i_tab-kunnr
AND budat BETWEEN v_date_low AND
v_date_high
AND umskz = space
AND blart IN s_blart.
AND gsber IN gsber.
IF bsid-shkzg = 'S'.
i_tab-dmbtr_s = i_tab-dmbtr_s + ( bsid-dmbtr ).
ELSEIF bsid-shkzg = 'H'.
i_tab-dmbtr_h = i_tab-dmbtr_h + ( bsid-dmbtr ).
ENDIF.
ENDSELECT.
ENDIF.
"opening balance ( þirket bazlý )z1 degeri
i_tab-z1 = i_tab-z1 + ( knc1-umsav + i_tab-dmbtr_s - i_tab-dmbtr_h ).
for israel
i_tab-dmbtril_s = i_tab-dmbtr_s .
i_tab-dmbtril_h = i_tab-dmbtr_h .
ENDSELECT.
praveen -
Hi all,
I need to display color for a field(cell) in a record.
is there any events to handle this.
please help me in this.
Regards
Anil Kumar KHi,
in OO ALV check this code../
REPORT ZTEST1234 MESSAGE-ID ZZ .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
V_FLAG,
V_DATA_CHANGE,
V_ROW TYPE LVC_S_ROW,
V_COLUMN TYPE LVC_S_COL,
V_ROW_NUM TYPE LVC_S_ROID.
* CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Hot spot Handler
HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO.
ENDCLASS. "lcl_event_handler DEFINITION
* CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW_ID.
V_COLUMN = E_COLUMN_ID.
V_ROW_NUM = ES_ROW_NO.
MESSAGE I000 WITH V_ROW 'clicked'.
ENDMETHOD. "lcl_event_handler
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK.
ENDMETHOD. "handle_double_click
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
*& Global Definitions
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
GS_LAYOUT TYPE LVC_S_LAYO.
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
X_FIELDCAT TYPE LVC_S_FCAT,
LS_VARI TYPE DISVARIANT.
* START-OF_SELECTION
START-OF-SELECTION.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
CELLCOLOR TYPE LVC_T_SCOL, "required for color
DROP(10),
END OF ITAB.
SELECT VBELN
POSNR
FROM LIPS
UP TO 20 ROWS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
END-OF-SELECTION.
IF NOT ITAB[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*& Form CREATE_AND_INIT_ALV
* text
FORM CREATE_AND_INIT_ALV .
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER1.
CREATE OBJECT G_GRID
EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
* Set a titlebar for the grid control
CLEAR GS_LAYOUT.
GS_LAYOUT-GRID_TITLE = TEXT-003.
GS_LAYOUT-ZEBRA = SPACE.
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-NO_ROWMARK = 'X'.
GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
DATA: L_INDEX TYPE SY-TABIX.
"Here i am changing the color of line 1,5,10...
"so you can change the color of font conditionally
LOOP AT ITAB.
L_INDEX = SY-TABIX.
IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
LS_CELLCOLOR-FNAME = 'POSNR'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
ENDIF.
ENDLOOP.
* setting focus for created grid control
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
* Build fieldcat and set editable for date and reason code
* edit enabled. Assign a handle for the dropdown listbox.
PERFORM BUILD_FIELDCAT.
PERFORM SET_DRDN_TABLE.
* Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
LS_VARI-REPORT = SY-REPID.
LS_VARI-HANDLE = SPACE.
LS_VARI-LOG_GROUP = SPACE.
LS_VARI-USERNAME = SPACE.
LS_VARI-VARIANT = SPACE.
LS_VARI-TEXT = SPACE.
LS_VARI-DEPENDVARS = SPACE.
**Calling the Method for ALV output
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
IS_VARIANT = LS_VARI
IS_LAYOUT = GS_LAYOUT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
* Set editable cells to ready for input initially
CALL METHOD G_GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
* text
* -->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form build_fieldcat
* Fieldcatalog
FORM BUILD_FIELDCAT .
DATA: L_POS TYPE I.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
X_FIELDCAT-HOTSPOT = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Item'(025).
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
X_FIELDCAT-FIELDNAME = 'DROP'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-DRDN_HNDL = '1'.
X_FIELDCAT-DRDN_ALIAS = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
ENDFORM. " build_fieldcat
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form SET_DRDN_TABLE
* text
FORM SET_DRDN_TABLE.
DATA:LT_DRAL TYPE LVC_T_DRAL,
LS_DRAL TYPE LVC_S_DRAL.
LOOP AT ITAB .
* First listbox (handle '1').
IF SY-INDEX = 1.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ' '.
LS_DRAL-INT_VALUE = ' '.
ELSE.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ITAB-POSNR.
LS_DRAL-INT_VALUE = ITAB-POSNR.
ENDIF.
APPEND LS_DRAL TO LT_DRAL.
ENDLOOP.
**Setting the Drop down table for Reason Code
CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
EXPORTING
IT_DROP_DOWN_ALIAS = LT_DRAL.
ENDFORM. " set_drdn_table -
Hi all,
i want to color just only one cell in my ALV report, but i don't know how can i do that.
Here my code :
REPORT ztest_alv_color_cell.
Used to limit user commands on selection-screen
INCLUDE rsdbc1xx.
DATA: BEGIN OF i_alv OCCURS 0,
connid TYPE sflight-connid,
currency TYPE sflight-currency,
FLDATE TYPE sflight-fldate,
END OF i_alv.
DATA: alv_grid TYPE REF TO cl_gui_alv_grid.
DATA: fieldcat TYPE lvc_t_fcat.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001 .
SELECT-OPTIONS: s_matnr FOR i_alv-connid.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF SCREEN 1010.
SELECTION-SCREEN END OF SCREEN 1010.
Events
AT SELECTION-SCREEN OUTPUT.
IF sy-dynnr = '1010'.
current_scr-mode = 'S'.
APPEND 'SPOS' TO current_scr-excl.
APPEND 'SCRH' TO current_scr-excl.
APPEND 'ONLI' TO current_scr-excl.
ENDIF.
START-OF-SELECTION.
PERFORM get_data.
CREATE OBJECT alv_grid
EXPORTING
i_parent = cl_gui_container=>screen0.
Populate Field Catalog
PERFORM get_fieldcatalog.
CALL METHOD alv_grid->set_table_for_first_display
CHANGING
it_outtab = i_alv[]
it_fieldcatalog = fieldcat[].
CALL SELECTION-SCREEN 1010.
FORM GET_DATA
FORM get_data.
SELECT * INTO CORRESPONDING FIELDS OF TABLE i_alv
FROM sflight.
SORT i_alv ASCENDING BY connid.
ENDFORM. "get_data
Form Get_Fieldcatalog - Set Up Columns/Headers
FORM get_fieldcatalog.
DATA: ls_fcat TYPE lvc_s_fcat.
REFRESH: fieldcat.
CLEAR: ls_fcat.
ls_fcat-reptext = 'Connid'.
ls_fcat-coltext = 'Connid'.
ls_fcat-fieldname = 'CONNID'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '10'.
ls_fcat-col_pos = 1.
APPEND ls_fcat TO fieldcat.
CLEAR: ls_fcat.
ls_fcat-reptext = 'Currency'.
ls_fcat-coltext = 'Currency'.
ls_fcat-fieldname = 'CURRENCY'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '10'.
ls_fcat-col_pos = 2.
APPEND ls_fcat TO fieldcat.
CLEAR: ls_fcat.
ls_fcat-reptext = 'Flight date'.
ls_fcat-coltext = 'Flight date'.
ls_fcat-fieldname = 'FLDATE'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-datatype = 'DATS'.
ls_fcat-outputlen = '10'.
ls_fcat-col_pos = 3.
APPEND ls_fcat TO fieldcat.
ENDFORM. "get_fieldcatalog
Imagine that i want to color in red line 1 column 1, please tell how can i do this.
Thanks very much for help.
CheersHi,
Check this code..
REPORT ZTEST1234 MESSAGE-ID ZZ .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
V_FLAG,
V_DATA_CHANGE,
V_ROW TYPE LVC_S_ROW,
V_COLUMN TYPE LVC_S_COL,
V_ROW_NUM TYPE LVC_S_ROID.
* CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Hot spot Handler
HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO.
ENDCLASS. "lcl_event_handler DEFINITION
* CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW_ID.
V_COLUMN = E_COLUMN_ID.
V_ROW_NUM = ES_ROW_NO.
MESSAGE I000 WITH V_ROW 'clicked'.
ENDMETHOD. "lcl_event_handler
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK.
ENDMETHOD. "handle_double_click
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
*& Global Definitions
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
GS_LAYOUT TYPE LVC_S_LAYO.
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
X_FIELDCAT TYPE LVC_S_FCAT,
LS_VARI TYPE DISVARIANT.
* START-OF_SELECTION
START-OF-SELECTION.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
CELLCOLOR TYPE LVC_T_SCOL, "required for color
DROP(10),
END OF ITAB.
SELECT VBELN
POSNR
FROM LIPS
UP TO 20 ROWS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
END-OF-SELECTION.
IF NOT ITAB[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*& Form CREATE_AND_INIT_ALV
* text
FORM CREATE_AND_INIT_ALV .
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER1.
CREATE OBJECT G_GRID
EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
* Set a titlebar for the grid control
CLEAR GS_LAYOUT.
GS_LAYOUT-GRID_TITLE = TEXT-003.
GS_LAYOUT-ZEBRA = SPACE.
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-NO_ROWMARK = 'X'.
GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
DATA: L_INDEX TYPE SY-TABIX.
"Here i am changing the color of line 1,5,10...
"so you can change the color of font conditionally
LOOP AT ITAB.
L_INDEX = SY-TABIX.
IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
LS_CELLCOLOR-FNAME = 'POSNR'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
ENDIF.
ENDLOOP.
* setting focus for created grid control
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
* Build fieldcat and set editable for date and reason code
* edit enabled. Assign a handle for the dropdown listbox.
PERFORM BUILD_FIELDCAT.
PERFORM SET_DRDN_TABLE.
* Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
LS_VARI-REPORT = SY-REPID.
LS_VARI-HANDLE = SPACE.
LS_VARI-LOG_GROUP = SPACE.
LS_VARI-USERNAME = SPACE.
LS_VARI-VARIANT = SPACE.
LS_VARI-TEXT = SPACE.
LS_VARI-DEPENDVARS = SPACE.
**Calling the Method for ALV output
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
IS_VARIANT = LS_VARI
IS_LAYOUT = GS_LAYOUT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
* Set editable cells to ready for input initially
CALL METHOD G_GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
* text
* -->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form build_fieldcat
* Fieldcatalog
FORM BUILD_FIELDCAT .
DATA: L_POS TYPE I.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
X_FIELDCAT-HOTSPOT = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Item'(025).
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
X_FIELDCAT-FIELDNAME = 'DROP'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-DRDN_HNDL = '1'.
X_FIELDCAT-DRDN_ALIAS = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
ENDFORM. " build_fieldcat
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form SET_DRDN_TABLE
* text
FORM SET_DRDN_TABLE.
DATA:LT_DRAL TYPE LVC_T_DRAL,
LS_DRAL TYPE LVC_S_DRAL.
LOOP AT ITAB .
* First listbox (handle '1').
IF SY-INDEX = 1.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ' '.
LS_DRAL-INT_VALUE = ' '.
ELSE.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ITAB-POSNR.
LS_DRAL-INT_VALUE = ITAB-POSNR.
ENDIF.
APPEND LS_DRAL TO LT_DRAL.
ENDLOOP.
**Setting the Drop down table for Reason Code
CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
EXPORTING
IT_DROP_DOWN_ALIAS = LT_DRAL.
ENDFORM. " set_drdn_table
Regards
vijay -
HI all,
i need to place a color for a cell.
color is ORANGE.
i am passing the code 7 to that field.
but ia m getting PURPUL Color....
I ned to make it ORANGE..
ls_cellcolor-color-col = '7'.
ls_cellcolor-color-int = '0'.
ls_cellcolor-color-inv = '0'.
PLaese help...
sachin.hi Samarendra
try like this
here is code
TYPE-POOLS:slis.
TABLES:mara,
makt,
marc.
DATA:BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
werks LIKE marc-werks,
mtart LIKE mara-mtart,
matkl LIKE mara-matkl,
meins LIKE mara-meins,
ntgew LIKE mara-ntgew,
rowcolor(4) TYPE c,
cellcolors TYPE lvc_t_scol,
END OF itab.
DATA:t_fcat TYPE slis_t_fieldcat_alv,
t_eve TYPE slis_t_event.
DATA : st_layout TYPE slis_layout_alv.
SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:mat FOR mara-matnr. " no intervals no-extension.
*PARAMETERS:mat LIKE mara-matnr.
SELECTION-SCREEN:END OF BLOCK blk1.
INITIALIZATION.
PERFORM build_cata USING t_fcat.
PERFORM build_event.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM display_data.
*& Form build_cata
text
-->TEMP_FCAT text
FORM build_cata USING temp_fcat TYPE slis_t_fieldcat_alv.
sy-tvar0 = sy-uname.
WRITE sy-datum TO sy-tvar1.
DATA:wa_fcat TYPE slis_fieldcat_alv.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-ref_tabname = 'MARA'.
wa_fcat-ref_fieldname = 'MATNR'.
wa_fcat-col_pos = 1.
wa_fcat-seltext_m = 'Material'.
wa_fcat-emphasize = 'C10'. "To change ALV Background Color
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MAKTX'.
wa_fcat-seltext_m = 'Description'.
wa_fcat-fix_column = 'x'.
wa_fcat-key = 'X'. "To color a column
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'WERKS'.
wa_fcat-seltext_m = 'Plant'.
wa_fcat-key = ' '.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MTART'.
wa_fcat-ddic_outputlen = 4.
wa_fcat-row_pos = 2.
wa_fcat-ref_tabname = 'MARA'.
wa_fcat-ref_fieldname = 'MTART'.
wa_fcat-seltext_m = 'Type'.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATKL'.
wa_fcat-ref_tabname = 'MARA'.
wa_fcat-row_pos = 2.
wa_fcat-ref_fieldname = 'MATKL'.
wa_fcat-seltext_m = 'Group'.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MEINS'.
wa_fcat-ref_tabname = ' '.
wa_fcat-ref_fieldname = ' '.
wa_fcat-row_pos = 2.
wa_fcat-seltext_m = 'Measurement Unit'.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'NTGEW'.
wa_fcat-seltext_m = 'Net Value'.
wa_fcat-row_pos = 2.
wa_fcat-no_out = ' '.
APPEND wa_fcat TO temp_fcat.
ENDFORM. "build_cata
*& Form build_event
text
FORM build_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_eve
EXCEPTIONS
list_type_wrong = 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. "build_event
*& Form data_retrieval
text
FORM data_retrieval.
SELECT maramatnr maramtart maramatkl marameins mara~ntgew
maktmaktx marcwerks
INTO CORRESPONDING FIELDS OF TABLE itab
FROM mara INNER JOIN makt ON
maramatnr = maktmatnr
INNER JOIN marc ON
maramatnr = marcmatnr
WHERE mara~matnr IN mat.
SORT itab BY matnr.
DELETE ADJACENT DUPLICATES FROM itab.
ENDFORM. "data_retrieval
*& Form display_data
text
FORM display_data.
*******************************For setting Cell Color*******************************************
DATA ls_cellcolor TYPE lvc_s_scol .
st_layout-coltab_fieldname = 'CELLCOLORS'.
LOOP AT itab WHERE meins EQ 'KG'.
READ TABLE itab INDEX 5 .
ls_cellcolor-fname = 'MEINS' .
ls_cellcolor-color-col = '7' .
ls_cellcolor-color-int = '1' .
APPEND ls_cellcolor TO itab-cellcolors .
MODIFY itab TRANSPORTING cellcolors .
ENDLOOP.
st_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_DS'
is_layout = st_layout
i_save = 'X'
it_fieldcat = t_fcat
it_events = t_eve
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. "display_data -
hi
in alv output i got 10 records i need to change the color of only my 3rd record (not the field) any one could give me an idea.REPORT ZTEST.
TABLES:
SPFLI.
TYPE-POOLS:SLIS.
DATA:
T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA:
FS_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA:
W_COL_POS TYPE I.
DATA: BEGIN OF FS_SPFLI,
W_COL TYPE SLIS_T_SPECIALCOL_ALV,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
COUNTRYFR TYPE SPFLI-COUNTRYFR,
COUNTRYTO TYPE SPFLI-COUNTRYTO,
CITYTO TYPE SPFLI-CITYTO,
DISTANCE TYPE SPFLI-DISTANCE,
DISTID TYPE SPFLI-DISTID,
FLTYPE TYPE SPFLI-FLTYPE,
CHK(1),
COL(3),
END OF FS_SPFLI.
DATA: " Field String for coloring a
FS_COL TYPE SLIS_SPECIALCOL_ALV. " cell
*--For CheckBox--
FS_LAYOUT-BOX_FIELDNAME = 'CHK'.
*--For Row color--
FS_LAYOUT-INFO_FIELDNAME = 'COL'. " Row Color
*--For Coloring a Cell--
FS_LAYOUT-COLTAB_FIELDNAME = 'W_COL'.
DATA:
T_SPFLI LIKE
STANDARD TABLE
OF FS_SPFLI.
DATA:
T_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA:
FS_SORT TYPE SLIS_SORTINFO_ALV.
FS_SORT-GROUP = 'UL'.
APPEND FS_SORT TO T_SORT.
SELECT CARRID
CONNID
COUNTRYFR
FLTYPE
INTO CORRESPONDING FIELDS OF TABLE T_SPFLI
FROM SPFLI.
WHERE CARRID EQ 'AA'.
*--COLORING A CELL--
CLEAR FS_SPFLI.
FS_COL-FIELDNAME = 'CARRID'.
FS_COL-COLOR-COL = 3.
APPEND FS_COL TO FS_SPFLI-W_COL.
MODIFY T_SPFLI FROM FS_SPFLI INDEX 10 TRANSPORTING W_COL.
MODIFY T_SPFLI FROM FS_SPFLI INDEX 11 TRANSPORTING W_COL.
*--COLORING A CELL--
CLEAR FS_SPFLI.
FS_COL-FIELDNAME = 'CONNID'.
FS_COL-COLOR-COL = 5.
APPEND FS_COL TO FS_SPFLI-W_COL.
MODIFY T_SPFLI FROM FS_SPFLI INDEX 3 TRANSPORTING W_COL.
*--COLORING A ROW--
FS_SPFLI-COL = 'C60'.
MODIFY T_SPFLI INDEX 7 FROM FS_SPFLI TRANSPORTING COL.
*--FIELD CATALOGUE--
PERFORM FIELD_FILLING_CARRID.
PERFORM FIELD_FILLING_CONNID.
PERFORM FIELD_FILLING_COUNFR.
PERFORM FIELD_FILLING_FLTYPE.
PERFORM FIELD_FILL.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT = FS_LAYOUT
IT_FIELDCAT = T_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = T_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = T_SPFLI
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 FIELD_FILLING_CARRID
text
--> p1 text
<-- p2 text
FORM FIELD_FILLING_CARRID .
ADD 01 TO W_COL_POS.
FS_FIELDCAT-FIELDNAME = 'CARRID'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-row_POS = W_COL_POS.
FS_FIELDCAT-COL_POS = W_COL_POS.
FS_FIELDCAT-KEY = 'X'.
FS_FIELDCAT-OUTPUTLEN = 5.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT.
ENDFORM. " FIELD_FILLING_CARRID
*& Form FIELD_FILLING_CONNID
text
--> p1 text
<-- p2 text
FORM FIELD_FILLING_CONNID .
ADD 01 TO W_COL_POS.
FS_FIELDCAT-FIELDNAME = 'CONNID'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-row_POS = W_COL_POS.
FS_FIELDCAT-COL_POS = W_COL_POS.
FS_FIELDCAT-KEY = 'X'.
FS_FIELDCAT-OUTPUTLEN = 6.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT.
ENDFORM. " FIELD_FILLING_CONNID
*& Form FIELD_FILLING_COUNFR
text
--> p1 text
<-- p2 text
FORM FIELD_FILLING_COUNFR .
ADD 01 TO W_COL_POS.
FS_FIELDCAT-FIELDNAME = 'COUNTRYFR'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-row_POS = W_COL_POS.
FS_FIELDCAT-COL_POS = W_COL_POS.
*FS_FIELDCAT-ICON = 'X'.
FS_FIELDCAT-EMPHASIZE = 'X'.
FS_FIELDCAT-OUTPUTLEN = 10.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT.
ENDFORM. " FIELD_FILLING_COUNFR
*& Form FIELD_FILLING_FLTYPE
text
--> p1 text
<-- p2 text
FORM FIELD_FILLING_FLTYPE .
ADD 01 TO W_COL_POS.
FS_FIELDCAT-FIELDNAME = 'FLTYPE'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = W_COL_POS.
FS_FIELDCAT-row_POS = W_COL_POS.
FS_FIELDCAT-EMPHASIZE = 'C610'. " Column Color
FS_FIELDCAT-KEY = SPACE.
*FS_FIELDCAT-outputlen = 10.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT.
ENDFORM. " FIELD_FILLING_FLTYPE
*& Form field_fill
text
--> p1 text
<-- p2 text
FORM FIELD_FILL .
ADD 01 TO W_COL_POS.
FS_FIELDCAT-FIELDNAME = 'W_COL'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = W_COL_POS.
FS_FIELDCAT-row_POS = W_COL_POS.
FS_FIELDCAT-EMPHASIZE = 'C610'. " Column Color
FS_FIELDCAT-KEY = SPACE.
FS_FIELDCAT-SELTEXT_L = 'NOT FROM DDIC'.
FS_FIELDCAT-OUTPUTLEN = 20.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT.
ENDFORM. " field_fill
Go through the following code.... It will help you in all the aspects...
Reward if it helps u........ -
Hi all,
I understand that the ALV grid color codes consists of the following format:
CXYZ
X = 0 - 7
Y,Z = 0 - 1
Is there any way to display color other than the above? I need a dark grey color (the color when the grid is set to not editable). Is there anywhere to do that? The intensity option is not helping much.
Thanks in advance.Hi,
Herewith i am sending for the sample code with alv grid report.
REPORT YMS_COLOURALV NO STANDARD PAGE HEADING.
TYPE-POOLS: SLIS, ICON.
DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: BEGIN OF IMARA OCCURS 0,
LIGHT(4) TYPE C,
MATNR TYPE MARA-MATNR,
MTART TYPE MARA-MTART,
MAKTX TYPE MAKT-MAKTX,
COLOR_LINE(4) TYPE C,
TCOLOR TYPE SLIS_T_SPECIALCOL_ALV, "cell
END OF IMARA.
DATA: XCOLOR TYPE SLIS_SPECIALCOL_ALV.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM WRITE_REPORT.
Get_Data
FORM GET_DATA.
WRITE ICON_GREEN_LIGHT AS ICON TO IMARA-LIGHT.
IMARA-MATNR = 'ABC'.
IMARA-MTART = 'ZCFG'.
IMARA-MAKTX = 'This is description for ABC'.
APPEND IMARA.
WRITE ICON_YELLOW_LIGHT AS ICON TO IMARA-LIGHT.
IMARA-MATNR = 'DEF'.
IMARA-MTART = 'ZCFG'.
IMARA-MAKTX = 'This is description for DEF'.
APPEND IMARA.
WRITE ICON_RED_LIGHT AS ICON TO IMARA-LIGHT.
IMARA-MATNR = 'GHI'.
IMARA-MTART = 'ZCFG'.
IMARA-MAKTX = 'This is description for GHI'.
APPEND IMARA.
LOOP AT IMARA.
IF SY-TABIX = 1.
IMARA-COLOR_LINE = 'C410'. " color line
ENDIF.
IF SY-TABIX = 2. " color CELL
CLEAR XCOLOR.
XCOLOR-FIELDNAME = 'MTART'.
XCOLOR-COLOR-COL = '3'.
XCOLOR-COLOR-INT = '1'. " Intensified on/off
XCOLOR-COLOR-INV = '0'.
APPEND XCOLOR TO IMARA-TCOLOR.
ENDIF.
MODIFY IMARA.
ENDLOOP.
ENDFORM. "get_data
WRITE_REPORT
FORM WRITE_REPORT.
DATA: LAYOUT TYPE SLIS_LAYOUT_ALV.
LAYOUT-COLTAB_FIELDNAME = 'TCOLOR'.
LAYOUT-INFO_FIELDNAME = 'COLOR_LINE'.
PERFORM BUILD_FIELD_CATALOG.
CALL ABAP LIST VIEWER (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT
TABLES
T_OUTTAB = IMARA.
ENDFORM. "write_report
BUILD_FIELD_CATALOG
FORM BUILD_FIELD_CATALOG.
DATA: FC_TMP TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
CLEAR: FIELDCAT. REFRESH: FIELDCAT.
CLEAR: FC_TMP.
FC_TMP-REPTEXT_DDIC = 'Status'.
FC_TMP-FIELDNAME = 'LIGHT'.
FC_TMP-TABNAME = 'IMARA'.
FC_TMP-OUTPUTLEN = '4'.
FC_TMP-ICON = 'X'.
APPEND FC_TMP TO FIELDCAT.
CLEAR: FC_TMP.
FC_TMP-REPTEXT_DDIC = 'Material Number'.
FC_TMP-FIELDNAME = 'MATNR'.
FC_TMP-TABNAME = 'IMARA'.
FC_TMP-OUTPUTLEN = '18'.
APPEND FC_TMP TO FIELDCAT.
CLEAR: FC_TMP.
FC_TMP-REPTEXT_DDIC = 'Material Type'.
FC_TMP-FIELDNAME = 'MTART'.
FC_TMP-TABNAME = 'IMARA'.
FC_TMP-OUTPUTLEN = '10'.
APPEND FC_TMP TO FIELDCAT.
CLEAR: FC_TMP.
FC_TMP-REPTEXT_DDIC = 'Material'.
FC_TMP-FIELDNAME = 'MAKTX'.
FC_TMP-TABNAME = 'IMARA'.
FC_TMP-OUTPUTLEN = '40'.
FC_TMP-EMPHASIZE = 'C610'. " color column
APPEND FC_TMP TO FIELDCAT.
ENDFORM. "build_field_catalog
Thanks,
Shankar -
Hello, I shot a sequence of photos for a stopmotion and have been having issues with color. It was shot on a green screen and so I used keylight to remove it, made the sequence, it all looks fine in AE, render it and when I open it afterward, the colors are off and pixelated and just terrible. I've tried both web and system colors and am just lost. The adobehelp site says that you can make your own color palette in photoshop if you need it and so I made one, but when I browse for it in AE, it doesn't recognize the file. It's very frustrating. Please help!
What exactly do you do? Sounds like you don't even understand how the GIF format (or any palette based format for that matter) works and what the limitations are and thus are using a completely wrong workflow. Anyway, you cannot load custom swatches/ palettes in AE, since it doesn't have an indexed color mode. Futile exercise. For the rest: Render a normal Quicktime, AVI or image sequence, import it into Photoshop as a video layer. Then export via Save for Web and Devices or Device Central. Any palette adjustmens can best be done there.
Mylenium -
END OF PAGE IN BLOCK ALV : PLZ HELP
Hi experts.
I have a requirement to display top-of-page end-of-page end-of-list in block alv but the problem is that end-of-page is not getting triggered instead top-of-page is getting triggered twice.
Below is the code for your reference :
REPORT zbhr_workers_comp_report
LINE-COUNT 60(4)
LINE-SIZE 999
NO STANDARD PAGE HEADING
MESSAGE-ID zmhr.
*//// This is how event table is getting populated:*
FORM events_get1 CHANGING t1_events TYPE slis_t_event.
DATA:ls1_events TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
IMPORTING
et_events = t1_events.
READ TABLE t1_events INTO ls1_events WITH KEY name = slis_ev_top_of_page.
IF sy-subrc = 0.
MOVE c_form_top_of_page TO ls1_events-form.
APPEND ls1_events TO t1_events.
modify t1_events FROM ls1_events INDEX sy-tabix TRANSPORTING form.
CLEAR ls1_events.
ENDIF.
READ TABLE t1_events INTO ls1_events WITH KEY name = slis_ev_end_of_page.
IF sy-subrc = 0.
MOVE c_form_end_of_page TO ls1_events-form.
APPEND ls1_events TO t1_events.
modify t1_events FROM ls1_events INDEX sy-tabix TRANSPORTING form.
CLEAR ls1_events.
ENDIF.
READ TABLE t1_events INTO ls1_events WITH KEY name = slis_ev_end_of_list.
IF sy-subrc = 0.
MOVE c_form_end_of_list TO ls1_events-form.
APPEND ls1_events TO t1_events.
modify t1_events FROM ls1_events INDEX sy-tabix TRANSPORTING form.
CLEAR ls1_events.
ENDIF.
ENDFORM. " EVENTS_GET1
FORM : TOP_OF_PAGE
FORM top_of_page.
WRITE : /45 text-020, 65(5) text-021 , 71(11) v_begda, 84(3) text-022 , 89(11) v_endda.
ENDFORM. "TOP_OF_PAGE
FORM : end_of_page
FORM end_of_page.
DATA: lv_process TYPE i.
CLEAR: lv_process.
LOOP AT t_final_temp INTO w_final_temp where customer = t_final-customer.
lv_process = lv_process + 1.
ENDLOOP.
*RESERVE 3 LINES.
WRITE: /4 'Number of read Record : '(023), v_total_read.
WRITE: /4 'Number of processed Record : '(024), lv_process.
ENDFORM. "end_of_page
FORM : end_of_list
FORM end_of_list .
v_total_process = LINES( t_final[] ).
WRITE: /4 'Total sum of all processed data: '(029), v_total_process.
ENDFORM. "end_of_list
*****Displaying the block alv.
FORM display_output .
To restrict the display of sel info and list info.
st_print-no_print_selinfos = 'X'.
st_print-no_print_listinfos = 'X'.
st_print-reserve_lines = 2. " Lines reserved for end of page
Initialize ALV Block List
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-repid.
Append the ALV Block list with table t_final.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = w1_layout
it_fieldcat = t1_fieldcat
i_tabname = 'T_FINAL'
it_events = t1_events
it_sort = t_sort
TABLES
t_outtab = t_final
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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.
Append the ALV Block list with table t_msg_display.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = w2_layout
it_fieldcat = t2_fieldcat
i_tabname = 'T_MSG_DISPLAY'
it_events = t2_events
TABLES
t_outtab = t_msg_display
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
is_print = st_print
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_OUTPUT
Above is the core logic which I have used for displaying top-of-page end-of-page and end-of-list in block alv.
Please Help
Regards
Arvind.Hi
MOVE 'TOP_OF_PAGE' TO ls1_events-form.
what is thie c_form_top_of_page instead write as above ,i hope it will work
Regards
Pavan -
Hi to all,
i have 't found any example programs for below function modules of alv
REUSE_ALE_GRID_COMMENTORY_GET
REUSE_ALE_GRID_DISPLAY_LVC
REUSE_ALE_GRID_LAYOUT_INFO_GET
REUSE_ALE_GRID_LAYOUT_INFO_SET
for above given f/m , i searched all standard programs also.
but they are too lengthy to understand .
pls.help in this regard .if any body has sample programs of bove f/m's,
pls.send me to my mail id : [email protected]
I am looking to hear a positive reply
Regards ,
Kiran.Hi,
REPORT YALV
NO STANDARD PAGE HEADING "
LINE-SIZE 80 "
LINE-COUNT 64 "
MESSAGE-ID XX. "
*TABLES:
TYPE-POOLS:SLIS.
DATA:BEGIN OF TB_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
WERKS LIKE MARC-WERKS,
LGORT LIKE MARD-LGORT,
ICON TYPE ICON-ID,
SEL(1) TYPE C,
END OF TB_MARA.
DATA:LS_FIELDCAT_ALV TYPE SLIS_FIELDCAT_ALV,
LT_FIELDCAT_ALV TYPE SLIS_T_FIELDCAT_ALV,
LS_LAYOUT_ALV TYPE SLIS_LAYOUT_ALV.
START-OF-SELECTION.
**--Perform to get matrial data.
PERFORM GET_MAT_DATA.
**--Perform fieldcat_alv.
PERFORM FIELDCAT_ALV. "USING LS_FIELDCAT_ALV. "CHANGING LT_FIELDCAT_ALV.
**--Perform to_display.
PERFORM DISPLAY_LAYOUT.
**--Perform to_display.
PERFORM DISPLAY_DATA.
*& Form get_mat_data
FORM GET_MAT_DATA .
SELECT MARAMATNR MARCWERKS MARD~LGORT
INTO TABLE TB_MARA
FROM MARA INNER JOIN MARC ON MARCMATNR = MARAMATNR
INNER JOIN MARD ON MARDMATNR = MARAMATNR.
LOOP AT TB_MARA.
TB_MOBILE-SEL = 'X'.
TB_MARA-ICON = '@08@'. "0A RED,08 GREEN,09 YELLOW
MODIFY TB_MARA.
ENDLOOP.
ENDFORM. " get_mat_data
*& Form fieldcat_alv
FORM FIELDCAT_ALV.
LS_FIELDCAT_ALV-FIELDNAME = 'ICON'.
LS_FIELDCAT_ALV-ICON = 'X'.
LS_FIELDCAT_ALV-COL_POS = 0.
LS_FIELDCAT_ALV-OUTPUTLEN = 4.
LS_FIELDCAT_ALV-EMPHASIZE = 'X'.
LS_FIELDCAT_ALV-KEY = 'X'.
APPEND LS_FIELDCAT_ALV TO LT_FIELDCAT_ALV.
CLEAR LS_FIELDCAT_ALV.
LS_FIELDCAT_ALV-SELTEXT_M = 'Material'.
LS_FIELDCAT_ALV-FIELDNAME = 'MATNR'.
LS_FIELDCAT_ALV-TABNAME = 'TB_MARA'.
LS_FIELDCAT_ALV-OUTPUTLEN = 18.
LS_FIELDCAT_ALV-KEY = 'X'.
APPEND LS_FIELDCAT_ALV TO LT_FIELDCAT_ALV.
CLEAR LS_FIELDCAT_ALV.
LS_FIELDCAT_ALV-SELTEXT_M = 'Plant'.
LS_FIELDCAT_ALV-FIELDNAME = 'WERKS'.
LS_FIELDCAT_ALV-TABNAME = 'TB_MARA'.
LS_FIELDCAT_ALV-OUTPUTLEN = 6.
LS_FIELDCAT_ALV-KEY = ' '.
APPEND LS_FIELDCAT_ALV TO LT_FIELDCAT_ALV.
CLEAR LS_FIELDCAT_ALV.
LS_FIELDCAT_ALV-SELTEXT_M = 'Storage Loc'.
LS_FIELDCAT_ALV-FIELDNAME = 'LGORT'.
LS_FIELDCAT_ALV-TABNAME = 'TB_MARA'.
LS_FIELDCAT_ALV-OUTPUTLEN = 10.
LS_FIELDCAT_ALV-KEY = ' '.
APPEND LS_FIELDCAT_ALV TO LT_FIELDCAT_ALV.
CLEAR LS_FIELDCAT_ALV.
ENDFORM. " fieldcat_alv
*& Form DISPLAY_LAYOUT
FORM DISPLAY_LAYOUT .
CLEAR LS_LAYOUT_ALV.
LS_LAYOUT_ALV-ZEBRA = 'X'.
LS_LAYOUT_ALV-BOX_FIELDNAME = 'SEL'.
LS_LAYOUT_ALV-BOX_TABNAME = 'TB_MARA'.
LS_LAYOUT_ALV-NO_INPUT = 'X'.
LS_LAYOUT_ALV-COLWIDTH_OPTIMIZE = 'X'.
LS_LAYOUT_ALV-TOTALS_TEXT = 'Totals'(201).
ENDFORM. " DISPLAY_LAYOUT
*& Form display_data
FORM DISPLAY_DATA .
DATA:LV_REPID LIKE SY-REPID.
LV_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = LV_REPID
IS_LAYOUT = LS_LAYOUT_ALV
IT_FIELDCAT = LT_FIELDCAT_ALV
I_SAVE = 'A'
TABLES
T_OUTTAB = TB_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.
Regards,
V.Durga -
I am creating a document in Publisher & converting to a pdf. Most of my png elements within the document, are then printing black and white from the pdf (everything else is in color)? Don't know what is going on, doesn't seem to happen on all printers, is there a setting I am missing? Help! Thanks
Could be a setting in the PNGs when they are saved.
Have you tried saving them as GIFs and replacing them in the document(s)? -
Hello,
I have an ALV grid with an editable checkbox column.
Now I have two problems regarding the colors:
1. as you know, when in edit mode, the colors change. I overrode them with custom colors, but the editable column's cells have still a white margin which I cannot get rid of
2. Zebra layout does not work anymore. If I color the rows with a zebra pattern manually, I would have to re-do it everytime the table is resorted.
Can anyone think of a better way to handle coloring in edit mode?
Thanks a lot.hi,
Chk this link.
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
Regards
Reshma -
Please let me know how to display alternate colors in ALV?
how to display end of list and top of list in a seperate colour?
ThanksHello Ramya,
there is an option for zebra coloring in layout... use the following statement.
data: g_r_layout type slis_layout_alv.
g_r_layout-zebra = 'X'.
example code is below...
report z_alv_ex1 .
*SET TITLEBAR 'T_MATNR'.
TYPE-POOLS
type-pools: slis. " Type pool for ALV
TABLE USED
tables: mara, " General Material Data
makt, " Material Descriptions
mard, " Storage Location Data for Material
marc, " Plant Data for Material
t001w. " Plants/Branches
INTERNAL TABLES
data: begin of g_t_itab occurs 0, " TO HOLD
sel type c,
lgort like mard-lgort, " storage location
werks like marc-werks, " plant
labst like mard-labst, " stock
matnr like mara-matnr, " material number
land1 like t001w-land1, " country i.e. branches
end of g_t_itab.
data: begin of g_t_detail occurs 0, " TO HOLD
matnr like mara-matnr, " material number
end of g_t_detail.
data: begin of g_t_makt occurs 0, " TO HOLD
matnr like makt-matnr, " material number
maktx like makt-maktx, " material description
spras like makt-spras, " language key
end of g_t_makt.
data: l_t_makt like makt occurs 0 " internal table with
with header line. " same structure like MAKT
Data Fields used for ALV call - Simple List
data: g_f_repid like sy-repid,
g_t_fieldcat type slis_t_fieldcat_alv,
g_r_fieldcat type slis_fieldcat_alv,
g_t_events type slis_t_event,
g_r_events type slis_alv_event,
g_r_layout type slis_layout_alv.
data: g_r_x_variant like disvariant,
g_r_variant like disvariant.
data: g_f_exit(1),
g_f_save(1).
SELECTION SCREEN
selection-screen begin of block b1 with frame title text-001.
select-options: s_matnr for mara-matnr,
s_werks for marc-werks.
parameter: p_gerplt as checkbox user-command r1.
selection-screen end of block b1.
START OF SELECTION
start-of-selection.
perform get_data.
AT SELECTION SCREEN
at selection-screen on s_matnr.
if not ( s_werks is initial ).
perform validation.
endif.
at selection-screen output.
loop at screen.
if screen-group1 eq 'G' and p_gerplt = 'X'.
screen-input = 0.
refresh s_werks.
endif.
modify screen.
endloop.
INITIALIZATION
initialization.
perform initial_selection_screen.
AT LINE SELECTION
*AT LINE-SELECTION.
PERFORM at_line_selection.
END OF SELECTION
end-of-selection.
perform set_alv_parameters.
perform display_list.
FORM get_data *
form get_data.
if p_gerplt = 'X'.
select blgort cwerks blabst amatnr d~land1
from mara as a
inner join mard as b
on amatnr = bmatnr
inner join marc as c
on bmatnr = cmatnr
inner join t001w as d
on cwerks = dwerks
into corresponding fields of table g_t_itab
where
a~matnr in s_matnr and
d~land1 eq 'DE'.
else.
select blgort cwerks blabst amatnr
from mara as a
inner join mard as b
on amatnr = bmatnr
inner join marc as c
on bmatnr = cmatnr
into corresponding fields of table g_t_itab
where
a~matnr in s_matnr and
c~werks in s_werks.
endif.
endform.
FORM set_alv_parameters *
form set_alv_parameters.
perform set_fieldcatlog.
Events
refresh : g_t_events.
clear : g_r_events.
TOP OF PAGE event for standard header
g_r_events-name = 'TOP_OF_PAGE'.
g_r_events-form = 'TOP_OF_PAGE'.
append g_r_events to g_t_events.
Attributes for layout
<b> g_r_layout-zebra = 'X'.</b>
g_r_layout-min_linesize = 119.
g_r_layout-colwidth_optimize = 'X'.
Field having checkbox
g_r_layout-box_fieldname = 'SEL'.
Field havind checkbox internal table name
g_r_layout-box_tabname = 'G_T_ITAB'.
endform.
FORM display_list *
form display_list.
g_f_repid = sy-repid.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = g_f_repid
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND'
I_STRUCTURE_NAME =
is_layout = g_r_layout
it_fieldcat = g_t_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
is_variant = g_r_variant
it_events = g_t_events[]
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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.
FORM set_fieldcatlog *
form set_fieldcatlog.
data: l_r_fieldcat type slis_fieldcat_alv.
clear : g_t_fieldcat,
g_t_fieldcat[].
Check - box
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'SEL'.
l_r_fieldcat-col_pos = 1.
l_r_fieldcat-checkbox = 'X'.
l_r_fieldcat-input = 'X'.
append l_r_fieldcat to g_t_fieldcat.
clear l_r_fieldcat.
Plant
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'WERKS'.
l_r_fieldcat-ref_tabname = 'MARC'.
l_r_fieldcat-ref_fieldname = 'WERKS'.
l_r_fieldcat-no_out = ' '.
l_r_fieldcat-input = ' '.
l_r_fieldcat-key = 'X'.
l_r_fieldcat-col_pos = 2.
append l_r_fieldcat to g_t_fieldcat.
clear l_r_fieldcat.
Storage Location
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'LGORT'.
l_r_fieldcat-ref_tabname = 'MARD'.
l_r_fieldcat-ref_fieldname = 'LGORT'.
l_r_fieldcat-col_pos = 3.
append l_r_fieldcat to g_t_fieldcat.
clear l_r_fieldcat.
Material Number
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'MATNR'.
l_r_fieldcat-ref_tabname = 'MARA'.
l_r_fieldcat-ref_fieldname = 'MATNR'.
l_r_fieldcat-col_pos = 4.
append l_r_fieldcat to g_t_fieldcat.
clear l_r_fieldcat.
Stock (Un Restricted)
l_r_fieldcat-tabname = 'G_T_ITAB'.
l_r_fieldcat-fieldname = 'LABST'.
l_r_fieldcat-ref_tabname = 'MARD'.
l_r_fieldcat-ref_fieldname = 'LABST'.
l_r_fieldcat-col_pos = 5.
append l_r_fieldcat to g_t_fieldcat.
clear l_r_fieldcat.
endform.
FORM top_of_page *
form top_of_page.
write: 'TOP OF PAGE'.
endform.
FORM user_command *
--> I_F_UCOMM *
--> I_R_SELFIELD *
form user_command using i_f_ucomm like sy-ucomm
i_r_selfield type slis_selfield.
if i_f_ucomm = 'DESCR'.
perform display_mat_desc.
endif.
endform.
FORM pf_status_set *
--> I_T_EXTAB *
form pf_status_set using i_t_extab type slis_t_extab.
set pf-status 'S_MATNR'.
endform.
FORM display_mat_desc *
form display_mat_desc.
read table g_t_itab with key sel = 'X'.
if sy-subrc ne 0.
message e001(00) with text-002.
endif.
clear : g_t_makt.
refresh : g_t_makt.
loop at g_t_itab where sel eq 'X'.
select matnr maktx spras
from makt
appending table g_t_makt
where
matnr eq g_t_itab-matnr.
endloop.
loop at g_t_makt.
write: / g_t_makt-matnr, g_t_makt-maktx, g_t_makt-spras.
endloop.
endform.
FORM initial_selection_screen *
form initial_selection_screen.
s_matnr-sign = 'I'.
s_matnr-option = 'EQ'.
s_matnr-low = '000000000000000012'.
s_matnr-high = ' '.
append s_matnr.
clear s_matnr.
s_matnr-sign = 'I'.
s_matnr-option = 'NE'.
s_matnr-low = '000000000000000002'.
s_matnr-high = ' '.
append s_matnr.
clear s_matnr.
s_matnr-sign = 'I'.
s_matnr-option = 'EQ'.
s_matnr-low = '000000000000000015'.
s_matnr-high ='000000000010000012'.
append s_matnr.
clear s_matnr.
endform.
FORM validation *
form validation.
select single * from marc
where matnr in s_matnr and
werks in s_werks.
if sy-subrc ne 0.
message e047(m3).
endif.
endform.
Reward If Useful
Sasi.
Message was edited by:
Sasidhar Reddy Matli
Maybe you are looking for
-
Problems Creating Mappings with Collections with tools or workbench
Hi - I am a new kodo user for my company. And am having a few problems in genereal with mapping objects with collections in them. I followed the tutorial on how to use the kodo workbench using the Passenger example. Build the java code and then tried
-
Finder takes long time to load some folders
When opening some folders, the Finder takes a long time (30-60 seconds) to load all the files in it. Specifically, these folders typically contain 10-50 PHP files, each about 10 kb. I also notice that sometimes, after the files are listed, their icon
-
Oracle9i JDBC Sample Applications :
Try out the new Oracle9i JDBC Sample Applications illustrating several key features of Oracle9i JDBC Drivers including NCHAR support, OCI TAF & middle tier authentication, connection cache, and distributed transactions. Point to http://otn.oracle.com
-
Hi all. I have a question, we will like to sort incoming IDOCs coming into SAP? Does anyone know where and or if its possible to sort IDOC's by Plant. Is this process configurable?
-
Stuttered scrolling and size changing
If I use the thumbnail size slide bar at the bottom right corner of iPhoto to change the view of either events or faces or photos within albums it is incredibly slow and stuttered, to the point of it taking several attempts to grab and slide the bar.