<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Editable ALV in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447332#M828025</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;The follow program demonstrates how to make individual fields of an ALV grid editable (NetPR greater than 10).&lt;/P&gt;&lt;P&gt;Changes required from a basic ALV grid include adding a new field to ALV grid data table(it_ekko), Populating this&lt;/P&gt;&lt;P&gt;field with style attribute and adding an entry to layout control table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  ZDEMO_ALVGRID_EDIT                                          *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;*&amp;amp; Example of a simple ALV Grid Report                                 *&lt;/P&gt;&lt;P&gt;*&amp;amp; ...................................                                 *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;*&amp;amp; The basic ALV grid, Enhanced to display specific fields as          *&lt;/P&gt;&lt;P&gt;*&amp;amp; editable depending on field value                                   *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZDEMO_ALVGRID_EDIT                 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES:     ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE-POOLS: slis.                                 "ALV Declarations&lt;/P&gt;&lt;P&gt;*Data Declaration&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------" /&gt;&lt;P&gt;TYPES: BEGIN OF t_ekko,&lt;/P&gt;&lt;P&gt;  ebeln TYPE ekpo-ebeln,&lt;/P&gt;&lt;P&gt;  ebelp TYPE ekpo-ebelp,&lt;/P&gt;&lt;P&gt;  statu TYPE ekpo-statu,&lt;/P&gt;&lt;P&gt;  aedat TYPE ekpo-aedat,&lt;/P&gt;&lt;P&gt;  matnr TYPE ekpo-matnr,&lt;/P&gt;&lt;P&gt;  menge TYPE ekpo-menge,&lt;/P&gt;&lt;P&gt;  meins TYPE ekpo-meins,&lt;/P&gt;&lt;P&gt;  netpr TYPE ekpo-netpr,&lt;/P&gt;&lt;P&gt;  peinh TYPE ekpo-peinh,&lt;/P&gt;&lt;P&gt;  field_style  TYPE lvc_t_styl, "FOR DISABLE&lt;/P&gt;&lt;P&gt; END OF t_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,&lt;/P&gt;&lt;P&gt;      wa_ekko TYPE t_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*ALV data declarations&lt;/P&gt;&lt;P&gt;DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: it_fieldcat TYPE lvc_t_fcat,     "slis_t_fieldcat_alv WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      wa_fieldcat TYPE lvc_s_fcat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      gd_tab_group TYPE slis_t_sp_group_alv,&lt;/P&gt;&lt;P&gt;      gd_layout    TYPE lvc_s_layo,     "slis_layout_alv,&lt;/P&gt;&lt;P&gt;      gd_repid     LIKE sy-repid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*Start-of-selection.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PERFORM data_retrieval.&lt;/P&gt;&lt;P&gt;  PERFORM set_specific_field_attributes.&lt;/P&gt;&lt;P&gt;  PERFORM build_fieldcatalog.&lt;/P&gt;&lt;P&gt;  PERFORM build_layout.&lt;/P&gt;&lt;P&gt;  PERFORM display_alv_report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  BUILD_FIELDCATALOG&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      Build Fieldcatalog for ALV Report&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM build_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'EBELN'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Purchase Order'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 0.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-outputlen   = 10.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-emphasize   = 'X'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-key         = 'X'.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'EBELP'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'PO Item'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 1.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'STATU'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Status'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 2.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'AEDAT'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Item change date'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 3.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'MATNR'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Material Number'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 4.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'MENGE'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'PO quantity'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 5.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'MEINS'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Order Unit'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 6.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'NETPR'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Net Price'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-edit        = 'X'. "sets whole column to be editable&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 7.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-outputlen   = 15.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-datatype     = 'CURR'.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'PEINH'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Price Unit'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 8.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;ENDFORM.                    " BUILD_FIELDCATALOG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  BUILD_LAYOUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      Build layout for ALV grid report&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM build_layout.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set layout field for field attributes(i.e. input/output)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  gd_layout-stylefname = 'FIELD_STYLE'.&lt;/P&gt;&lt;P&gt;  gd_layout-zebra             = 'X'.&lt;/P&gt;&lt;P&gt;ENDFORM.                    " BUILD_LAYOUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  DISPLAY_ALV_REPORT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      Display report using ALV grid&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM display_alv_report.&lt;/P&gt;&lt;P&gt;  gd_repid = sy-repid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; call function 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            i_callback_program      = gd_repid&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           i_callback_user_command = 'USER_COMMAND'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            is_layout_lvc               = gd_layout&lt;/P&gt;&lt;P&gt;            it_fieldcat_lvc             = it_fieldcat&lt;/P&gt;&lt;P&gt;            i_save                  = 'X'&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            t_outtab                = it_ekko&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            program_error           = 1&lt;/P&gt;&lt;P&gt;            OTHERS                  = 2.&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;ENDFORM.                    " DISPLAY_ALV_REPORT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  DATA_RETRIEVAL&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      Retrieve data form EKPO table and populate itab it_ekko&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM data_retrieval.&lt;/P&gt;&lt;P&gt;  SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh&lt;/P&gt;&lt;P&gt;   UP TO 10 ROWS&lt;/P&gt;&lt;P&gt;    FROM ekpo&lt;/P&gt;&lt;P&gt;    INTO  CORRESPONDING FIELDS OF TABLE it_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " DATA_RETRIEVAL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  set_specific_field_attributes&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      populate FIELD_STYLE table with specific field attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form set_specific_field_attributes .&lt;/P&gt;&lt;P&gt;  DATA ls_stylerow TYPE lvc_s_styl .&lt;/P&gt;&lt;P&gt;  DATA lt_styletab TYPE lvc_t_styl .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate style variable (FIELD_STYLE) with style properties&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;The NETPR field/column has been set to editable in the fieldcatalog...&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The following code sets it to be disabled(display only) if 'NETPR'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;is gt than 10.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  LOOP AT it_ekko INTO wa_ekko.&lt;/P&gt;&lt;P&gt;    IF wa_ekko-netpr GT 10.&lt;/P&gt;&lt;P&gt;      ls_stylerow-fieldname = 'NETPR' .&lt;/P&gt;&lt;P&gt;      ls_stylerow-style = cl_gui_alv_grid=&amp;gt;mc_style_disabled.&lt;/P&gt;&lt;P&gt;                                             "set field to disabled&lt;/P&gt;&lt;P&gt;      APPEND ls_stylerow  TO wa_ekko-field_style.&lt;/P&gt;&lt;P&gt;      MODIFY it_ekko FROM wa_ekko.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " set_specific_field_attributes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Feb 2008 07:23:38 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-25T07:23:38Z</dc:date>
    <item>
      <title>Editable ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447331#M828024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In editable alv , when I make any changes , those changes should be updated in Background.This is because I have 1000 matnrs to update.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone tell me how is that possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 07:09:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447331#M828024</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T07:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Editable ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447332#M828025</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;The follow program demonstrates how to make individual fields of an ALV grid editable (NetPR greater than 10).&lt;/P&gt;&lt;P&gt;Changes required from a basic ALV grid include adding a new field to ALV grid data table(it_ekko), Populating this&lt;/P&gt;&lt;P&gt;field with style attribute and adding an entry to layout control table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  ZDEMO_ALVGRID_EDIT                                          *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;*&amp;amp; Example of a simple ALV Grid Report                                 *&lt;/P&gt;&lt;P&gt;*&amp;amp; ...................................                                 *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;*&amp;amp; The basic ALV grid, Enhanced to display specific fields as          *&lt;/P&gt;&lt;P&gt;*&amp;amp; editable depending on field value                                   *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZDEMO_ALVGRID_EDIT                 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES:     ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE-POOLS: slis.                                 "ALV Declarations&lt;/P&gt;&lt;P&gt;*Data Declaration&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------" /&gt;&lt;P&gt;TYPES: BEGIN OF t_ekko,&lt;/P&gt;&lt;P&gt;  ebeln TYPE ekpo-ebeln,&lt;/P&gt;&lt;P&gt;  ebelp TYPE ekpo-ebelp,&lt;/P&gt;&lt;P&gt;  statu TYPE ekpo-statu,&lt;/P&gt;&lt;P&gt;  aedat TYPE ekpo-aedat,&lt;/P&gt;&lt;P&gt;  matnr TYPE ekpo-matnr,&lt;/P&gt;&lt;P&gt;  menge TYPE ekpo-menge,&lt;/P&gt;&lt;P&gt;  meins TYPE ekpo-meins,&lt;/P&gt;&lt;P&gt;  netpr TYPE ekpo-netpr,&lt;/P&gt;&lt;P&gt;  peinh TYPE ekpo-peinh,&lt;/P&gt;&lt;P&gt;  field_style  TYPE lvc_t_styl, "FOR DISABLE&lt;/P&gt;&lt;P&gt; END OF t_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,&lt;/P&gt;&lt;P&gt;      wa_ekko TYPE t_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*ALV data declarations&lt;/P&gt;&lt;P&gt;DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: it_fieldcat TYPE lvc_t_fcat,     "slis_t_fieldcat_alv WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      wa_fieldcat TYPE lvc_s_fcat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      gd_tab_group TYPE slis_t_sp_group_alv,&lt;/P&gt;&lt;P&gt;      gd_layout    TYPE lvc_s_layo,     "slis_layout_alv,&lt;/P&gt;&lt;P&gt;      gd_repid     LIKE sy-repid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*Start-of-selection.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PERFORM data_retrieval.&lt;/P&gt;&lt;P&gt;  PERFORM set_specific_field_attributes.&lt;/P&gt;&lt;P&gt;  PERFORM build_fieldcatalog.&lt;/P&gt;&lt;P&gt;  PERFORM build_layout.&lt;/P&gt;&lt;P&gt;  PERFORM display_alv_report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  BUILD_FIELDCATALOG&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      Build Fieldcatalog for ALV Report&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM build_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'EBELN'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Purchase Order'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 0.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-outputlen   = 10.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-emphasize   = 'X'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-key         = 'X'.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'EBELP'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'PO Item'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 1.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'STATU'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Status'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 2.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'AEDAT'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Item change date'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 3.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'MATNR'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Material Number'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 4.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'MENGE'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'PO quantity'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 5.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'MEINS'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Order Unit'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 6.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'NETPR'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Net Price'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-edit        = 'X'. "sets whole column to be editable&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 7.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-outputlen   = 15.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-datatype     = 'CURR'.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname   = 'PEINH'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-scrtext_m   = 'Price Unit'.&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos     = 8.&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat.&lt;/P&gt;&lt;P&gt;  CLEAR  wa_fieldcat.&lt;/P&gt;&lt;P&gt;ENDFORM.                    " BUILD_FIELDCATALOG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  BUILD_LAYOUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      Build layout for ALV grid report&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM build_layout.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set layout field for field attributes(i.e. input/output)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  gd_layout-stylefname = 'FIELD_STYLE'.&lt;/P&gt;&lt;P&gt;  gd_layout-zebra             = 'X'.&lt;/P&gt;&lt;P&gt;ENDFORM.                    " BUILD_LAYOUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  DISPLAY_ALV_REPORT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      Display report using ALV grid&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM display_alv_report.&lt;/P&gt;&lt;P&gt;  gd_repid = sy-repid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; call function 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            i_callback_program      = gd_repid&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           i_callback_user_command = 'USER_COMMAND'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            is_layout_lvc               = gd_layout&lt;/P&gt;&lt;P&gt;            it_fieldcat_lvc             = it_fieldcat&lt;/P&gt;&lt;P&gt;            i_save                  = 'X'&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            t_outtab                = it_ekko&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            program_error           = 1&lt;/P&gt;&lt;P&gt;            OTHERS                  = 2.&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;ENDFORM.                    " DISPLAY_ALV_REPORT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  DATA_RETRIEVAL&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      Retrieve data form EKPO table and populate itab it_ekko&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM data_retrieval.&lt;/P&gt;&lt;P&gt;  SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh&lt;/P&gt;&lt;P&gt;   UP TO 10 ROWS&lt;/P&gt;&lt;P&gt;    FROM ekpo&lt;/P&gt;&lt;P&gt;    INTO  CORRESPONDING FIELDS OF TABLE it_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " DATA_RETRIEVAL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  set_specific_field_attributes&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      populate FIELD_STYLE table with specific field attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form set_specific_field_attributes .&lt;/P&gt;&lt;P&gt;  DATA ls_stylerow TYPE lvc_s_styl .&lt;/P&gt;&lt;P&gt;  DATA lt_styletab TYPE lvc_t_styl .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate style variable (FIELD_STYLE) with style properties&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;The NETPR field/column has been set to editable in the fieldcatalog...&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The following code sets it to be disabled(display only) if 'NETPR'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;is gt than 10.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  LOOP AT it_ekko INTO wa_ekko.&lt;/P&gt;&lt;P&gt;    IF wa_ekko-netpr GT 10.&lt;/P&gt;&lt;P&gt;      ls_stylerow-fieldname = 'NETPR' .&lt;/P&gt;&lt;P&gt;      ls_stylerow-style = cl_gui_alv_grid=&amp;gt;mc_style_disabled.&lt;/P&gt;&lt;P&gt;                                             "set field to disabled&lt;/P&gt;&lt;P&gt;      APPEND ls_stylerow  TO wa_ekko-field_style.&lt;/P&gt;&lt;P&gt;      MODIFY it_ekko FROM wa_ekko.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " set_specific_field_attributes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 07:23:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447332#M828025</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T07:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Editable ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447333#M828026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The follow program demonstrates how to capture which rows of the ALV grid the user has selected.&lt;/P&gt;&lt;P&gt;Changes required from a basic ALV grid include adding a new field to ALV grid data table(it_ekko-sel) and&lt;/P&gt;&lt;P&gt;adding an entry to the layout control table (gd_layout-box_fieldname = 'SEL'). Please note you need to use&lt;/P&gt;&lt;P&gt;the SHIFT and CONTROL keys to select multiple rows!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  ZDEMO_ALVGRID_SELROW                                        *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;*&amp;amp; Example of a simple ALV Grid Report                                 *&lt;/P&gt;&lt;P&gt;*&amp;amp; ...................................                                 *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;*&amp;amp; The basic ALV grid, Enhanced to display capture each row a user has *&lt;/P&gt;&lt;P&gt;*&amp;amp; selected                                                            *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  zdemo_alvgrid_selrow                 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES:     ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;type-pools: slis.                                 "ALV Declarations&lt;/P&gt;&lt;P&gt;*Data Declaration&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------" /&gt;&lt;P&gt;TYPES: BEGIN OF t_ekko,&lt;/P&gt;&lt;P&gt;  SEl,                         "stores which row user has selected&lt;/P&gt;&lt;P&gt;  ebeln TYPE ekpo-ebeln,&lt;/P&gt;&lt;P&gt;  ebelp TYPE ekpo-ebelp,&lt;/P&gt;&lt;P&gt;  statu TYPE ekpo-statu,&lt;/P&gt;&lt;P&gt;  aedat TYPE ekpo-aedat,&lt;/P&gt;&lt;P&gt;  matnr TYPE ekpo-matnr,&lt;/P&gt;&lt;P&gt;  menge TYPE ekpo-menge,&lt;/P&gt;&lt;P&gt;  meins TYPE ekpo-meins,&lt;/P&gt;&lt;P&gt;  netpr TYPE ekpo-netpr,&lt;/P&gt;&lt;P&gt;  peinh TYPE ekpo-peinh,&lt;/P&gt;&lt;P&gt; END OF t_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,&lt;/P&gt;&lt;P&gt;      wa_ekko TYPE t_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*ALV data declarations&lt;/P&gt;&lt;P&gt;data: fieldcatalog type slis_t_fieldcat_alv with header line,&lt;/P&gt;&lt;P&gt;      gd_tab_group type slis_t_sp_group_alv,&lt;/P&gt;&lt;P&gt;      gd_layout    type slis_layout_alv,&lt;/P&gt;&lt;P&gt;      gd_repid     like sy-repid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*Start-of-selection.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform data_retrieval.&lt;/P&gt;&lt;P&gt;perform build_fieldcatalog.&lt;/P&gt;&lt;P&gt;perform build_layout.&lt;/P&gt;&lt;P&gt;perform display_alv_report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  BUILD_FIELDCATALOG&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      Build Fieldcatalog for ALV Report&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form build_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;There are a number of ways to create a fieldcat.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;For the purpose of this example i will build the fieldcatalog manualy&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;by populating the internal table fields individually and then&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;appending the rows. This method can be the most time consuming but can&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;also allow you  more control of the final product.&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;Beware though, you need to ensure that all fields required are&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;populated. When using some of functionality available via ALV, such as&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;total. You may need to provide more information than if you were&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;simply displaying the result&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;              I.e. Field type may be required in-order for&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                   the 'TOTAL' function to work.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'EBELN'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Purchase Order'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 0.&lt;/P&gt;&lt;P&gt;  fieldcatalog-outputlen   = 10.&lt;/P&gt;&lt;P&gt;  fieldcatalog-emphasize   = 'X'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-key         = 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; fieldcatalog-do_sum      = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; fieldcatalog-no_zero     = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  append fieldcatalog to fieldcatalog.&lt;/P&gt;&lt;P&gt;  clear  fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'EBELP'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'PO Item'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 1.&lt;/P&gt;&lt;P&gt;  append fieldcatalog to fieldcatalog.&lt;/P&gt;&lt;P&gt;  clear  fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'STATU'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Status'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 2.&lt;/P&gt;&lt;P&gt;  append fieldcatalog to fieldcatalog.&lt;/P&gt;&lt;P&gt;  clear  fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'AEDAT'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Item change date'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 3.&lt;/P&gt;&lt;P&gt;  append fieldcatalog to fieldcatalog.&lt;/P&gt;&lt;P&gt;  clear  fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'MATNR'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Material Number'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 4.&lt;/P&gt;&lt;P&gt;  append fieldcatalog to fieldcatalog.&lt;/P&gt;&lt;P&gt;  clear  fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'MENGE'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'PO quantity'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 5.&lt;/P&gt;&lt;P&gt;  append fieldcatalog to fieldcatalog.&lt;/P&gt;&lt;P&gt;  clear  fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'MEINS'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Order Unit'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 6.&lt;/P&gt;&lt;P&gt;  append fieldcatalog to fieldcatalog.&lt;/P&gt;&lt;P&gt;  clear  fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'NETPR'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Net Price'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 7.&lt;/P&gt;&lt;P&gt;  fieldcatalog-outputlen   = 15.&lt;/P&gt;&lt;P&gt;  fieldcatalog-do_sum      = 'X'.        "Display column total&lt;/P&gt;&lt;P&gt;  fieldcatalog-datatype     = 'CURR'.&lt;/P&gt;&lt;P&gt;  append fieldcatalog to fieldcatalog.&lt;/P&gt;&lt;P&gt;  clear  fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'PEINH'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Price Unit'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 8.&lt;/P&gt;&lt;P&gt;  append fieldcatalog to fieldcatalog.&lt;/P&gt;&lt;P&gt;  clear  fieldcatalog.&lt;/P&gt;&lt;P&gt;endform.                    " BUILD_FIELDCATALOG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  BUILD_LAYOUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      Build layout for ALV grid report&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form build_layout.&lt;/P&gt;&lt;P&gt;  gd_layout-box_fieldname     = 'SEL'.&lt;/P&gt;&lt;P&gt;                                 "set field name to store row selection&lt;/P&gt;&lt;P&gt;  gd_layout-edit              = 'X'. "makes whole ALV table editable&lt;/P&gt;&lt;P&gt;  gd_layout-zebra             = 'X'.&lt;/P&gt;&lt;P&gt;endform.                    " BUILD_LAYOUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  DISPLAY_ALV_REPORT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      Display report using ALV grid&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form display_alv_report.&lt;/P&gt;&lt;P&gt;  gd_repid = sy-repid.&lt;/P&gt;&lt;P&gt;  call function 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;            i_callback_program      = gd_repid&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            i_callback_user_command = 'USER_COMMAND'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           i_grid_title           = outtext&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            is_layout               = gd_layout&lt;/P&gt;&lt;P&gt;            it_fieldcat             = fieldcatalog[]&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           it_special_groups       = gd_tabgroup&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           IT_EVENTS                = GT_XEVENTS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            i_save                  = 'X'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           is_variant              = z_template&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       tables&lt;/P&gt;&lt;P&gt;            t_outtab                = it_ekko&lt;/P&gt;&lt;P&gt;       exceptions&lt;/P&gt;&lt;P&gt;            program_error           = 1&lt;/P&gt;&lt;P&gt;            others                  = 2.&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;endform.                    " DISPLAY_ALV_REPORT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  DATA_RETRIEVAL&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&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;      Retrieve data form EKPO table and populate itab it_ekko&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form data_retrieval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ebeln ebelp statu aedat matnr menge meins netpr peinh&lt;/P&gt;&lt;P&gt; up to 10 rows&lt;/P&gt;&lt;P&gt;  from ekpo&lt;/P&gt;&lt;P&gt;  into corresponding fields of table it_ekko.&lt;/P&gt;&lt;P&gt;endform.                    " DATA_RETRIEVAL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&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;      FORM USER_COMMAND                                          *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&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;      --&amp;gt; R_UCOMM                                                *&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      --&amp;gt; RS_SELFIELD                                            *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM user_command USING r_ucomm LIKE sy-ucomm&lt;/P&gt;&lt;P&gt;                  rs_selfield TYPE slis_selfield.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check function code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CASE r_ucomm.&lt;/P&gt;&lt;P&gt;    WHEN '&amp;amp;IC1'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Check field clicked on within ALVgrid report&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    IF rs_selfield-fieldname = 'EBELN'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Read data table, using index of row user clicked on&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Set parameter ID for transaction screen field&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Sxecute transaction ME23N, and skip initial data entry screen&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    WHEN '&amp;amp;DATA_SAVE'.  "user presses SAVE&lt;/P&gt;&lt;P&gt;    loop at it_ekko into wa_ekko.&lt;/P&gt;&lt;P&gt;      if wa_ekko-sel EQ 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Process records that have been selected&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;  ENDCASE.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 07:24:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447333#M828026</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T07:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: Editable ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447334#M828027</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;Please refer to the SAP standard demo program.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
BCALV_TEST_GRID_EDITABLE
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 07:26:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447334#M828027</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T07:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: Editable ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447335#M828028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;amp;---------------------------------------------------------------------
*&amp;amp; Report ZUS_SDN_ALVGRID_EDITABLE_8
*&amp;amp;
*&amp;amp; Description: editable ALV -&amp;gt; ENTER jumps to next row
&amp;amp;---------------------------------------------------------------------
*&amp;amp; Dynpro flow logic: no screen elements, ok_code = GD_OKCODE
** PROCESS BEFORE OUTPUT.
** MODULE STATUS_0100.
***
** PROCESS AFTER INPUT.
** MODULE USER_COMMAND_0100.
**
*&amp;amp;
&amp;amp;---------------------------------------------------------------------

REPORT zus_sdn_alvgrid_editable_8.

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_grid TYPE REF TO cl_gui_alv_grid.


DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1.


---------------------------------------------------------------------
* CLASS lcl_eventhandler DEFINITION
---------------------------------------------------------------------
*
---------------------------------------------------------------------
CLASS lcl_eventhandler DEFINITION.

PUBLIC SECTION.

CLASS-METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING
er_data_changed
e_onf4
e_onf4_before
e_onf4_after
e_ucomm
sender.


ENDCLASS. "lcl_eventhandler DEFINITION


---------------------------------------------------------------------
* CLASS lcl_eventhandler IMPLEMENTATION
---------------------------------------------------------------------
*
---------------------------------------------------------------------
CLASS lcl_eventhandler IMPLEMENTATION.

METHOD handle_data_changed.
* define local data

** cl_gui_cfw=&amp;gt;set_new_ok_code( 'NEXT_ROW' ). " not possible on 4.6c
CALL METHOD cl_gui_cfw=&amp;gt;set_new_ok_code
EXPORTING
new_code = 'NEXT_ROW'
* IMPORTING
* RC =
.
" Triggers PAI of dynpro with ok_code = 'NEXT_ROW'

ENDMETHOD. "handle_data_changed


ENDCLASS. "lcl_eventhandler IMPLEMENTATION





PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '2000' OBLIGATORY.




START-OF-SELECTION.

SELECT * FROM knb1 INTO TABLE gt_knb1
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 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_grid
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

" Triggers event DATA_CHANGED when ENTER is pushed
CALL METHOD go_grid-&amp;gt;register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=&amp;gt;mc_evt_enter
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

SET HANDLER:
lcl_eventhandler=&amp;gt;handle_data_changed FOR go_grid.


* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog_knb1.



* Display data
CALL METHOD go_grid-&amp;gt;set_table_for_first_display
CHANGING
it_outtab = gt_knb1
it_fieldcatalog = gt_fcat
EXCEPTIONS
OTHERS = 4.
IF sy-subrc 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 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'.

** CALL METHOD go_grid1-&amp;gt;refresh_table_display
*** EXPORTING
*** IS_STABLE =
*** I_SOFT_REFRESH =
** EXCEPTIONS
** FINISHED = 1
** others = 2
** .
** IF sy-subrc 0.
*** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
** ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&amp;amp;---------------------------------------------------------------------
*&amp;amp; Module USER_COMMAND_0100 INPUT
&amp;amp;---------------------------------------------------------------------
* text
----------------------------------------------------------------------
MODULE user_command_0100 INPUT.

go_grid-&amp;gt;check_changed_data( ).

CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.

" NOTE: ENTER button alone works apparently only if the cursor
" is placed within the command window (left-upper corner)
WHEN 'ENTER' OR
'NEXT_ROW'.
PERFORM set_cursor_next_row.

WHEN OTHERS.
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 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

&amp;amp;---------------------------------------------------------------------
*&amp;amp; Form SET_CURSOR_NEXT_ROW
&amp;amp;---------------------------------------------------------------------
* text
----------------------------------------------------------------------
* --&amp;gt; p1 text
* &amp;lt;-- p2 text
----------------------------------------------------------------------
FORM set_cursor_next_row .
* define local data
DATA:
ls_row TYPE lvc_s_row,
ls_col TYPE lvc_s_col.



CALL METHOD go_grid-&amp;gt;get_current_cell
IMPORTING
* E_ROW =
* E_VALUE =
* E_COL =
es_row_id = ls_row
es_col_id = ls_col
* ES_ROW_NO =
.

ADD 1 TO ls_row-index. " next row

CALL METHOD go_grid-&amp;gt;set_current_cell_via_id
EXPORTING
is_row_id = ls_row
is_column_id = ls_col
* IS_ROW_NO =
.

ENDFORM. " SET_CURSOR_NEXT_ROW&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 07:27:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447335#M828028</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T07:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Editable ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447336#M828029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks For the reply, But i did had the logic to save the data . My main requirement is , when I click  on the button to save changes , These changes should be saved in Background as the number of materials to be updated are more than 1000.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2008 07:32:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/editable-alv/m-p/3447336#M828029</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-25T07:32:28Z</dc:date>
    </item>
  </channel>
</rss>

