<?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: Editable ALV in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827739#M1129636</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;use the method Get_selected_row of this class&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;before using plz set the sel_mode of layout as 'A', 'C' or 'D'....&lt;/P&gt;&lt;P&gt;Call this method as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: gi_itab type lvc_t_row.&lt;/P&gt;&lt;P&gt;call method &amp;lt;ref variable of cl_gui_alv_grid&amp;gt;-&amp;gt;get_selected_row&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;et_index_rows = gi_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this table will have the indexes of the selected rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also to make fields editable&lt;/P&gt;&lt;P&gt;set wa_fcat-edit = 'X'.&lt;/P&gt;&lt;P&gt;     wa_fcat-input = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this solves your problem...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;ags.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Nov 2008 14:50:31 GMT</pubDate>
    <dc:creator>agnihotro_sinha2</dc:creator>
    <dc:date>2008-11-27T14:50:31Z</dc:date>
    <item>
      <title>Editable ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827738#M1129635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Iam displaying an ALV, in which one field is editable, &lt;/P&gt;&lt;P&gt;So when i change the values ,how can i capture back the edited values into my internal table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Nov 2008 14:47:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827738#M1129635</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-27T14:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Editable ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827739#M1129636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;use the method Get_selected_row of this class&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;before using plz set the sel_mode of layout as 'A', 'C' or 'D'....&lt;/P&gt;&lt;P&gt;Call this method as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: gi_itab type lvc_t_row.&lt;/P&gt;&lt;P&gt;call method &amp;lt;ref variable of cl_gui_alv_grid&amp;gt;-&amp;gt;get_selected_row&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;et_index_rows = gi_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this table will have the indexes of the selected rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also to make fields editable&lt;/P&gt;&lt;P&gt;set wa_fcat-edit = 'X'.&lt;/P&gt;&lt;P&gt;     wa_fcat-input = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this solves your problem...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;ags.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Nov 2008 14:50:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827739#M1129636</guid>
      <dc:creator>agnihotro_sinha2</dc:creator>
      <dc:date>2008-11-27T14:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Editable ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827740#M1129637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there check this sample code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT zjay_edit_alv.

*******************************************************************
* TYPE-POOLS *
*******************************************************************
TYPE-POOLS: slis.

*******************************************************************
* INTERNAL TABLES/WORK AREAS/VARIABLES
*******************************************************************
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
w_field TYPE slis_fieldcat_alv,
p_table LIKE dd02l-tabname,
dy_table TYPE REF TO data,
dy_tab TYPE REF TO data,
dy_line TYPE REF TO data.

*******************************************************************
* FIELD-SYMBOLS *
*******************************************************************
FIELD-SYMBOLS: &amp;lt;dyn_table&amp;gt; TYPE STANDARD TABLE,
&amp;lt;dyn_wa&amp;gt; TYPE ANY,
&amp;lt;dyn_field&amp;gt; TYPE ANY,
&amp;lt;dyn_tab_temp&amp;gt; TYPE STANDARD TABLE.

*******************************************************************
* SELECTION SCREEN *
*******************************************************************
PARAMETERS: tabname(30) TYPE c DEFAULT 'MARA',
lines(5) TYPE n DEFAULT 7.

*******************************************************************
* START-OF-SELECTION *
*******************************************************************
START-OF-SELECTION.

* Storing table name
p_table = tabname.

* Create internal table dynamically with the stucture of table name
* entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_table-&amp;gt;* TO &amp;lt;dyn_table&amp;gt;.
IF sy-subrc &amp;lt;&amp;gt; 0.
MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.

LEAVE TO LIST-PROCESSING.
ENDIF.
* Create workarea for the table
CREATE DATA dy_line LIKE LINE OF &amp;lt;dyn_table&amp;gt;.
ASSIGN dy_line-&amp;gt;* TO &amp;lt;dyn_wa&amp;gt;.

* Create another temp. table
CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_tab-&amp;gt;* TO &amp;lt;dyn_tab_temp&amp;gt;.

SORT i_fieldcat BY col_pos.

* Select data from table
SELECT * FROM (p_table)
INTO TABLE &amp;lt;dyn_table&amp;gt;
UP TO lines ROWS.

REFRESH &amp;lt;dyn_tab_temp&amp;gt;.

* Display report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = &amp;lt;dyn_table&amp;gt;
EXCEPTIONS
program_error = 1
OTHERS = 2.

IF sy-subrc &amp;lt;&amp;gt; 0.

ENDIF.

*&amp;amp;-----------------------------------------------------------------*
*&amp;amp; Form SET_PF_STATUS
*&amp;amp;-----------------------------------------------------------------*
* Setting custom PF-Status
*------------------------------------------------------------------*
* --&amp;gt;RT_EXTAB Excluding table
*------------------------------------------------------------------*
FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'ZSTANDARD'. "copy it from SALV func group standard

ENDFORM. "SET_PF_STATUS

*&amp;amp;----------------------------------------------------------------*
*&amp;amp; Form user_command
*&amp;amp;-----------------------------------------------------------------*
* Handling custom function codes
*------------------------------------------------------------------*
* --&amp;gt;R_UCOMM Function code value
* --&amp;gt;RS_SELFIELD Info. of cursor position in ALV
*------------------------------------------------------------------*
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 = sy-repid
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>Thu, 27 Nov 2008 14:54:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827740#M1129637</guid>
      <dc:creator>former_member156446</dc:creator>
      <dc:date>2008-11-27T14:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Editable ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827741#M1129638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the at-user command for ALV Input Data copy over the Internal table, use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rs_selfield-refresh = 'X'.  "For Refreshing the ALV&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Nov 2008 14:55:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827741#M1129638</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-27T14:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Editable ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827742#M1129639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming that you are using OO-based ALV grids (CL_GUI_ALV_GRID) you simply have to call method &lt;STRONG&gt;go_grid-&amp;gt;check_changed_data( )&lt;/STRONG&gt; at &lt;STRONG&gt;PAI&lt;/STRONG&gt; of the dynpro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample report &lt;STRONG&gt;ZUS_SDN_ALVGRID_EDITABLE_7&lt;/STRONG&gt; in thread &lt;SPAN __jive_macro_name="thread" id="1136016"&gt;&lt;/SPAN&gt; nicely demonstrates the effect of calling this method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Nov 2008 15:36:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827742#M1129639</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-11-27T15:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Editable ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827743#M1129640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see the  standard report  :&lt;STRONG&gt;bcalv_test_grid_editable&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2008 06:42:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/4827743#M1129640</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-28T06:42:29Z</dc:date>
    </item>
  </channel>
</rss>

