cancel
Showing results for 
Search instead for 
Did you mean: 

to make column disable in runtime

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Answers (3)

Answers (3)

Former Member
0 Kudos

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

Former Member
0 Kudos

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 ).

Former Member
0 Kudos

Hi Saurav,

the line wa-enable = ' ' gives an error "The data object "WA_PRG_DET" does not have a component called "ENABLE".

Kindly help.

Thanks & Regards,

Raji.

Former Member
0 Kudos

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

Former Member
0 Kudos

hi,

Enable is a context attribute added to the node binded to Table.

Type of Enable is wdy_boolean.

bind all columns' Enable property with this attribute.

Former Member
0 Kudos

hi,

I have done the same.Still I am getting this error

raji.

Former Member
0 Kudos

What is the type of Wa in your case . It should be :

DATA wa TYPE wd_this->element_cn_popin.

cn_popin should be replaced by your node name...

Former Member
0 Kudos

Hi,

Please paste your code...

Former Member
0 Kudos

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 ).

Former Member
0 Kudos

It should be :

data wa_prg_det TYPE wd_this->Element_prg_det

not this data wa_prg_det TYPE wd_this->Elements_prg_det

Former Member
0 Kudos

Thanks, first error is corrected.

Now I am getting an error "The data object "WA_PRG_DET" does not have a component called "DISABLE_ROWS".

Former Member
0 Kudos

Check whether you have added Diable_rows attribute inside your node prg_det.

Former Member
0 Kudos

Hi All,

Thanks a lot..It worked...But i have to give wa_prg_det-DISABLE_ROWS = abap_true instead of clear wa_prg_det.

Best Regards,

Raji.

Former Member
0 Kudos

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