REUSE_ALV_GRID: coloring of cells without digits
Hello Experts,
Im using reuse_alv to display my internal table:
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename
filetype = 'ASC'
TABLES
data_tab = ta_csv.
IF sy-subrc <> 0.
MESSAGE 'Lokale Datei nicht gefunden oder Zugriff gescheitert'
TYPE 'E'.
EXIT.
ENDIF.
DATA: BEGIN OF st_csv_data,
vkorg TYPE vkorg,
matnr TYPE matnr,
preis(10) TYPE c,
END OF st_csv_data.
LOOP AT ta_csv INTO v_record.
IF sy-tabix = 1.
CONTINUE.
ENDIF.
SPLIT v_record AT ';'
INTO st_csv_data-vkorg
st_csv_data-matnr
st_csv_data-preis.
MOVE: st_csv_data-vkorg TO wa_csv_data-vkorg,
st_csv_data-matnr TO wa_csv_data-matnr,
st_csv_data-preis TO wa_csv_data-preis.
APPEND wa_csv_data TO ta_csv_data.
ENDLOOP.
v_repid = sy-repid.
v_layout-zebra = 'X'.
v_layout-edit = 'X'.
v_layout-colwidth_optimize = 'X'.
v_grid_title = text-t02.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_grid_title = v_grid_title
i_save = 'A'
i_structure_name = 'zst_preisupload'
is_layout = v_layout
i_callback_pf_status_set = 'STANDARD'
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = ta_csv_data
EXCEPTIONS
program_error = 1
OTHERS = 2.
and I'd like to have cells in th grid being colored in case there are empty or there are not digits inside.
Until now I only foud some example solutions hot to do this static...could you may be give some advise for that case?
Hi Denis,
Not sure how you will do it with individual cells, but if you have a look at sap demo program BCALV_TEST_COLORS they use this same Function Module as you i.e. for the same case.
Hope this helps you.
Similar Messages
-
IP : Delete a value in e cell without entering zero
We have an input ready planning layout created with WAD. In WEB user deletes a value in a cell without entering zero instead. When we refresh data former value appears again. When the user enters zero to the cell we have no problem. When we execute the query with BEX and delete the value in cell without entering zero, there is no problem also. Is there a parameter in WAD to check this?
Hi
If you create a "Delete" function and provide the same on layout it will delete the same from the cube. However, the user need to enter the line # which he/she wants to delete from the layout. Ofcourse, entering zero in the input for Key Figure will help delete the values from cube but if it has any corresponding calculations (say salary or revenue)....it will not get nullified. It is always good idea to provide a standard delete function on the layout.
Regards
Srinivas -
To color selected cells in dynamically created table in ALV.
Hi,
The requirement is to display a table (whose columns are dynamic) using ALV n to color few cells of the table based on some condition.
For creating the table dynamically i have used the method cl_alv_table_create=>create_dynamic_table.
Now for coloring the cells i tried to use the field EMPHASIZE .
But when I try this method the whole column is getting colored.
So any suggestions on how to color only particular cells.Hi,
Try this one...
DATA: gs_layout TYPE slis_layout_alv, "Define layout
gt_color TYPE lvc_t_scol WITH HEADER LINE. "Define Internal Table for Cell Colouring
Use below Sample Code after building a Field Catalog:
gs_layout-coltab_fieldname = 'COLINFO'.
" 'it' is the final internal table which contain positive & negative value of Field 'MENGE'
LOOP AT it.
REFRESH gt_color.
CLEAR gt_color.
IF it-menge GE 0.
CLEAR gt_color.
gt_color-fname = 'MENGE'.
gt_color-color-col = cl_gui_resources=>list_col_positive.
gt_color-color-int = 0.
APPEND gt_color.
ELSEIF it-menge LE 0.
CLEAR gt_color.
gt_color-fname = 'MENGE'.
gt_color-color-col = cl_gui_resources=>list_col_negative.
gt_color-color-int = 0.
APPEND gt_color.
ENDIF.
it-colinfo[] = gt_color[].
MODIFY it.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = gs_layout
it_fieldcat = ct_fieldcat
i_save = 'A'
TABLES
t_outtab = it
EXCEPTIONS
program_error = 1
OTHERS = 2.
Hope this solves your problem.
Regards,
Tarun -
Dynamically coloring a cell based on user action.
Dear Gurus,
I know that many a questions have been posted based on cell coloring. But sadly i couldn't find anything that suits my requirement. My requirement is like i want to color a cell when the user double clicks on that cell. I have captured the double click event and iam filling the required color in a field in final itab (name : color). After this iam calling refresh_table_display.
But sadly no changes are visible. Any help would be greatly appreciated.
Given below the code.
gfl_color-fname = l_fname-fieldname.
gfl_color-color-col = '6' .
gfl_color-color-inv = '1'.
APPEND gfl_color TO gfl_rfinal-color.
MODIFY git_rfinal FROM gfl_rfinal INDEX l_index-row_id
TRANSPORTING color.
CLEAR gfl_rfinal.
CALL METHOD r_grid1->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
Thanks and Regards,
Sandeep Sivan
Edited by: sandeep sivan on Aug 5, 2010 10:51 AM
Edited by: sandeep sivan on Aug 5, 2010 11:01 AMIssue Solved.
-
[kinda urgent] Is that possible signing without digital ID?
Hello!
I want to ask two questions. Those things might similar to each other, which may concerning signing without Digital ID.
First one is that we want to get sign right away right on the place(maybe without Digital ID). Probably a pad or something, such the device we use when taking bills with credit card, would be connected to the computer. Is that possible or at least sounds probable? and if it is, please let me know how.
Not only that, I wanna ask u one more thing. It is using pdf file with table pc, such as I-PAD. hmm.. giving an example, let's say I read a dynamic forms with I-pad, and I want to sign without Digital ID thing, specifically 'on the pad'. is that possible? like the former one, if it is, please tell me how to do it.
The former one is more important and the fact whether possible or not is the first priority.
In case the information is not specific enough, just comment about that, I am gonna add more detail.
kinda in a hurry, Please help me.
Any comment would be appreciated!!
virtuodo123The PDF format supports many types of "Electronic" signatures, including signatures created using a signature pad. Acrobat and Reader (with a reader extended form) have the ability to sign PDF documents using Digital IDs (x509 digital certificates) out of the box. Other types of signatures are supported using third party plugins.
For more info, check out http://www.adobe.com/security/partners/index.html
Regards
Steve -
Hi All,
I am working with REUSE_ALV_HIERSEQ_LIST_DISPLAY function module to diaplay hierarchial list. Now my requirement is to color particular cells in the output based on condition. Can any one help me in this regard.
Thanks and Regards,
Srinadh.hi ,
try this..
* FIELD CATALOG
DATA : it_field TYPE slis_t_fieldcat_alv, "internal table for field catalog
wa_field TYPE slis_fieldcat_alv. "work area for field catalog
* FOR LAYOUT OF ALV GRID
DATA : wa_layout TYPE slis_layout_alv. "work area for layout design
*& Form SET_LAYOUT
* SUB-ROUTINE SET_LAYOUT IS USED TO SET THE DISPLAY OF THE
* ALV GRID LINES IN ALTERNATIVE COLOURS
FORM set_layout .
wa_layout-zebra = 'X'.
ENDFORM. " SET_LAYOUT
*& Form ALV_DISPLAY
* SUB-ROUTINE ALV_DISPLAY IS USED TO SET THE PARAMETERS
* FOR THE FUNCTION MODULE REUSE_ALV_GRID_DISPLAY
* AND PASS THE INTERNAL TABLE EXISTING THE RECORDS TO BE
* DISPLAYED IN THE GRID FORMAT
FORM alv_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = 'SY-REPID '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_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 =
* I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_field
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_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
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_final
* 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. "alv_display
regards
Ritesh J -
Hello,
im trying to Color some Cells in a Webdynpro ALV.
So far i found out that there are maybe two ways:
one like this with WDUI_TABLE_CELL_DESIGN
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71393
but i didnt find out, how to color specified Cells. With this example it is only possible to color the column by the saved color.
the other way is to append a color table to ich column LVC_T_SCOL
and after that
* We will set this COLOR table field name of the internal table to
* COLUMNS tab reference for the specific colors
TRY.
lo_cols_tab->set_color_column( 'T_COLOR' ).
CATCH cx_salv_data_error. "#EC NO_HANDLER
ENDTRY.
http://help-abap.blogspot.com/2008/10/salv-table-9-apply-colors.html
but i dont works in Webdynpro ALV. or has someone an idea?
i hope someone can help me.
greets,
SaschaHi ,
Check this thread, [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71393]
In your case you will have to create 1 attribute ( type WDY_UIE_LIBRARY_ENUM_TYPE ) for every column. ( for eg: c1, c2, c3 ,c4 , c5 for pt1 pt2 pt3 pt4 pt5 respectively ) and bind it as follows,
*---------- Column settings
DATA: l_column_settings TYPE REF TO if_salv_wd_column_settings.
l_column_settings ?= lo_value.
* Get columns
DATA: lt_columns TYPE salv_wd_t_column_ref ,
ls_columns TYPE salv_wd_s_column_ref .
DATA: l_column_header TYPE REF TO cl_salv_wd_column_header .
lt_columns = l_column_settings->get_columns( ) .
LOOP AT lt_columns INTO ls_columns .
CASE ls_columns-id .
WHEN 'PT1' .
l_column_header = ls_columns-r_column->get_header( ) .
l_column_header->set_ddic_binding_field(
if_salv_wd_c_column_settings=>ddic_bind_none ) .
ls_columns-r_column->set_cell_design_fieldname( value = 'C1' ). "binding C1 is attribute
WHEN 'PT2' .
l_column_header = ls_columns-r_column->get_header( ) .
l_column_header->set_ddic_binding_field(
if_salv_wd_c_column_settings=>ddic_bind_none ) .
l_column_header->set_text( 'Item No' ) .
ls_columns-r_column->set_cell_design_fieldname( value = 'C2' ). " binding
........similarly continue for all the columns.
Now modify your internal table based on your condition and set the required color as follows,
LOOP AT lt_alv INTO ls_alv.
if pt1 is lowest.
ls_alv-color1 = '02'. " green
elseif pt2 is lowest.
ls_alv-color2 = '03'. "red
endif.
MODIFY lt_alv FROM ls_alv INDEX sy-tabix.
ENDLOOP.
* Bind Data to ALV
cn_alv->bind_table( lt_alv ).
Hope it helps!
Radhika. -
Problem in color a cell for field symbol table.
Hi guru's
when i'm trying to color a cell based on condition, getting the following error.
ERROR: the data object <line> has no structure and therefore no component called "cell_colour" .
providing my code here:
DATA: wa_cellcolor TYPE lvc_s_scol,
lv_index TYPE sy-tabix.
break satishkumarc.
LOOP AT <table> ASSIGNING <line>.
lv_index = sy-tabix.
ASSIGN COMPONENT 'COMPLIANCE' OF STRUCTURE <line> TO <field>.
IF <field> EQ 'YES'.
wa_cellcolor-fname = 'COMPLIANCE'.
wa_cellcolor-color-col = col_positive.
wa_cellcolor-color-int = 0.
wa_cellcolor-color-inv = 0.
ELSE.
wa_cellcolor-fname = 'COMPLIANCE'.
wa_cellcolor-color-col = col_negative.
wa_cellcolor-color-int = 0.
wa_cellcolor-color-inv = 0.
ENDIF.
APPEND wa_cellcolor TO <line>-cell_colour. " error line
MODIFY <table> FROM <line> INDEX lv_index TRANSPORTING cell_colour. " error line
CLEAR: wa_cellcolor.
ENDLOOP.
actually i know that <line>-cell_colour won't work. but i don't know how to achive this functionality .
could anybody please help me out in this.
Thanks in Advance.
regards
satish
thankhi ashish,
i'm using
field-symbols: <line> type any.
CREATE DATA mydata LIKE LINE OF <table>.
ASSIGN mydata->* TO <line>.
to make the structure. so i guess i cannot give the structure name while declaring <line>.
Thanks & regards
satish -
IQS9 Completes Quality Notifications without digital signature
Hi all,
When we complete quality notifications, the system requires the user to enter digital signature (username and password) in qm02. However when you select a list of notifications in IQS9, and then click on Edit from there, it brings the notificaion up in transaction IQS22 and you can complete a nitification there without digital signature which is bad.
We can't take everyone away from using IQS22 because it provides a much better selection and drill down capabilities for all types of notifications (service and quality). Is there a way to have IQS22 require a digital signature for quality notifications just like qm02 does?
Thank you very much,
SergiyE-signatures in Quality Notifications WAS (!!) not a part of the standard features in SAP. But as of ECC 6 (extension pack 4 - I think) e.signature in notifications are avalable in tasks and actions. I have never test this function. But:
If this not solves your problem you can implement SAP e-signature Tool with alow you to add digital signatures "everywhere" in the system. This is a pre defined "ABAP-tool" to cal up at any system action by a exit/mod.
http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0fbaa71-cd8d-2910-5982-e30626035400
I hope this will awnser you question and that anyone that has test te e-signatures in notifications can add info. -
How to set colors in cells depending the conditions in alvtree
Hi All,
Could you please provide me idea or sample program how to set colors in cells depending the conditions in alvtree.
Thanks,
SureshWhen running vim in a terminal, it will use whatever colour scheme is defined by the terminal. You should have a look at this thread:
http://bbs.archlinux.org/viewtopic.php?id=51818
Also, check the wiki article on Xdefaults. -
Color a cell when i select THAT cell
Hi!
I searced for something about my question, but i didn't find anything about it :/
I have to color one cell of a JTable when i select it and make some operation.
I tried with this:
java.awt.Component cell = jTable1.getComponentAt(jTable1.getSelectedColumn(),jTable1.getSelectedRow());
cell.setForeground(java.awt.Color.red);But it color all my table and not THE cell that i've selected.
If i've understood, the overriding of the metods prepareRenderer (or similar, i don't remember its exact name) sets the color of cells under particulare condition, but i think i don't need it: i have to color a cell only when i select it.
Thank you!but i think i don't need it: i have to color a cell only when i select it. Why don't you think you need it. You have a special requirement that you only want to give the cell a specific color when it is selected. So the prepareRenderer() method should do what you want.
If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
Don't forget to use the [Code Formatting Tags|http://forum.java.sun.com/help.jspa?sec=formatting], so the posted code retains its original formatting. -
Color table cells depending on value of entry in row (UI5 & JSON)
Hello all,
I've stuck here a bit. There have been some discussions about how to color the cells of a table that has been bound to a JSON data model. I found some answers how to color individual cells (http://http://scn.sap.com/thread/3383698), but I have a hard time to fulfill the following requirement (rephrased for simplicity):
Given value "a" in the first cell of a table row, color the row cells 1 - 4 in blue, and 5-7 in red.
Given value "b" in the first cell of a table row, color the row cells 1 - 4 in yellow and 5-7 in green.
This wouldn't be a problem with normal HTML as I could easily assign style classes to every cell, however I can't find the solution for the UI5 table.
Any ideas?
Thanks,
ChristianHi Nishant,
not sure if I undestand you correctly.
When I scroll the table, the data scrolls with the table correctly, but in the "Last Name" column the formatting gets messed up.
To solve this, you need to remove the previously added classes:
// Approach 2
template = new sap.ui.commons.TextView().bindProperty("text", {
parts: [
{path: "***" },
{path: "lname" }
formatter: function(***, lname){
// Remove previously added classes
this.removeStyleClass("cyan").removeStyleClass("yellow");
if(*** == "m" ){
<!-- approach 2 step B : Add Css style class to element -->
this.addStyleClass("yellow");
} else if(*** == "f" )
this.addStyleClass("cyan");
return lname ;
oTable.addColumn(new sap.ui.table.Column({ label: "Last Name",
template: template,
Same for the first approach using where you have to remove the custom data instead if the class.
This should solve the problem. (By the way this is already mentioned in this thread in my post from Mar 10, 2014 11:40 AM)
Greeets,
ben -
Is there any way for a formula to ignore other cells without data in them yet?
I'm trying to create a spreadsheet to track my grades. I have all the formulas set up (quizzes, tests, etc. are calculated separately because they are all weighted differently towards the final grade). The "Final Grade" formula has an error because some of the other sets don't have data in them yet (i.e. haven't taken a test yet). Is there any way to get the Final Grade formula to ignore the cells without data yet?
Formula for each category (quizzes, tests, etc): ((SUM [total point column]) / (SUM [total points possible column])) * 100
Formula for Final Grade: (([quiz grade] * 0.15) + ([test grade] * 0.25)) * 100Hi badwolfgirl,
I agree with quinn that merged cells can lead to many problems. Here is a table with no merged cells
Two Header Rows, one Header Column and one Footer Row.
I have used Cell Fills (colours) to distinguish Quizzes, Tests, Final Exam and Projects.
Formula in Footer B8
=IF(SUM(C)=0,"",100×SUM(C)÷SUM(D))
if the SUM of C is 0 (zero), insert "" (NULL) to make it appear blank. Else insert 100xSUM(C)/SUM(D) to show the % score.
Formula in C8
=SUM(C)
Formula in D8
=SUM(D)
Select B8 to D8 and drag the yellow Fill Handle to the right.
If you want the appearance of merged cells, you can delete the contents of B1 and D1, then show No Border to the left and right of C1
And so on for EFG etc.
The cells are still there (to avoid problems down the track.
Regards,
Ian.
Edited to rearrange paragraphs. Ian. -
Color a cell in ALV using CL_GUI_ALV_GRID
Hi,
How to color a cell using CL_GUI_ALV_GRID?
Thanks!Hi Ezachiael,
you dont have to trigger event DOUBLE_CLICK, it will be triggered, in case of double click :-).
You have to implent event handling class and event handler method - It is quite simple.
Check out this [Reference on SDN|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907].
Regards
REA -
How to export table data with coloring of cell according to value.
Hi all,
I am using jdeveloper 11.1.1.6
i want to export table data with lot of formatting. like with coloring of cell according to value and so many.How to do that?Hi,
like with coloring of cell according to value and so many.How to do that?
Answer is, you can't
Frank
Maybe you are looking for
-
How to use the 3 button mouse to swipe from one window to another window
when I use the trackpad in the macbook pro 2010 with 3 fingers, I can easily swipe left or right to another window that I setup one for my home and one for my office work, but I also use a external mouse, keyboard and big display to use the MBP with
-
How can I take out a picture from Imovie
Hi, i'm trying to extract pictures from Imovie and it's like if it was not possible. Do you know the way I can do that ? Thank you very much
-
Hi, im using sap crystal report version 13.0.2000.0... i kept one sting field in details section, in stored procedure its length is 50 characters but in my report it is displaying only 10 characters..how to format this field,is there any formula for
-
Upgrade from CRM 4.0 Mobile Components to SAP CRM 7.0
Hi CRM guru's I am a SAP BASIS consultant. New to CRM. I have a few queries for which i require help. 1) Is it possible to upgrade CRM 4.0 Mobile Components to SAP CRM 7.0 platform? 2) What is the approach used to upgrading a CRM 4.0 Mobile Component
-
IMac keeps crashing Kernal Log help please
Hello, I have a imac mid 2007 runnibg Lion 10.7.2 upgraded 4gb Ram 2Ghz - It doesn't matter what application Iam in, I constantly get Kernel panic, then the screen freezes and I have to switch off manually. I have a wireless keyboard so not able to r