<?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: ALV - access to protected method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-access-to-protected-method/m-p/2242748#M483675</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;&lt;/P&gt;&lt;P&gt;thanks a lot. I did it with an inherited class in dictionary and a new method which called the original protected message. Works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Holger&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Jun 2007 04:29:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-05T04:29:58Z</dc:date>
    <item>
      <title>ALV - access to protected method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-access-to-protected-method/m-p/2242744#M483671</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;I have a object from class "CL_GUI_ALV_GRID" and want to change the protected attribute "EVT_DELAYED_CHANGE_SELECTION	Constant	Protected" with the method &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD alv_grid-&amp;gt;SET_DELAY_CHANGE_SELECTION&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        time = lv_delay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I access this protected attribute?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Holger&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2007 09:19:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-access-to-protected-method/m-p/2242744#M483671</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-22T09:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: ALV - access to protected method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-access-to-protected-method/m-p/2242745#M483672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Holger&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try to sub-class CL_GUI_ALV_GRID and add a public method (e.g. SET_DELAY_CHANGE_SELECTION_PUBL) to your sub-class which does nothing else but calling the protected 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>Tue, 22 May 2007 10:05:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-access-to-protected-method/m-p/2242745#M483672</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-05-22T10:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: ALV - access to protected method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-access-to-protected-method/m-p/2242746#M483673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Holger,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          The attribute EVT_DELAYED_CHANGE_SELECTION is a CONSTANT with value 7, so i think we can not change the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kesava&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2007 14:08:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-access-to-protected-method/m-p/2242746#M483673</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-04T14:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: ALV - access to protected method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-access-to-protected-method/m-p/2242747#M483674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This will do what you want&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Trick is to define a sub class inheriting the super class where the protected attributes and methods exist in - then you can access the protected methods and attributes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do this don't forget to call  the SUPER CONSTRUCTOR (of the class you are inheriting from) in your constructor method. Code example shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here I want the original and modified table of an alv grid but you can adapt this code to whatever you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create blank screen (100) with a custom container CCONTAINER1 and the following scren 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;&lt;/P&gt;&lt;P&gt;now look at the code here. Note text in Bold&lt;/P&gt;&lt;P&gt;&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;P&gt;James Hawthorne&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;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;&amp;lt;b&amp;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&amp;lt;/b&amp;gt;&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;&amp;lt;b&amp;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;method disp_tab.&lt;/P&gt;&lt;P&gt;*mt_outtab is the data table held as a protected attribute&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;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 already by&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;call to form 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.&amp;lt;/b&amp;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;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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        for event data_changed of cl_gui_alv_grid&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&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 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;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 retrieval&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;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 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;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 are handled as events&lt;/P&gt;&lt;P&gt;*in method user_command.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*we can also get control if the Data entered and the ENTER is pressed by&lt;/P&gt;&lt;P&gt;*raising an event.&lt;/P&gt;&lt;UL&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 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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2007 14:55:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-access-to-protected-method/m-p/2242747#M483674</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-04T14:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: ALV - access to protected method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-access-to-protected-method/m-p/2242748#M483675</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;&lt;/P&gt;&lt;P&gt;thanks a lot. I did it with an inherited class in dictionary and a new method which called the original protected message. Works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Holger&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2007 04:29:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-access-to-protected-method/m-p/2242748#M483675</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-05T04:29:58Z</dc:date>
    </item>
  </channel>
</rss>

