{"id":7756,"date":"2025-09-06T02:13:50","date_gmt":"2025-09-05T20:43:50","guid":{"rendered":"https:\/\/www.sapewmhelp.com\/?question=how-to-implement-get-cursor-hide-and-user-command-in-sap-reports"},"modified":"2025-09-06T02:13:50","modified_gmt":"2025-09-05T20:43:50","slug":"how-to-implement-get-cursor-hide-and-user-command-in-sap-reports","status":"publish","type":"question","link":"https:\/\/www.sapewmhelp.com\/?question=how-to-implement-get-cursor-hide-and-user-command-in-sap-reports","title":{"rendered":"How to implement get cursor, hide and user command in sap reports"},"content":{"rendered":"<p><strong>GET CURSOR<\/strong> \u2192 to capture the position of the cursor in a list\/report.<\/p>\n<p><strong>HIDE<\/strong> \u2192 to store values \u201chidden\u201d behind a line for later retrieval.<\/p>\n<p><strong>USER COMMAND (AT USER-COMMAND)<\/strong> \u2192 to react to user actions (e.g., double-clicks, buttons, PF keys).<\/p>\n<h5>1. <strong>GET CURSOR<\/strong><\/h5>\n<p>This is used to know <em>where<\/em> the user placed the cursor or clicked in a list.<\/p>\n<p>GET CURSOR FIELD gv_field VALUE gv_value.<\/p>\n<ul>\n<li><code>gv_field<\/code> \u2192 variable to hold the field name under the cursor.<\/li>\n<li><code>gv_value<\/code> \u2192 variable to hold the value of that field.<\/li>\n<\/ul>\n<p>Example:<\/p>\n<p>GET CURSOR FIELD lv_field VALUE lv_value.<br \/>\nWRITE: \/ &#8216;Cursor on:&#8217;, lv_field, &#8216;Value:&#8217;, lv_value.<\/p>\n<p>&nbsp;<\/p>\n<h5>2. <strong>HIDE<\/strong><\/h5>\n<p>The <code>HIDE<\/code> statement stores the value of a variable in the system\u2019s <strong>hide area<\/strong>, linked to the current line.<br \/>Later, when the user double-clicks on that line, the hidden values are retrieved automatically.<\/p>\n<p>Example:<\/p>\n<\/p>\n<p>LOOP AT it_mara INTO wa_mara.<br \/>\nWRITE: \/ wa_mara-matnr, wa_mara-maktx.<br \/>\nHIDE: wa_mara-matnr, wa_mara-maktx.<br \/>\nENDLOOP.<\/p>\n<\/p>\n<p>When the user double-clicks on a line, the hidden fields for that line become available again.<\/p>\n<\/p>\n<h5>3. <strong>USER COMMAND (AT USER-COMMAND)<\/strong><\/h5>\n<p>This event block reacts to user actions (function keys, buttons, or double-clicks).<\/p>\n<p>Example:<\/p>\n<p>AT USER-COMMAND.<br \/>\nCASE sy-ucomm.<br \/>\nWHEN &#8216;DETAIL&#8217;. &#8220;Custom function code<br \/>\nWRITE: \/ &#8216;Details for material:&#8217;, wa_mara-matnr.<br \/>\nWHEN &#8216;EXIT&#8217;.<br \/>\nLEAVE PROGRAM.<br \/>\nENDCASE.<\/p>\n<\/p>\n<p><strong>Full Example:<\/strong><\/p>\n<\/p>\n<p>REPORT zsample_report.<\/p>\n<p>TABLES: mara.<\/p>\n<p>DATA: wa_mara TYPE mara.<\/p>\n<p>START-OF-SELECTION.<br \/>\nSELECT * FROM mara UP TO 10 ROWS.<br \/>\nWRITE: \/ mara-matnr, mara-mtart, mara-mbrsh.<br \/>\nHIDE: mara-matnr.<br \/>\nENDSELECT.<\/p>\n<p>AT LINE-SELECTION. &#8220;Triggered by double-click<br \/>\nWRITE: \/ &#8216;You selected material:&#8217;, mara-matnr.<\/p>\n<p>AT USER-COMMAND.<br \/>\nCASE sy-ucomm.<br \/>\nWHEN &#8216;DETAIL&#8217;.<br \/>\nGET CURSOR FIELD DATA(lv_field) VALUE DATA(lv_value).<br \/>\nWRITE: \/ &#8216;Field:&#8217;, lv_field, &#8216;Value:&#8217;, lv_value.<br \/>\nWHEN &#8216;EXIT&#8217;.<br \/>\nLEAVE PROGRAM.<br \/>\nENDCASE.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","question-category":[158],"question_tags":[178,200,213,177],"class_list":["post-7756","question","type-question","status-publish","hentry","question-category-abap","question_tags-abap","question_tags-rap","question_tags-reports","question_tags-sap"],"_links":{"self":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/question\/7756","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/question"}],"about":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7756"}],"wp:attachment":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7756"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fquestion-category&post=7756"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fquestion_tags&post=7756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}