<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ALV display using OOPS method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-display-using-oops-method/m-p/3500874#M842067</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sameer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;gt; For displaying ALV we are using oops method .&lt;/P&gt;&lt;P&gt;&amp;gt; for this method we need to fix size of container in screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FALSE.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need a container then define it as resizable in the screen painter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do not require a container because the only screen element is the ALV grid which should cover the entire dynpro then I always use a docking container and set its extension value extremely high (99999). The docking container is then linked to the empty dynrpo (see sample report &lt;STRONG&gt;ZUS_SDN_ALV_FULLSCREEN&lt;/STRONG&gt; ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZUS_SDN_ALV_EDITABLE
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;

* Flow logic of screen '100' (no elements, ok-code =&amp;gt; gd_okcode ):
**PROCESS BEFORE OUTPUT.
**  MODULE STATUS_0100.
***
**PROCESS AFTER INPUT.
**  MODULE USER_COMMAND_0100.
*&amp;amp;---------------------------------------------------------------------*

REPORT  zus_sdn_alv_editable_1c.


TYPE-POOLS: abap.


CONSTANTS:
  gc_tabname       TYPE tabname  VALUE 'KNB1'.


TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE knb1.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                      WITH DEFAULT KEY.

DATA:
  gd_okcode        TYPE ui_func,
  gd_repid         TYPE syrepid,
*
  gt_fcat          TYPE lvc_t_fcat,
  gs_layout        TYPE lvc_s_layo,
  gs_variant       TYPE disvariant,
  go_docking       TYPE REF TO cl_gui_docking_container,
  go_grid          TYPE REF TO cl_gui_alv_grid.


DATA:
  gs_outtab        TYPE ty_s_outtab,
  gt_outtab        TYPE ty_t_outtab.



START-OF-SELECTION.

  SELECT * FROM  (gc_tabname) INTO TABLE gt_outtab UP TO 99 ROWS.





* Create docking container
  CREATE OBJECT go_docking
    EXPORTING
      parent = cl_gui_container=&amp;gt;screen0
      ratio  = 90  " 90% yet not full-screen size
    EXCEPTIONS
      OTHERS = 6.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  CALL METHOD go_docking-&amp;gt;set_extension
    EXPORTING
      extension  = 99999  " full-screen size !!!
    EXCEPTIONS
      cntl_error = 1
      OTHERS     = 2.
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* Create ALV grid
  CREATE OBJECT go_grid
    EXPORTING
      i_parent = go_docking
    EXCEPTIONS
      OTHERS   = 5.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.



* Build fieldcatalog and set hotspot for field KUNNR
  PERFORM build_fieldcatalog.

  PERFORM set_layout_and_variant.


* Display data
  CALL METHOD go_grid-&amp;gt;set_table_for_first_display
    EXPORTING
      is_layout       = gs_layout
      is_variant      = gs_variant
      i_save          = 'A'
    CHANGING
      it_outtab       = gt_outtab
      it_fieldcatalog = gt_fcat
    EXCEPTIONS
      OTHERS          = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

* NOTE:
* Documenation of I_SAVE ("An Easy Reference for ALV Grid Control")
*I_SAVE
*Determines the options available to the user for saving a layout:
*? 'X': global saving only
*? 'U': user-specific saving only
*? 'A': corresponds to 'X' and 'U'
*? SPACE: no saving



* Link the docking container to the target dynpro
  gd_repid = syst-repid.
  CALL METHOD go_docking-&amp;gt;link
    EXPORTING
      repid                       = gd_repid
      dynnr                       = '0100'
*      CONTAINER                   =
    EXCEPTIONS
      OTHERS                      = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* ok-code field = GD_OKCODE
  CALL SCREEN '0100'.


END-OF-SELECTION.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_0100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.
*  SET TITLEBAR 'xxx'.


ENDMODULE.                 " STATUS_0100  OUTPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0100  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.


  CASE gd_okcode.
    WHEN 'BACK'  OR
         'EXIT'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.


    WHEN OTHERS.
  ENDCASE.

  CLEAR: gd_okcode.

ENDMODULE.                 " USER_COMMAND_0100  INPUT


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  BUILD_FIELDCATALOG
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM build_fieldcatalog .
* define local data
  DATA:
    ls_fcat        TYPE lvc_s_fcat.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
*     I_BUFFER_ACTIVE              =
      i_structure_name             = gc_tabname
*     I_CLIENT_NEVER_DISPLAY       = 'X'
*     I_BYPASSING_BUFFER           =
*     I_INTERNAL_TABNAME           =
    CHANGING
      ct_fieldcat                  = gt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.



ENDFORM.                    " BUILD_FIELDCATALOG


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  SET_LAYOUT_AND_VARIANT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM set_layout_and_variant .

  CLEAR: gs_layout,
         gs_variant.

  gs_layout-cwidth_opt = abap_true.
  gs_layout-zebra      = abap_true.

  gs_variant-report = syst-repid.
  gs_variant-handle = 'GRID'.

ENDFORM.                    " SET_LAYOUT_AND_VARIANT
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Mar 2008 21:12:54 GMT</pubDate>
    <dc:creator>uwe_schieferstein</dc:creator>
    <dc:date>2008-03-05T21:12:54Z</dc:date>
    <item>
      <title>ALV display using OOPS method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-display-using-oops-method/m-p/3500873#M842066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For displaying ALV we are using oops method .&lt;/P&gt;&lt;P&gt;for this method we need to fix size of container in screen&lt;/P&gt;&lt;P&gt;When user changes screen resolution user wont get fullscreen display&lt;/P&gt;&lt;P&gt;for ALV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To overcome this problem if we design a screen using maximum screen&lt;/P&gt;&lt;P&gt;size. Then scrollbar dosnt work for all resolution&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Steps for the Reconstruction  &lt;/P&gt;&lt;P&gt;1 For resolution 1024 x 768 design Full screen ALV container&lt;/P&gt;&lt;P&gt;User will get fullscreen display &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Now change resolution 1280 x 1024 display same alv report. &lt;/P&gt;&lt;P&gt;Report dosnt utilize full screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. For resolution 1280 x 1024 design full screen container.&lt;/P&gt;&lt;P&gt;display ALV report in this container. It will work perfect &lt;/P&gt;&lt;P&gt;for 1208 x 1024 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Now change resolution back to 1024 x 768&lt;/P&gt;&lt;P&gt;ALV will display in full screen but scroll bar dosnt scroll till &lt;/P&gt;&lt;P&gt;last column&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Please let me know if you have any suggestions to have full screen ALV container for all screen resolutions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 11:44:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-display-using-oops-method/m-p/3500873#M842066</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-05T11:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: ALV display using OOPS method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-display-using-oops-method/m-p/3500874#M842067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sameer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;gt; For displaying ALV we are using oops method .&lt;/P&gt;&lt;P&gt;&amp;gt; for this method we need to fix size of container in screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FALSE.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need a container then define it as resizable in the screen painter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do not require a container because the only screen element is the ALV grid which should cover the entire dynpro then I always use a docking container and set its extension value extremely high (99999). The docking container is then linked to the empty dynrpo (see sample report &lt;STRONG&gt;ZUS_SDN_ALV_FULLSCREEN&lt;/STRONG&gt; ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZUS_SDN_ALV_EDITABLE
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;

* Flow logic of screen '100' (no elements, ok-code =&amp;gt; gd_okcode ):
**PROCESS BEFORE OUTPUT.
**  MODULE STATUS_0100.
***
**PROCESS AFTER INPUT.
**  MODULE USER_COMMAND_0100.
*&amp;amp;---------------------------------------------------------------------*

REPORT  zus_sdn_alv_editable_1c.


TYPE-POOLS: abap.


CONSTANTS:
  gc_tabname       TYPE tabname  VALUE 'KNB1'.


TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE knb1.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                      WITH DEFAULT KEY.

DATA:
  gd_okcode        TYPE ui_func,
  gd_repid         TYPE syrepid,
*
  gt_fcat          TYPE lvc_t_fcat,
  gs_layout        TYPE lvc_s_layo,
  gs_variant       TYPE disvariant,
  go_docking       TYPE REF TO cl_gui_docking_container,
  go_grid          TYPE REF TO cl_gui_alv_grid.


DATA:
  gs_outtab        TYPE ty_s_outtab,
  gt_outtab        TYPE ty_t_outtab.



START-OF-SELECTION.

  SELECT * FROM  (gc_tabname) INTO TABLE gt_outtab UP TO 99 ROWS.





* Create docking container
  CREATE OBJECT go_docking
    EXPORTING
      parent = cl_gui_container=&amp;gt;screen0
      ratio  = 90  " 90% yet not full-screen size
    EXCEPTIONS
      OTHERS = 6.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  CALL METHOD go_docking-&amp;gt;set_extension
    EXPORTING
      extension  = 99999  " full-screen size !!!
    EXCEPTIONS
      cntl_error = 1
      OTHERS     = 2.
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* Create ALV grid
  CREATE OBJECT go_grid
    EXPORTING
      i_parent = go_docking
    EXCEPTIONS
      OTHERS   = 5.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.



* Build fieldcatalog and set hotspot for field KUNNR
  PERFORM build_fieldcatalog.

  PERFORM set_layout_and_variant.


* Display data
  CALL METHOD go_grid-&amp;gt;set_table_for_first_display
    EXPORTING
      is_layout       = gs_layout
      is_variant      = gs_variant
      i_save          = 'A'
    CHANGING
      it_outtab       = gt_outtab
      it_fieldcatalog = gt_fcat
    EXCEPTIONS
      OTHERS          = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

* NOTE:
* Documenation of I_SAVE ("An Easy Reference for ALV Grid Control")
*I_SAVE
*Determines the options available to the user for saving a layout:
*? 'X': global saving only
*? 'U': user-specific saving only
*? 'A': corresponds to 'X' and 'U'
*? SPACE: no saving



* Link the docking container to the target dynpro
  gd_repid = syst-repid.
  CALL METHOD go_docking-&amp;gt;link
    EXPORTING
      repid                       = gd_repid
      dynnr                       = '0100'
*      CONTAINER                   =
    EXCEPTIONS
      OTHERS                      = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* ok-code field = GD_OKCODE
  CALL SCREEN '0100'.


END-OF-SELECTION.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_0100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.
*  SET TITLEBAR 'xxx'.


ENDMODULE.                 " STATUS_0100  OUTPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0100  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.


  CASE gd_okcode.
    WHEN 'BACK'  OR
         'EXIT'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.


    WHEN OTHERS.
  ENDCASE.

  CLEAR: gd_okcode.

ENDMODULE.                 " USER_COMMAND_0100  INPUT


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  BUILD_FIELDCATALOG
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM build_fieldcatalog .
* define local data
  DATA:
    ls_fcat        TYPE lvc_s_fcat.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
*     I_BUFFER_ACTIVE              =
      i_structure_name             = gc_tabname
*     I_CLIENT_NEVER_DISPLAY       = 'X'
*     I_BYPASSING_BUFFER           =
*     I_INTERNAL_TABNAME           =
    CHANGING
      ct_fieldcat                  = gt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.



ENDFORM.                    " BUILD_FIELDCATALOG


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  SET_LAYOUT_AND_VARIANT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM set_layout_and_variant .

  CLEAR: gs_layout,
         gs_variant.

  gs_layout-cwidth_opt = abap_true.
  gs_layout-zebra      = abap_true.

  gs_variant-report = syst-repid.
  gs_variant-handle = 'GRID'.

ENDFORM.                    " SET_LAYOUT_AND_VARIANT
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 21:12:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-display-using-oops-method/m-p/3500874#M842067</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-03-05T21:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: ALV display using OOPS method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-display-using-oops-method/m-p/3500875#M842068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Uwe,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply. I used docking container and i get the desired result in different screen resolution. I had 2 more questions:&lt;/P&gt;&lt;P&gt;1. Is docking container generally used for background transactions? or it can be used for frontend also.&lt;/P&gt;&lt;P&gt;2. We are facing issues for subtotals, is it not possible to use sort functionality with subtotals if we use docking containers?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sameer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2008 13:35:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-display-using-oops-method/m-p/3500875#M842068</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-06T13:35:02Z</dc:date>
    </item>
  </channel>
</rss>

