cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a table readonly dynamically

former_member295881
Contributor
0 Kudos

Hello Experts,

I've a requirement where I've to check certain values in a custom table and then based on those I need to make a table readonly at the run-time. I've been able to bind my table successfully but wondering if I can use any method or property to make my table read-only. Can somebody please advice how to accomplish it?

*binding
       lo_nd_rerate_dtl = wd_context->get_child_node( name = wd_this->wdctx_rerate_dtl ).
       lo_nd_rerate_dtl->bind_table( new_items = it_all_invoice_items  set_initial_elements = abap_true ).

Many thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi Zero,

The Table UI element has a readOnly property that you can bind to a context attribute or set statically in the view layout.

Cheers,

Amy

former_member295881
Contributor
0 Kudos

Thanks for your input Amy, so what will be the syntax? Can you give any example because I need to bind to my context attribute as I've to do it in the runtime after checking few values in some tables.

amy_king
Active Contributor
0 Kudos

Hi Zero,

The Table's readOnly property is of type wdy_boolean. Assuming you have bound the property to a context attribute of the same type, you can use the code wizard to generate the code to set the context attribute value to true or false, for example...

   data lo_nd_mynode type ref to if_wd_context_node.
   data lo_el_
mynode type ref to if_wd_context_element.

   lo_nd_
mynode = wd_context->get_child_node( name = wd_this->wdctx_mynode ).
   lo_el_
mynode = lo_nd_mynode->get_element( ).

   lo_el_
mynode->set_attribute(
       name `BOOLEAN_ATTRIBUTE`
       value = abap_true ).

Cheers,

Amy

former_member184578
Active Contributor
0 Kudos

Hi,

In addition to Amy's suggestion, Check this related document: http://scn.sap.com/docs/DOC-27125

Hope this helps u.,

Regards,

Kiran

Answers (1)

Answers (1)

harsha_jalakam
Active Contributor
0 Kudos

Take a new attribute"Read_only" of type wdy_boolean. Based on that condition set the attribute to abap_true if u want to make it read only.