on 11-17-2009 12:15 PM
Hi
I have a table element.There are four columns in it.The first column is a drop down,The rest are f4 helps.
When I add a new row,I want to make the two columns of, all the previously added rows disabled so that user wont be able to change these.
please help me to do this.
Thanks & Regards,
Raji.
hi,
Follow this steps:
1. Create an Attribute of type wdy_boolean in the node binded to table.
2. Now When you click on Button, Get the data shown in Table in an internal table.
3. Now se t the attribute as ' ' for making all rows as disable.
4. Append new row with this attribute as 'X'.
Make sure to bind the enable property of all Table Columns with this Attribute.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Raj ,
another option is 1. Added oone more column in that table element as it ( ENABLE type WDY_READ_ONLY ),
2. bind read-only properties of those columns in that table elements = table-enable values .
3. when user clicks on button , update value of ENABLE = 'X' if records are already added.
regards
prabhu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Code for reference :
DATA lo_nd_cn_popin TYPE REF TO if_wd_context_node.
DATA wa TYPE wd_this->element_cn_popin.
DATA itab TYPE wd_this->elements_cn_popin.
Get all row data inside an internal table *******
lo_nd_cn_popin = wd_context->get_child_node( name = wd_this->wdctx_cn_popin ).
lo_nd_cn_popin->get_static_attributes_table( IMPORTING table = itab ).
*******Set all rows as disable *********
loop at itab into wa.
wa-enable = ' '.
modify itab from wa.
endloop.
Add new Row*******
clear wa.
append wa to itab.
*******Bind the table with new row and previous row Disable ***
lo_nd_cn_popin->bind_table( itab ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Raji ,
in ur context node , which is binded to Table Control ,u need to create a context attribute ENABLE
of type WDY_BOOLEAN and thn u need to use the ABAP statement :
wa-ENABLE = ' '
to set all ur previous rows to non editable mode
u first need to read the context node , using get_static_attributes_table fetch values into the internal table
and have to modify this internal table
MODIFY itab from wa
and bind it to ur node again , as expained earlier in previous steps.
regards
amit
When I give "data wa_prg_det TYPE wd_this->Elements_prg_det." it says " "WA_PRG_DET" cannot be converted to the line type of "LT_PRG_DET" ".
I am pasting my code here.
DATA lo_nd_prg_det TYPE REF TO if_wd_context_node.
DATA lt_prg_det TYPE wd_this->Elements_prg_det.
data wa_prg_det TYPE wd_this->Elements_prg_det.
DATA lo_el_prg_det TYPE REF TO if_wd_context_element.
DATA lv_obj_type TYPE wd_this->Element_prg_det-obj_type.
DATA lv_obj_type TYPE ZTRAC_DTE_OBJTYPE.
navigate from <CONTEXT> to <PRG_DET> via lead selection
lo_nd_prg_det = wd_context->get_child_node( name = wd_this->wdctx_prg_det ).
lo_nd_prg_det->get_static_attributes_table( importing table = lt_prg_det ).
*******Set all rows as disable *********
loop at lt_prg_det into wa_prg_det.
wa_prg_det-DISABLE_ROWS = abap_false. " (DISABLE_ROWS is my context attribute of WDY_BOOLEAN)
modify lt_prg_det from wa_prg_det.
endloop.
*
Add new Row*******
clear wa_prg_det.
append wa_prg_det to lt_prg_det.
APPEND INITIAL LINE TO lt_prg_det.
navigate from <CONTEXT> to <PRG_DET> via lead selection
lo_nd_prg_det = wd_context->get_child_node( name = wd_this->wdctx_prg_det ).
lo_nd_prg_det->bind_table( new_items = lt_prg_det set_initial_elements = abap_true ).
hi Raji
use the attribute WDY_BOOLEAN
proceed as follows :
1 for the UI which u want to disable , bind the ENABLE property of that to a context attribute of type WDY_BOOLEAN
2 read the context node , using get_static_attributes_table fetch values into the internal table
3 disable context attribute by setting it to ' ' and modify internal table
just read the context attribute using control +f7 thru code wizard
* set single attribute
lo_el_cn_all->set_attribute(
EXPORTING
name = `ENABLE`
value = ' ' ).
// or u can set it to ABAP_FALSE as well
* set single attribute
lo_el_cn_all->set_attribute(
EXPORTING
name = `ENABLE`
value = ' ABAP_FALSE' ).
context attribute ENABLE under the context node cn_all
regards,
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.