Skip to Content

Editing selected row in a table?

Hi Experts,

How can we edit selected record or row in a table? can any one give me some suggetions?

Thanks and Regards,

kris.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Sep 13, 2010 at 02:51 PM

    Kris,

    data lo_nd_ type ref to if_wd_context_node.

    data lo_el type ref to if_wd_context_element.

    lo_nd = wd_context->get_child_node( name = wd_this->wdctx_node_name).

    call method lo_nd->get_lead_selection

    receiving

    element = lo_el

    lo_el holds the value of the selected row

    Thanks

    Bala Duvvuri

    .

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 14, 2010 at 11:19 AM

    This message was moderated.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 15, 2010 at 05:30 AM

    Hi

    
    METHOD onactionupdate .
    
      DATA lo_nd_is_data TYPE REF TO if_wd_context_node.
    
      DATA lo_el_is_data TYPE REF TO if_wd_context_element.
      DATA ls_is_data TYPE wd_this->element_is_data.
      DATA : lv_name TYPE wd_this->element_is_data-name,
             lv_sal TYPE wd_this->element_is_data-sal,
             lv_per TYPE wd_this->element_is_data-percent,
             lv_empno   TYPE wd_this->element_is_data-empno,
             wa_data TYPE ysg_demo,
             it_data TYPE STANDARD TABLE OF ysg_demo.
    
    
    *   navigate from <CONTEXT> to <IS_DATA> via lead selection
      lo_nd_is_data = wd_context->path_get_node( path = `YSG_DEMO.CHANGING.IS_DATA` ).
    
    *   get element via lead selection
      lo_el_is_data = lo_nd_is_data->get_element( ).
    
      lo_nd_is_data->get_lead_selection( ).
    
      lo_el_is_data->get_attribute( EXPORTING name =  `EMPNO`   IMPORTING value = lv_empno ).
      lo_el_is_data->get_attribute( EXPORTING name =  `NAME`    IMPORTING value = lv_name ).
      lo_el_is_data->get_attribute( EXPORTING name =  `SAL`  IMPORTING value = lv_sal ).
      lo_el_is_data->get_attribute( EXPORTING name =  `PERCENT` IMPORTING value = lv_per ).
    
    
      MOVE :  lv_empno TO  wa_data-empno,
        lv_name TO wa_data-name,
        lv_sal TO wa_data-sal,
        lv_per TO wa_data-percent.
    
    *  APPEND wa_data TO it_data.
    
      MODIFY ysg_demo FROM wa_data.
    
    ENDMETHOD.
    
    

    Note: First get data to your table and take button say 'UPDATE' and implement the code on action of a button.Hope this will help you.

    Regards

    Sankar

    Edited by: sankar.cgsl on Sep 15, 2010 11:00 AM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Krishna Reddy B

      Hi,

      Please maintain the attribute 'set_read_only' along with other attributes table. Bind this attribute to the table read_only property.

      Say User clicks on 'Edit' button then get the row selected using get_lead_Selection method of node and set the attribute of 'set_read_only' as abap_false. This will make the row editable.

      • ths should be written in edit action method ************

      element = node->get_lead_selection( ).

      element->set_attribute(

      exporting

      name = 'SET_READ_ONLY'

      value = abap_false ).

      Note : Table columns read_only property has to be binded to set_read_only attribute.

      With Regards,

      Shridhar

  • avatar image
    Former Member
    Sep 20, 2010 at 01:24 PM

    Hi,

    sorry Table Column read_only property has to binded to 'SET_READ_ONLY' attribute.

    Say you had 3 columns all 3 columns read_only property has to be binded 'SET_READ_ONLY' attribute

    With Regards,

    Shridhar

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Krishna Reddy B

      Hi,

      I guess your table read_only property is not set. So in layout set the read_only property of table.

      Then when user selects the row and clicks Update button, here

      1. You need to set the read_only property as abap_false .

      2. Choose the input field or dropdown or any UI you want as selected cell variant.

      With Regards,

      Shridhar