{"id":527,"date":"2013-04-28T14:10:56","date_gmt":"2013-04-28T13:10:56","guid":{"rendered":"http:\/\/oprsteny.cz\/?p=527"},"modified":"2016-07-29T09:17:12","modified_gmt":"2016-07-29T08:17:12","slug":"alv-tutorial-04-2-grids-in-splitscreen","status":"publish","type":"post","link":"https:\/\/oprsteny.cz\/?p=527","title":{"rendered":"ALV tutorial 04 &#8211; 2 grids in splitscreen"},"content":{"rendered":"<p>Display two grids in split screen mode<!--more--><\/p>\n<pre lang=\"abap\">REPORT  z_alv_demo_04.\r\nTYPES: BEGIN OF ty_data.\r\n        INCLUDE STRUCTURE sflight.\r\nTYPES: END OF ty_data.\r\n\r\nDATA: gt_data TYPE TABLE OF ty_data,\r\n      g_grid_left TYPE REF TO cl_gui_alv_grid,\r\n      g_grid_right TYPE REF TO cl_gui_alv_grid,\r\n      gs_layout TYPE lvc_s_layo,\r\n      gt_fieldcat TYPE lvc_t_fcat.\r\n\r\nCONSTANTS:\r\n  c_max_rows TYPE i VALUE 100.\r\n\r\nCALL SCREEN 100.\r\n\r\n*&amp;---------------------------------------------------------------------*\r\n*&amp;      Form  read_data\r\n*&amp;---------------------------------------------------------------------*\r\n*       text\r\n*----------------------------------------------------------------------*\r\nFORM read_data.\r\n  SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_data\r\n    FROM sflight\r\n    UP TO c_max_rows ROWS.\r\nENDFORM.                    \"read_data\r\n\r\n*&amp;---------------------------------------------------------------------*\r\n*&amp;      Form  display_grid\r\n*&amp;---------------------------------------------------------------------*\r\n*       text\r\n*----------------------------------------------------------------------*\r\nFORM display_grid.\r\n  data: splitter TYPE REF TO cl_gui_splitter_container,\r\n        graphic_parent1 TYPE REF TO cl_gui_container,\r\n        graphic_parent2 TYPE REF TO cl_gui_container.\r\n\r\n  PERFORM get_layout.\r\n\r\n  CREATE OBJECT splitter\r\n     EXPORTING\r\n       parent  = cl_gui_container=&gt;default_screen\r\n       rows    = 1\r\n       columns = 2\r\n       align   = 15.\r\n\r\n  CALL METHOD splitter-&gt;get_container\r\n      EXPORTING\r\n        row       = 1\r\n        column    = 1\r\n      RECEIVING\r\n        container = graphic_parent1.\r\n\r\n  call METHOD splitter-&gt;get_container\r\n      EXPORTING\r\n        row       = 1\r\n        column    = 2\r\n      RECEIVING\r\n        container = graphic_parent2.\r\n\r\n  CREATE OBJECT g_grid_left\r\n    EXPORTING\r\n      i_parent =  graphic_parent1.\r\n\r\n  CREATE OBJECT g_grid_right\r\n    EXPORTING\r\n      i_parent =  graphic_parent2.\r\n\r\n  CALL METHOD g_grid_left-&gt;set_table_for_first_display\r\n    EXPORTING\r\n      i_structure_name              = 'SFLIGHT'\r\n      is_layout                     = gs_layout\r\n    CHANGING\r\n      it_outtab                     = gt_data\r\n*      it_fieldcatalog               = gt_fieldcat\r\n    EXCEPTIONS\r\n      invalid_parameter_combination = 1\r\n      program_error                 = 2\r\n      too_many_lines                = 3\r\n      OTHERS                        = 4.\r\n  IF sy-subrc &lt;&gt; 0.\r\n    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno\r\n               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.\r\n  ENDIF.\r\n\r\n    CALL METHOD g_grid_right-&gt;set_table_for_first_display\r\n    EXPORTING\r\n      i_structure_name              = 'SFLIGHT'\r\n      is_layout                     = gs_layout\r\n    CHANGING\r\n      it_outtab                     = gt_data\r\n*      it_fieldcatalog               = gt_fieldcat\r\n    EXCEPTIONS\r\n      invalid_parameter_combination = 1\r\n      program_error                 = 2\r\n      too_many_lines                = 3\r\n      OTHERS                        = 4.\r\n  IF sy-subrc &lt;&gt; 0.\r\n    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno\r\n               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.\r\n  ENDIF.\r\nENDFORM.                    \"display_grid\r\n*&amp;---------------------------------------------------------------------*\r\n*&amp;      Module  STATUS_0100  OUTPUT\r\n*&amp;---------------------------------------------------------------------*\r\n*       text\r\n*----------------------------------------------------------------------*\r\nMODULE status_0100 OUTPUT.\r\n  SET PF-STATUS 'MAIN'.\r\n  SET TITLEBAR 'ALV_EXAMPLES'.\r\nENDMODULE.                 \" STATUS_0100  OUTPUT\r\n*&amp;---------------------------------------------------------------------*\r\n*&amp;      Module  DISPLAY_GRID  OUTPUT\r\n*&amp;---------------------------------------------------------------------*\r\n*       text\r\n*----------------------------------------------------------------------*\r\nMODULE display_grid OUTPUT.\r\n  PERFORM read_data.\r\n  PERFORM display_grid.\r\nENDMODULE.                 \" DISPLAY_GRID  OUTPUT\r\n*&amp;---------------------------------------------------------------------*\r\n*&amp;      Module  USER_COMMAND_0100  INPUT\r\n*&amp;---------------------------------------------------------------------*\r\n*       text\r\n*----------------------------------------------------------------------*\r\nMODULE user_command_0100 INPUT.\r\n*   to react on oi_custom_events:\r\n  CALL METHOD cl_gui_cfw=&gt;dispatch.\r\n  CASE sy-ucomm.\r\n    WHEN 'BACK' OR\r\n         'EXIT' OR\r\n         'CANCEL'.\r\n      LEAVE PROGRAM.\r\n    WHEN OTHERS.\r\n*     do nothing\r\n  ENDCASE.\r\nENDMODULE.                 \" USER_COMMAND_0100  INPUT\r\n*&amp;---------------------------------------------------------------------*\r\n*&amp;      Form  GET_LAYOUT\r\n*&amp;---------------------------------------------------------------------*\r\n*       text\r\n*----------------------------------------------------------------------*\r\n*  --&gt;  p1        text\r\n*  \r\n<\/pre>\n<p>Output should\u00a0look like the following:<\/p>\n<p><a href=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/SPLIT_SCREEN_001.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1550\" data-permalink=\"https:\/\/oprsteny.cz\/?attachment_id=1550\" data-orig-file=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SPLIT_SCREEN_001.png\" data-orig-size=\"803,372\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"ALV Split Screen result\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SPLIT_SCREEN_001.png\" class=\"size-medium wp-image-1550 alignnone\" src=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/SPLIT_SCREEN_001-300x139.png\" alt=\"ALV Split Screen result\" width=\"300\" height=\"139\" srcset=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SPLIT_SCREEN_001-300x139.png 300w, https:\/\/oprsteny.cz\/wp-content\/uploads\/SPLIT_SCREEN_001-768x356.png 768w, https:\/\/oprsteny.cz\/wp-content\/uploads\/SPLIT_SCREEN_001-500x232.png 500w, https:\/\/oprsteny.cz\/wp-content\/uploads\/SPLIT_SCREEN_001.png 803w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Display two grids in split screen mode<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"ALV tutorial 04 - 2 grids in splitscreen","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[16,136,9],"tags":[446,447,17,115,131],"class_list":["post-527","post","type-post","status-publish","format-standard","hentry","category-abap","category-alv-tutorial","category-development","tag-abap","tag-alv","tag-sap","tag-split-screen","tag-splitter"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3nYbe-8v","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=527"}],"version-history":[{"count":6,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/527\/revisions"}],"predecessor-version":[{"id":1552,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/527\/revisions\/1552"}],"wp:attachment":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}