cancel
Showing results for 
Search instead for 
Did you mean: 

How I could edit some entries of a webdynpro table

adrian_mejido
Contributor
0 Kudos

Hi friends,

I trying to learn about WEBDYNPRO. I want something like this:

I have a CONTEXT of my view, where I have some nodes and subnodes. One of these subnodes (FLIGHT_LIST) is binded to an internal table which entries were taken to the SFLIGHT database.

I was trying to put an atributte in the subnode FLIGHT_LIST which would be "read_only" and then read the atributtes of the subnode and put false or true in that atributte, but I couldn`t do that.

Can anybody help me?

Thanks for your time.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

For that column use the input field instead of text view .

Regards,

venkat.

adrian_mejido
Contributor
0 Kudos

I am thinking in another option. When I init the webdynpro I bind an internal table with some entries. Then I call the method "GET_STATIC_ATTRIBUTES'.

With this method I fill a second internal table and I do a loop. If the value of a field is bigger than a fixed value (for example > 25 ) I want to put this cell how non-edit. I have an attribute in the context for do this. But when I try to bind the structure and I pass an index for that, there´s an error.

How I could do that?

Thanks for all.

adrian_mejido
Contributor
0 Kudos

I have already solved my problem. I am going to show the solution for If anybody has the same problem:

I don´t need any extra attribute. Instead of this I bind the read_only property of the layout with the second option of the radiobutton ("bind to the property of the selected attribute").

Then In my INIT method, I do a select to an internal table which I bind to the webdynpro TABLE. After binding the internal table, I get the elements in another internal table. I do a Loop at this internal table and I call the method "GET_ATTRIBUTES" for the column that I want to edit or not edit (In my program, I can edit the value of the cell if is lower than a specific value, but I can´t edit this if is bigger) for get the value of the cell. I do the conditional depending of the parameter and if I want to block the edition mode of the cell, I call the method "SET_ATTRIBUTE_PROPERTY" exporting the name of my column, the property READ_ONLY and I put this property active.

I hope that my reply could help anybody in the future.

Thanks for your help.

Best regards

Abhijeet-K
Active Participant
0 Kudos

Hi Adrian,

While your solution should surely work, there can be an simpler and more elegant way to achieve the same. Within your INIT method, after you fill the internal table (I assume, the one which is bound with the table UI element), do a loop in the same. In the loop, check your condition and set an additional field, say readonly, as per the logic. In the layout tab, make the binding of this internal table field with readOnly property of the UI element of the column you wish to make conditionally editable.

This procedure will be easier for you to maintain and enhance at a later date, apart from being more efficient.

Answers (2)

Answers (2)

chengalarayulu
Active Contributor
0 Kudos

can you explore bit clear.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Declare an attribute in node(say read_only of type wdy_boolean). In the UI element, bind the read_only property to that context attribute which is created. In the coding, use the set_attribute of the if_wd_context_element to the set the value either to true or false.

   data lo_el_context type ref to if_wd_context_element.

*    get element via lead selection
     lo_el_context = wd_context->get_element(  ).


call method lo_el_context->set_attribute
  exporting
    value  = abap_true
    name   = 'READ_ONLY'.

Abhijeet-K
Active Participant
0 Kudos

A minor correction. You would need to specify the index, while retrieving the element, to identify which row is to be made read-only. In a table, it can identified by programming either the onLeadSelect / onSelect event of Table UI element or, onAction event of TableColumn UI element or, onEnter event of the actual UI element (like InputField). Within these methods, use get_index method of importing parameter CONTEXT_ELEMENT.

adrian_mejido
Contributor
0 Kudos

Thanks  for your reply Jayanthi,

But I want to edit one of the colums of the table. The read_only property is in the layout, but this property isn`t available for each column. How I could do this only for one column?

Thanks for your time.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Check this document. Here I am explaining step-by-step procedure for the same.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/3076e6dd-e11b-2e10-3585-ad58c22ae...

Former Member
0 Kudos

Read Only property wont be available for column. But within column you will have some UI element. If the UI element is Input Field, Read Only property will be available.