<?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: User input in ALV Grid in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317888#M508536</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Indrajit,&lt;/P&gt;&lt;P&gt;If you want to have an input field in the ALV grid, all you have to do is to set the EDIT field of the field catalog structure LVC_T_FCAT,ie.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
DATA:ls_fcat TYPE lvc_s_fcat.
 ls_fcat-edit = 'X'
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 May 2007 13:46:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-31T13:46:43Z</dc:date>
    <item>
      <title>User input in ALV Grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317883#M508531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to have a user input in ALV grid. I know there can be editable columns/cells but suppose the application demands an input field to be placed in ALV Grid where the user will enter some value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone please suggest if this can be done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Indrajit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2007 08:29:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317883#M508531</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-22T08:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: User input in ALV Grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317884#M508532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;check these sites.&lt;/P&gt;&lt;P&gt;How do I create and use input-enabled fields in ALV?&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=84933" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=84933&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=69878" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=69878&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2007 09:41:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317884#M508532</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-22T09:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: User input in ALV Grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317885#M508533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Indrajit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at the discussion about editable ALV lists in:&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="376060"&gt;&lt;/A&gt;&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>Tue, 22 May 2007 10:02:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317885#M508533</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-05-22T10:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: User input in ALV Grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317886#M508534</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;This is one sample program for your query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: g_container TYPE scrfname VALUE 'CUSTOM CONTROL',&lt;/P&gt;&lt;P&gt;g_custom_container TYPE REF TO cl_gui_custom_container,&lt;/P&gt;&lt;P&gt;g_grid TYPE REF TO cl_gui_alv_grid,&lt;/P&gt;&lt;P&gt;gs_layout TYPE lvc_s_layo,&lt;/P&gt;&lt;P&gt;ok_code LIKE sy-ucomm,&lt;/P&gt;&lt;P&gt;save_ok LIKE sy-ucomm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: gt_outtab TYPE TABLE OF sflight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MAIN *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;CALL SCREEN 100 STARTING AT 1 1..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Module STATUS_0100 OUTPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE status_0100 OUTPUT.&lt;/P&gt;&lt;P&gt;SET PF-STATUS 'MAIN100'.&lt;/P&gt;&lt;P&gt;SET TITLEBAR 'MAIN100'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDMODULE. " STATUS_0100 OUTPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Module pbo OUTPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;MODULE pbo OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF g_custom_container IS INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT g_custom_container&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;container_name = g_container&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;cntl_error = 1&lt;/P&gt;&lt;P&gt;cntl_system_error = 2&lt;/P&gt;&lt;P&gt;create_error = 3&lt;/P&gt;&lt;P&gt;lifetime_error = 4&lt;/P&gt;&lt;P&gt;lifetime_dynpro_dynpro_link = 5&lt;/P&gt;&lt;P&gt;OTHERS = 6.&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT g_grid&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;i_parent = g_custom_container&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;error_cntl_create = 1&lt;/P&gt;&lt;P&gt;error_cntl_init = 2&lt;/P&gt;&lt;P&gt;error_cntl_link = 3&lt;/P&gt;&lt;P&gt;error_dp_create = 4&lt;/P&gt;&lt;P&gt;OTHERS = 5 .&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gs_layout-edit = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM sflight INTO TABLE gt_outtab UP TO 10 ROWS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*§1.Set status of all cells to editable using the layout structure.&lt;/P&gt;&lt;P&gt;CALL METHOD g_grid-&amp;gt;set_table_for_first_display&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;i_structure_name = 'SFLIGHT'&lt;/P&gt;&lt;P&gt;is_layout = gs_layout&lt;/P&gt;&lt;P&gt;CHANGING&lt;/P&gt;&lt;P&gt;it_outtab = gt_outtab&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;invalid_parameter_combination = 1&lt;/P&gt;&lt;P&gt;program_error = 2&lt;/P&gt;&lt;P&gt;too_many_lines = 3&lt;/P&gt;&lt;P&gt;OTHERS = 4.&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*§2.Use SET_READY_FOR_INPUT to allow editing initially.&lt;/P&gt;&lt;P&gt;CALL METHOD g_grid-&amp;gt;set_ready_for_input&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;i_ready_for_input = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDMODULE. " pbo OUTPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Module pai INPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;MODULE pai INPUT.&lt;/P&gt;&lt;P&gt;save_ok = ok_code.&lt;/P&gt;&lt;P&gt;CLEAR ok_code.&lt;/P&gt;&lt;P&gt;CASE save_ok.&lt;/P&gt;&lt;P&gt;WHEN 'EXIT'.&lt;/P&gt;&lt;P&gt;PERFORM exit_program.&lt;/P&gt;&lt;P&gt;WHEN 'SWITCH'.&lt;/P&gt;&lt;P&gt;PERFORM switch_edit_mode.&lt;/P&gt;&lt;P&gt;WHEN OTHERS.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;do nothing&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;ENDMODULE. " pai INPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Form exit_program&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;FORM exit_program .&lt;/P&gt;&lt;P&gt;LEAVE PROGRAM.&lt;/P&gt;&lt;P&gt;ENDFORM. " exit_program&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Form switch_edit_mode&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;FORM switch_edit_mode .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*§3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.&lt;/P&gt;&lt;P&gt;IF g_grid-&amp;gt;is_ready_for_input( ) EQ 0.&lt;/P&gt;&lt;P&gt;CALL METHOD g_grid-&amp;gt;set_ready_for_input&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;i_ready_for_input = 1.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;CALL METHOD g_grid-&amp;gt;set_ready_for_input&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;i_ready_for_input = 0.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDFORM. " switch_edit_mode&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;For More Info, Check this link.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_editable.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_editable.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;&lt;P&gt;Then you can capture the events in USER COMMAND.&lt;/P&gt;&lt;/B&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_ucomm.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_ucomm.htm&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;&lt;P&gt;Award if useful&lt;/P&gt;&lt;/B&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jackie..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Jackie Chan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2007 12:42:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317886#M508534</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-22T12:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: User input in ALV Grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317887#M508535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai Indrajit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it is very simple, u develop a code as u do for ALV using oops, and on the screen along with custom control place a dictionary input output field, and in the program u declare &lt;/P&gt;&lt;P&gt;tables: vbrk.&lt;/P&gt;&lt;P&gt;and in extracting data write&lt;/P&gt;&lt;P&gt;select * from vbrp into table itab where vbeln = vbrk-vbeln.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2007 13:04:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317887#M508535</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-31T13:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: User input in ALV Grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317888#M508536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Indrajit,&lt;/P&gt;&lt;P&gt;If you want to have an input field in the ALV grid, all you have to do is to set the EDIT field of the field catalog structure LVC_T_FCAT,ie.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
DATA:ls_fcat TYPE lvc_s_fcat.
 ls_fcat-edit = 'X'
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2007 13:46:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317888#M508536</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-31T13:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: User input in ALV Grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317889#M508537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't forget to CALL METHOD alv-&amp;gt;refresh_table_display before you're going to save the user input. Thus, you insure that the latest version is saved!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jun 2007 09:26:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317889#M508537</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-01T09:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: User input in ALV Grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317890#M508538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's THE definitive way to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This little proggy demonstrates the following.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Create a DYNAMIC FCAT for an internal table with USER defined fields (i.e non ddic) and colour some columns in the FCAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Create a DYNAMIC TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) Define a subclass of CL_GUI_ALV_GRID so you can access some very useful protected methods and attributes - you can get original and changed table IN ROWS which is a lot easier sometimes than messing around with individual&lt;/P&gt;&lt;P&gt;cells.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) Create extra buttons on the toolbar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5) Define EVENT handlers including data change so you can get control when the user enters data. YOU DON'T NEED PAI anymore with event handlers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6) Call methods in your subclass of CL_GUI_ALV_GRID (you can also call methods in CL_GUI_ALV_GRID by virtue of Inheritance) from methods in your event handler class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7) Display an editable Grid. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;This method will work for almost any conditions you need to use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure this covers all the bases -- please reply if any queries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run the program, click on the EDIT button and enter your data. Press ENTER when done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All you need to do is copy this code and create one empty screen (SE51) with a custom container called CCONTAINER1  with the following logic in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS BEFORE OUTPUT.&lt;/P&gt;&lt;P&gt; MODULE STATUS_0100.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT.&lt;/P&gt;&lt;P&gt; MODULE USER_COMMAND_0100.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(In the program you don't actually do anything in the PAI as the event handler takes care of this)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now here's the program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROGRAM zdynfieldcat.&lt;/P&gt;&lt;P&gt;class zcltest definition  deferred.  "For field symbol reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Simple test of dynamic ITAB with user defined (not ddic) fields&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build dynamic fcat&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Table structure obtained via new RTTI functionality&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;use ALV grid to display and edit.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create a blank screen 100 with a custom container called CCONTAINER1.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Define field symbols as these can't be defined in classes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;dyn_table&amp;gt; type standard table,&lt;/P&gt;&lt;P&gt;               &amp;lt;g2&amp;gt; type ref to zcltest,&lt;/P&gt;&lt;P&gt;               &amp;lt;g1&amp;gt; type ref to cl_gui_custom_container,&lt;/P&gt;&lt;P&gt;               &amp;lt;actual_tab&amp;gt; type standard table,&lt;/P&gt;&lt;P&gt;               &amp;lt;outtab&amp;gt; type table,&lt;/P&gt;&lt;P&gt;               &amp;lt;fs1&amp;gt; type ANY,&lt;/P&gt;&lt;P&gt;               &amp;lt;FS2&amp;gt; TYPE TABLE,&lt;/P&gt;&lt;P&gt;               &amp;lt;fs3&amp;gt; type table,&lt;/P&gt;&lt;P&gt;               &amp;lt;fs4&amp;gt; type table,&lt;/P&gt;&lt;P&gt;               &amp;lt;fs5&amp;gt; type  table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class zcltest definition inheriting from cl_gui_alv_grid.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;define this as a subclass so we can access the protected attributes&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;of the superclass cl_gui_alv_grid&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  public section.&lt;/P&gt;&lt;P&gt;    types:  g4 type ref to cl_gui_custom_container.&lt;/P&gt;&lt;P&gt;    types:  g3  type ref to cl_alv_changed_data_protocol.&lt;/P&gt;&lt;P&gt;    data:   i_parent type g4,&lt;/P&gt;&lt;P&gt;            lr_rtti_struc TYPE REF TO cl_abap_structdescr, "RTTI&lt;/P&gt;&lt;P&gt;    zog like line of lr_rtti_struc-&amp;gt;components. "RTTI&lt;/P&gt;&lt;P&gt;    types: struc like zog.&lt;/P&gt;&lt;P&gt;    types: struc1 type table of struc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    methods:&lt;/P&gt;&lt;P&gt;       constructor&lt;/P&gt;&lt;P&gt;           importing i_parent type g4,&lt;/P&gt;&lt;P&gt;       disp_tab&lt;/P&gt;&lt;P&gt;           importing  p_er_data_changed type g3,&lt;/P&gt;&lt;P&gt;       create_dynamic_fcat&lt;/P&gt;&lt;P&gt;           importing zogt type struc1&lt;/P&gt;&lt;P&gt;           exporting it_fldcat type lvc_t_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Protected section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   data: stab type ref to data,&lt;/P&gt;&lt;P&gt;        wa_it_fldcat type lvc_s_fcat,&lt;/P&gt;&lt;P&gt;        c_index type sy-index.&lt;/P&gt;&lt;P&gt;endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class zcltest implementation.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        i_appl_events = 'X'&lt;/P&gt;&lt;P&gt;        i_parent      = i_parent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method disp_tab.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;mt_outtab is the data table held as a protected &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; attribute in class cl_gui_alv_grid.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    assign me-&amp;gt;mt_outtab-&amp;gt;* TO &amp;lt;outtab&amp;gt;. "Original data&lt;/P&gt;&lt;P&gt;    assign p_er_data_changed-&amp;gt;mp_mod_rows TO &amp;lt;FS1&amp;gt;.&lt;/P&gt;&lt;P&gt;    stab = p_er_data_changed-&amp;gt;mp_mod_rows.&lt;/P&gt;&lt;P&gt;    assign p_er_data_changed-&amp;gt;mt_inserted_rows to &amp;lt;fs3&amp;gt;.&lt;/P&gt;&lt;P&gt;    assign p_er_data_changed-&amp;gt;mt_deleted_rows to &amp;lt;fs4&amp;gt;.&lt;/P&gt;&lt;P&gt;    assign p_er_data_changed-&amp;gt;mt_mod_cells to &amp;lt;fs5&amp;gt;.&lt;/P&gt;&lt;P&gt;    assign stab-&amp;gt;* TO &amp;lt;fs2&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;do whatever you want with &amp;lt;outtab&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;contains data BEFORE changes each time.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Note that NEW (Changed) table has been obtained&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; already by  call to form &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;check_data USING P_ER_DATA_CHANGED&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Entered data is in table defined by &amp;lt;fs2&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;In this method you can compare original and changed data.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Easier than messing around with individual cells.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;do what you want with data in &amp;lt;fs2&amp;gt; validate / update / merge etc&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method create_dynamic_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    loop at zogt into zog.&lt;/P&gt;&lt;P&gt;      c_index = c_index + 1.&lt;/P&gt;&lt;P&gt;      clear wa_it_fldcat.&lt;/P&gt;&lt;P&gt;      wa_it_fldcat-fieldname = zog-name .&lt;/P&gt;&lt;P&gt;      wa_it_fldcat-datatype = zog-type_kind.&lt;/P&gt;&lt;P&gt;      wa_it_fldcat-inttype = zog-type_kind.&lt;/P&gt;&lt;P&gt;      wa_it_fldcat-intlen = zog-length.&lt;/P&gt;&lt;P&gt;      wa_it_fldcat-decimals = zog-decimals.&lt;/P&gt;&lt;P&gt;      wa_it_fldcat-coltext = zog-name.&lt;/P&gt;&lt;P&gt;      wa_it_fldcat-lowercase = 'X'.&lt;/P&gt;&lt;P&gt;      if c_index eq 2.&lt;/P&gt;&lt;P&gt;        wa_it_fldcat-emphasize = 'C411'.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;      if c_index eq 3.&lt;/P&gt;&lt;P&gt;        wa_it_fldcat-emphasize = 'C511'.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;      append wa_it_fldcat to it_fldcat .&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;  endmethod.                    "create_dynamic_fcat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endclass.                    "zcltest IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class lcl_grid_event_receiver definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  public section.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;note that zcltest inherits all of events etc from &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;class cl_gui_alv_grid so specify event handler for &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;zcltest.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;methods:&lt;/P&gt;&lt;P&gt;    handle_data_changed&lt;/P&gt;&lt;P&gt;         for event data_changed of zcltest&lt;/P&gt;&lt;P&gt;         importing  er_data_changed,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    toolbar&lt;/P&gt;&lt;P&gt;         for event toolbar of zcltest&lt;/P&gt;&lt;P&gt;         importing e_object&lt;/P&gt;&lt;P&gt;         e_interactive,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    user_command&lt;/P&gt;&lt;P&gt;         for event user_command of zcltest&lt;/P&gt;&lt;P&gt;         importing e_ucomm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class lcl_grid_event_receiver implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method handle_data_changed.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;code whatever required after data entry.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;various possibilites here as you&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;can get back Cell(s) changed&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;columns or the entire updated table.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Data validation is also possible here.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Note here the field sybol &amp;lt;g2&amp;gt; contains our &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;instance of  class zcltest so we can now&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;call any methods / access&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;attributes of that class from this method&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;in our event handler class. &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method &amp;lt;g2&amp;gt;-&amp;gt;disp_tab&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        p_er_data_changed = er_data_changed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endmethod.                    "handle_data_changed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method toolbar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    data : ls_toolbar type stb_button.&lt;/P&gt;&lt;P&gt;    clear ls_toolbar.&lt;/P&gt;&lt;P&gt;    move 0 to ls_toolbar-butn_type.&lt;/P&gt;&lt;P&gt;    move 'EDIT' to ls_toolbar-function.&lt;/P&gt;&lt;P&gt;    move space to ls_toolbar-disabled.&lt;/P&gt;&lt;P&gt;    move 'Edit' to ls_toolbar-text.&lt;/P&gt;&lt;P&gt;    move icon_change_text to ls_toolbar-icon.&lt;/P&gt;&lt;P&gt;    move 'Click2Edit' to ls_toolbar-quickinfo.&lt;/P&gt;&lt;P&gt;    append ls_toolbar to e_object-&amp;gt;mt_toolbar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear ls_toolbar.&lt;/P&gt;&lt;P&gt;    move 0 to ls_toolbar-butn_type.&lt;/P&gt;&lt;P&gt;    move 'UPDA' to ls_toolbar-function.&lt;/P&gt;&lt;P&gt;    move space to ls_toolbar-disabled.&lt;/P&gt;&lt;P&gt;    move 'Update' to ls_toolbar-text.&lt;/P&gt;&lt;P&gt;    move icon_system_save to ls_toolbar-icon.&lt;/P&gt;&lt;P&gt;    move 'Click2Update' to ls_toolbar-quickinfo.&lt;/P&gt;&lt;P&gt;    append ls_toolbar to e_object-&amp;gt;mt_toolbar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear ls_toolbar.&lt;/P&gt;&lt;P&gt;    move 0 to ls_toolbar-butn_type.&lt;/P&gt;&lt;P&gt;    move 'EXIT' to ls_toolbar-function.&lt;/P&gt;&lt;P&gt;    move space to ls_toolbar-disabled.&lt;/P&gt;&lt;P&gt;    move 'Exit' to ls_toolbar-text.&lt;/P&gt;&lt;P&gt;    move icon_system_end to ls_toolbar-icon.&lt;/P&gt;&lt;P&gt;    move 'Click2Exit' to ls_toolbar-quickinfo.&lt;/P&gt;&lt;P&gt;    append ls_toolbar to e_object-&amp;gt;mt_toolbar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endmethod.                    "toolbar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method user_command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    case e_ucomm .&lt;/P&gt;&lt;P&gt;      when 'EDIT'. "From Tool bar&lt;/P&gt;&lt;P&gt;        perform set_input.&lt;/P&gt;&lt;P&gt;        perform init_grid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      when 'UPDA'. "From Tool bar&lt;/P&gt;&lt;P&gt;        perform refresh_disp.&lt;/P&gt;&lt;P&gt;        perform update_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      when 'EXIT'. "From Tool bar&lt;/P&gt;&lt;P&gt;        leave program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endmethod.                    "user_command&lt;/P&gt;&lt;P&gt;endclass.                    "lcl_grid_event_receiver IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;program data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;include &amp;lt;icon&amp;gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;define any old internal structure NOT in DDIC&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;types: begin of s_elements,&lt;/P&gt;&lt;P&gt;anyfield1(20) type c,&lt;/P&gt;&lt;P&gt;anyfield2(20) type c,&lt;/P&gt;&lt;P&gt;anyfield3(20) type c,&lt;/P&gt;&lt;P&gt;anyfield4(20) type c,&lt;/P&gt;&lt;P&gt;anyfield5(11) type n,&lt;/P&gt;&lt;P&gt;end of s_elements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: wa_element type s_elements,&lt;/P&gt;&lt;P&gt;wa_data type s_elements.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Note new RTTI functionality allows field detail&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;retrieval at runtime for dynamic tables.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt;        grid1 type ref to zcltest,&lt;/P&gt;&lt;P&gt;        grid_handler type ref to lcl_grid_event_receiver,&lt;/P&gt;&lt;P&gt;        c_dec2 type s_elements-anyfield5,&lt;/P&gt;&lt;P&gt;        wa_it_fldcat type lvc_s_fcat,&lt;/P&gt;&lt;P&gt;        it_fldcat type lvc_t_fcat,&lt;/P&gt;&lt;P&gt;        lr_rtti_struc TYPE REF TO cl_abap_structdescr, "RTTI&lt;/P&gt;&lt;P&gt;        lt_comp TYPE cl_abap_structdescr=&amp;gt;component_table,"RTTI&lt;/P&gt;&lt;P&gt;        ls_comp LIKE LINE OF lt_comp, "RTTI&lt;/P&gt;&lt;P&gt;        zog like line of lr_rtti_struc-&amp;gt;components,  "RTTI&lt;/P&gt;&lt;P&gt;        struct_grid_lset type lvc_s_layo,&lt;/P&gt;&lt;P&gt;        l_valid type c,&lt;/P&gt;&lt;P&gt;        new_table type ref to data.&lt;/P&gt;&lt;P&gt;        types: struc like zog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; data:  zogt type table of struc,&lt;/P&gt;&lt;P&gt;        grid_container1 type ref to cl_gui_custom_container,&lt;/P&gt;&lt;P&gt;        g_event_receiver type ref to lcl_grid_event_receiver,&lt;/P&gt;&lt;P&gt;        ok_code like sy-ucomm,&lt;/P&gt;&lt;P&gt;        i4 type int4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;  call screen 100.&lt;/P&gt;&lt;P&gt;module status_0100 output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if grid_container1 is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    create object grid_container1&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;    container_name = 'CCONTAINER1'.&lt;/P&gt;&lt;P&gt;    assign grid_container1 to &amp;lt;g1&amp;gt;.&lt;/P&gt;&lt;P&gt;    create object grid1&lt;/P&gt;&lt;P&gt;     exporting i_parent = grid_container1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;we need reference to this instance so we can use&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Methods etc of zcltest class and alv (superclass)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;in our event receiver class.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;     assign grid1 to &amp;lt;g2&amp;gt;.&lt;/P&gt;&lt;P&gt;    create object grid_handler.&lt;/P&gt;&lt;P&gt;    set handler:&lt;/P&gt;&lt;P&gt;    grid_handler-&amp;gt;user_command for grid1,&lt;/P&gt;&lt;P&gt;    grid_handler-&amp;gt;toolbar for grid1,&lt;/P&gt;&lt;P&gt;    grid_handler-&amp;gt;handle_data_changed for grid1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Internal table structure&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    lr_rtti_struc ?= cl_abap_structdescr=&amp;gt;describe_by_data( wa_data ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build field catalog just use basic data here&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;colour specific columns as well&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    zogt[] = lr_rtti_struc-&amp;gt;components.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       call method grid1-&amp;gt;create_dynamic_fcat&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        zogt      = zogt&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        it_fldcat = it_fldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Create dynamic internal table and assign&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; to field symbol.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Use dynamic field catalog just built.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      it_fieldcatalog = it_fldcat&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      ep_table        = new_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  assign new_table-&amp;gt;* to &amp;lt;dyn_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    perform populate_dynamic_itab.&lt;/P&gt;&lt;P&gt;    perform init_grid.&lt;/P&gt;&lt;P&gt;    perform register_enter_event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;set off ready for input initially&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    i4 = 0.&lt;/P&gt;&lt;P&gt;    call method grid1-&amp;gt;set_ready_for_input&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        i_ready_for_input = i4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endmodule.                    "status_0100 OUTPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;module user_command_0100 input.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*PAI not needed in OO ALV anymore as User Commands&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;are handled as events&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*in method user_command.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;we can also get control if any data was entered&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;and the ENTER is pressed by&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;raising an event.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Control then returns to method handle_data_changed.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endmodule.                    "user_command_0100 INPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form populate_dynamic_itab.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;load up a line of the dynamic table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  c_dec2 = c_dec2 + 11.&lt;/P&gt;&lt;P&gt;  wa_element-anyfield1 = 'Tabbies'.&lt;/P&gt;&lt;P&gt;  wa_element-anyfield2 = 'ger.shepards'.&lt;/P&gt;&lt;P&gt;  wa_element-anyfield3 = 'White mice'.&lt;/P&gt;&lt;P&gt;  wa_element-anyfield4 = 'Any old text'.&lt;/P&gt;&lt;P&gt;  wa_element-anyfield5 = c_dec2.&lt;/P&gt;&lt;P&gt;  append wa_element to &amp;lt;dyn_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    "populate_dynamic_itab&lt;/P&gt;&lt;P&gt;form exit_program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method grid_container1-&amp;gt;free.&lt;/P&gt;&lt;P&gt;  call method cl_gui_cfw=&amp;gt;flush.&lt;/P&gt;&lt;P&gt;  leave program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    "exit_program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form refresh_disp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method grid1-&amp;gt;refresh_table_display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    "refresh_disp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form update_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The dynamic table here is the changed table&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;read from the grid&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;after user has changed it&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Data can be saved to DB or whatever.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  loop at &amp;lt;dyn_table&amp;gt; into wa_element.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;do what you want with the data here&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;switch off edit mode again for next function&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  i4 = 0.&lt;/P&gt;&lt;P&gt;  call method grid1-&amp;gt;set_ready_for_input&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      i_ready_for_input = i4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    "update_table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form set_input.&lt;/P&gt;&lt;P&gt;  i4 = 1.&lt;/P&gt;&lt;P&gt;  call method grid1-&amp;gt;set_ready_for_input&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      i_ready_for_input = i4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    "set_input&lt;/P&gt;&lt;P&gt;form switch_input.&lt;/P&gt;&lt;P&gt;  if i4 = 1.&lt;/P&gt;&lt;P&gt;    i4 = 0.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    i4 = 1.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  call method grid1-&amp;gt;set_ready_for_input&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      i_ready_for_input = i4.&lt;/P&gt;&lt;P&gt;endform.                    "switch_input&lt;/P&gt;&lt;P&gt;form init_grid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Enabling the grid to edit mode,&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  struct_grid_lset-edit = 'X'. "To enable editing in ALV&lt;/P&gt;&lt;P&gt;  struct_grid_lset-grid_title = 'Jimbos Test'.&lt;/P&gt;&lt;P&gt;   call method grid1-&amp;gt;set_table_for_first_display&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      is_layout       = struct_grid_lset&lt;/P&gt;&lt;P&gt;    CHANGING&lt;/P&gt;&lt;P&gt;      it_outtab       = &amp;lt;dyn_table&amp;gt;&lt;/P&gt;&lt;P&gt;      it_fieldcatalog = it_fldcat.&lt;/P&gt;&lt;P&gt;endform.                    "init_grid&lt;/P&gt;&lt;P&gt;form register_enter_event.&lt;/P&gt;&lt;P&gt;  call method grid1-&amp;gt;register_edit_event&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      i_event_id = cl_gui_alv_grid=&amp;gt;mc_evt_enter.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Instantiate the event or it won't work.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  create object g_event_receiver.&lt;/P&gt;&lt;P&gt;  set handler g_event_receiver-&amp;gt;handle_data_changed for grid1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    "register_enter_event&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have fun with this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;jimbo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jun 2007 11:19:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/user-input-in-alv-grid/m-p/2317890#M508538</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-01T11:19:19Z</dc:date>
    </item>
  </channel>
</rss>

