Coloring the rows
Hi every 1 ,
I am displaying the grid output with material and batch.
but for every change of batch i want to change the color for that row .
its urgent please any body help me to resolve this problem.
thanks in advance
madhavi,
check these below links may be useful for you
http://www.sapfans.com/forums/viewtopic.php?t=52107
change color of particular cell in input enable ooalv
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
Coming to Colors in ALV's. Following links would help you.
Re: Color cell
Re: Cell Colors in ALV report
Cell Colors in ALV report
Colors in ALV
Colors in ALV
we can also manipulate the color in each cell.
2.
IMPORTANT THINGS
a. Extra field in internal table
clr TYPE slis_t_specialcol_alv,
(this field will contain the colour codes)
b. assign fieldname to alv layout
alvly-coltab_fieldname = 'CLR'
c. work area for colour
DATA : clrwa TYPE slis_specialcol_alv.
d. Populating the color
Once again
Loop at ITAB.
*********logic
if itab-field < 0 "---negative
clrwa-fieldname = 'FIELDNAME'. "<--- FIELDNAME FOR COLOR
clrwa-color-col = 6. <------- COLOUR 0-9
APPEND clrwa TO itab-clr.
MODIFY ITAB.
endif.
ENDLOOP.
5. just copy paste in new program
6.
REPORT abc .
NECESSARY / MUST
TYPE-POOLS : slis.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
ITAB DECLARATION
DATA : prg TYPE sy-repid.
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : clname(3) TYPE c,
clr TYPE slis_t_specialcol_alv,
END OF itab.
DATA : clrwa TYPE slis_specialcol_alv.
PARAMETERS : a TYPE c.
DATA : flname TYPE slis_fieldname.
SELECT
START-OF-SELECTION.
SELECT * FROM t001
INTO CORRESPONDING FIELDS OF TABLE itab..
LOOP AT itab..
IF SY-TABIX <= 5.
itab-clname = 'C50'.
ELSE.
itab-clname = 'C30'.
ENDIF.
MODIFY itab.
ENDLOOP.
LOOP AT ITAB.
check itab-bukrs = '1000'
clrwa-fieldname = 'BUTXT'.
clrwa-color-col = 6.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
clrwa-fieldname = 'LAND1'.
clrwa-color-col = 4.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
ENDLOOP.
prg = sy-repid.
flname = 'CLNAME'.
alvly-info_fieldname = 'CLNAME'.
alvly-coltab_fieldname = 'CLR'.
LOOP AT ITAB.
if sy-tabix = 3.
clrwa-fieldname = 'BUTXT'.
clrwa-color-col = 6.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
clrwa-fieldname = 'LAND1'.
clrwa-color-col = 1.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
endif.
ENDLOOP
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = prg
i_internal_tabname = 'ITAB'
i_inclname = prg
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
minimum
*CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
extra
sy-uname = 'XYZAB'.
prg = sy-repid.
Excluding
DATA : excl TYPE slis_t_extab.
DATA : exclwa TYPE slis_extab.
exclwa = '&OUP'.
APPEND exclwa TO excl.
exclwa = '&ODN'.
APPEND exclwa TO excl.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid
is_layout = alvly
i_callback_user_command = 'ITAB_USER_COMMAND'
it_excluding =
excl
i_save = 'A'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form itab_user_command
text
-->WHATCOMM text
-->WHATROW text
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
BREAK-POINT.
ENDFORM. "itab_user_command
Mark the points if u find useful
~~Guduri
Similar Messages
-
Color the row based on condition
Hello all,
I am woring on an interactive adobe form being called by a web dynpro application.
The adobe form interface used is XML Schema based. The form displays some data at header level and item level.
The item details are displayed in a table. Now. my requirement is that i have a field 'STATUS' in the item table. I want to display the row with RED color if the STATUS = 'X' . How can i achieve this.. i tried using java script at Row initialze event but that didn' work.
Please let me know if you have some solutions.
Thanks & Regards,
Ravi AswaniTry this code
var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);
var custordertext;
for (var i=0; i <= fields.length-1; i++)
if (fields.item(i).name == "STATUS")
if(fields.item(i).rawValue == "X")
this.fillColor = "50, 50, 255";
use this event in calculate event
Thanks,
Rakesh -
How to color specific row in a table....
Hi all,
I created a table out of an Array[]. The table is successfully filled up by array's elements. Each element is a row.
I want to be able to color specific row; instead of every row. How do I do that?
I was looking rendering to color a row or a string; but not successfull.
Thank you for your time and assistence.My favorite way of doing this is to use CSS. You plan on giving the row you want colored an id attribute, then provide a style like this:
<style type="text/css">
tr#colorMe td {
background-color:blue;
</style>Then, when you want to color the row, you make the HTML output like this:
<table ...>
<tr> //normal row
<td></td><td></td><td></td>
</tr>
<tr id="colorMe"> //colored row
<td></td><td></td><td></td>
</tr>
<tr> //normal row
<td></td><td></td><td></td>
</tr>
</table> -
Coloring each row Dynamically in WebDynpro using SALV_WD_TABLE component
Hi All,
We have a requirement in WebDynpro ABAP ,to display the ALV table rows with different colors on the bases of come condition at runtime.
We have checked but got only for column wise but not row wise.
Can we archive it for Row wise also?
Thanks in advance.
CBHi Saji,
Please go through this...
coloring the rows of alv dnamically
Color ALV column and rows
Cell color change in ALV
Cheers,
Kris. -
Dynamic coloring of rows using FM (Reuse_alv_grid_display.)
I need to color the rows depending on the condition dynamically . I am using FM Reuse_alv_grid_display for ALV . I have the code using Oops Concept, But i need to know how can we do using the Function Module. Please Clarify
Hi,
In the final internal table you declare one fieldsline_col(4) type c.
Data: begin of itab occurs 0, "final internal table.
line_col(4) type c,.
end of itab.
IF .......your condition.
loop at itab.
if itab-WERKS = '1000'.
itab-line_col = 'C600'.
endif.
modify itab.
clear itab.
endloop.
Next build your FIELDCATALOG ......
gt_layout-zebra = 'X'.
gt_LAYOUT-DETAIL_POPUP = ' '.
gt_layout-info_fieldname = 'LINE_COL'.
Next pass this to your FM.
I hope this will help you.
Thanks.
If your issue is solved award points and close the thread if not revert back.
Message was edited by: Deepak333 k
Message was edited by: Deepak333 k -
Reg... coloring of rows
I am displaying data in a ALV grid using oops, i want to color the rows depending on the combination of (Sold to party and Customer PO).
how can i do that using oopsHi Kumar,
Check this link for Coloring rows in ALV
http://www.sapfans.com/forums/viewtopic.php?t=52107FirefoxHTMLShellOpenCommand
Please check this Blog for Changing colors for individual Rows..
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/change%2bcolor%2bof%2bindividual%2balv%2brows
Please check this thread..
Re: ALV row coloring
Check this WIKI
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/coloring%2ba%2bcell%2bin%2ban%2balv%2bconditionally
Hope this would help you.
Good luck
Narin -
Conditionally Color a row based on the Day of the Week for that row ?
Hi,
I have a Table containing some timing entries for each day. I have been trying to format some rows depending on a value in one of the columns for that row. What I would like to achieve is color the cell background gray for every row where the Date found in the first Column isn't a Week Day.
I have been trying many things by now, but can't seem to figure it out. Does anyone have suggestions ? I have included a screenshot of what I would like to achieve :
Thanks a lot in advance,
Stefaan
Message was edited by: Stefaan LesageVariations on my post linked in Badunit's message here:
You'll need a second table with one column and as many rows as Table 1 (which contains the dates).
The formula for Table 2 assumes the dates are in column B of Table 1.
=OR(WEEKDAY(Table 1::B)=1,WEEKDAY(Table 1::B)=7)
Enter the formula in the same row as the first data row in Table 1, and Fill it down.
Rule for conditional formatting for all cells in Table 2: Equals TRUE
Other instructions as in the linked message.
Regards,
Barry -
How can i change the color of row?
hi
I want change my background color of rows.
for examole first row ,white and next gray and the other rows.
thanks.Hello,
May be you also select the rownum and use the following example. For more information, please search 'SRW.ATTR' in report help.
function F_SALFormatTrigger return boolean is
begin
if :rownum = 1 then
srw.attr.mask := SRW.BORDERWIDTH_ATTR +
SRW.FBCOLOR_ATTR +
SRW.BBCOLOR_ATTR +
SRW.BORDPATT_ATTR +
SRW.FFCOLOR_ATTR +
SRW.BFCOLOR_ATTR +
SRW.FILLPATT_ATTR;
srw.attr.borderwidth := 1;
srw.attr.fbcolor := 'red';
srw.attr.bbcolor := 'blue';
srw.attr.bordpatt := 'checker';
srw.attr.ffcolor := 'yellow';
srw.attr.bfcolor := 'green';
srw.attr.fillpatt := 'crisscross';
srw.set_attr (0, srw.attr);
end if;
RETURN(TRUE);
end;
Regards,
George
hi
I want change my background color of rows.
for examole first row ,white and next gray and the other rows.
thanks. -
How to print the row ,column,and particular cell in separate color
how to print the row ,column,and particular cell in separate color IN ALV GRID
HI,
Here you go good program links
<a href="http://www.sapfans.com/forums/viewtopic.php?t=52107">How to Set Color to a Cell in AVL</a>
<a href="http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm">ALV Grid Coloring</a>
Thanks
Mahesh -
Retaining the Color of the row when it is refreshed in Javascript
Hi,
I have a checkbox when it is checked it will highlight the row with the color. When it is unchecked the color will go off. This is happening fine.
But the problem i have is that when i refresh the page or goes to some other page and come back the color is not retained eventhough the checkbox is checked.
I want the color to be retained even when the page gets refreshed.
Please do provide a solution for this since it is urgent. I will be waiting for ur replies..
Thanks,
M.Ananthutry to make a hidden form that will hold the value of the colored form
ex. <input type="hidden" name="name" value="<%=colorOfForm%>"
you can pass this value to the next page.. so that when you go back to that page.. you will get the value of the hidden using request.getParameter(''name"); and set the color of the form using javascript -
Alternate color to the rows with sorting
I have a table which has alternate color to the rows.one row in white and other in blue.when sorting is used, the blue-highlighted lines on the table are randomely re-located. They should not be impacted by the sorting.But they are getting effected.Is it possible to give alternate color to the rows with sorting?if yes,how.
Go to Service.sap.com and follow the path > Problem Solving > Create Customer Messages. Choose a System and write a Message.
raising an OSS message -
How to chang the row's color in the Jtable?
I have a table and many rows,I want chang the rows color,like row one's color is red,row tow's color is write,row three's color is green.How can do it? And if i want chang row 3,coloum 2's color.How can do it?
thanks.hi,
I use jdbtable to view data,I want them to chang row color when some cells equal the value.But interface getTableCellRendererComponent not run.I don't know why!
jdbtable is extend jtable ,it made in borland jbuilder.
//1 class
package errorreport;
import java.awt.Component;
import java.awt.Color;
import javax.swing.table.DefaultTableCellRenderer;
import com.borland.dbswing.*;
public class rowcolor extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent
(JdbTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column)
Component cell = super.getTableCellRendererComponent
(table, value, isSelected, hasFocus, row, column);
int iColcount = 0;
iColcount = table.getColumnCount();
if( value instanceof String )
String strAlmlev = (String)value;
if(strAlmlev.trim().equals("C1"))
cell.setBackground( Color.red );
// You can also customize the Font and Foreground this way
// cell.setForeground();
// cell.setFont();
else
if(strAlmlev.trim().equals("C2"))
cell.setBackground( Color.orange );
else
if(strAlmlev.trim().equals("C3"))
cell.setBackground( Color.yellow );
else
if(strAlmlev.trim().equals("ERR"))
cell.setBackground( Color.green );
return cell;
//2 class
JdbTable jdbTable2 = new JdbTable();
TableCellRenderer renderer = new rowcolor();
try
jdbTable2.setDefaultRenderer( Class.forName( "java.lang.String" ), renderer );
catch( ClassNotFoundException ex )
System.exit( 0 );
thanks -
Color the sub-total row in an alv-grid
Hi all.
I work on SAP 4.7 WAS6.20 and output a table with the cl_gui_alv_grid. I´m able to color special rows (or columns) in the alv grid. But I want to color individually the sub-total lines (like the lines before) and don´t want the yellow color for all of the sub-total lines.
Do you know how to color the sub-total-lines?
Thanks a lot.
MichaelHi,
U can color an individula row see the link below
Color a line
The steps for coloring a line i the grid is much the same as making a traffic light.
* To color a line the structure of the table must include a Char 4 field for color properties
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
* Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
* Loop trough the table to set the color properties of each line. The color properties field is
* Char 4 and the characters is set as follows:
* Char 1 = C = This is a color property
* Char 2 = 6 = Color code (1 - 7)
* Char 3 = Intensified on/of = 1 = on
* Char 4 = Inverse display = 0 = of
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-line_color = 'C610'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
* Name of the color field
gs_layout-info_fname = 'LINE_COLOR'.
* Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight
see the link
http://www.sapgenie.com/abap/controls/alvgrid.htm -
Ow to change the color of row in Datagrid view
How to change the color of row in Datagridview. Eg. Am getting a remote server services by get-service. I want to change the color of services that are not running. Am using the below function to get the services.
Please help me it would be useful
function Get-SystemInfo
$array = New-Object System.Collections.ArrayList
$Script:SystemInfo = Get-WmiObject win32_service -ComputerName $textbox1Computername.text | select DisplayName,Name,state,status,startmode | Sort-Object state,startmode,DisplayName
$array.AddRange($SystemInfo)
$datagridview1.DataSource = $arrayThanks.
Can you simply my code for Memory usage to Show Computer name, TotalMem,UsedMem,FreeMem, used Mem %, Free Mem %
Am using the below code :
$buttonMemory_Click= {
if($textbox1Computername.text -ne "")
$script:Object =@()
$script:array = New-Object System.Collections.ArrayList
$Object =@()
$SystemInfo = Get-WmiObject -Class Win32_OperatingSystem -computername $textbox1Computername.text | Select-Object csname, TotalVisibleMemorySize, FreePhysicalMemory
$TotalRAM = $SystemInfo.TotalVisibleMemorySize/1MB
$FreeRAM = $SystemInfo.FreePhysicalMemory/1MB
$UsedRAM = $TotalRAM - $FreeRAM
$RAMPercentFree = ($FreeRAM / $TotalRAM) * 100
$RAMUsedPercent = (100 * $UsedRAM) / $TotalRAM
$TotalRAM = [Math]::Round($TotalRAM, 2)
$FreeRAM = [Math]::Round($FreeRAM, 2)
$UsedRAM = [Math]::Round($UsedRAM, 2)
$RAMPercentFree = [Math]::Round($RAMPercentFree, 2)
$RAMUsedPercent = [Math]::Round($RAMUsedPercent, 2)
$TotalVirtualMemorySize=[Math]::Round($SystemInfo.TotalVirtualMemorySize/1MB, 3)
$FreeVirtualMemory=[Math]::Round($SystemInfo.FreeVirtualMemory/1MB, 3)
$FreeSpaceInPagingFiles=[Math]::Round($SystemInfo.FreeSpaceInPagingFiles/1MB, 3)
$NP=$SystemInfo.NumberofProcesses
$NU=$SystemInfo.NumberOfUsers
$Object += New-Object PSObject -Property @{
#ComputerName = $textbox1Computername.text
TotalRAMGB = $TotalRAM;
FreeRAMGB = $FreeRAM;
UsedRAMGB = $UsedRAM;
FreeRAMPercentage =$RAMPercentFree;
UsedRAMPercentage =$RAMUsedPercent; -
How to fast color the current mouse-hovered row in MultiColumnBox
Hi,
I'm trying to color in a very efficient way the current mouse-hovered row in MutliColumnBox... however, it turns out to be pretty slow...?
Any idea about how to make it (much) faster?
Find attached my current way of achieving this purpose... a bit slow and plus the ActiveCell {-2, -2} considered all the cells... including the row and column headers (how to avoid this by the way ?) (No way to avoid to repainting the headers... after all?)
EDIT: I tried to defer the visual updates on the Front Panel but no big improvements so far.
Thanks,
Ehouarn
Attachments:
Color Mouse Hovered Row in MultiColumnListBox.vi 12 KBEhouarn wrote:
however, it turns out to be pretty slow...?
Your example VI runs quite well on my computer (LV 2011, pretty old Dell laptop with an i7). I don't notice any slowness at all, even when moving the cursor up and down quickly. Maybe it's something with LV 2010 or with your computer specifically?
One possible workaround for things like this (if you can't find another solution) is not to run the update on every mouse move, but rather throttle it. There are a number of ways of doing this. One example is to move the code to the timeout case and set the timeout value through a shift register. The move event sets it to N (let's say 20) and the timeout event sets it to -1. That way, the code runs once, N ms after the last move event.
And no, -2 will always grab the headers too. Your code is the only way I know of to fix it. Maybe it will work if you hide and show the headers, but I haven't tried it and I'm guessing it won't.
Try to take over the world!
Maybe you are looking for
-
Cannot do wireless printing to HP Photosmart C7180 since upgrading to Win 7 Home Premium 64-bit
I recently upgraded one of my new HP p6150t Pavillion PCs from Vista Home Premium 64-bit to Windows 7 Home Premium 64-bit. Since then I have not been able to print to my networked printer, an HP Photosmart C7180 All-in-One, which is wireless on
-
Is JRun free of cost and it seems that, I can install the Developer Version on "N" number of JVM's and do whatever i want too; like develop, deploy and test. Thx
-
Hey all, Mike the newbie has more questions I imported about 6k images into lightroom and I'm working on organizing them within the collections but my question previews. As I scroll through the library there is a delay in seeing the images as they se
-
Smartwatch 2 [error] [blank screen]
just got some problem from my SW2: -The screen doesn't turn on [but the battery is full] -can't be turned on [What!?] -can't be charged again [really!?] P.S: NFC still working [PFFT!] not funny guys! hope someone will help me... ~TheChains
-
The ipod universal dock just doesnt like cases.
Its no doubt that all the dock adapters were meant to only fit the ipods with no case or anything. I have an ipod touch with a sort of rubber back caseing. The thing wont fit into any dock adapters, but fits into the dock without an adapter just fine