<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Saving editable column contents in Std. Table using ALV in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/saving-editable-column-contents-in-std-table-using-alv/m-p/8469780#M1651178</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM user_command  USING    r_ucomm LIKE sy-ucomm
        			    rs_selfield TYPE slis_selfield.

* Local data declaration
  DATA: li_tab TYPE REF TO data,
        l_line TYPE REF TO data.

* Local field-symbols
  FIELD-SYMBOLS:&amp;lt;l_tab&amp;gt; TYPE table,
                &amp;lt;l_wa&amp;gt;  TYPE ANY.

* Create table
  CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
  ASSIGN li_tab-&amp;gt;* TO &amp;lt;l_tab&amp;gt;.

* Create workarea
  CREATE DATA l_line LIKE LINE OF &amp;lt;l_tab&amp;gt;.
  ASSIGN l_line-&amp;gt;* TO &amp;lt;l_wa&amp;gt;.

  CASE r_ucomm.

*   When a record is selected
    WHEN '&amp;amp;IC1'.

*     Read the selected record
      READ TABLE &amp;lt;dyn_table&amp;gt; ASSIGNING &amp;lt;dyn_wa&amp;gt; INDEX
      rs_selfield-tabindex.

      IF sy-subrc = 0.

*       Store the record in an internal table
        APPEND &amp;lt;dyn_wa&amp;gt; TO &amp;lt;l_tab&amp;gt;.

*       Fetch the field catalog info
        CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
          EXPORTING
            i_program_name         = 'Z_DEMO_ALV'
            i_structure_name       = p_table
          CHANGING
            ct_fieldcat            = i_fieldcat
          EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
        IF sy-subrc = 0.

*         Make all the fields input enabled except key fields
          w_field-input = 'X'.

          MODIFY i_fieldcat FROM w_field TRANSPORTING input
          WHERE key IS INITIAL.

        ENDIF.

*       Display the record for editing purpose
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program    = sy-repid
            i_structure_name      = p_table
            it_fieldcat           = i_fieldcat
            i_screen_start_column = 10
            i_screen_start_line   = 15
            i_screen_end_column   = 200
            i_screen_end_line     = 20
          TABLES
            t_outtab              = &amp;lt;l_tab&amp;gt;
          EXCEPTIONS
            program_error         = 1
            OTHERS                = 2.

        IF sy-subrc = 0.

*         Read the modified data
          READ TABLE &amp;lt;l_tab&amp;gt; INDEX 1 INTO &amp;lt;l_wa&amp;gt;.

*         If the record is changed then track its index no.
*         and populate it in an internal table for future
*         action
          IF sy-subrc = 0 AND &amp;lt;dyn_wa&amp;gt; &amp;lt;&amp;gt; &amp;lt;l_wa&amp;gt;.
            &amp;lt;dyn_wa&amp;gt; = &amp;lt;l_wa&amp;gt;.
            i_index = rs_selfield-tabindex.
            APPEND i_index.
          ENDIF.
        ENDIF.

      ENDIF.

*   When save button is pressed
    WHEN 'SAVE'.

*     Sort the index table
      SORT i_index.

*     Delete all duplicate records
      DELETE ADJACENT DUPLICATES FROM i_index.

      LOOP AT i_index.

*       Find out the changes in the internal table
*       and populate these changes in another internal table
        READ TABLE &amp;lt;dyn_table&amp;gt; ASSIGNING &amp;lt;dyn_wa&amp;gt; INDEX i_index.
        IF sy-subrc = 0.
          APPEND &amp;lt;dyn_wa&amp;gt; TO &amp;lt;dyn_tab_temp&amp;gt;.
        ENDIF.

      ENDLOOP.

*     Lock the table
      CALL FUNCTION 'ENQUEUE_E_TABLE'
        EXPORTING
          mode_rstable   = 'E'
          tabname        = p_table
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.

      IF sy-subrc = 0.

*       Modify the database table with these changes
        MODIFY (p_table) FROM TABLE &amp;lt;dyn_tab_temp&amp;gt;.

        REFRESH &amp;lt;dyn_tab_temp&amp;gt;.

*       Unlock the table
        CALL FUNCTION 'DEQUEUE_E_TABLE'
          EXPORTING
            mode_rstable = 'E'
            tabname      = p_table.

      ENDIF.
  ENDCASE.

  rs_selfield-refresh = 'X'.

ENDFORM.                    "user_command
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 18 Dec 2011 08:44:51 GMT</pubDate>
    <dc:creator>mithun_shetty4</dc:creator>
    <dc:date>2011-12-18T08:44:51Z</dc:date>
    <item>
      <title>Saving editable column contents in Std. Table using ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/saving-editable-column-contents-in-std-table-using-alv/m-p/8469779#M1651177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;   I developed a ALV report which displays list of sales orders of particular customer, in this report created by name is editable column. Now i want to save the created by name after user changes the contents of this column and click on save button. I am getting all the data to be saved in field "RS_SELFIELD" (RS_SELFIELD TYPE SLIS_SELFIELD)  Kindly help me to get out of this issue.   &lt;/P&gt;&lt;P&gt;Advance thanks for your response.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Dec 2011 08:28:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/saving-editable-column-contents-in-std-table-using-alv/m-p/8469779#M1651177</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-18T08:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Saving editable column contents in Std. Table using ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/saving-editable-column-contents-in-std-table-using-alv/m-p/8469780#M1651178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM user_command  USING    r_ucomm LIKE sy-ucomm
        			    rs_selfield TYPE slis_selfield.

* Local data declaration
  DATA: li_tab TYPE REF TO data,
        l_line TYPE REF TO data.

* Local field-symbols
  FIELD-SYMBOLS:&amp;lt;l_tab&amp;gt; TYPE table,
                &amp;lt;l_wa&amp;gt;  TYPE ANY.

* Create table
  CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
  ASSIGN li_tab-&amp;gt;* TO &amp;lt;l_tab&amp;gt;.

* Create workarea
  CREATE DATA l_line LIKE LINE OF &amp;lt;l_tab&amp;gt;.
  ASSIGN l_line-&amp;gt;* TO &amp;lt;l_wa&amp;gt;.

  CASE r_ucomm.

*   When a record is selected
    WHEN '&amp;amp;IC1'.

*     Read the selected record
      READ TABLE &amp;lt;dyn_table&amp;gt; ASSIGNING &amp;lt;dyn_wa&amp;gt; INDEX
      rs_selfield-tabindex.

      IF sy-subrc = 0.

*       Store the record in an internal table
        APPEND &amp;lt;dyn_wa&amp;gt; TO &amp;lt;l_tab&amp;gt;.

*       Fetch the field catalog info
        CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
          EXPORTING
            i_program_name         = 'Z_DEMO_ALV'
            i_structure_name       = p_table
          CHANGING
            ct_fieldcat            = i_fieldcat
          EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
        IF sy-subrc = 0.

*         Make all the fields input enabled except key fields
          w_field-input = 'X'.

          MODIFY i_fieldcat FROM w_field TRANSPORTING input
          WHERE key IS INITIAL.

        ENDIF.

*       Display the record for editing purpose
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program    = sy-repid
            i_structure_name      = p_table
            it_fieldcat           = i_fieldcat
            i_screen_start_column = 10
            i_screen_start_line   = 15
            i_screen_end_column   = 200
            i_screen_end_line     = 20
          TABLES
            t_outtab              = &amp;lt;l_tab&amp;gt;
          EXCEPTIONS
            program_error         = 1
            OTHERS                = 2.

        IF sy-subrc = 0.

*         Read the modified data
          READ TABLE &amp;lt;l_tab&amp;gt; INDEX 1 INTO &amp;lt;l_wa&amp;gt;.

*         If the record is changed then track its index no.
*         and populate it in an internal table for future
*         action
          IF sy-subrc = 0 AND &amp;lt;dyn_wa&amp;gt; &amp;lt;&amp;gt; &amp;lt;l_wa&amp;gt;.
            &amp;lt;dyn_wa&amp;gt; = &amp;lt;l_wa&amp;gt;.
            i_index = rs_selfield-tabindex.
            APPEND i_index.
          ENDIF.
        ENDIF.

      ENDIF.

*   When save button is pressed
    WHEN 'SAVE'.

*     Sort the index table
      SORT i_index.

*     Delete all duplicate records
      DELETE ADJACENT DUPLICATES FROM i_index.

      LOOP AT i_index.

*       Find out the changes in the internal table
*       and populate these changes in another internal table
        READ TABLE &amp;lt;dyn_table&amp;gt; ASSIGNING &amp;lt;dyn_wa&amp;gt; INDEX i_index.
        IF sy-subrc = 0.
          APPEND &amp;lt;dyn_wa&amp;gt; TO &amp;lt;dyn_tab_temp&amp;gt;.
        ENDIF.

      ENDLOOP.

*     Lock the table
      CALL FUNCTION 'ENQUEUE_E_TABLE'
        EXPORTING
          mode_rstable   = 'E'
          tabname        = p_table
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.

      IF sy-subrc = 0.

*       Modify the database table with these changes
        MODIFY (p_table) FROM TABLE &amp;lt;dyn_tab_temp&amp;gt;.

        REFRESH &amp;lt;dyn_tab_temp&amp;gt;.

*       Unlock the table
        CALL FUNCTION 'DEQUEUE_E_TABLE'
          EXPORTING
            mode_rstable = 'E'
            tabname      = p_table.

      ENDIF.
  ENDCASE.

  rs_selfield-refresh = 'X'.

ENDFORM.                    "user_command
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Dec 2011 08:44:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/saving-editable-column-contents-in-std-table-using-alv/m-p/8469780#M1651178</guid>
      <dc:creator>mithun_shetty4</dc:creator>
      <dc:date>2011-12-18T08:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Saving editable column contents in Std. Table using ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/saving-editable-column-contents-in-std-table-using-alv/m-p/8469781#M1651179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From your post I understand that changed data on the ALV is now available in the RS_SELFIELD structure.&lt;/P&gt;&lt;P&gt;Now you can update the standard table(Here VBAK as sales orders are displayed) through a BAPI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BAPI that can be used for updating created by Name field in the sales order is 'BAPI_SALESORDER_CHANGE'.&lt;/P&gt;&lt;P&gt;Here you can pass the sales order number and update the header strucute with fields which needs to be updated(Here created by Name).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this post will help you to solve the issue.&lt;/P&gt;&lt;P&gt;Let me know does this solved your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ashesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 14:22:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/saving-editable-column-contents-in-std-table-using-alv/m-p/8469781#M1651179</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-12-20T14:22:29Z</dc:date>
    </item>
  </channel>
</rss>

