<?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 program in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761546#M642879</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;PRE&gt;&lt;CODE&gt;
form save_data.
  data: l_valid type c.
* §7.Check if any errors exist in protocol by using method
*    CHECK_CHANGED_DATA of your ALV Grid instance.

* The method CHECK_CHANGED_DATA checks all new cells syntactically,
* raises event DATA_CHANGED and looks then for any entries
* in the error protocol. If any exist the parameter e_valid
* is initial ('X' in the other case).
*
  call method g_grid-&amp;gt;check_changed_data
               importing e_valid = l_valid.

  if l_valid is initial.
    call function 'POPUP_TO_INFORM'
         exporting
              titel = text-i06
              txt1  = text-i07
              txt2  = text-i08
              txt3  = text-i09.

  else.
    perform update_database. "&amp;lt;&amp;lt;&amp;lt; Check this form you need to write your update statements here
    message s000(0k) with text-s01.
  endif.
endform.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Sep 2007 17:55:45 GMT</pubDate>
    <dc:creator>former_member194669</dc:creator>
    <dc:date>2007-09-03T17:55:45Z</dc:date>
    <item>
      <title>ALV program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761537#M642870</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;I am triyng to make a program for maintain a Z table using ALV... the program i was used as a template is BCALV_EDIT_04 but this program only insert and delete records but not maintain existing records.. please if any have a code or site where i can download it... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks In Advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Juan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 16:04:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761537#M642870</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T16:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: ALV program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761538#M642871</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;U need to manage the event DATA_CHANGED: in the report BCALV_EDIT_04 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example of handler class:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CLASS lcl_alv_handler_1100 DEFINITION.                         &lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&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 cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;             IMPORTING er_data_changed,&lt;/P&gt;&lt;P&gt;ENDCLASS.              &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 16:11:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761538#M642871</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-09-03T16:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: ALV program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761539#M642872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a®s...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I figure that... but could u be more specific??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks In Advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Juan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 16:14:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761539#M642872</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T16:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: ALV program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761540#M642873</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;PRE&gt;&lt;CODE&gt;
In OO case:
after creating your ALV, you have first to register to teh 'ENTER' event: everytime the user press enter, the event will be triggered:


CALL METHOD gr_alv-&amp;gt;register_edit_event
      EXPORTING
        i_event_id = cl_gui_alv_grid=&amp;gt;mc_evt_enter.



Then you have to create the event handler:

CREATE OBJECT gr_alv_handler_1100.
    SET HANDLER gr_alv_handler_1100-&amp;gt;handle_data_changed FOR gr_alv.



An example of handler class:

CLASS lcl_alv_handler_1100 DEFINITION.                          "#EC CLAS_FINAL
  PUBLIC SECTION.
    METHODS:
      handle_data_changed                                       "#EC CALLED
         FOR EVENT data_changed OF cl_gui_alv_grid
             IMPORTING er_data_changed,
ENDCLASS.               "LCL_ALV_HANDLER_1100

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 16:21:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761540#M642873</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-09-03T16:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: ALV program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761541#M642874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks again its more clear now... but i am stucked in the:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT pr_data_changed-&amp;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;&lt;P&gt;endloop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks In Advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Juan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 16:57:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761541#M642874</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T16:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: ALV program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761542#M642875</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;Simply call this method . This will automatically update your changes in the GRID to your output table&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  call method g_grid-&amp;gt;check_changed_data
    importing
      e_valid = v_valid.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 17:11:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761542#M642875</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-09-03T17:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: ALV program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761543#M642876</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;Ok but i need to execute a modify comand to update my z table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont know in which internal is the data changed,... gs_outtab? if so i need to read this table to know which records was modified&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks In advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Juan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 17:28:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761543#M642876</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T17:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: ALV program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761544#M642877</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;If you check the program BCALV_EDIT_04&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  call method g_grid-&amp;gt;set_table_for_first_display
       exporting it_toolbar_excluding  = lt_exclude
                 is_layout             = gs_layout
       changing  it_fieldcatalog       = pt_fieldcat
                 it_outtab             = pt_outtab[].  "&amp;lt;&amp;lt;&amp;lt;&amp;lt; Output table 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once user press SAVE button In the PAI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*----------------------------------------------------------------------*
* Module Pai INPUT                                                     *
*----------------------------------------------------------------------*
* PAI module                                                           *
*----------------------------------------------------------------------*
module pai input.
  save_ok = ok_code.
  clear ok_code.
  case save_ok.
    when 'EXIT'.
      perform f_exit_program.
    when 'CANC'.
      perform f_exit_program.
    when 'BACK'.
      perform f_exit_program.
    when 'SAVE'.
      perform f_save_data.   "&amp;lt;&amp;lt;&amp;lt; You need to write a perform 
    when 'EVEW'.
      perform f_set_fcode.
      perform f_save_data .
    when 'VADD'.
      perform f_f4_help_fieldname.
  endcase.
endmodule.                               " Pai INPUT

*&amp;amp;---------------------------------------------------------------------*
* Form  f_save_data                                                    *
*&amp;amp;---------------------------------------------------------------------*
* After save                                                           *
*----------------------------------------------------------------------*
form f_save_data .
  data : p_index like sy-index.
  refresh : i_message, i_message1.

  call method g_grid-&amp;gt;check_changed_data
    importing
      e_valid = v_valid.

  if not v_valid is initial.
    if save_ok eq 'SAVE'.
     loop at pt_outtab.
         "&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; write your statement to update your ZTABLE
     endloop,
   endif.
  endif.
endform.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 17:37:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761544#M642877</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-09-03T17:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: ALV program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761545#M642878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could u send me please the complete code of your example to jcdiezdemedina@gmail.com... it seems that the version are differentt.. we are on 4.6c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks In Advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Juan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 17:48:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761545#M642878</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T17:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: ALV program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761546#M642879</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;PRE&gt;&lt;CODE&gt;
form save_data.
  data: l_valid type c.
* §7.Check if any errors exist in protocol by using method
*    CHECK_CHANGED_DATA of your ALV Grid instance.

* The method CHECK_CHANGED_DATA checks all new cells syntactically,
* raises event DATA_CHANGED and looks then for any entries
* in the error protocol. If any exist the parameter e_valid
* is initial ('X' in the other case).
*
  call method g_grid-&amp;gt;check_changed_data
               importing e_valid = l_valid.

  if l_valid is initial.
    call function 'POPUP_TO_INFORM'
         exporting
              titel = text-i06
              txt1  = text-i07
              txt2  = text-i08
              txt3  = text-i09.

  else.
    perform update_database. "&amp;lt;&amp;lt;&amp;lt; Check this form you need to write your update statements here
    message s000(0k) with text-s01.
  endif.
endform.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 17:55:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761546#M642879</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-09-03T17:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: ALV program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761547#M642880</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;Ok but i dont think that the best way was to update my z table from outab.. i only need to update the modified records... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* 1.Delete Lines:
*  call method g_verifier-&amp;gt;get_deleted_rows
*          importing deleted_rows = lt_del_rows.
*
*  delete sflight from table lt_del_rows.
*
** 2.Insert Lines:
*  call method g_verifier-&amp;gt;get_inserted_rows
*          importing inserted_rows = lt_ins_keys.
*
*  loop at lt_ins_keys into l_ins_key.
*    read table gt_outtab into ls_outtab
*     with key carrid = l_ins_key-carrid
*              connid = l_ins_key-connid
*              fldate = l_ins_key-fldate.
*    if sy-subrc eq 0.
*      move-corresponding ls_outtab to ls_sflight.
*      append ls_sflight to lt_instab.
*    endif.
*  endloop.
*
*  insert sflight from table lt_instab.
*&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the point 3 modified records is missing jajaja  &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;  this the code i need...&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;&lt;P&gt;Thanks In Advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Juan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2007 18:02:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-program/m-p/2761547#M642880</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-03T18:02:16Z</dc:date>
    </item>
  </channel>
</rss>

