ALV table coloring
Hi All,
I have a requirment like alv table shuld display in white color which we can see if we make the rows as editable but it shuld not be in editable mode.
Regards
Santhosh.
Hi Santosh,
I think you are looking for editable ALV, or you want to color alv row?? i am confusing.
Please go through this...
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1?quicklink=index&overridelayout=true
/people/sap.user72/blog/2006/01/09/wda--user-defined-functions-in-alv
Cheers,
Kris.
Similar Messages
-
Colors in Dynamic ALV table display
Hello All,
I have dynamic ALV table display in which i created the columns dynamically and finally binded that created node and diplayed the table ..
Now what i want to do is depending on some condition i need to change the colors in the table display..
I tried to set the color in this way inside the loop .
if lv_phase = '3'.
lr_column->set_cell_design( CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-badvalue_medium ).
else.
lr_column->set_cell_design( CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-standard ).
endif.
This piece of code either changes all the coloumns into one color only why it is not changing the color based upon the condition . I am unable to understand..
Please help me in this...Do i need to some thing else..Solved by creating a new column called cell design ... and settign the set_cell_design_fieldname ...
This solved my Problem .. -
About setting color properties to alv table....
Hi experts,
I have scenario in which i have created one node with two columns..one for data and othr for cell design...both dis node attributed are bind to standard table's column's value property and cell design properties respectively...
Bt now..dis is only poss in Standard tables...and i want da same in ALVs..
In which m not gettin where to bind dat cell design attribute of da node to ALV table...lik we bind data..using set_data( ) thg...
Hope u understood ma query...
Please help me out to solve dis.....
Thanks and Regards,
Runali.Then have a field cell_design in your context. And instead of calling set_cell_design, you should just say
lr_column->set_cell_design_fieldname( 'CELL_DESIGN' ).
In ALV, for every property, a method set_<property>_fieldname is available to bind the proerty to a context attribute. When you initialise your ALV settings, set this attribute and it will be bound to the cell design.
The attribute cell_design should be in the same context node that you bind to the ALV. You can make the column with column ID cell_design as invisible. This way you can set the colors even at an individual cell level. In your internal table, if you wish, you can set a particular color for a set of values etc.
Hope this helps you solve your problem.
Regards,
Nithya -
Hi Experts,
I need single column to be selected from a ALV table...selected in da sense to be highlighted....as it happens..by default for a row.....
I hope u understood my query...
Please help me out in this..
I know u all will surely help me...
Thks and Regards,
Runali.Hi Runali,
Get the reference to the column settings of your ALV Model. Then you can get the reference of each column by passing the column ID. There is a method set_selected_state in the column class, but that does not highlight the column as it does for a row. So what you can use is a cell design for a column that will highlight the column with a color or whatever.
lr_column = lr_column_settings->get_column( ID = id ).
lr_column->set_cell_design( preferred design ).
Hope this helps. Please award points if it solves your purpose.
Regards,
Nithya -
hi gurus,
I have a ALV Display report with Sub totals at two levels.
plant wise and category wise
plant1
category1
subtot
category2
subtot
subtot
plant2
category1
subtot
category2
subtot
subtot
Now the subtotals are being displayed for both the plant wise and category wise, but they are displayed with the same row color.
so, now i want these two subtotal rows with different ROW COLORS.
so where should i change for acheving the above.
thanks in advance.
chaitanyaHi,
Check this coding it will help you alot and also check the TCode LIBS & BIBS u can find more examples here
code&----
*& Report ZALVCOLOR *
REPORT ZALVCOLOR .
DATA : mara TYPE mara. " General Material Data
TYPE-POOLS: slis. " ALV Global types
FIELD-SYMBOLS :
<data> TYPE table. " Data to display
SELECT-OPTIONS :
s_matnr FOR mara-matnr. " Material number
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '50' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Maximum of lines to display'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
Form f_read_data
FORM f_read_data.
FIELD-SYMBOLS :
<field> TYPE ANY,
<field2> TYPE ANY,
<header> TYPE ANY,
<header2> TYPE ANY,
<lt_data> TYPE table. " Data read from DB
DATA:
lp_struct TYPE REF TO data,
lp_struct2 TYPE REF TO data,
lp_table TYPE REF TO data, " Pointer to dynamic table
lp_table2 TYPE REF TO data, " Pointer to dynamic table
ls_lvc_cat TYPE lvc_s_fcat,
lt_lvc_cat TYPE lvc_t_fcat. " Field catalog
First column
CLEAR ls_lvc_cat.
ls_lvc_cat-fieldname = 'MATNR'.
ls_lvc_cat-ref_table = 'MARA'.
APPEND ls_lvc_cat TO lt_lvc_cat.
2nd column
CLEAR ls_lvc_cat.
ls_lvc_cat-fieldname = 'MAKTX'.
ls_lvc_cat-ref_table = 'MAKT'.
APPEND ls_lvc_cat TO lt_lvc_cat.
3rd column
CLEAR ls_lvc_cat.
ls_lvc_cat-fieldname = 'MATKL'.
ls_lvc_cat-ref_table = 'MARA'.
APPEND ls_lvc_cat TO lt_lvc_cat.
Create 1st internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING it_fieldcatalog = lt_lvc_cat
IMPORTING ep_table = lp_table.
ASSIGN lp_table->* TO <lt_data>.
Read data into 1st internal table
SELECT matnr maktx matkl
INTO TABLE <lt_data>
FROM v_matnr
UP TO p_max ROWS
WHERE matnr IN s_matnr.
Create 2nd internal table
Checkbox
CLEAR ls_lvc_cat.
ls_lvc_cat-fieldname = 'CHECKBOX'.
APPEND ls_lvc_cat TO lt_lvc_cat.
Table color
CLEAR ls_lvc_cat.
ls_lvc_cat-fieldname = 'TABCOLOR'.
ls_lvc_cat-ref_table = 'CALENDAR_TYPE'.
ls_lvc_cat-ref_field = 'COLTAB'.
APPEND ls_lvc_cat TO lt_lvc_cat.
Create 2nd internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING it_fieldcatalog = lt_lvc_cat
IMPORTING ep_table = lp_table2.
ASSIGN lp_table2->* TO <data>.
Create structure = structure of the 1st internal table
CREATE DATA lp_struct LIKE LINE OF <lt_data>.
ASSIGN lp_struct->* TO <header>.
Create structure = structure of the 2nd internal table
CREATE DATA lp_struct2 LIKE LINE OF <data>.
ASSIGN lp_struct2->* TO <header2>.
Move data from 1st internal table --> 2nd internal table
LOOP AT <lt_data> ASSIGNING <header>.
DESCRIBE TABLE lt_lvc_cat.
CLEAR <header2>.
Fill the internal to display <data>
DO sy-tfill TIMES.
READ TABLE lt_lvc_cat INTO ls_lvc_cat INDEX sy-index.
For each field of lt_lvc_cat.
ASSIGN COMPONENT ls_lvc_cat-fieldname OF STRUCTURE <header>
TO <field>.
IF sy-subrc NE 0. EXIT .ENDIF.
ASSIGN COMPONENT ls_lvc_cat-fieldname OF STRUCTURE <header2>
TO <field2>.
IF sy-subrc NE 0. EXIT .ENDIF.
<field2> = <field>.
ENDDO.
Modify color
ASSIGN COMPONENT 'TABCOLOR' OF STRUCTURE <header2>
TO <field2>.
IF sy-subrc EQ 0.
PERFORM f_modify_color USING 'MAKTX' <field2>.
PERFORM f_modify_color USING 'MATKL' <field2>.
ENDIF.
APPEND <header2> TO <data> .
ENDLOOP.
ENDFORM. " f_read_data
Form F_DISPLAY_DATA
FORM f_display_data.
Macro definition
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-down = 'X'.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_layout TYPE slis_layout_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv. " Field catalog
Build Fieldcatalog - First column
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-ref_tabname = 'MARA'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO lt_fieldcat.
Build Fieldcatalog - 2nd column
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MAKTX'.
ls_fieldcat-ref_tabname = 'MAKT'.
APPEND ls_fieldcat TO lt_fieldcat.
Build Fieldcatalog - 3rd column
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MATKL'.
ls_fieldcat-ref_tabname = 'MARA'.
APPEND ls_fieldcat TO lt_fieldcat.
Layout
ls_layout-zebra = 'X'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-box_fieldname = 'CHECKBOX'.
ls_layout-coltab_fieldname = 'TABCOLOR'.
m_sort 'MATNR'. " Sort by creation date
Display data
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = <data>.
ENDFORM. " F_DISPLAY_DATA
Form F_modify_color
FORM f_modify_color USING u_fieldname TYPE lvc_fname
ut_tabcolor TYPE table.
DATA:
l_rnd_value TYPE datatype-integer2,
ls_tabcolor TYPE lvc_s_scol.
Random value
CALL FUNCTION 'RANDOM_I2'
EXPORTING
rnd_min = 0
rnd_max = 3
IMPORTING
rnd_value = l_rnd_value.
CLEAR ls_tabcolor.
ls_tabcolor-fname = u_fieldname.
CASE l_rnd_value.
WHEN 0.
ls_tabcolor-color-col = 1. " Blue.
ls_tabcolor-color-int = 0.
ls_tabcolor-color-inv = 0.
WHEN 1.
ls_tabcolor-color-col = 3. " Yellow.
ls_tabcolor-color-int = 0.
ls_tabcolor-color-inv = 0.
WHEN 2.
ls_tabcolor-color-col = 5. " Green.
ls_tabcolor-color-int = 0.
ls_tabcolor-color-inv = 0.
WHEN 3.
ls_tabcolor-color-col = 6. " Red.
ls_tabcolor-color-int = 0.
ls_tabcolor-color-inv = 0.
ENDCASE.
INSERT ls_tabcolor INTO TABLE ut_tabcolor.
ENDFORM. " F_MODIFY_COLOR[/code]
Regards,
Raj. -
ALV with colored cell exporting to Excel
Hi all,
I have an ALV-Table in my webdynpro appliation. There are some dropdownbykey fields in the alv and some cells are colored.
After export to excel the colored cells are no more colored.
Is there a possibility to export the color too.
Best regards
MarcusHave you found a solution to this issue? I am searching for the same.
-
Hi all,
Can we have a legend in ALV table.
Basically I have different colors in different rows depending on some conidtions in the data.
I have to show a legend giving meanings of which color stands for what condirion.
Regards,
ReemaHere is a quick demo I built:
http://www.flickr.com/photos/tjung/2922995882/
>How can I associate the legend ID with the ALV table.
I actually didn't do any association. I just placed a standalone Legend with the View.
http://www.flickr.com/photos/tjung/2923003826/
>Moreover, after creating a legend, how to create legend items
Just right mouse click on the legend and choose Insert Item. You can insert single LegendItems at design time and set their color, Icon, and text. Or you can insert a MultipleLegendItem which gets bound to a context node for more dynamic legend items.
http://www.flickr.com/photos/tjung/2922151867/ -
Hi All,
Is it possible to display ALV without colors ?
If yes pls help me....
DilipHi Dilip,
Try this code,
REPORT ZTEST.
TYPE-POOLS : SLIS.
DATA: BEGIN OF IT_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN,
ERDAT LIKE VBAK-ERDAT,
END OF IT_VBAK.
DATA : FLD_CAT TYPE SLIS_T_FIELDCAT_ALV,
FLD TYPE SLIS_FIELDCAT_ALV .
DATA:V_REPID LIKE SY-REPID.
START-OF-SELECTION.
V_REPID = SY-REPID.
SELECT VBELN ERDAT FROM VBAK INTO TABLE IT_VBAK.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_VBAK'
I_STRUCTURE_NAME =
I_INCLNAME = V_REPID
CHANGING
CT_FIELDCAT = FLD_CAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 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.
LOOP AT FLD_CAT INTO FLD.
CASE FLD-FIELDNAME.
WHEN 'VBELN'.
FLD-KEY = ' '.
MODIFY FLD_CAT FROM FLD.
ENDCASE.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
IT_FIELDCAT = FLD_CAT
TABLES
T_OUTTAB = IT_VBAK
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.
Thanks
Lakshman -
Separatate column of Web Dynpro ALV table using a vertical line
Hi Experts!
I have Web Dynpro ALV table and I have a requirement to add a colored vertical line between two columns as a separator.
Is this possible? Is it possible to adjust border width of individual cells?
I would be grateful for any ideas you may able to share.Both could be achieved by creating custom theme. But those changes will be applicable to tables and ALVs in your applications.
Nitesh -
hi ,
can one send me program for alv cell color with help of function modules
kiranHi Kiran .
<b>1.Cell Color.</b>
While Building Fieldcatalog ,there is one field called
EMPHASIZE.You have to set like this .
i_field-emphasize = 'C26'.
<b>2.ROW COLOR.</b>
Have a look at this example .
<b>a</b>.Define one variable COLOR in ur main ITAB.
<b>b</b>.Fill it .
<b>c</b>.Pass this info.
w_layout-info_fieldname = 'COLOR'.
<b>d</b>. display it .
*& Report ZGRID_COLOR *
REPORT zgrid_color .
TYPE-POOLS slis.
DATA: BEGIN OF i_pa0001 OCCURS 0,
<b> color(3) TYPE c,</b>
pernr TYPE pa0001-pernr,
subty TYPE pa0001-subty,
END OF i_pa0001.
DATA :i_field TYPE slis_t_fieldcat_alv,
w_field LIKE LINE OF i_field,
w_layout TYPE slis_layout_alv.
START-OF-SELECTION .
PERFORM get_data.
PERFORM fieldcat.
PERFORM layout_build.
PERFORM dispaly .
*& Form fieldcat
FORM fieldcat .
CLEAR :w_field,i_field[].
w_field-fieldname = 'PERNR'.
w_field-tabname = 'I_PA0001'.
w_field-seltext_m = 'PERNR'.
APPEND w_field TO i_field.
CLEAR w_field.
w_field-fieldname = 'SUBTY'.
w_field-tabname = 'I_PA0001'.
w_field-seltext_m = 'SUBTY'.
APPEND w_field TO i_field.
CLEAR w_field.
ENDFORM. " fieldcat
*& Form dispaly
FORM dispaly .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = 'ZGRID_COLOR'
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 =
<b> is_layout = w_layout</b>
it_fieldcat = i_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
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 =
TABLES
t_outtab = i_pa0001
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. " dispaly
*& Form get_data
FORM get_data .
SELECT pernr subty
FROM pa0001
INTO CORRESPONDING FIELDS OF TABLE i_pa0001
UP TO 10 ROWS.
LOOP AT i_pa0001.
IF sy-tabix GT 5.
<b> i_pa0001-color = 'C51'.</b>
MODIFY i_pa0001 INDEX sy-tabix.
ENDIF.
ENDLOOP.
ENDFORM. " get_data
*& Form layout_build
FORM layout_build .
<b> w_layout-info_fieldname = 'COLOR'.</b>
ENDFORM. " layout_build
I hope it helps u .
<b>Thanks,
Venkat.O</b> -
Displaying default value for a field in ALV table
Hai all,
I am having an ALV table in which I want to display Requisition number by default using a value which i generated randomly and it is stored in a variable.
While displaying ALV table my req number field should display that value by default when ever user is inserting a row( all the coloumns n my alv are editable.
Is it possible??
Kindly give some suggestions.
Thanks in Advance,
Nalla.BHai Kris,
I took help from ur link and i declared a global attribute request_number.
and i created an event handler ON_ALV_INSERT and did the follwing coding for giving default value wen ever am inserting new row.
FIELD-SYMBOLS: <wa_row> LIKE LINE OF r_param->t_inserted_rows.
DATA bill_details TYPE REF TO zdom_bill_detail.
LOOP AT r_param->t_inserted_rows ASSIGNING <wa_row>.
bill_details ?= <wa_row>-r_value.
IF bill_details->REQ_NUMBER IS INITIAL.
DATA lo_nd_bill_detail TYPE REF TO if_wd_context_node.
DATA lo_el_bill_detail TYPE REF TO if_wd_context_element.
DATA ls_bill_detail TYPE wd_this->Element_bill_detail.
navigate from <CONTEXT> to <BILL_DETAIL> via lead selection
lo_nd_bill_detail = wd_context->get_child_node( name = wd_this->wdctx_bill_detail ).
lo_el_bill_detail = lo_nd_bill_detail->get_element( index = <wa_row>-index ).
lo_el_bill_detail->set_attribute(
EXPORTING
name = 'REQ_NUMBER'
value = wd_comp_controller->request_number
Wen am setting the value of wd_comp_controller->request_number to my context attribute am getting NULL object ref error.
lo_el_bill_detail->set_attribute(
name = `REQ_NUMBER`
value = wd_comp_controller->request_number ).
Pls give some suggestions,
Thanks in Advance,
Nalla.B -
How can i change the column label text in a alv table display
how can i change the column label text in a alv table display??
A similar kinda of question was posted previuosly where the requirement was the label text was needed and following below code was given as solution :
<i>* declare column, settings, header object
DATA: lr_column TYPE REF TO cl_salv_wd_column.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
DATA: lr_column_header type ref to CL_SALV_WD_COLUMN_HEADER.
get column by specifying column name.
lr_column = lr_column_settings->get_column( 'COLUMN_NAME1' ).
set Header Text as null
lr_column_header = lr_column->get_header( ).
lr_column_header->set_text( ' ' ).</i>
My specific requirement is i have an input field on the screen and i want reflect that value as the column label for one of the column in the alv table. I have used he above code with slight modification in the MODIFYVIEW method of the view since it is a process after input. The component gets activated without any errors but while run time i get an error stating
<i>"The following error text was processed in the system CDV : Access via 'NULL' object reference not possible."</i>
i have checked in debugging and the error occured at the statement :
<i>lr_column = lr_column_settings->get_column( 'CURRENT_YEAR' ).</i>Please can you provide me an alternative for my requirement or correct me if i have done it wrong.
Thanks,
SuriI found it myself how to do it. The error says that it is not able to find the reference object i.e it is asking us to refer to the table. The following piece of code will solve this problem. Have to implement this in WDDOMODIFYVIEW method of the view. This thing works comrades enjoy...
DATA : lr_cmp_usage TYPE REF TO if_wd_component_usage,
lr_if_controller TYPE REF TO iwci_salv_wd_table,
lr_cmdl TYPE REF TO cl_salv_wd_config_table,
lr_col TYPE REF TO cl_salv_wd_column.
DATA : node_year TYPE REF TO if_wd_context_node,
elem_year TYPE REF TO if_wd_context_element,
stru_year TYPE if_alv_layout=>element_importing,
item_year LIKE stru_year-i_current_year,
lf_string TYPE char(x),
DATA: lr_column TYPE REF TO cl_salv_wd_column.
DATA: lr_column_header TYPE REF TO cl_salv_wd_column_header.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
Get the entered value from the input field of the screen
node_year = wd_context->get_child_node( name = 'IMPORTING_NODE' ).
elem_year = node_year->get_element( ).
elem_year->get_attribute(
EXPORTING
name = 'IMPORT_NODE-PARAMETER'
IMPORTING
value = L_IMPORT_PARAM ).
WRITE L_IMPORT_PARAM TO lf_string.
Get the reference of the table
lr_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lr_cmp_usage->has_active_component( ) IS INITIAL.
lr_cmp_usage->create_component( ).
ENDIF.
lr_if_controller = wd_this->wd_cpifc_alv( ).
lr_column_settings = lr_if_controller->get_model( ).
get column by specifying column name.
IF lr_column_settings IS BOUND.
lr_column = lr_column_settings->get_column( 'COLUMN_NAME').
set Header Text as null
lr_column_header = lr_column->get_header( ).
lr_column_header->set_text( lf_string ).
endif. -
How to delete a particular row in ALV table
Hi,
How to delete a particular row in ALV table based on some condition(by checking value for one of the columns in a row)
Thanks
Bala DuvvuriHello Bala,
Can you please be a bit more clear as to how you intend to delete the rows from your ALV? By the way deleting rows from an ALV is no different from deleting rows from a normal table. Suppose you have enabled selection property in ALV & then select multiple rows and click up on a button to delete the rows then below would be the coding: (Also keep in mind that you would have to maintain the Selection property of the context node that you are binding to your ALV to 0..n)
data : lr_table_settings TYPE REF TO if_salv_wd_table_settings,
lr_config TYPE REF TO cl_salv_wd_config_table.
lr_table_settings ?= lr_config.
** Setting the ALV selection to multiple selection with no lead selection
lr_table_settings->set_selection_mode( value = cl_wd_table=>e_selection_mode-multi_no_lead ).
Next delete the selected rows in the action triggered by the button:
METHOD onactiondelete_rows .
DATA: wd_node TYPE REF TO if_wd_context_node,
lt_node1 TYPE ig_componentcontroller=>elements_node,
wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set,
row_number TYPE i VALUE 0.
wd_node = wd_context->get_child_node( name = 'NODE' ).
CALL METHOD wd_node->get_selected_elements
RECEIVING
set = lt_temp.
LOOP AT lt_temp INTO wa_temp.
wd_node->remove_element( EXPORTING element = wa_temp ).
ENDLOOP.
CALL METHOD wd_node->get_static_attributes_table
EXPORTING
from = 1
to = 2147483647
IMPORTING
table = lt_node1.
wd_node->bind_table( new_items = lt_node1 ).
ENDMETHOD.
If in case this isn't your requirement please do let me know so that I can try come up with another analysis.
Regards,
Uday -
UI Element : MessageArea : How to I show a ALV table instead of messages
UI Element : MessageArea : How to I show a ALV table (Message Log) instead of all the messages.
Hi,
Create a View Container UI Element at the bottom of the View and Embed ALV into it. Catch the Errors and populate into ALV instead of report message.
hope this helps u.,
Thanks & Regards,
Kiran -
How To Edit Selected Row In ALV Table
Hello Experts,
In My Webdynpro Application, I am displaying records from database table into an ALV Table.
I want to edit only selected record from ALV table.
Please Suggest How to achieve this.
Thanks,
PratibhaThe link given above is for the UI element 'Table' and does not pertain to ALV.
To Make an ALV Editable on lead selection for that particular lead selected row.
1. The ALV should be made lead selectable, when initializing
2. The ON_LEAD_SELECT function should be invoked.
3. Withing this function the index has to be retrieved to know which row was selected.
4. Based on the index retrived all the columns have to pass FALSE to read_only in the column properties.
Regards,
Pramod
Maybe you are looking for
-
Custom Hardware Fan Control - problem if speed pin not connected?
Hi There, I am planing to install a hardware fan control (poti) to my MacPro 1.1 rear fan. (because I have a defective northbridge temperature sensor and the fan is running at maximum speed... so i thought of slowing it down with a fan control for th
-
HT1766 how do i connect it to my computer
How Do I connect My Ipod To Itunes After I Already Downloaded it?
-
Survey answer validation in runtime
Hi all, Does anybody how validate the survey answers values in runtime (before submitting it to the CRM database) at BAdI ORDER_SAVE? Regards
-
Collect core dumps in a Linux vmware
Hi, we have a Linux installed using VMware, and are using this for teaching. Unfortunately collect core dumps on every executable, on some installtions. We tried studio 12 and express and different Linux distributions. Scientific Linux 5.1 and Ubuntu
-
HP ELite L2201x and Dell Inspiron 1525 laptop?
Hi, I bought an HP Elite L2201x Monitor, and I want to connect it to my Dell Inspiron 1525 laptop. I got a display port to HDMI port cable but my laptop doesn't recognize at all the HP monitor, it is like if it were not there! Any advice? I thought