{"id":1600,"date":"2017-01-16T15:50:48","date_gmt":"2017-01-16T14:50:48","guid":{"rendered":"http:\/\/oprsteny.cz\/?p=1600"},"modified":"2017-01-16T15:53:09","modified_gmt":"2017-01-16T14:53:09","slug":"abap-very-simple-alv","status":"publish","type":"post","link":"https:\/\/oprsteny.cz\/?p=1600","title":{"rendered":"ABAP &#8211; Very simple ALV"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"358\" data-permalink=\"https:\/\/oprsteny.cz\/?attachment_id=358\" data-orig-file=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SAP.jpg\" data-orig-size=\"44,50\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Picasa&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1365690880&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;}\" data-image-title=\"SAP\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SAP.jpg\" class=\"alignleft size-full wp-image-358\" src=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/SAP.jpg\" alt=\"\" width=\"44\" height=\"50\" \/>It&#8217;s quite common request to show lines of an internal table in form of ALV popup &#8211; e.g. some custom log messages after a program execution.<!--more--><\/p>\n<p>Here&#8217;s an example of very short &amp; easy code snippet to display any internal table in either separate window or as a popup window encapsulated in a CLASS-METHOD<\/p>\n<pre lang=\"abap\">CLASS lcl_helper DEFINITION.\r\n  PUBLIC SECTION.\r\n    CLASS-METHODS:\r\n      simple_alv\r\n        IMPORTING\r\n          iv_start_col  TYPE i         DEFAULT 25\r\n          iv_start_line TYPE i         DEFAULT 6\r\n          iv_end_col    TYPE i         DEFAULT 100\r\n          iv_end_line   TYPE i         DEFAULT 10\r\n          iv_popup      TYPE abap_bool DEFAULT abap_false\r\n        CHANGING\r\n          ct_table      TYPE ANY TABLE.\r\nENDCLASS.\r\n\r\nCLASS lcl_helper IMPLEMENTATION.\r\n  METHOD simple_alv.\r\n    DATA lo_alv TYPE REF TO cl_salv_table.\r\n\r\n    TRY.\r\n        cl_salv_table=&gt;factory(\r\n          IMPORTING\r\n            r_salv_table = lo_alv\r\n          CHANGING\r\n            t_table      = ct_table[] ).\r\n\r\n      CATCH cx_salv_msg.\r\n    ENDTRY.\r\n\r\n    DATA: lr_functions TYPE REF TO cl_salv_functions_list.\r\n\r\n    lr_functions = lo_alv-&gt;get_functions( ).\r\n    lr_functions-&gt;set_all( 'X' ).\r\n\r\n    IF lo_alv IS BOUND.\r\n      IF iv_popup = 'X'.   \"display as popup?\r\n        lo_alv-&gt;set_screen_popup(\r\n          start_column = iv_start_col\r\n          end_column   = iv_end_col\r\n          start_line   = iv_start_line\r\n          end_line     = iv_end_line ).\r\n      ENDIF.\r\n\r\n      lo_alv-&gt;display( ).\r\n\r\n    ENDIF.\r\n  ENDMETHOD.\r\nENDCLASS.<\/pre>\n<p>Here&#8217;s the method real usage &#8211; show ALV fullscreen<\/p>\n<pre lang=\"abap\">START-OF-SELECTION.\r\n  DATA:\r\n    lt_curr TYPE TABLE OF tcurr.\r\n\r\n  SELECT *\r\n    FROM tcurr\r\n    INTO TABLE lt_curr.\r\n\r\n  lcl_helper=&gt;simple_alv(\r\n*  EXPORTING\r\n*    iv_start_col  = 25\r\n*    iv_start_line = 6\r\n*    iv_end_col    = 100\r\n*    iv_end_line   = 10\r\n*    iv_popup      = ABAP_TRUE\r\n    CHANGING\r\n      ct_table      = lt_curr\r\n  ).<\/pre>\n<p><a href=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_01.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1601\" data-permalink=\"https:\/\/oprsteny.cz\/?attachment_id=1601\" data-orig-file=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_01.png\" data-orig-size=\"685,923\" 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=\"Simple ALV fullscreen\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_01.png\" class=\"size-medium wp-image-1601 alignnone\" src=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_01-223x300.png\" alt=\"\" width=\"223\" height=\"300\" srcset=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_01-223x300.png 223w, https:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_01.png 685w\" sizes=\"auto, (max-width: 223px) 100vw, 223px\" \/><\/a><\/p>\n<p>And a simple code modification when you want to display the result as a popup<\/p>\n<pre lang=\"abap\">  lcl_helper=&gt;simple_alv(\r\n    EXPORTING\r\n*    iv_start_col  = 25\r\n*    iv_start_line = 6\r\n*    iv_end_col    = 100\r\n*    iv_end_line   = 10\r\n      iv_popup      = abap_true\r\n    CHANGING\r\n      ct_table      = lt_curr\r\n  ).<\/pre>\n<p><a href=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_02.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1602\" data-permalink=\"https:\/\/oprsteny.cz\/?attachment_id=1602\" data-orig-file=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_02.png\" data-orig-size=\"640,361\" 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=\"Simple ALV in popup\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_02.png\" class=\"size-medium wp-image-1602 alignnone\" src=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_02-300x169.png\" alt=\"\" width=\"300\" height=\"169\" srcset=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_02-300x169.png 300w, https:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_02-500x282.png 500w, https:\/\/oprsteny.cz\/wp-content\/uploads\/SIMPLE_ALV_OO_02.png 640w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s quite common request to show lines of an internal table in form of ALV popup &#8211; e.g. some custom log messages after a program execution.<\/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":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"ABAP - Very simple ALV","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,86,136,9],"tags":[446,447,501,221],"class_list":["post-1600","post","type-post","status-publish","format-standard","hentry","category-abap","category-alv","category-alv-tutorial","category-development","tag-abap","tag-alv","tag-cl_salv_table","tag-oo-abap"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3nYbe-pO","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/1600","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=1600"}],"version-history":[{"count":1,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/1600\/revisions"}],"predecessor-version":[{"id":1603,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/1600\/revisions\/1603"}],"wp:attachment":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1600"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1600"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1600"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}