<?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: regarding ALV Grid display using OOps in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660773#M613779</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 are lot of example programs in the Package SLIS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Aug 2007 15:18:55 GMT</pubDate>
    <dc:creator>seshatalpasai_madala</dc:creator>
    <dc:date>2007-08-10T15:18:55Z</dc:date>
    <item>
      <title>regarding ALV Grid display using OOps</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660772#M613778</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 doing the ALV  grid display report using oops concept please any one send me the simple alv grid display report code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Hari.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 15:14:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660772#M613778</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-10T15:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: regarding ALV Grid display using OOps</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660773#M613779</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 are lot of example programs in the Package SLIS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 15:18:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660773#M613779</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-08-10T15:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: regarding ALV Grid display using OOps</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660774#M613780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Check this for basic concepts of OOPS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tabstrip&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Editable ALV&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tree&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;General Tutorial for OOPS&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/reporting/alvhome.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/reporting/alvhome.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/what-is-alv-programming.htm" target="test_blank"&gt;http://www.sap-img.com/abap/what-is-alv-programming.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap-function.htm" target="test_blank"&gt;http://www.sap-img.com/abap-function.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.geocities.com/mpioud/Abap_programs.html" target="test_blank"&gt;http://www.geocities.com/mpioud/Abap_programs.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf" target="test_blank"&gt;http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap-function.htm" target="test_blank"&gt;http://www.sap-img.com/abap-function.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Classical ALV:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.geocities.com/mpioud/Abap_programs.html" target="test_blank"&gt;http://www.geocities.com/mpioud/Abap_programs.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OOPS ALV:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907" target="test_blank"&gt;https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points for useful Answers&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 15:28:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660774#M613780</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-10T15:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: regarding ALV Grid display using OOps</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660775#M613781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Search the ABAP Objects forum for my sample reports (beginning with ZUS_SDN). All of them contain at least one example of OO-based event handling. These are simplified reports showing the only the crucial points of event handling.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BCALV_GRID_01&lt;/P&gt;&lt;P&gt;BCALV_GRID_02&lt;/P&gt;&lt;P&gt;BCALV_GRID_03&lt;/P&gt;&lt;P&gt;BCALV_GRID_04&lt;/P&gt;&lt;P&gt;BCALV_GRID_05&lt;/P&gt;&lt;P&gt;BCALV_GRID_06&lt;/P&gt;&lt;P&gt;BCALV_GRID_07&lt;/P&gt;&lt;P&gt;BCALV_GRID_08&lt;/P&gt;&lt;P&gt;BCALV_GRID_09&lt;/P&gt;&lt;P&gt;BCALV_GRID_10&lt;/P&gt;&lt;P&gt;BCALV_GRID_11&lt;/P&gt;&lt;P&gt;BCALV_GRID_AND_POPUP&lt;/P&gt;&lt;P&gt;BCALV_GRID_DEMO&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&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 15:49:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660775#M613781</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-10T15:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: regarding ALV Grid display using OOps</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660776#M613782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;STEPS: &lt;/P&gt;&lt;P&gt;1.	Call a screen.&lt;/P&gt;&lt;P&gt;2.	Go to the screen layout  and add a custom control .&lt;/P&gt;&lt;P&gt;3.	Go to attribute and give a name to the custom control (Ex: 'CUSTOM_CONTROL').&lt;/P&gt;&lt;P&gt;4.	Give a name to the ok_code ( Ex: ok_code) in the attribute of the screen. &lt;/P&gt;&lt;P&gt;5.	Data Declaration section:&lt;/P&gt;&lt;P&gt;I.	Data declaration for ALV&lt;/P&gt;&lt;P&gt;a.	Declare a object type cl_gui_alv_grid for ALV Grid instance referance &lt;/P&gt;&lt;P&gt;b.	Declare a object type cl_gui_custom_container for Custom container instance referance&lt;/P&gt;&lt;P&gt;c.	Declare Name of the custom control added to the screen&lt;/P&gt;&lt;P&gt;d.	Declare field catalog table of type lvc_t_fcat.&lt;/P&gt;&lt;P&gt;e.	Declare layout of type lvc_s_layo. &lt;/P&gt;&lt;P&gt;II.	Data declaration for fetching data as input&lt;/P&gt;&lt;P&gt;III.	Declare variables for ok_code.&lt;/P&gt;&lt;P&gt;6.	Set pf-status and titlebar for the screen.&lt;/P&gt;&lt;P&gt;7.	Write PBO. IN PBO do the following:&lt;/P&gt;&lt;P&gt;i.	Check whether gr_alvgrid is initial.&lt;/P&gt;&lt;P&gt;a.	If yes do the following.&lt;/P&gt;&lt;P&gt;&amp;#149;	Create instance for  custom container (gr_container) by passing the container name.&lt;/P&gt;&lt;P&gt;&amp;#149;	Create instance for ALV grid by passing the custom control instance reference.&lt;/P&gt;&lt;P&gt;&amp;#149;	select the material data from database&lt;/P&gt;&lt;P&gt;&amp;#149;	Build field ctalog&lt;/P&gt;&lt;P&gt;&amp;#149;	Build layout&lt;/P&gt;&lt;P&gt;&amp;#149;	Call method &amp;#145;set_table_for_first_display&amp;#146; for the object gr_alvgrid(alv grid instance reference) with passing layout, input table and field catalog.&lt;/P&gt;&lt;P&gt;b.	If NO do the following.&lt;/P&gt;&lt;P&gt;&amp;#149;	Call method &amp;#145;refresh_table_display for the object gr_alvgrid(alv grid instance reference).&lt;/P&gt;&lt;P&gt;ii.	&lt;/P&gt;&lt;P&gt;8.	Write PAI. IN PAI do the following:&lt;/P&gt;&lt;P&gt;         Check the ok_code, if &amp;#145;Exit&amp;#146; then leave from program.&lt;/P&gt;&lt;P&gt;         All the user commands where user do any actions in the screen will be code here . For this purpose check the value of ok_code and according that ok_code, code the functionality for the particular user actions.&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;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  zdemoab.


************************************
*DATA DECLARATION
*************************************
*---Global data deckaration for alv
*--ALV Grid instance referance
DATA: gr_alvgrid TYPE REF TO cl_gui_alv_grid,
*--Name of the custom control added to the screen
      gc_custom_control_name TYPE scrfname VALUE 'CUSTOM_CONTROL',
*--Custom container instance referance
      gr_container TYPE REF TO cl_gui_custom_container,
*--Field catalog table
      gt_fieldcat TYPE lvc_t_fcat,
*--Layout structure
      gs_layout TYPE lvc_s_layo.

DATA: ok_code LIKE sy-ucomm,
      save_ok LIKE sy-ucomm.


*---Input table
TYPES: BEGIN OF t_mara,
        matnr TYPE mara-matnr,
        mtart TYPE mara-mtart,
        matkl TYPE mara-matkl,
        meins TYPE mara-meins,
      END OF t_mara.
TYPES: t_mara_table TYPE STANDARD TABLE OF t_mara.

DATA: gt_mara TYPE STANDARD TABLE OF t_mara.

************************************
*MAIN
*************************************
CALL SCREEN 101.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_0101  OUTPUT
*&amp;amp;---------------------------------------------------------------------*

MODULE status_0101 OUTPUT.
  SET PF-STATUS 'STATUS-0101'.
  SET TITLEBAR 'TITLE'.

ENDMODULE.                 " STATUS_0101  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  display_alv  OUTPUT
*&amp;amp;---------------------------------------------------------------------*

MODULE display_alv OUTPUT.

  IF gr_alvgrid IS INITIAL.
*----Create custom container instance
    CREATE OBJECT gr_container
      EXPORTING
        container_name              = gc_custom_control_name
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        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 instance
    CREATE OBJECT gr_alvgrid
      EXPORTING
        i_parent          = gr_container
      EXCEPTIONS
        error_cntl_create = 1
        error_cntl_init   = 2
        error_cntl_link   = 3
        error_dp_create   = 4
        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.

* select the material data from database
    PERFORM get_input CHANGING gt_mara..
* prepare field catalog
    PERFORM prepare_fieldcatalog CHANGING gt_fieldcat.
* prepare layout
    PERFORM prepare_layout CHANGING gs_layout.


    CALL METHOD gr_alvgrid-&amp;gt;set_table_for_first_display
      EXPORTING
        is_layout                     = gs_layout
      CHANGING
        it_outtab                     = gt_mara[]
        it_fieldcatalog               = gt_fieldcat
      EXCEPTIONS
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        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.
  ELSE.
    CALL METHOD gr_alvgrid-&amp;gt;refresh_table_display
      EXCEPTIONS
        finished = 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.


  ENDIF.
ENDMODULE.                 " display_alv  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  get_input
*&amp;amp;---------------------------------------------------------------------*
FORM get_input CHANGING gt_mara_table TYPE t_mara_table.
  SELECT matnr mtart matkl meins INTO TABLE gt_mara_table
                                 FROM mara UP TO 10 ROWS.
ENDFORM.                    " get_input
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  prepare_fieldcatalog
*&amp;amp;---------------------------------------------------------------------*

FORM prepare_fieldcatalog  CHANGING gt_fieldcat_table TYPE lvc_t_fcat.

  DATA: ls_fcat TYPE lvc_s_fcat,
        l_col_no TYPE i.

  CLEAR: ls_fcat,
         l_col_no .

  l_col_no = l_col_no + 1.
  ls_fcat-fieldname = 'MATNR'.
  ls_fcat-ref_table = 'MARA'.
  ls_fcat-col_pos   = l_col_no.
  ls_fcat-outputlen = 18.
  ls_fcat-coltext   = 'Material No'.
  ls_fcat-seltext   = 'Material No'.
  APPEND ls_fcat TO gt_fieldcat_table.

  l_col_no = l_col_no + 1.
  ls_fcat-fieldname = 'MTART'.
  ls_fcat-ref_table = 'MARA'.
  ls_fcat-col_pos   = l_col_no.
  ls_fcat-outputlen = 4.
  ls_fcat-coltext   = 'Material type'.
  ls_fcat-seltext   = 'Material type'.
  APPEND ls_fcat TO gt_fieldcat_table.

  l_col_no = l_col_no + 1.
  ls_fcat-fieldname = 'MATKL'.
  ls_fcat-ref_table = 'MARA'.
  ls_fcat-col_pos   = l_col_no.
  ls_fcat-outputlen = 9.
  ls_fcat-coltext   = 'Material group'.
  ls_fcat-seltext   = 'Material group'.
  APPEND ls_fcat TO gt_fieldcat_table.

  l_col_no = l_col_no + 1.
  ls_fcat-fieldname = 'MEINS'.
  ls_fcat-ref_table = 'MARA'.
  ls_fcat-col_pos   = l_col_no.
  ls_fcat-outputlen = 3.
  ls_fcat-coltext   = 'Unit'.
  ls_fcat-seltext   = 'Unit'.
  APPEND ls_fcat TO gt_fieldcat_table.

  CLEAR: ls_fcat,
         l_col_no .

ENDFORM.                    " prepare_fieldcatalog
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  prepare_layout
*&amp;amp;---------------------------------------------------------------------*
FORM prepare_layout  CHANGING p_gs_layout TYPE lvc_s_layo.

  p_gs_layout-zebra = 'X'.
  p_gs_layout-grid_title = 'Material'.
  p_gs_layout-smalltitle = 'X'.

ENDFORM.                    " prepare_layout
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0101  INPUT
*&amp;amp;---------------------------------------------------------------------*

MODULE user_command_0101 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'EXIT'.
      PERFORM exit_program.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0101  INPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  exit_program
*&amp;amp;---------------------------------------------------------------------*
FORM exit_program .
  LEAVE PROGRAM.
ENDFORM.                    " exit_program&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 16:19:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660776#M613782</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-10T16:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: regarding ALV Grid display using OOps</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660777#M613783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: g_container TYPE scrfname VALUE 'CUSTOM CONTROL',
      g_custom_container TYPE REF TO cl_gui_custom_container,
      g_grid  TYPE REF TO cl_gui_alv_grid,
      gs_layout TYPE lvc_s_layo,
      ok_code LIKE sy-ucomm,
      save_ok LIKE sy-ucomm.
.

DATA: gt_outtab TYPE TABLE OF sflight.


*---------------------------------------------------------------------*
*       MAIN                                                          *
*---------------------------------------------------------------------*
CALL SCREEN 100 STARTING AT 1 1..

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_0100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*

MODULE status_0100 OUTPUT.
  SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'MAIN100'.

ENDMODULE.                 " STATUS_0100  OUTPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  pbo  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
MODULE pbo OUTPUT.

  IF g_custom_container IS INITIAL.

    CREATE OBJECT g_custom_container
      EXPORTING
        container_name              = g_container
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        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 OBJECT g_grid
      EXPORTING
        i_parent          = g_custom_container
      EXCEPTIONS
        error_cntl_create = 1
        error_cntl_init   = 2
        error_cntl_link   = 3
        error_dp_create   = 4
        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.

    gs_layout-edit = 'X'.

    SELECT * FROM sflight INTO TABLE gt_outtab UP TO 10 ROWS.

*§1.Set status of all cells to editable using the layout structure.
    CALL METHOD g_grid-&amp;gt;set_table_for_first_display
      EXPORTING
        i_structure_name              = 'SFLIGHT'
        is_layout                     = gs_layout
      CHANGING
        it_outtab                     = gt_outtab
      EXCEPTIONS
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        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.

*§2.Use SET_READY_FOR_INPUT to allow editing initially.
    CALL METHOD g_grid-&amp;gt;set_ready_for_input
      EXPORTING
        i_ready_for_input = 1.

  ENDIF.
ENDMODULE.                 " pbo  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  pai  INPUT
*&amp;amp;---------------------------------------------------------------------*
MODULE pai INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'EXIT'.
      PERFORM exit_program.
    WHEN 'SWITCH'.
      PERFORM switch_edit_mode.
    WHEN OTHERS.
*     do nothing
  ENDCASE.
ENDMODULE.                 " pai  INPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  exit_program
*&amp;amp;---------------------------------------------------------------------*
FORM exit_program .
  LEAVE PROGRAM.
ENDFORM.                    " exit_program
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  switch_edit_mode
*&amp;amp;---------------------------------------------------------------------*
FORM switch_edit_mode .

*§3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.
  IF g_grid-&amp;gt;is_ready_for_input( ) EQ 0.
    CALL METHOD g_grid-&amp;gt;set_ready_for_input
      EXPORTING
        i_ready_for_input = 1.
  ELSE.
    CALL METHOD g_grid-&amp;gt;set_ready_for_input
      EXPORTING
        i_ready_for_input = 0.
  ENDIF.
ENDFORM.                    " switch_edit_mode&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 16:20:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-alv-grid-display-using-oops/m-p/2660777#M613783</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-10T16:20:22Z</dc:date>
    </item>
  </channel>
</rss>

