<?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 alv grid display in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/3418859#M821141</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;There is report which uses ALV Grid display. In the Output i can change the value of a coloumn. now if the Output list has several pages,and if i change the value of a filed,say in page 3, and after i press enter the display goes back to page 1.This happens everytime i make a change in any page.I want the display to be in the same page where i make changes. can some one tell me how to handle this? Is there any method for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Challa.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Feb 2008 19:28:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-12T19:28:18Z</dc:date>
    <item>
      <title>alv grid display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/3418859#M821141</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;There is report which uses ALV Grid display. In the Output i can change the value of a coloumn. now if the Output list has several pages,and if i change the value of a filed,say in page 3, and after i press enter the display goes back to page 1.This happens everytime i make a change in any page.I want the display to be in the same page where i make changes. can some one tell me how to handle this? Is there any method for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Challa.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2008 19:28:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/3418859#M821141</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-12T19:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: alv grid display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/3418860#M821142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try with &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

CALL METHOD  &amp;lt;ref.var. to  CL_GUI_ALV_GRID &amp;gt; -&amp;gt;set_current_cell_via_id

   EXPORTING
      IS_ROW_ID    =   &amp;lt;structure of type LVC_S_ROW &amp;gt; 
      IS_COLUMN_ID =   &amp;lt;structure of type LVC_S_COL &amp;gt;
      IS_ROW_NO    =   &amp;lt;structure of type LVC_S_ROID &amp;gt;.


&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>Wed, 13 Feb 2008 02:00:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/3418860#M821142</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2008-02-13T02:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: alv grid display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/3418861#M821143</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 arrived at that point. But i dont know how to proceed further. If i use CALL METHOD  &amp;lt;ref.var. to  CL_GUI_ALV_GRID &amp;gt; -&amp;gt;set_current_cell_via_id&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   EXPORTING&lt;/P&gt;&lt;P&gt;      IS_ROW_ID    =   &amp;lt;structure of type LVC_S_ROW &amp;gt; &lt;/P&gt;&lt;P&gt;      IS_COLUMN_ID =   &amp;lt;structure of type LVC_S_COL &amp;gt;&lt;/P&gt;&lt;P&gt;      IS_ROW_NO    =   &amp;lt;structure of type LVC_S_ROID &amp;gt;.&lt;/P&gt;&lt;P&gt;If i change the value of a field in a particular row, the display is at the same row but the updated value is not displayed(not getting updated).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also can you help me how to Pass values to is_row_id and all those parameters. I use event double click to select the filed and change the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Challa.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2008 03:53:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/3418861#M821143</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-14T03:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: alv grid display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/3418862#M821144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm feeling kind today so here is a complete example of an editable Grid.&lt;/P&gt;&lt;P&gt;It's really easy --once you've done this you should NEVER need any more info on ALV GRIDS (or at least the Non Tree variety)..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I HATE the stupid Plane seats / airline system used in SAP examples so I've got a MUCH EASIER one here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Column 1 contains a Hotspot sales order - click it and VA03 is entered . After the display the Grid is re-entered and the last column in the table is updated with a 'V'. The cursor  is also placed on the sales order selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other columns can be double clicked - for example if a material is double clicked then MM03 is entered. After the exit from the transaction  as before the table is updated with a V and the cursor set to the cell that was double clicked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There's also a toolbar extra button -- the method doesn't do anything except is entered --here you can add your own code.  The toolbar method adds user toolbars to the ALV Grid which are executed in the ON_USER_COMMAND  method.&lt;/P&gt;&lt;P&gt;It's all simply commented as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a bonus here I've used the new RTTI functionality (4.6C and onwards) so FOR ANY STRUCTURE we can build automatically a field catalog and a dynamic table so the code here can be used as a model whateverr your actual data structures are.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can actually edit the data --it currently doesn't do anything however.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will need to implement ON_DATA_CHANGED&lt;/P&gt;&lt;P&gt;and ON_DATA_CHAGED_FINISHED methods -- &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These need to be registered via  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 CALL METHOD grid1-&amp;gt;register_edit_event
       EXPORTING
          i_event_id = cl_gui_alv_grid=&amp;gt;mc_evt_enter.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will need also to add the handlers and methods for these -- however like all typical textbooks : I'll leave this as an exercise for our readers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code here works --t o add the data changed facility is really easy but you must do something yourselves to show you've understoood the basic functionality.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NO MORE  SLIS Function modules needed -- after all this IS the OO Forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However to use  the program you DO have to do 2 little pieces of work yourselves.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) create a screen ( SE51) with a single element on it a Custom container called CCONTAINER1.  Uncomment the genereated PAI and PBO logic in the screen before you activate it..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Create a standard status  (SE 41) 001 with a title 000. Just 3 buttons on this are needed BACK, EXIT, CANCEL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now here's the code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PROGRAM zzz_simple_editable_grid.
INCLUDE &amp;lt;icon&amp;gt;.
DATA grid1 TYPE REF TO cl_gui_alv_grid..
DATA: es_row_no TYPE lvc_s_roid,
     ls_row_id  TYPE lvc_s_row,
     ls_col_id TYPE  lvc_s_col,
     ls_row    TYPE i,
     ls_value  TYPE c,
     ls_col    TYPE i,
     ls_row_no  TYPE lvc_s_roid.

CLASS lcl_event_handler DEFINITION .
  PUBLIC SECTION .
    METHODS:
**Hot spot Handler
    handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
                      IMPORTING e_row_id e_column_id es_row_no,
**Double Click Handler
    handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
                                    IMPORTING e_row e_column es_row_no,
** Toolbar handler.
 handle_toolbar
        FOR EVENT toolbar OF cl_gui_alv_grid
            IMPORTING e_object e_interactive,
* button press
    handle_user_command
        FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING e_ucomm.

ENDCLASS.                    "lcl_event_handler DEFINITION

CLASS lcl_event_handler IMPLEMENTATION.

*Handle Hotspot Click
  METHOD handle_hotspot_click .
    PERFORM mouse_click
      USING e_row_id
            e_column_id.
    CALL METHOD grid1-&amp;gt;get_current_cell
       IMPORTING
         e_row     = ls_row
         e_value   = ls_value
         e_col     = ls_col
         es_row_id = ls_row_id
        es_col_id = ls_col_id
        es_row_no = es_row_no.


    CALL METHOD grid1-&amp;gt;refresh_table_display.
    CALL METHOD grid1-&amp;gt;set_current_cell_via_id

  EXPORTING
    is_column_id =  e_column_id
    is_row_no  =  es_row_no.



  ENDMETHOD.                    "lcl_event_handler

*Handle Double Click
  METHOD  handle_double_click.

    PERFORM double_click
       USING e_row
       e_column.

    CALL METHOD grid1-&amp;gt;get_current_cell
    IMPORTING
    e_row     = ls_row
    e_value   = ls_value
    e_col     = ls_col
    es_row_id = ls_row_id
   es_col_id = ls_col_id
   es_row_no = es_row_no.

    CALL METHOD grid1-&amp;gt;refresh_table_display.

    CALL METHOD grid1-&amp;gt;set_current_cell_via_id

  EXPORTING
    is_column_id =  ls_col_id
    is_row_no  =  es_row_no.



  ENDMETHOD.

  METHOD handle_toolbar.
    DATA: ls_toolbar  TYPE stb_button.
* append a separator to normal toolbar
    CLEAR ls_toolbar.
    MOVE 3 TO ls_toolbar-butn_type.
    APPEND ls_toolbar TO e_object-&amp;gt;mt_toolbar.
* append an icon for your function
    CLEAR ls_toolbar.
    MOVE 'FUNC' TO ls_toolbar-function.
    MOVE icon_railway TO ls_toolbar-icon.
    MOVE 'Your Function' TO ls_toolbar-quickinfo.
    MOVE 'Your user function' TO ls_toolbar-text.
    MOVE ' ' TO ls_toolbar-disabled.
    APPEND ls_toolbar TO e_object-&amp;gt;mt_toolbar.

  ENDMETHOD.
  METHOD handle_user_command.
    BREAK-POINT 1.
    CASE e_ucomm.
      WHEN 'FUNC'.    "Your button
* Perform what you need to do.
      WHEN OTHERS.
    ENDCASE.
  ENDMETHOD.

ENDCLASS.

* Define any structure
TYPES:  BEGIN OF s_elements,
  vbeln   TYPE vapma-vbeln,
  posnr   TYPE vapma-posnr,
  matnr   TYPE vapma-matnr,
  kunnr   TYPE vapma-kunnr,
  werks   TYPE vapma-werks,
  vkorg   TYPE vapma-vkorg,
  vkbur   TYPE vapma-vkbur,
  status  TYPE c,

END OF  s_elements.

* end of your structure
DATA:wa_elements TYPE s_elements.
DATA: ord_nr TYPE vapma-vbeln,
      mat_nr TYPE vapma-matnr,
      cus_nr TYPE vapma-kunnr.


DATA lr_rtti_struc TYPE REF TO cl_abap_structdescr .
DATA:
zog                     LIKE LINE OF lr_rtti_struc-&amp;gt;components .
DATA:
zogt                    LIKE TABLE OF zog,
wa_it_fldcat TYPE lvc_s_fcat,
it_fldcat TYPE lvc_t_fcat ,
dy_line            TYPE REF TO data,
dy_table           TYPE REF TO data.
DATA:  dref               TYPE REF TO data.
FIELD-SYMBOLS: &amp;lt;fs&amp;gt; TYPE ANY,
   &amp;lt;dyn_table&amp;gt;    TYPE  STANDARD TABLE,
   &amp;lt;dyn_wa&amp;gt;.

DATA grid_container1 TYPE REF TO cl_gui_custom_container .
DATA: g_handler TYPE REF TO lcl_event_handler. "handler

DATA: ok_code TYPE sy-ucomm.
DATA: struct_grid_lset TYPE lvc_s_layo.

START-OF-SELECTION.
*now I want to build a field catalog
* First get your data structure into a field symbol

  CREATE DATA dref TYPE s_elements.
  ASSIGN dref-&amp;gt;* TO &amp;lt;fs&amp;gt;.

  lr_rtti_struc ?= cl_abap_structdescr=&amp;gt;describe_by_data( &amp;lt;fs&amp;gt; ).

* Now get the structure details into a table.
* table zogt[] contains the structure details
* From which we can build the field catalog

  zogt[]  = lr_rtti_struc-&amp;gt;components.
  LOOP AT zogt INTO zog.
    CLEAR wa_it_fldcat.
    wa_it_fldcat-fieldname = zog-name .
    wa_it_fldcat-datatype = zog-type_kind.
    wa_it_fldcat-inttype = zog-type_kind.
    wa_it_fldcat-intlen = zog-length.
    wa_it_fldcat-decimals = zog-decimals.
    wa_it_fldcat-coltext = zog-name.
    wa_it_fldcat-lowercase = 'X'.
    IF wa_it_fldcat-fieldname = 'VBELN'.
      wa_it_fldcat-hotspot = 'X'.
    ENDIF.
    APPEND wa_it_fldcat TO it_fldcat.

  ENDLOOP.
*
* You can perform any modifications / additions to your field catalog
* here such as your own column names etc.

* Now using the field catalog created above we can
* build a dynamic table
* and populate it

* First build the dynamic table
* the table will contain entries for
* our structure defined at the start of the program

  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
         EXPORTING
              it_fieldcatalog = it_fldcat
         IMPORTING
              ep_table = dy_table.


  ASSIGN dy_table-&amp;gt;* TO &amp;lt;dyn_table&amp;gt;.
  CREATE DATA dy_line LIKE LINE OF &amp;lt;dyn_table&amp;gt;.
  ASSIGN dy_line-&amp;gt;* TO &amp;lt;dyn_wa&amp;gt;.

* Now fill our table with data

  SELECT vbeln posnr matnr kunnr werks vkorg vkbur
         UP TO 200 ROWS
         FROM vapma
         INTO  CORRESPONDING FIELDS OF TABLE &amp;lt;dyn_table&amp;gt;.

* Call the screen to display the grid
  CALL SCREEN 100.


FORM double_click
USING e_row   TYPE lvc_s_row
e_column      TYPE lvc_s_col.
  READ TABLE &amp;lt;dyn_table&amp;gt; INDEX e_row INTO wa_elements.

  CASE e_column-fieldname.
    WHEN 'MATNR'.
      mat_nr = wa_elements-matnr.
      SET PARAMETER ID 'MAT'  FIELD mat_nr.
      CALL TRANSACTION  'MM03' AND SKIP FIRST SCREEN.
    WHEN 'KUNNR'.
      cus_nr = wa_elements-kunnr.
      SET PARAMETER ID 'KUN'  FIELD cus_nr.
      CALL TRANSACTION  'XD03' AND SKIP FIRST SCREEN.
    WHEN OTHERS.
  ENDCASE.
  wa_elements-status = 'V'.
  MODIFY &amp;lt;dyn_table&amp;gt; FROM wa_elements INDEX e_row.

ENDFORM.

FORM mouse_click
  USING e_row TYPE lvc_s_row
        e_column_id TYPE  lvc_s_col.
  READ TABLE &amp;lt;dyn_table&amp;gt; INDEX e_row INTO wa_elements.


  ord_nr = wa_elements-vbeln.
  SET PARAMETER ID 'AUN'  FIELD ord_nr.

  CALL TRANSACTION  'VA03' AND SKIP FIRST SCREEN.
  wa_elements-status = 'V'.
  MODIFY &amp;lt;dyn_table&amp;gt; FROM wa_elements INDEX e_row.



ENDFORM.

* PBO module

MODULE status_0100 OUTPUT.
  DATA: off TYPE int4.
  IF sy-batch = 'X'.
    CALL METHOD cl_gui_alv_grid=&amp;gt;offline
   RECEIVING
   e_offline = off.
  ENDIF.

  IF sy-batch = 'X'.
    IF ( off IS INITIAL ).
      CREATE OBJECT grid_container1
              EXPORTING
                 container_name = 'CCONTAINER1'.
      CREATE OBJECT  grid1
         EXPORTING
            i_parent = grid_container1.
    ENDIF.
  ENDIF.
  IF sy-batch NE 'X'.

    IF grid_container1 IS INITIAL.
      CREATE OBJECT grid_container1
              EXPORTING
                 container_name = 'CCONTAINER1'.
    ENDIF.
    CREATE OBJECT  grid1
       EXPORTING
          i_parent = grid_container1.
    IF sy-batch NE 'X'.
      struct_grid_lset-edit = 'X'.    "To enable editing in ALV
    ENDIF.
  ENDIF.

  CREATE OBJECT g_handler.
  SET HANDLER g_handler-&amp;gt;handle_double_click FOR grid1.
  SET HANDLER g_handler-&amp;gt;handle_hotspot_click FOR grid1.
  SET HANDLER g_handler-&amp;gt;handle_toolbar FOR grid1.
  SET HANDLER g_handler-&amp;gt;handle_user_command FOR grid1.
  CALL METHOD grid1-&amp;gt;register_edit_event
       EXPORTING
          i_event_id = cl_gui_alv_grid=&amp;gt;mc_evt_enter.


  CALL METHOD grid1-&amp;gt;set_table_for_first_display
    EXPORTING is_layout =  struct_grid_lset
    CHANGING
               it_outtab       = &amp;lt;dyn_table&amp;gt;
               it_fieldcatalog = it_fldcat.

  SET PF-STATUS '001'.
  SET TITLEBAR '000'.

ENDMODULE.

* PAI module

MODULE user_command_0100 INPUT.
  CASE sy-ucomm.
    WHEN 'BACK'.
      LEAVE PROGRAM.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
    WHEN 'RETURN'.
      LEAVE PROGRAM.
    WHEN OTHERS.
  ENDCASE.
ENDMODULE.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and isn't it easy !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jimbo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2008 11:11:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/3418862#M821144</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-14T11:11:35Z</dc:date>
    </item>
  </channel>
</rss>

