on 02-01-2011 12:06 PM
Hi
How to disable some columns in table control.
For Ex: Table contains 8 columns.
In first row i want to disable first 4 columns.
in second row i want to disable last 4 columns.
In third row i want to disable first 2 and last 2 columns. How can we achieve this?
Cheers,
Venkys.
Hi Venky,
I think your requirement is not the use case for Table UI. You have to think in a other way to achieve this.
I am curious about this requirement : When and who wants this kind of display with variable columns per row ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Basakaran,
Thanks for your reply.
This is forecasting application. In table i am inserting 1 row first, if on click of button i am inserting another row, but i have to restrict some columns (greyed out). columns contains some dates, so between that weeks i want to open for enter values, and all other columns should be greyed out.
Is it possible by using cell variants?
Cheers,
Venkys.
Edited by: venkys on Feb 1, 2011 1:16 PM
Hi,
Can you check if you can use RowRepeater View Element to achieve your requirement?
http://help.sap.com/saphelp_nw70/helpdata/en/44/93d3792e8c60d6e10000000a114a6b/frameset.htm
Thanks,
Prashant
Hi Basakaran,
Requirement is, Table have one dropdown column, contains 3 values based on dropdown selection i want to disable other colums.
For example, In drop down if i select
A -- i want to disable 4 columns(Toal 8 colums ),
B--- i want to disable last 4 columns.
C-- i want to disable first 2 and last 2 columns. in that row. Any solution is thre?
Cheers,
venkys.
Hi Venky,
That must be possible with binding the cell_editor property enabled to the context attribute property enabled.
DATA lo_nd_data TYPE REF TO if_wd_context_node.
DATA context_element TYPE REF TO if_wd_context_element.
DATA ls_data TYPE wd_this->element_data.
DATA lt_properties TYPE wdr_context_properties_tab.
DATA ls_properties TYPE wdr_context_properties.
ls_properties-attribute_name = 'Attri-1'.
ls_properties-required = abap_false.
ls_properties-read_only = abap_false.
ls_properties-visible = abap_true.
ls_properties-enabled = abap_false.
APPEND ls_properties TO lt_properties.
"Repeat the above step for all other attributes in your context
"Set the ls_properties-enabled to true or false
* set the context_element
context_element->set_attribute_props_for_elem(
properties = lt_properties
* keep_others = ABAP_FALSE
).
remember that the context_element is available in wdevent object when you select Dropdown. In this case then You can remove the data-declaration DATA context_element TYPE REF TO if_wd_context_element otherwise you get null pointer exception.
PS: You might have to loop through your table first time to get all the entires default enabled.
hi venky,
yes it is possible all you need to do is this that you will need an attribute say read_only of char01 type and on checking the value of the dropdown field you can set the value of this attribute and the bind the visibility of the column.m sharing a piece of code for your reference.
here in this code i had a column of checkbox and i have made it enable and disable according to the condition.
DATA:LT_COLUMNS TYPE SALV_WD_T_COLUMN_REF,
LS_COLUMNS TYPE SALV_WD_S_COLUMN_REF.
LOOP AT LT_COLUMNS INTO LS_COLUMN .
CASE LS_COLUMN-ID .
WHEN 'DEFECT_CLEARED'.
CREATE OBJECT LR_CHECKBOX
EXPORTING
CHECKED_FIELDNAME = LS_COLUMN-ID.
IF WA_ZAUTHO-OBJECT NE 'AA'.
LR_CHECKBOX->SET_READ_ONLY_FIELDNAME( VALUE = 'READ_ONLY' ). "look this line
LS_COLUMN-R_COLUMN->SET_CELL_EDITOR( LR_CHECKBOX ).
FREE LR_CHECKBOX.
ELSE.
LS_COLUMN-R_COLUMN->SET_CELL_EDITOR( LR_CHECKBOX ).
LR_CHECKBOX->SET_READ_ONLY( ABAP_TRUE ). " and this line
FREE LR_CHECKBOX.
ENDIF.
hope this may solve your problem.
regards,
sahai.s
LR_CHECKBOX->SET_READ_ONLY( ABAP_TRUE ).
FREE LR_CHECKBOX.
ENDIF.
Edited by: sahai.s on Feb 3, 2011 11:28 AM
HI
Create three attribute in the node which is bound to the table as data source.
say pro1, pro2, and pro3 of type wdy_boolean.
now bind the enabled property of first four column editors to pro1, last 4 to pro2, and pro3 to first 2 and last 2.
then go to the eventhandler of the dropdown 's on select event and write the code to update the values of these attribute
according to the selected value.
here is the sample code.
DATA lo_nd TYPE REF TO if_wd_context_node.
DATA lo_el TYPE REF TO if_wd_context_element.
DATA lv_VAL LIKE ls_dealer1-name.
lo_nd = wd_context->get_child_node( name = 'DEALER1').
lo_el = lo_nd->get_element( ).
lo_el->get_attribute(
EXPORTING
name = `NAME`
IMPORTING
value = lv_VAL ).
DATA PR1 TYPE WDY_BOOLEAN.
DATA PR2 TYPE WDY_BOOLEAN.
DATA PR3 TYPE WDY_BOOLEAN.
PR1 = ABAP_TRUE.
PR2 = ABAP_TRUE.
PR3 = ABAP_TRUE.
IF LV_VAL EQ 'A'.
PR1 = ABAP_FALSE.
PR2 = ABAP_TRUE.
PR3 = ABAP_TRUE.
ELSEIF LV_VAL EQ 'B'.
PR1 = ABAP_TRUE.
PR2 = ABAP_FALSE.
PR3 = ABAP_TRUE.
ELSEIF LV_VAL EQ 'C'.
PR1 = ABAP_TRUE.
PR2 = ABAP_TRUE.
PR3 = ABAP_FALSE.
ENDIF.
LO_EL->SET_ATTRIBUTE(
NAME = 'PRO1'
VALUE = PR1
).
LO_EL->SET_ATTRIBUTE(
NAME = 'PRO2'
VALUE = PR2
).
LO_EL->SET_ATTRIBUTE(
NAME = 'PRO3'
VALUE = PR3
).
thanks
sarbjeet singh
hi venky,
then it is easier task in table ui element...Create three attribute of type wdy_boolean in the node and bind them to the table as data source and bind the enabled property of columns accordingly
then write the code to update the values of these attribute according to the selected value.
hope this will sove your problem.
in case of query tell me.
thanks and regards,
sahai.s
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.