Coloring particular line in ALV
Hi Experts,
I want to make color to parrticular line when it satisfies the condition in ALV report.
I am not using SLIS.
so is there any alternavite to clolor row on specific condition like...NETWR > 10000,
that row shold be in RED color.
Please give me Example of code.
Poins will be awarded soon.
Thanks,
Rohan
Hi,
Check this code,
type-pools slis.
data: fieldcat type slis_t_fieldcat_alv.
data: begin of imara occurs 0,
matnr type mara-matnr,
mtart type mara-mtart,
maktx type makt-maktx,
color_line(4) type c,
end of imara.
data: xcolor type slis_specialcol_alv.
START-OF-SELECTION.
PERFORM get_data.
PERFORM write_report.
Get_Data
FORM get_data.
imara-matnr = 'ABC'.
imara-mtart = 'ZCFG'.
imara-maktx = 'This is description for ABC'.
APPEND imara.
imara-matnr = 'DEF'.
imara-mtart = 'ZCFG'.
imara-maktx = 'This is description for DEF'.
APPEND imara.
imara-matnr = 'GHI'.
imara-mtart = 'ZCFG'.
imara-maktx = 'This is description for GHI'.
APPEND imara.
imara-matnr = 'JKL'.
imara-mtart = 'ZCFG'.
imara-maktx = 'This is description for JKL'.
APPEND imara.
DATA: color_code(1) TYPE n VALUE '1'.
data: color_line(4) type c.
LOOP AT imara.
AT NEW matnr.
CONCATENATE 'C' color_code '10' INTO color_line.
color_code = color_code + 1.
IF color_code = '8'.
color_code = '1'.
ENDIF.
ENDAT.
imara-color_line = color_line..
MODIFY imara.
ENDLOOP.
ENDFORM. "get_data
WRITE_REPORT
FORM write_report.
DATA: layout TYPE slis_layout_alv.
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 = '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 = '4'.
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'.
APPEND fc_tmp TO fieldcat.
ENDFORM.
reward if helpful.
regards,
pritha.
Similar Messages
-
Color a line in ALV Grid Control
<<Do not ask for or offer points>>
Hi all,
How to color a line in ALV Grid Control using OOPs.
The appropriate replies will be rewarded.
regards,
S Philip
Edited by: Matt on Dec 22, 2008 11:05 AM<<Points unassigned - cut and paste not allowed. http://sgstocks.tripod.com/alvgrid_control.htm>>
Hi,
To color a line, the structure of the table must include a Char4 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.
Regards,
John
Edited by: Matt on Dec 22, 2008 11:18 AM -
How to color a line in ALV Dispaly
Hi Abaper,
As of my requirement i want to display output of the report for certain lines in a color iam using ALV method,
Plz help me ASAP
answer will be reward.
Thanks in advance
hemaHi Hema..
this is The code for Applying the colors For Lines or Cells also..
report yacpr0007.
This must be included in order to create the fieldcatalog.
type-pools: slis.
parameters: p_dummy type c.
types: begin of ty_data,
select type c,
f1 type i,
f2 type i,
f3 type i,
color_line(4) type c, " Line color
color_cell type lvc_t_scol, " Cell color
end of ty_data.
constants: c_true type boolean_flg value 'X',
c_false type boolean_flg value space.
data: i_data type table of ty_data,
i_field_cat type slis_t_fieldcat_alv,
s_layout type slis_layout_alv.
start-of-selection.
perform f_create_field_cat.
perform f_set_layout.
perform f_create_data.
end-of-selection.
perform f_display_grid.
*& @FORMS
*& Form f_create_data
Create some sample data.
form f_create_data.
data: lw_data type ty_data,
lw_color_cell like line of lw_data-color_cell.
do 15 times.
clear lw_data.
lw_data-f1 = sy-index.
case sy-index.
when 3.
**/ Set the row or cell to color
lw_data-color_line = 'C410'.
when 8.
lw_color_cell-color-col = 6.
lw_color_cell-fname = 'F1'.
append lw_color_cell to lw_data-color_cell. "/ .
endcase.
lw_data-f2 = sy-index * 2.
lw_data-f3 = lw_data-f1 + lw_data-f2.
append lw_data to i_data.
enddo.
endform. "f_create_data
*& Form f_create_field_cat
Create the fieldcatalog. This needs to contain a minimum of
the names of the fields you wish to display. However there are
numerous other things which can be added such as position, colour etc.
form f_create_field_cat.
**/ Add data to the field catalog
perform f_append_row using: 'F1' 'field one' 3,
'F2' 'field two' 2,
'F3' 'field three' 1. "/ .
endform. "f_create_field_cat
*& Form f_append_row
Append a single row to the field catalog.
-->L_NAME The name of the field to be added.
-->L_DESC The description for the column heading.
-->L_POS The column number for the field.
form f_append_row using pv_name pv_desc pv_pos.
data: lw_field_cat like line of i_field_cat.
**/ Append the field catalog record.
lw_field_cat-fieldname = pv_name.
lw_field_cat-seltext_l = pv_desc.
lw_field_cat-col_pos = pv_pos.
append lw_field_cat to i_field_cat. "/ .
endform. "f_append_row
*& Form f_set_layout
Set the layout including the field names used to indicate the
cells or rows should be coloured.
form f_set_layout.
s_layout-colwidth_optimize = space.
s_layout-no_colhead = space.
s_layout-zebra = space.
s_layout-no_vline = space.
**/ Field that identify color line in internal table
s_layout-info_fieldname = 'COLOR_LINE'.
Field that identify cell color in inetrnal table
s_layout-coltab_fieldname = 'COLOR_CELL'. "/ .
endform. "f_create_layout
*& Form f_display_grid
Call the function to display the grid.
form f_display_grid.
**/ You need to pass in a minimum of the fieldcatalog and the table of data
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
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 = s_layout
**/ the field catalog. Tells SAP what to display
it_fieldcat = i_field_cat
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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
**/ The table of data and exceptions
tables
t_outtab = i_data
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. "f_display_grid
<b>reward if Helpful</b> -
Coloring column in an ALV tree
Hi all,
What I want to do is set background color for columns in a tree-view ALV(class cl_gui_alv_tree). However no matter how I set the field EMPHASIZE in the fieldcatalog internal table, the display of the ALV tree keeps unchange. Anyone can help me on this?
Thanks,
Chen ChangHi,
<b>If u want to change the node colr in ALV tree do as follows</b>
Adding Root Nodes for the tree.
Key:
NODE_KEY, RELATKEY, RELATSHIP, HIDDEN, DISABLED, ISFOLDER, N_IMAGE,
EXP_IMAGE, <b>STYLE</b>, LAST_HITEM, NO_BRANCH, EXPANDER, DRAGDROPID, TEXT
perform f9101_node_list using: '1' 'ROOT' '' '' '' c_x '' '' '' '' ''
c_x '' text-003.
Adding subitems for the root node.
perform f9101_node_list using:
Material Details
'MATRL' '1' '' '' '' '' '' '' '' '' '' '' ''
text-001,
Document Details
'DOCU' '1' '' '' '' '' '' '' '' '' '' '' ''
text-002.
form f9101_node_list using value(pnodekey)
value(prelatkey)
value(prelatship)
value(phidden)
value(pdisabled)
value(pisfolder)
value(pimage)
value(pexpimage)
value(pstyle)
value(plastitem)
value(pnobranch)
value(pexpander)
value(pdragdropid)
value(ptext).
w_nodes-node_key = pnodekey.
w_nodes-relatkey = prelatkey.
w_nodes-relatship = prelatship. "Natural number
w_nodes-hidden = phidden.
w_nodes-disabled = pdisabled.
w_nodes-isfolder = pisfolder.
w_nodes-n_image = pimage. "Icons / embedded bitmap
w_nodes-exp_image = pexpimage. "Icons / embedded bitmap
<b> w_nodes-style = pstyle.</b> w_nodes-last_hitem = plastitem. "Tree Control: Column Name / Item
"Name
w_nodes-no_branch = pnobranch.
w_nodes-expander = pexpander.
w_nodes-dragdropid = pdragdropid.
w_nodes-text = ptext.
append w_nodes to i_nodes.
endform. " f9101_node_list
Try changing the style so that u can change the column color.
If u want that in ALV grid
1. different color in line of alv
2. Coloring Cells/rows in ALV Grid.
Got this from forum
report .
Use of colours in ALV grid (cell, line and column) *
Table
tables : mara.
Type
types : begin of ty_mara,
matnr like mara-matnr,
matkl like mara-matkl,
counter(4) type n,
free_text(15) type c,
color_line(4) type c, " Line color
color_cell type lvc_t_scol, " Cell color
end of ty_mara.
Structures
data : wa_mara type ty_mara,
wa_fieldcat type lvc_s_fcat,
is_layout type lvc_s_layo,
wa_color type lvc_s_scol.
Internal table
data : it_mara type standard table of ty_mara,
it_fieldcat type standard table of lvc_s_fcat,
it_color type table of lvc_s_scol.
Variables
data : okcode like sy-ucomm,
w_alv_grid type ref to cl_gui_alv_grid,
w_docking_container type ref to cl_gui_docking_container.
parameters : p_column as checkbox,
p_line as checkbox,
p_cell as checkbox.
at selection-screen output.
perform get_data.
perform fill_catalog.
if w_docking_container is initial.
perform create_objects.
endif.
*& Form create_objects
form create_objects.
create object w_docking_container
exporting
ratio = 60
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
create object w_alv_grid
exporting
i_parent = w_docking_container.
Field that identify color line in internal table
move 'COLOR_LINE' to is_layout-info_fname.
Field that identify cell color in inetrnal table
move 'COLOR_CELL' to is_layout-ctab_fname.
call method w_alv_grid->set_table_for_first_display
exporting
is_layout = is_layout
changing
it_outtab = it_mara
it_fieldcatalog = it_fieldcat
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
endform.
*& Form get_data
form get_data.
select * from mara up to 5 rows.
clear : wa_mara-color_line, wa_mara-color_cell.
move-corresponding mara to wa_mara.
add 1 to wa_mara-counter.
move 'Blabla' to wa_mara-free_text.
if wa_mara-counter = '0002'
and p_line = 'X'.
Color line move 'C410' to wa_mara-color_line.
elseif wa_mara-counter = '0004'
and p_cell = 'X'.
Color cell
move 'FREE_TEXT' 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.
wa_mara-color_cell[] = it_color[].
endif.
append wa_mara to it_mara.
endselect.
endform.
*& Form fill_catalog
form fill_catalog.
Colour code : *
Colour is a 4-char field where : *
- 1st char = C (color property) *
- 2nd char = color code (from 0 to 7) *
0 = background color *
1 = blue *
2 = gray *
3 = yellow *
4 = blue/gray *
5 = green *
6 = red *
7 = orange *
- 3rd char = intensified (0=off, 1=on) *
- 4th char = inverse display (0=off, 1=on) *
Colour overwriting priority : *
1. Line *
2. Cell *
3. Column *
data : w_position type i value '1'.
clear wa_fieldcat.
move w_position to wa_fieldcat-col_pos.
move 'MATNR' to wa_fieldcat-fieldname.
move 'MARA' to wa_fieldcat-ref_table.
move 'MATNR' to wa_fieldcat-ref_field.
append wa_fieldcat to it_fieldcat.
add 1 to w_position.
clear wa_fieldcat.
move w_position to wa_fieldcat-col_pos.
move 'MATKL' to wa_fieldcat-fieldname.
move 'MARA' to wa_fieldcat-ref_table.
move 'MATKL' to wa_fieldcat-ref_field.
Color column
if p_column = 'X'.
move 'C610' to wa_fieldcat-emphasize.
endif.
append wa_fieldcat to it_fieldcat.
add 1 to w_position.
clear wa_fieldcat.
move w_position to wa_fieldcat-col_pos.
move 'COUNTER' to wa_fieldcat-fieldname.
move 'N' to wa_fieldcat-inttype.
move '4' to wa_fieldcat-intlen.
move 'Counter' to wa_fieldcat-coltext.
append wa_fieldcat to it_fieldcat.
add 1 to w_position.
clear wa_fieldcat.
move w_position to wa_fieldcat-col_pos.
move 'FREE_TEXT' to wa_fieldcat-fieldname.
move 'C' to wa_fieldcat-inttype.
move '20' to wa_fieldcat-intlen.
move 'Text' to wa_fieldcat-coltext.
append wa_fieldcat to it_fieldcat.
endform.
Check this link to get code for different colors http://www.sapdesignguild.org/resources/ma_guidelines/VisualDesignRules/colors.html
Try this out the same thing will work for Reuse also.
Thanks & Regards,
Judith.
Message was edited by: Judith Jessie Selvi -
How to give color of particular cell in alv list display for dynamic table
Dear Experts,
i want to give color of a particular cell in alv list display (reuse_alv_list_display). Here i am passing data through dynamic table?Hi,
Se this:
DATA: lt_color TYPE lvc_t_scol WITH HEADER LINE.
DATA: BEGIN OF data_tab OCCURS 0.
tabcolor TYPE lvc_t_scol,
END OF data_tab.
* Befone ALV call
alv_layout-coltab_fieldname = 'TABCOLOR'.
* For each row in data_tab
REFRESH: lt_color.
CLEAR: lt_color.
lt_color-color-col = 6.
lt_color-color-int = 1.
lt_color-fname = FIELD1'.
APPEND lt_color.
lt_color-color-col = 2.
lt_color-color-int = 0.
lt_color-fname = 'FIELD2'.
APPEND lt_color.
data_tab-tabcolor[] = lt_color[].
append data_tab.
Best regards,
Leandro Mengue -
Changing font size(bold) or color of a particular row in ALV Grid Digplay
Hi Experts ,
I am having a requirment to highlight some particular rows in ALV Grid Display . To achieve this i need to change font size or make it bold or change color of that row .
Please give me some inputs .
Thanks in Advance.
VijyetaHi
Coloring An Entire Row
Coloring a row is a bit (really a bit) more complicated. , you should add an additional field to your list data table. It should be of character type and length at least 4. This field will contain the color code for the row.
First you have to declaration of our list data table u201Cgt_listu201D.
DATA BEGIN OF gt_list OCCURS 0 .
INCLUDE STRUCTURE SFLIGHT .
DATA rowcolor(4) TYPE c .
DATA END OF gt_list .
Adding the field that will contain row color data
As you guess, you should fill the color code to this field. But how will ALV Grid know that you have loaded the color data for the row to this field. So, you make it know this by passing the name of the field containing color codes to the field u201CINFO_FNAMEu201D of the layout structure.
e.g.
ps_layout-info_fname = <field_name_containing_color_codes>. u201Ce.g. u2018ROWCOLORu2019
You can fill that field anytime during execution. But, of course, due to the flow logic of screens, it will be reflected to your list display as soon as an ALV refresh occurs.
Try this link also:
Possible functionalities in ALV
Regards
Neha -
Editable ALV - Particular Lines Display and Edit Problem
Hi,
I have developed a program which updates the Custom tables in the database.
I am using cl_gui_alv_grid in the module pool program. I am making all the fields editable using ls_fcat-edit = 'X'.
But as per my requirement in the change mode of the same data base entry, the user should not be able to change the existing data (like PO line items).
My requirement is for a particular Purchase Order if there are line items, when I open the Purchase Order in the change mode all the existing line items should be in display mode and I need to provide the user to add more lines.
Say the PO has 3 line items, in the Grid, it should be like all the existing 3 line items should be in display mode and rest of the lines should be in editable mode which will give the option for the user to add more line items for the same PO.
Here it is not Purchase Order, I just compared as an example.
Logic I am using.
I am building the internal table with a serial numbers from 1-99 and this particular column will be in display mode in the ALV Grid. Using the class cl_gui_alv_grid.
Capturing all the data entered using event handler with method handle_data_changed.
Please tell me how do I set the particular lines in display mode and others in editable mode within the same internal table.
ThanksHi Prabhu,
thanks for the logic, but for some reason the it is not working for me. Please see the below logic and let me know what I am missing.
I am not passing anything related to style to the method Set table for first display.
Is this correct it_outtab = gt_outtab[].
or because of the below method
CALL METHOD g_grid->set_ready_for_input the lines are not actually coming in display mode
DATA : BEGIN OF gt_outtab OCCURS 0.
INCLUDE TYPE zaodoperation.
DATA: celltab TYPE lvc_t_styl ."--->for styles.....
DATA: END OF gt_outtab.
DATA ls_celltab TYPE lvc_s_styl .
DATA lt_celltab TYPE lvc_t_styl .
DATA v_tabix TYPE sy-tabix.
IF gt_outtab[] IS NOT INITIAL.
*Setting the non editiable mode
LOOP AT gt_outtab INTO gs_outtab.
IF gs_outtab-heatnum IS NOT INITIAL.
LOOP AT gt_fieldcat INTO gs_fieldcat.
ls_celltab-fieldname = gs_fieldcat-fieldname.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled."-->no edit.....
INSERT ls_celltab INTO TABLE lt_celltab.
ENDLOOP.
INSERT LINES OF lt_celltab INTO TABLE gs_outtab-celltab.
MODIFY gt_outtab FROM gs_outtab.
CLEAR : gs_outtab.
* else.
* v_tabix = sy-tabix.
ENDIF.
* delete gt_outtab INDEX v_tabix.
ENDLOOP.
ENDIF.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = gt_exclude
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = gt_outtab[].
* set editable cells to ready for input
CALL METHOD g_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
CALL METHOD g_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
Thanks -
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 -
How to provide hyperlink for a particular field in ALV
Hi,
How to provide hyperlink for a particular field in alv report.
Regards,
Ramu.Yes you can do that. using the fieldcatalog there is an option for that. give HOT_SPOT = 'X'. for the column you want.
wa_field-hotspot = 'X'.
REPORT ztest_alv.
TYPE-POOLS:slis.
DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
wa_field LIKE LINE OF it_fieldcat.
DATA: BEGIN OF it_likp OCCURS 0,
vbeln TYPE likp-vbeln,
END OF it_likp.
DATA: layout TYPE slis_layout_alv.
wa_field-fieldname = 'VBELN'.
wa_field-tabname = 'IT_LIKP'.
wa_field-hotspot = 'X'.
wa_field-outputlen = 10.
wa_field-no_zero = 'X'.
wa_field-seltext_l = 'Sales'.
APPEND wa_field TO it_fieldcat.
SELECT vbeln FROM likp
UP TO 10 ROWS
INTO TABLE it_likp.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_likp
EXCEPTIONS
program_error = 1.
*& Form user_Command
* text
* -->UCOMM text
* -->SELFIELD text
FORM user_command USING ucomm TYPE sy-ucomm
selfield TYPE slis_selfield.
CASE ucomm.
WHEN '&IC1'.
SET PARAMETER ID 'VL' FIELD selfield-value.
CALL TRANSACTION 'VL02N' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "user_Command -
Check condition on sub total line of ALV list
Hi All ,
Is it possible to check condition on the value of subtotal line in ALV list ,
I,e If the value of subtotal line is say greator than 100 I need to change the color of that line or change the text on the subtotal line .
I know how to change the subtotal text but i want to change with respect to value of the subtotal ,
Any input if this can be achieved will be great .
Thanks in adv .
Vinay
Edited by: vinay kolla on Jul 29, 2009 4:43 AMHi,
I donu2019t think there is any direct way to check the subtotal value in LIST display, try the following logic.
1. Use the event BEFORE_LINE_OUTPUT to check the subtotal value and accordingly change the text or colour of the line.
2. To use events in ALV, first get the events into a table through the FM REUSE_ALV_EVENTS_GET as shown
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = z_i_events.
SORT z_i_events BY name.
CLEAR z_wa_events.
READ TABLE z_i_events WITH KEY name = slis_ev_before_line_output
INTO z_wa_events BINARY SEARCH.
IF sy-subrc = 0.
MOVE 'BEFORE_LINE_OUTPUTu2019 TO z_wa_events-form.
MODIFY z_i_events FROM z_wa_events INDEX sy-tabix.
ENDIF.
3. Create a form with the name BEFORE_LINE_OUTPUT and do the coding to check the subtotals there.
Form BEFORE_LINE_OUTPUT USING RS_LINEINFO TYPE SLIS_LINEINFO.
*The structure RS_LINEINFO will have u2018Xu2019 in the field rs_lineinfo-subtot for subtotals.
If RS_LINEINFO-SUBTOT = u2018Xu2019.
*Here try to find the totals by looping at your final internal table till rs_lineinfo-tabindex.
*Then based on this u can give the colour to the line.
*I think there is no other way to check the subtotal value.
Endif.
Endform.
Edited by: venkatesh PH on Jul 29, 2009 5:31 AM -
About inserting color to rows in alv
hi ,
could any one tell me how to insert colors to rows in alv.
regards,
pavan.hi,
try like this
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
line_color(4) TYPE c, "Used to store row color attributes
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-info_fieldname = 'LINE_COLOR'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
TABLES
t_outtab = it_ekko
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
DATA: ld_color(1) TYPE c.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekko.
*Populate field with color attributes
LOOP AT it_ekko INTO wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
IF ld_color = 8.
ld_color = 1.
ENDIF.
CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
MODIFY it_ekko FROM wa_ekko.
ENDLOOP.
ENDFORM. " DATA_RETRIEVAL
reward if usefull.... -
To Set Goods Receipt Indicator For Particular Line Items In SRM
Hi All,
i am working on BBP_DOC_CHANGE_BADI in SRM. i am trying to set the goods receipt indicator for particular line items based upon certain conditions. The values are being set in the badi. But when the Purchase Order is created in the backend R/3 i coudn't able to find the goods receipt indiactor being set..
i used this field to set the GR indicator
GR_IND = 'X'. " Goods Receipt Indicator
Can anyone help me in this?
helpfull answers will be rewarded....
Thanks,
MuraliTo Murali and Christophe,
I have set the GR and GR non val indicator in CREATE_PO BADI but I face the following situation :
problem -
In case of multiple account assignment in the shopping cart, the R/3 transaction ME21N sets these flags.
The flag status determined as per EBP conditions is lost.
I need to retain the flag status as per EBP conditions even in this multiple account assignment scenario.
proposed solution -
- CREATE PO badi is already implemented in EBP and customised logic for GR and GR non valflag is in place.
- I create user exit in R/3 backend system in ME21N transaction
- I make RFC call in this user exit to EBP and check the table BBP_PDPSET for the shopping cart.
This is how I get the flag status as per EBP conditions and copy the same to R/3 thereby overriding the multiple account assignment check of the R/3 system.
issue -
When I tried to verify that I can check the BBP_PDPSET table from R/3, I found that this table is not having entries for all the records in CRMD_ORDERADM_I table.
For which shopping carts will the BBP_PDPSET table not be populated ?
thank you in advance,
Bhakti. -
How to insert horizontal lines in alv report?
hi,
i have to insert horizontal lines in alv report.( RM07MLBB )
actually my requirement is:
basis list = RM07MLBB.
first secondary list = another report is called here ( RM07DOCS )
i want to insert horizontal lines in the first secondary list, when i execute individually RM07DOCS , i can get horizontal lines, but when i dounle click in the basic list --> in the first secondary list , i am not getting the horizontal lnes.
functional modules used are REUSE_ALV_HIERSEQ_LIST_DISPLAY & REUSE_ALV_GRID_DISPLAY.
here in this program,
is_layout = alv_layout.
hence i tried to give
alv_layout-no_hline = ' '.
but not effecting.
can some one please tell me , how to insert lines in the alv report.
thanks in advance,
Dastagir.hello,
so i cannot insert horizontal lines in the first secondary list according to my sorting condition, i.e., in a single block there should be :
if same delivery challan number is repeating they should come in the same block,
for the corresponding delivery challen number, if have po number, is repeating , they also should come in the same block.
in this way i have to seperate the blocks containing EXNUM , EBELN CONDITIONED. -
Deactivate the double click/ hot spot for a particular row in alv grid.
Hello,
As per a certain condition how to deactivate the double click/ hot spot for a particular row in alv grid.
Regards,
Sarojwhere u define layout there is a field hotspot.like
data: var.
if con is true
var = 'X'. (show hotspot)
else.
var = ' '. (deactive hotspot)
elseif ws_fieldcat-fieldname = 'DMBTR'
AND ws_fieldcat-tabname = 'T_MTAB'.
ws_fieldcat-do_sum = C_X.
<b>ws_fieldcat-hotsopts = var.</b>
MODIFY Wt_fieldcat FROM ws_fieldcat
TRANSPORTING DO_SUM.
It is helpful for u. if any problen send me ur coding i will change it.
Regards
Manish Kumar -
How to delete and edit particular line in a file and save it in same file ?
Hi,
I want to delete and edit text at particular line in a file.
But edit and delete should reflect in same file.
I have done googling for this but it results with using another file, that i dont want as i need to save changes in same file.
How can i do this?
Thanks in advance
Edited by: vj_victor on May 24, 2010 3:33 PMI just want to make sure, this is the only way to do what i mentioned ? or it could be done another way !a) write the data to a new file
b) delete the old file
c) write the data to a newer file
d) delete the new file
e) rename the newer file to the old file name.
For a hint about still more ways to do this, search for the complete lyrics of One man went to mow, Went to mow a meadow...
db
Maybe you are looking for
-
How to show a relevant value in alv table, when i press enter key
I created a alv table. in this table there is a column called user id, and the other column called user name. what do I want: i wanna input a value in column user id eg. user id = D1111; when i press the enter keyboard, the column user name will be s
-
DW6 fluid grid layout issue: writes to page instead of css file
Using DW6 (version 12, owned, build 5861) on Windows 7 64 bit. Following tutorials and the help files to use the fluid grid layout. Start a blank page on a new site, which inserts the starter div and new css file Immediately save page, which also gen
-
Stuck - load the Excel file dynamically with different columns and worksheet names
I have a situation where I want to load the Excel file dynamically, and the excel file have different columns or even worksheet name. Any idea how I could approach this? I believe there's no way to modify the meta data (specifically the mapping) in
-
About Calendar Year/Month in demo cube 0D_PU_C01
Dear Friends, I'm now working with the demo cube <b>0D_PU_C01</b>,and then I met such a problem: I download the csv file via a program, and then I found the stucture of the data is not suitable for this cube , so I changed it manually, and when I
-
Adding Vertical Lines in Footer
How do I add vertical lines using Dreamweaver CS4 in my footer to divide up the various links..(as in the very bottom of this page where the various links are divided by small vertical lines)??