Skip to Content
avatar image
Former Member

ALV - Switching off Edit-ability on Certain Rows of an Input Enabled Column

I have an alv that initially pulls up a 'n' records .

I also allow users to add a new blank row.

I allow input on one 'lookup' field(column) of the record, and the wddomodify populates the rest of the rec.

I would like to turn off the input for the cells on records 1-n, and only allow input for the 'new' records.

Any thoughts?

Thanks...

...Mike

( Right now, I just reset the lookup field to its original value if they enter data in it, but I'd much prefer to make the cell not editable)

Edited by: Michael McInerney on Mar 27, 2010 3:23 PM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Mar 28, 2010 at 06:27 AM

    Hi,

    Create an attribute in the same node which is bound to ALV of type WDY_BOOLEAN.

    Bind this attribute to cell editor of respective columns read only property.

    Now based on your lead selection you can set the property of this attribute as true\ false for the node elements which you want as editable\ non editable, then bind the modified data back to the node.

    Hope this helps.

    Also, there are lots of threads for editable ALV - setting the rows editable\ non editable dynamically, just search in the forum.

    Regards

    Manas Dua

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 28, 2010 at 07:03 AM

    Hi Mike,

    Create an attribute say "READ_ONLY" of type WDY_BOOLEAN in your context node which you use to bind the ALV and do the following in your code if your editable ALV cell has a checkbox -

    Now use the set_read_only_fieldname method of your embedded UI element say checbox or input field to set readonly property -

    lr_cbox->set_read_only_fieldname( 'READ_ONLY' ).

    Then based on your criteria set the READ_ONLY attribute as true while populating the node.

    Refer to the example code in the below link for more details -

    http://www.divulgesap.com/blog.php?p=MTA2

    Hope this helps.

    Cheers,

    Ravikiran

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks for the answers, but I may not have explained as well as I should.

      When the data is first displayed, I want it to be read only (based on he original_record_indicator )

                                                                                      Undisplayed original  
                        Abbrev  StateName               Capital                      record indicator
                           #    (always read only)      (always read only)                 
      
      
                         +----+------------------------+------------------------+  
      original record 1  | NY | New York               | Albany                 |      TRUE
                         +----+------------------------+------------------------+  
      original record 2  | CA | California             | Sacramento             |      TRUE
                         +----+------------------------+------------------------+  
      original record 4  | NM | Texas                  | Austin                 |      TRUE
                         +----+------------------------+------------------------+  
      original record 4  | PA | New Jersey             | Trenton                |      TRUE
                         +----+------------------------+------------------------+  
      
      #  Read Only if Original_Record_indicator = TRUE
      #  Open for input when Original_record_indicator = FALSE
      

      But after the user INSERTS a new record (which will be blank) , I want to open input on just the ABBREV field of JUST the record where ORIGINAL_RECORD_INDICATOR = FALSE

      
      
                         +----+------------------------+------------------------+  
      NEW RECORD         |[  ]|                        |                        |      FALSE
                         +----+------------------------+------------------------+  
      original record 1  | NY | New York               | Albany                 |      TRUE
                         +----+------------------------+------------------------+  
      original record 2  | CA | California             | Sacramento             |      TRUE
                         +----+------------------------+------------------------+  
      original record 4  | NM | Texas                  | Austin                 |      TRUE
                         +----+------------------------+------------------------+  
      original record 4  | PA | New Jersey             | Trenton                |      TRUE
                         +----+------------------------+------------------------+  
      
      

      Edited by: Michael McInerney on Mar 28, 2010 3:40 PM