cancel
Showing results for 
Search instead for 
Did you mean: 

grey out rows in table

Former Member
0 Kudos

Dear all

I am using a Table in my webdynpro layout as input cells.the application is running fine .

when user logs in again , it should display the previous entries made in the table.

I know how to put those values in table but the table rows (which contain data ) are not greyed out .

My concern is how to grey out those rows which already have data so that user cannot alter that but at the same time user should be allowed to enter new entries.

number of entries are bot restricted.

Regards

Vaibhav



Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

Create an attribute disable of type wdy_boolean. Then bind the readOnly property of input fields of table cell to to the created attribute(say disable) .

Now loop the entries of the table and set the attribute disable to abap_true if the data is not initial.

You can check this similar document for reference: http://scn.sap.com/docs/DOC-27125

Hope this helps u.,

Regards

Kiran

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

Thanks Kiran.

Thread Closed.

Regards

Vaibhav

Former Member
0 Kudos

Hi

I tried what u suggested but it is not working . Can you please help.

This code is working fine but nothing is happening.

user can still write in that particular cell .

Regards

Vaibhav

Former Member
0 Kudos

Hello,

.. i am using some part of ur code.

You can achieve it by adding one more attribute to the node used as the data source for the table.

add this attribute  say

name  -  'READ_ONLY' of type   -  wdy_boolean and set the initial value = X. And bind this attribute the 'readonly' property of the table.You might be filling the node by binding it to one internal table using the bind_table( ) method.

When you launch the screen,Read the node(which has been binded to the table) as table operation as shown below.

********************************************

suppose node came (LT_student)

Now Suppose ur table/node have a field Any_ID(Which will have data in all case)..

Loop at LT_student into LS_student where Any_ID is not initial.

LS_student-Readonly = 'X'.

append LS_student into LT_student_copy.

bind_table(LT_student_copy).

This is Demo Code.. Syntax need to be modify.

BR

Chandra..

Former Member
0 Kudos

Hello Vaibhav,

You can achieve it by adding one more attribute to the node used as the data source for the table.

add this attribute  say

name  -  'READ_ONLY' of type   -  wdy_boolean and set the initial value = X. And bind this attribute the 'readonly' property of the table.You might be filling the node by binding it to one internal table using the bind_table( ) method.

When you launch the screen,Read the node(which has been binded to the table) as table operation as shown below.

& Check of the node is initial or not.If yes, read that 'READ_ONLY' attribute and set the value as lv_read_only = abap_true.

   DATA lo_el_context TYPE REF TO if_wd_context_element.
    DATA ls_context TYPE wd_this->element_context.
    DATA lv_read_only TYPE wd_this->element_context-read_only.

* get element via lead selection
    lo_el_context = wd_context->get_element( ).
*  get element via lead selection
    lo_el_context = wd_context->get_element( ).
*  get single attribute
    lo_el_context->get_attribute(
      EXPORTING
        name `READ_ONLY`
      IMPORTING
        value =  lv_read_only ).

    lv_read_only  = abap_true.
    lo_el_context->set_attribute(
      EXPORTING
        value =   lv_read_only " Attribute Value
        name  =   `READ_ONLY` " Web Dynpro: Name of Context Element
    ).

Now the user cannot alter the entires in the table.This will help you.

Thanks

Katrice