{"id":1070,"date":"2018-11-26T13:38:47","date_gmt":"2018-11-26T06:38:47","guid":{"rendered":"http:\/\/www.todsapon.com\/story\/?p=1070"},"modified":"2019-01-14T17:18:07","modified_gmt":"2019-01-14T10:18:07","slug":"abap-how-to-display-variant-f4","status":"publish","type":"post","link":"http:\/\/www.todsapon.com\/story\/programmer\/abap-how-to-display-variant-f4","title":{"rendered":"ABAP Code:How to Display variant F4 on screen Report"},"content":{"rendered":"<div id=\"attachment_985\" style=\"width: 680px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/sap-abap.jpg\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-985\" class=\"size-full wp-image-985\" src=\"http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/sap-abap.jpg\" alt=\"ABAP How to Display variant F4 on screen Report\" width=\"670\" height=\"320\" srcset=\"http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/sap-abap.jpg 670w, http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/sap-abap-300x143.jpg 300w\" sizes=\"auto, (max-width: 670px) 100vw, 670px\" \/><\/a><p id=\"caption-attachment-985\" class=\"wp-caption-text\">ABAP How to Display variant F4 on screen Report<\/p><\/div>\n<p>\u0e42\u0e14\u0e22\u0e2a\u0e48\u0e27\u0e19\u0e21\u0e32\u0e01 \u0e16\u0e49\u0e32 Report \u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17 Report ALV \u0e08\u0e30\u0e15\u0e49\u0e2d\u0e07\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16 \u0e17\u0e33\u0e43\u0e2b\u0e49\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01 Layout \u0e02\u0e2d\u0e07 ALV \u0e44\u0e14\u0e49 \u0e41\u0e25\u0e30\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e44\u0e14\u0e49 \u0e01\u0e47\u0e15\u0e49\u0e2d\u0e07\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e2a\u0e31\u0e48\u0e07\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e44\u0e14\u0e49 \u0e1c\u0e48\u0e32\u0e19\u0e17\u0e32\u0e07\u0e2b\u0e19\u0e49\u0e32 Screen \u0e01\u0e48\u0e2d\u0e19\u0e23\u0e31\u0e19 Report \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e2a\u0e30\u0e14\u0e27\u0e01\u0e41\u0e25\u0e30\u0e23\u0e27\u0e14\u0e40\u0e23\u0e47\u0e27\u0e43\u0e19\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19 Report<br \/>\n<!--more--><\/p>\n<p><strong>Step 0. \u0e01\u0e33\u0e2b\u0e19\u0e14\u0e15\u0e31\u0e27\u0e41\u0e1b\u0e23\u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u00a0<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nDATA: gd_repid LIKE sy-repid,\r\ng_save TYPE c VALUE 'X',\r\ng_variant TYPE disvariant,\r\ngx_variant TYPE disvariant,\r\ng_exit TYPE c.\r\n<\/pre>\n<p><strong>Step 1. \u0e1b\u0e23\u0e30\u0e01\u0e32\u0e28\u0e1e\u0e32\u0e23\u0e32\u0e21\u0e34\u0e40\u0e15\u0e2d\u0e23\u0e4c p_vari \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u00a0Display variant<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nPARAMETERS: p_vari TYPE disvariant-variant.\r\n<\/pre>\n<p><strong>Step 2. \u0e23\u0e30\u0e1a\u0e38 Code \u0e40\u0e23\u0e34\u0e48\u0e21\u0e15\u0e49\u0e19\u0e17\u0e35\u0e48\u00a0INITIALIZATION.<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ngx_variant-report = sy-repid.\r\nCALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'\r\nEXPORTING\r\ni_save = g_save\r\nCHANGING\r\ncs_variant = gx_variant\r\nEXCEPTIONS\r\nnot_found = 2.\r\nIF sy-subrc = 0.\r\np_vari = gx_variant-variant.\r\n<\/pre>\n<p><strong>Step 3. \u0e23\u0e30\u0e1a\u0e38 Code \u0e20\u0e32\u0e22\u0e43\u0e15\u0e49\u00a0AT SELECTION-SCREEN.<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n** F4 Help for Varient\r\nAT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.\r\n**-- Display all existing variants\r\ng_variant-report = sy-repid.\r\n* Utilizing the name of the report, this function module will search for a list of\r\n* variants and will fetch the selected one into the parameter field for variants\r\nCALL FUNCTION 'REUSE_ALV_VARIANT_F4'\r\nEXPORTING\r\nis_variant = g_variant\r\ni_save = g_save\r\nIMPORTING\r\ne_exit = g_exit\r\nes_variant = gx_variant\r\nEXCEPTIONS\r\nnot_found = 2.\r\nIF sy-subrc = 2.\r\nMESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno\r\nWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.\r\nELSE.\r\nIF g_exit = space.\r\np_vari = gx_variant-variant.\r\nENDIF.\r\nENDIF.\r\n<\/pre>\n<p><strong>Step 4. \u0e23\u0e30\u0e1a\u0e38 Code \u0e20\u0e32\u0e22\u0e43\u0e15\u0e49\u00a0START-OF-SELECTION.\u00a0<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nPERFORM check_variant.\r\n\r\nFORM check_variant .\r\ng_variant-variant = p_vari.\r\ng_variant-report = sy-repid.\r\nCALL FUNCTION 'LVC_VARIANT_EXISTENCE_CHECK' &quot;Check for display variant\r\nEXPORTING\r\ni_save = space &quot;Variants Can be Saved\r\nCHANGING\r\ncs_variant = g_variant &quot;Variant information\r\nEXCEPTIONS\r\nwrong_input = 1 &quot;Inconsistent input parameters\r\nnot_found = 2 &quot;Variant not found\r\nprogram_error = 3 &quot;Program Errors\r\n. &quot; LVC_VARIANT_EXISTENCE_CHECK\r\nIF sy-subrc = 2.\r\nMESSAGE 'Display Variant Not Found, Displaying Default Variant'\r\nTYPE 'S'.\r\nENDIF.\r\nCALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'\r\nEXPORTING\r\ni_save = g_save\r\nCHANGING\r\ncs_variant = gx_variant\r\nEXCEPTIONS\r\nnot_found = 2.\r\nIF sy-subrc = 0.\r\np_vari = gx_variant-variant.\r\nENDIF.\r\nENDFORM. &quot;CHECK_VARIANT\r\n<\/pre>\n<p><strong>\u0e2b\u0e25\u0e31\u0e07\u0e08\u0e32\u0e01\u0e23\u0e30\u0e1a\u0e38 Code \u0e40\u0e2a\u0e23\u0e47\u0e08 \u0e08\u0e30\u0e44\u0e14\u0e49\u0e2b\u0e19\u0e49\u0e32\u0e15\u0e32\u0e01\u0e32\u0e23\u0e17\u0e33\u0e07\u0e32\u0e19\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49<\/strong><\/p>\n<div id=\"attachment_1071\" style=\"width: 440px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/how-to-display-Display-variant-F4-1.jpg\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1071\" class=\"size-full wp-image-1071\" src=\"http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/how-to-display-Display-variant-F4-1.jpg\" alt=\"ABAP How to Display variant F4 on screen Report\" width=\"430\" height=\"98\" srcset=\"http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/how-to-display-Display-variant-F4-1.jpg 430w, http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/how-to-display-Display-variant-F4-1-300x68.jpg 300w\" sizes=\"auto, (max-width: 430px) 100vw, 430px\" \/><\/a><p id=\"caption-attachment-1071\" class=\"wp-caption-text\">ABAP How to Display variant F4 on screen Report<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_1072\" style=\"width: 501px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/how-to-display-Display-variant-F4-2.jpg\" data-rel=\"lightbox-image-2\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1072\" class=\"size-full wp-image-1072\" src=\"http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/how-to-display-Display-variant-F4-2.jpg\" alt=\"ABAP How to Display variant F4 on screen Report\" width=\"491\" height=\"253\" srcset=\"http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/how-to-display-Display-variant-F4-2.jpg 491w, http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/how-to-display-Display-variant-F4-2-300x155.jpg 300w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/a><p id=\"caption-attachment-1072\" class=\"wp-caption-text\">ABAP How to Display variant F4 on screen Report<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u0e42\u0e14\u0e22\u0e2a\u0e48\u0e27\u0e19\u0e21\u0e32\u0e01 \u0e16\u0e49\u0e32 Report \u0e40\u0e1b\u0e47\u0e19\u0e1b\u0e23\u0e30\u0e40\u0e20\u0e17 Report ALV \u0e08\u0e30\u0e15\u0e49\u0e2d\u0e07\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16 \u0e17\u0e33\u0e43\u0e2b\u0e49\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01 Layout \u0e02\u0e2d\u0e07 ALV \u0e44\u0e14\u0e49 \u0e41\u0e25\u0e30\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e44\u0e14\u0e49 \u0e01\u0e47\u0e15\u0e49\u0e2d\u0e07\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e2a\u0e31\u0e48\u0e07\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e44\u0e14\u0e49 \u0e1c\u0e48\u0e32\u0e19\u0e17\u0e32\u0e07\u0e2b\u0e19\u0e49\u0e32 Screen \u0e01\u0e48\u0e2d\u0e19\u0e23\u0e31\u0e19 Report \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e2a\u0e30\u0e14\u0e27\u0e01\u0e41\u0e25\u0e30\u0e23\u0e27\u0e14\u0e40\u0e23\u0e47\u0e27\u0e43\u0e19\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19 Report<\/p>\n","protected":false},"author":1,"featured_media":985,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_options":[]},"categories":[250,384,251],"tags":[331,318,317,255,254],"class_list":["post-1070","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programmer","category-archive-blog","category-sap-abap","tag-abap-code","tag-code","tag-f4","tag-how-to","tag-sap"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"http:\/\/www.todsapon.com\/story\/wp-content\/uploads\/2018\/11\/sap-abap.jpg","jetpack_shortlink":"https:\/\/wp.me\/p5sZE6-hg","amp_enabled":true,"_links":{"self":[{"href":"http:\/\/www.todsapon.com\/story\/wp-json\/wp\/v2\/posts\/1070","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.todsapon.com\/story\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.todsapon.com\/story\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.todsapon.com\/story\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.todsapon.com\/story\/wp-json\/wp\/v2\/comments?post=1070"}],"version-history":[{"count":2,"href":"http:\/\/www.todsapon.com\/story\/wp-json\/wp\/v2\/posts\/1070\/revisions"}],"predecessor-version":[{"id":1105,"href":"http:\/\/www.todsapon.com\/story\/wp-json\/wp\/v2\/posts\/1070\/revisions\/1105"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.todsapon.com\/story\/wp-json\/wp\/v2\/media\/985"}],"wp:attachment":[{"href":"http:\/\/www.todsapon.com\/story\/wp-json\/wp\/v2\/media?parent=1070"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.todsapon.com\/story\/wp-json\/wp\/v2\/categories?post=1070"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.todsapon.com\/story\/wp-json\/wp\/v2\/tags?post=1070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}