<?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: Refresh in alv oops in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855257#M1135379</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;After you change the value on the screen and refresh PAI and PBO gets triggered. Update the other field of the internal table which u are passing to set_table_for_first_display and call the function refresh_table_display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this logic should work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PBO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if container is initial.&lt;/P&gt;&lt;P&gt;CREATE OBJECT custom_container1&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;            container_name = cont_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;create an instance of alv control&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CREATE OBJECT grid1&lt;/P&gt;&lt;P&gt;           EXPORTING i_parent = custom_container1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD grid1-&amp;gt;set_table_for_first_display&lt;/P&gt;&lt;P&gt;         EXPORTING i_structure_name = 'your structure'&lt;/P&gt;&lt;P&gt;                   is_layout        = your_layout&lt;/P&gt;&lt;P&gt;         CHANGING  it_outtab        = internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt; CALL METHOD w_ref_grid-&amp;gt;refresh_table_display&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    IS_STABLE      =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    I_SOFT_REFRESH =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   EXCEPTIONS&lt;/P&gt;&lt;P&gt;     finished       = 1&lt;/P&gt;&lt;P&gt;     OTHERS         = 2&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;PAI.&lt;/P&gt;&lt;P&gt;update the content of the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rahul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Nov 2008 07:05:33 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-11-24T07:05:33Z</dc:date>
    <item>
      <title>Refresh in alv oops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855253#M1135375</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 m displaying a report using alv oops . In this one field is editable .When i am changing the value for the field then on clicking on refresh option corresponding one more field should get updated.What should i do?? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Dhwani&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Nov 2008 11:13:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855253#M1135375</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-22T11:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh in alv oops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855254#M1135376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can use the data_changed event, have a local class for event handling, in the implementation you will get the changed values from the changed protocol. use the changed value update the other value. and refresh the grid using the refresh_table_display method.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Nov 2008 16:26:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855254#M1135376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-22T16:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh in alv oops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855255#M1135377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  Have you used       &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CALL METHOD w_ref_grid-&amp;gt;refresh_table_display
*   EXPORTING
*     IS_STABLE      =
*     I_SOFT_REFRESH =
   EXCEPTIONS
     finished       = 1
     OTHERS         = 2
                .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tks,&lt;/P&gt;&lt;P&gt;Krishna...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Nov 2008 03:36:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855255#M1135377</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-24T03:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh in alv oops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855256#M1135378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dhwani&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sample report &lt;STRONG&gt;ZUS_SDN_ALVGRID_EDITABLE_7A&lt;/STRONG&gt; shows you the effect of calling method go_grid-&amp;gt;&lt;STRONG&gt;CHECK_CHANGED_DATA&lt;/STRONG&gt; at PAI. Just execute the report, enter a few values in the editable column, put the cursor outside the ALV grid and push the ENTER button. Two additional ALV lists will be displayed, one before and one after the method call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZUS_SDN_ALVGRID_EDITABLE
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Thread: Refresh in alv oops
*&amp;amp; &amp;lt;a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1138666"&amp;gt;&amp;lt;/a&amp;gt;
*&amp;amp;---------------------------------------------------------------------*

REPORT  zus_sdn_alvgrid_editable_7a.

DATA:
  gd_repid         TYPE syst-repid,
  gd_okcode        TYPE ui_func,
*
  gt_fcat          TYPE lvc_t_fcat,
  go_docking       TYPE REF TO cl_gui_docking_container,
  go_grid1         TYPE REF TO cl_gui_alv_grid.


DATA:
  gt_knb1          TYPE STANDARD TABLE OF knb1.


PARAMETERS:
  p_bukrs      TYPE bukrs  DEFAULT '2000'  OBLIGATORY.






START-OF-SELECTION.

  SELECT        * FROM  knb1 INTO TABLE gt_knb1 UP TO 30 ROWS
         WHERE  bukrs  = p_bukrs.



* Create docking container
  CREATE OBJECT go_docking
    EXPORTING
      parent = cl_gui_container=&amp;gt;screen0
      ratio  = 90
    EXCEPTIONS
      OTHERS = 6.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* Create ALV grid
  CREATE OBJECT go_grid1
    EXPORTING
      i_parent = go_docking
    EXCEPTIONS
      OTHERS   = 5.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.




* Build fieldcatalog and set hotspot for field KUNNR
  PERFORM build_fieldcatalog_knb1.



* Display data
  CALL METHOD go_grid1-&amp;gt;set_table_for_first_display
    CHANGING
      it_outtab       = gt_knb1
      it_fieldcatalog = gt_fcat
    EXCEPTIONS
      OTHERS          = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.




* Link the docking container to the target dynpro
  gd_repid = syst-repid.
  CALL METHOD go_docking-&amp;gt;link
    EXPORTING
      repid                       = gd_repid
      dynnr                       = '0100'
*      CONTAINER                   =
    EXCEPTIONS
      OTHERS                      = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* ok-code field = GD_OKCODE
  CALL SCREEN '0100'.


END-OF-SELECTION.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_0100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.
*  SET TITLEBAR 'xxx'.


ENDMODULE.                 " STATUS_0100  OUTPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0100  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  CASE gd_okcode.
    WHEN 'BACK' OR
         'END'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.



    WHEN OTHERS.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          i_structure_name = 'KNB1'
          i_grid_title     = 'before CHECK_DATA_CHANGED'
        TABLES
          t_outtab         = gt_knb1
        EXCEPTIONS
          program_error    = 1
          OTHERS           = 2.
      IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.


*     Transport of changes from ALV grid -&amp;gt; itab
      go_grid1-&amp;gt;check_changed_data( ).

      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          i_structure_name = 'KNB1'
          i_grid_title     = 'after CHECK_DATA_CHANGED'
        TABLES
          t_outtab         = gt_knb1
        EXCEPTIONS
          program_error    = 1
          OTHERS           = 2.
      IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.


  ENDCASE.

  CLEAR: gd_okcode.

ENDMODULE.                 " USER_COMMAND_0100  INPUT


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  BUILD_FIELDCATALOG_KNB1
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM build_fieldcatalog_knb1 .
* define local data
  DATA:
    ls_fcat        TYPE lvc_s_fcat.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
*     I_BUFFER_ACTIVE              =
      i_structure_name             = 'KNB1'
*     I_CLIENT_NEVER_DISPLAY       = 'X'
*     I_BYPASSING_BUFFER           =
*     I_INTERNAL_TABNAME           =
    CHANGING
      ct_fieldcat                  = gt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


  LOOP AT gt_fcat INTO ls_fcat
          WHERE ( fieldname = 'ZUAWA' ).
    ls_fcat-edit    = abap_true.
    ls_fcat-col_opt = abap_true.
    MODIFY gt_fcat FROM ls_fcat.
  ENDLOOP.


ENDFORM.                    " BUILD_FIELDCATALOG_KNB1
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&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>Mon, 24 Nov 2008 04:26:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855256#M1135378</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-11-24T04:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh in alv oops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855257#M1135379</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;After you change the value on the screen and refresh PAI and PBO gets triggered. Update the other field of the internal table which u are passing to set_table_for_first_display and call the function refresh_table_display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this logic should work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PBO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if container is initial.&lt;/P&gt;&lt;P&gt;CREATE OBJECT custom_container1&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;            container_name = cont_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;create an instance of alv control&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CREATE OBJECT grid1&lt;/P&gt;&lt;P&gt;           EXPORTING i_parent = custom_container1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD grid1-&amp;gt;set_table_for_first_display&lt;/P&gt;&lt;P&gt;         EXPORTING i_structure_name = 'your structure'&lt;/P&gt;&lt;P&gt;                   is_layout        = your_layout&lt;/P&gt;&lt;P&gt;         CHANGING  it_outtab        = internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt; CALL METHOD w_ref_grid-&amp;gt;refresh_table_display&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    IS_STABLE      =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    I_SOFT_REFRESH =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   EXCEPTIONS&lt;/P&gt;&lt;P&gt;     finished       = 1&lt;/P&gt;&lt;P&gt;     OTHERS         = 2&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;PAI.&lt;/P&gt;&lt;P&gt;update the content of the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rahul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Nov 2008 07:05:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855257#M1135379</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-24T07:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh in alv oops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855258#M1135380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dhwani,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again... just an addition to the above posts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we register the &lt;STRONG&gt;edit event&lt;/STRONG&gt;  &lt;EM&gt;cl_gui_alv_grid=&amp;gt;mc_evt_modified&lt;/EM&gt; , the &lt;STRONG&gt;data_changed&lt;/STRONG&gt; event ll be triggered even if u place the cursor on another cell after changing the contents of a cell...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So we can change the contents of the &lt;STRONG&gt;dependent cell&lt;/STRONG&gt; without &lt;STRONG&gt;pressing refresh button&lt;/STRONG&gt; or even &lt;STRONG&gt;without hitting enter!!&lt;/STRONG&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the below code for example....&lt;/P&gt;&lt;P&gt;Here language field is editable...change the language using F4 hlp and u can see the description &lt;/P&gt;&lt;P&gt;changing to the selected lang ( provided, it is available in MAKT table )... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Screen flow logic&lt;/STRONG&gt;..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PROCESS BEFORE OUTPUT.
  MODULE pbo.

PROCESS AFTER INPUT.
  MODULE pai AT EXIT-COMMAND.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;program&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*----------------------------------------------------------------------*
*       CLASS lcl_event_responder DEFINITION                           *
*----------------------------------------------------------------------*
CLASS lcl_event_responder DEFINITION.
  PUBLIC SECTION.
    DATA  : ls_changed_cell TYPE  lvc_s_modi,
            lv_language     TYPE  spras.
    METHODS refresh_changed_data  FOR EVENT data_changed
                                  OF cl_gui_alv_grid
                                  IMPORTING er_data_changed
                                            e_ucomm.

ENDCLASS.                    "event_responder DEFINITION

DATA: go_handler         TYPE REF TO lcl_event_responder,
      go_grid            TYPE REF TO cl_gui_alv_grid,
      gt_fieldcat        TYPE lvc_t_fcat,
      gv_language        TYPE spras VALUE 'E',
      gt_outtab          TYPE TABLE OF makt WITH HEADER LINE.

CALL SCREEN 100.

*---------------------------------------------------------------------*
*       MODULE PBO OUTPUT                                             *
*---------------------------------------------------------------------*
MODULE pbo OUTPUT.
  SET PF-STATUS 'BASIC'.  " has a BACK button with func-type 'E'
  PERFORM create_and_init_alv CHANGING gt_outtab[]
                                       gt_fieldcat.
ENDMODULE.                    "pbo OUTPUT
*---------------------------------------------------------------------*
*       MODULE PAI INPUT                                              *
*---------------------------------------------------------------------*
MODULE pai INPUT.
  LEAVE PROGRAM.
ENDMODULE.                    "pai INPUT



*&amp;amp;---------------------------------------------------------------------*
FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
                                  pt_fieldcat TYPE lvc_t_fcat.

  CHECK go_grid IS NOT BOUND.

  CREATE OBJECT go_grid
    EXPORTING
      i_parent = cl_gui_container=&amp;gt;default_screen.

  PERFORM build_display_table.

  PERFORM build_fieldcat CHANGING pt_fieldcat.

  go_grid-&amp;gt;set_table_for_first_display( CHANGING  it_fieldcatalog      = pt_fieldcat
                                                  it_outtab            = pt_outtab ).

  go_grid-&amp;gt;set_ready_for_input( 1 ).

  " raises the 'data_changed' event when we select another cell/any action after changing the data
  go_grid-&amp;gt;register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=&amp;gt;mc_evt_modified ).

  CREATE OBJECT go_handler.

  SET HANDLER go_handler-&amp;gt;refresh_changed_data FOR go_grid.

ENDFORM.                               "CREATE_AND_INIT_ALV
*&amp;amp;---------------------------------------------------------------------*
FORM build_display_table.
  FREE gt_outtab.
  SELECT * FROM makt UP TO 20 ROWS INTO TABLE gt_outtab WHERE spras EQ gv_language.
ENDFORM.                               "build_display_table
*&amp;amp;---------------------------------------------------------------------*
FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.

  DATA ls_fcat TYPE lvc_s_fcat.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name = 'MAKT'
    CHANGING
      ct_fieldcat      = pt_fieldcat.

  LOOP AT pt_fieldcat INTO ls_fcat.
    IF    ls_fcat-fieldname EQ 'SPRAS'.
      ls_fcat-outputlen  = 7.
      ls_fcat-edit       = abap_true.
      MODIFY pt_fieldcat FROM ls_fcat.
    ENDIF.
  ENDLOOP.
ENDFORM.                               "build_fieldcat
*&amp;amp;---------------------------------------------------------------------*
FORM change_display_table USING pv_language pv_rowno TYPE i.
  READ TABLE gt_outtab INDEX pv_rowno.
  SELECT SINGLE * FROM makt INTO gt_outtab WHERE matnr = gt_outtab-matnr AND spras = pv_language.
  IF sy-subrc EQ 0.
    DELETE gt_outtab INDEX pv_rowno.
    INSERT gt_outtab INDEX pv_rowno.
  ELSE.
    CLEAR : gt_outtab-maktx,
            gt_outtab-maktg.
    DELETE gt_outtab INDEX pv_rowno.
    INSERT gt_outtab INDEX pv_rowno.
  ENDIF.
ENDFORM.                    "change_display_table

*---------------------------------------------------------------------*
*       CLASS event_responder IMPLEMENTATION                          *
*---------------------------------------------------------------------*
CLASS lcl_event_responder IMPLEMENTATION.
  METHOD refresh_changed_data.
    READ TABLE er_data_changed-&amp;gt;mt_mod_cells INTO ls_changed_cell INDEX 1.
    CALL FUNCTION 'CONVERSION_EXIT_ISOLA_INPUT'
      EXPORTING
        input  = ls_changed_cell-value
      IMPORTING
        output = lv_language.
    PERFORM change_display_table USING lv_language ls_changed_cell-row_id.
    go_grid-&amp;gt;refresh_table_display( ).
  ENDMETHOD.                    "click
ENDCLASS.                    "event_responder IMPLEMENTATION&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Jose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Nov 2008 07:13:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/refresh-in-alv-oops/m-p/4855258#M1135380</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-24T07:13:19Z</dc:date>
    </item>
  </channel>
</rss>

