Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV size should be adjustable to screen resolution automatically

Former Member
0 Likes
3,387

Hi,

Is there in any way that the size of ALV grid should be adjustable to screen resolution automatically?

Thanks & Regards,

Reena

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
1,773

Hello Reena

If your ALV list is the only element on your dynpro then you should not use a custom container on the dynpro. Instead use the following approach:

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_ALVLIST_FULLSCREEN
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
 
REPORT  zus_sdn_alvlist_fullscreen.
 
 
DATA:
  gt_kna1           TYPE STANDARD TABLE OF kna1.
 
 
DATA:
  go_docking        TYPE REF TO cl_gui_docking_container,
  go_alvgrid        TYPE REF TO cl_gui_alv_grid.
 
 
 
START-OF-SELECTION.
* Select some data
  SELECT * FROM  kna1 INTO TABLE gt_kna1.
 
* Create docking container and dock at left side
  CREATE OBJECT go_docking
    EXPORTING
      parent                      = cl_gui_container=>screen0
*      REPID                       =
*      DYNNR                       =
      side                        =
                  cl_gui_docking_container=>dock_at_left
*      EXTENSION                   = 50
*      STYLE                       =
*      LIFETIME                    = lifetime_default
*      CAPTION                     =
*      METRIC                      = 0
      ratio                       = 90  " 90% of screen
    EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      create_error                = 3
      lifetime_error              = 4
      lifetime_dynpro_dynpro_link = 5
      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.
 
* Set very high extension -> not overruled by screen resizing
  CALL METHOD go_docking->set_extension
    EXPORTING
      extension  = 99999
    EXCEPTIONS
      CNTL_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.
 
 
 
 
* Create ALV grid
  CREATE OBJECT go_alvgrid
    EXPORTING
      i_parent          = go_docking
    EXCEPTIONS
      error_cntl_create = 1
      error_cntl_init   = 2
      error_cntl_link   = 3
      error_dp_create   = 4
      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.
 
 
 
 
 
 
  CALL METHOD go_alvgrid->set_table_for_first_display
    EXPORTING
*      I_BUFFER_ACTIVE               =
*      I_BYPASSING_BUFFER            =
*      I_CONSISTENCY_CHECK           =
      i_structure_name              = 'KNA1'
*      IS_VARIANT                    =
*      I_SAVE                        =
*      I_DEFAULT                     = 'X'
*      IS_LAYOUT                     =
*      IS_PRINT                      =
*      IT_SPECIAL_GROUPS             =
*      IT_TOOLBAR_EXCLUDING          =
*      IT_HYPERLINK                  =
*      IT_ALV_GRAPHICS               =
*      IT_EXCEPT_QINFO               =
*      IR_SALV_ADAPTER               =
    CHANGING
      it_outtab                     = gt_kna1
*      IT_FIELDCATALOG               =
*      IT_SORT                       =
*      IT_FILTER                     =
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      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.
 
* Empty dynpro without any elements
  CALL SCREEN '0100'.
* NOTE: dynpro flow logic contains only the two modules shown below  
 
 
END-OF-SELECTION.
 
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.
 
* Link to current dynpro
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = syst-cprog
      dynnr                       = syst-dynnr
*      CONTAINER                   =
    EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      lifetime_dynpro_dynpro_link = 3
      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.
 
 
ENDMODULE.                 " STATUS_0100  OUTPUT
 
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  SET SCREEN 0. LEAVE SCREEN.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

Regards

Uwe

Hi,

Is there in any way that the size of ALV grid should be adjustable to screen resolution automatically?

Thanks & Regards,

Reena

4 REPLIES 4
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,773

Hi,

The size of the ALV is always controlled by the custom container's hight and the Width. One you have specified the size of this then if the screen resolution is less and it cannot show the full container the scorllbars appear automatically.

You can also set the resizable option for the container.

Regards,

Sesh

Message was edited by: Seshatalpasai Madala

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,774

Hello Reena

If your ALV list is the only element on your dynpro then you should not use a custom container on the dynpro. Instead use the following approach:

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_ALVLIST_FULLSCREEN
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
 
REPORT  zus_sdn_alvlist_fullscreen.
 
 
DATA:
  gt_kna1           TYPE STANDARD TABLE OF kna1.
 
 
DATA:
  go_docking        TYPE REF TO cl_gui_docking_container,
  go_alvgrid        TYPE REF TO cl_gui_alv_grid.
 
 
 
START-OF-SELECTION.
* Select some data
  SELECT * FROM  kna1 INTO TABLE gt_kna1.
 
* Create docking container and dock at left side
  CREATE OBJECT go_docking
    EXPORTING
      parent                      = cl_gui_container=>screen0
*      REPID                       =
*      DYNNR                       =
      side                        =
                  cl_gui_docking_container=>dock_at_left
*      EXTENSION                   = 50
*      STYLE                       =
*      LIFETIME                    = lifetime_default
*      CAPTION                     =
*      METRIC                      = 0
      ratio                       = 90  " 90% of screen
    EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      create_error                = 3
      lifetime_error              = 4
      lifetime_dynpro_dynpro_link = 5
      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.
 
* Set very high extension -> not overruled by screen resizing
  CALL METHOD go_docking->set_extension
    EXPORTING
      extension  = 99999
    EXCEPTIONS
      CNTL_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.
 
 
 
 
* Create ALV grid
  CREATE OBJECT go_alvgrid
    EXPORTING
      i_parent          = go_docking
    EXCEPTIONS
      error_cntl_create = 1
      error_cntl_init   = 2
      error_cntl_link   = 3
      error_dp_create   = 4
      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.
 
 
 
 
 
 
  CALL METHOD go_alvgrid->set_table_for_first_display
    EXPORTING
*      I_BUFFER_ACTIVE               =
*      I_BYPASSING_BUFFER            =
*      I_CONSISTENCY_CHECK           =
      i_structure_name              = 'KNA1'
*      IS_VARIANT                    =
*      I_SAVE                        =
*      I_DEFAULT                     = 'X'
*      IS_LAYOUT                     =
*      IS_PRINT                      =
*      IT_SPECIAL_GROUPS             =
*      IT_TOOLBAR_EXCLUDING          =
*      IT_HYPERLINK                  =
*      IT_ALV_GRAPHICS               =
*      IT_EXCEPT_QINFO               =
*      IR_SALV_ADAPTER               =
    CHANGING
      it_outtab                     = gt_kna1
*      IT_FIELDCATALOG               =
*      IT_SORT                       =
*      IT_FILTER                     =
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      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.
 
* Empty dynpro without any elements
  CALL SCREEN '0100'.
* NOTE: dynpro flow logic contains only the two modules shown below  
 
 
END-OF-SELECTION.
 
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.
 
* Link to current dynpro
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = syst-cprog
      dynnr                       = syst-dynnr
*      CONTAINER                   =
    EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      lifetime_dynpro_dynpro_link = 3
      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.
 
 
ENDMODULE.                 " STATUS_0100  OUTPUT
 
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  SET SCREEN 0. LEAVE SCREEN.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

Regards

Uwe

Read only

0 Likes
1,773

Thank you very much, it really helped

Read only

Former Member
0 Likes
1,773

hi

good

go through this link

http://www.erpgenie.com/sapgenie/docs/Using%20ALV.pdf

thanks

mrutyun^