{"id":247,"date":"2013-02-20T15:52:19","date_gmt":"2013-02-20T14:52:19","guid":{"rendered":"http:\/\/oprsteny.cz\/?p=247"},"modified":"2013-04-17T19:39:17","modified_gmt":"2013-04-17T18:39:17","slug":"check-if-abap-program-runs-in-production-system","status":"publish","type":"post","link":"https:\/\/oprsteny.cz\/?p=247","title":{"rendered":"Check if ABAP program runs in production system"},"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\" alt=\"SAP\" src=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/SAP.jpg\" width=\"44\" height=\"50\" \/>There are lot of cases where you need to run a whole program or its piece in development or testing environment only and you want to avoid running it in production. Or vice versa. In the following article I&#8217;ll show you a construct which will check if you&#8217;re running on production system or not.<!--more--><\/p>\n<pre lang=\"abap\">SELECT SINGLE cccategory \r\n  FROM t000 \r\n  INTO t000-cccategory \r\n  WHERE mandt EQ sy-mandt.\r\n\r\nIF NOT t000-cccategory EQ 'P'\r\n  \" do stuff for non-production system here\r\nENDIF.<\/pre>\n<p>The above snippet is part of a function called &#8216;PRGN_CHECK_SYSTEM_PRODUCTIVE&#8217; so you can do the same as above by calling a function module:<\/p>\n<pre lang=\"abap\">DATA: l_production TYPE flag.\r\n\r\nCALL FUNCTION 'PRGN_CHECK_SYSTEM_PRODUCTIVE'\r\n  EXCEPTIONS\r\n \u00a0  client_is_productive = 1\r\n \u00a0\u00a0\u00a0OTHERS = 2.\r\n\r\nIF sy-subrc &lt;&gt; 0.\r\n  l_production = abap_true.\r\nENDIF.<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>There are lot of cases where you need to run a whole program or its piece in development or testing environment only and you want to avoid running it in production. Or vice versa. In the following article I&#8217;ll show &hellip; <a href=\"https:\/\/oprsteny.cz\/?p=247\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_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":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[16,9],"tags":[446,58,17],"class_list":["post-247","post","type-post","status-publish","format-standard","hentry","category-abap","category-development","tag-abap","tag-production-system","tag-sap"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3nYbe-3Z","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/247","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=247"}],"version-history":[{"count":3,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/247\/revisions"}],"predecessor-version":[{"id":461,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/247\/revisions\/461"}],"wp:attachment":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=247"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=247"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}