{"id":792,"date":"2013-11-13T09:39:20","date_gmt":"2013-11-13T08:39:20","guid":{"rendered":"http:\/\/oprsteny.cz\/?p=792"},"modified":"2013-11-13T09:45:40","modified_gmt":"2013-11-13T08:45:40","slug":"abap-cool-program-discovering-all-user-exits-for-a-tcode","status":"publish","type":"post","link":"https:\/\/oprsteny.cz\/?p=792","title":{"rendered":"ABAP &#8211; cool program discovering all user exits for a TCode"},"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=\"size-full wp-image-358 alignleft\" alt=\"SAP\" src=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/SAP.jpg\" width=\"44\" height=\"50\" \/>I believe all of you were searching for a list of available user exits that are triggered after a specific transaction code is executed. Here I&#8217;d like to present simple program, that will discover and display exactly that &#8211; list of available user exits for given TCode.<!--more--><\/p>\n<pre lang=\"abap\">TABLES:\r\n  tstc, tstct,\r\n  tadir, trdir, tfdir, enlfdir,\r\n  modsapt, modact.\r\n\r\nDATA:\r\n  jtab LIKE tadir OCCURS 0 WITH HEADER LINE,\r\n  field1(30),\r\n  v_devclass LIKE tadir-devclass.\r\n\r\nPARAMETERS:\r\n  p_tcode LIKE tstc-tcode OBLIGATORY.\r\n\r\nSELECT SINGLE *\r\n  FROM tstc\r\n  WHERE tcode EQ p_tcode.\r\nIF sy-subrc EQ 0.\r\n  SELECT SINGLE *\r\n    FROM tadir\r\n    WHERE pgmid = 'R3TR' AND\r\n          object = 'PROG' AND\r\n          obj_name = tstc-pgmna.\r\n\r\n  MOVE tadir-devclass TO v_devclass.\r\n\r\n  IF sy-subrc NE 0.\r\n    SELECT SINGLE *\r\n      FROM trdir\r\n      WHERE name = tstc-pgmna.\r\n\r\n    IF trdir-subc EQ 'F'.\r\n      SELECT SINGLE *\r\n        FROM tfdir\r\n        WHERE pname = tstc-pgmna.\r\n\r\n      SELECT SINGLE *\r\n        FROM enlfdir\r\n        WHERE funcname = tfdir-funcname.\r\n\r\n      SELECT SINGLE *\r\n        FROM tadir\r\n        WHERE pgmid = 'R3TR' AND\r\n              object = 'FUGR' AND\r\n              obj_name EQ enlfdir-area.\r\n\r\n      MOVE tadir-devclass TO v_devclass.\r\n    ENDIF.\r\n  ENDIF.\r\n\r\n  SELECT *\r\n    FROM tadir\r\n    INTO TABLE jtab\r\n    WHERE pgmid = 'R3TR' AND\r\n          object = 'SMOD' AND\r\n          devclass = v_devclass.\r\n\r\n  SELECT SINGLE *\r\n    FROM tstct\r\n    WHERE sprsl EQ sy-langu AND\r\n          tcode EQ p_tcode.\r\n\r\n  FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.\r\n  WRITE:\/(19) 'Transaction Code - ',\r\n       20(20) p_tcode,\r\n       45(50) tstct-ttext.\r\n  SKIP.\r\n\r\n  IF NOT jtab[] IS INITIAL.\r\n    WRITE:\/(95) sy-uline.\r\n    FORMAT COLOR COL_HEADING INTENSIFIED ON.\r\n    WRITE:\/1 sy-vline,\r\n           2 'Exit Name',\r\n          21 sy-vline ,\r\n          22 'Description',\r\n          95 sy-vline.\r\n\r\n    WRITE:\/(95) sy-uline.\r\n\r\n    LOOP AT jtab.\r\n      SELECT SINGLE * FROM modsapt\r\n        WHERE sprsl = sy-langu AND\r\n              name = jtab-obj_name.\r\n\r\n      FORMAT COLOR COL_NORMAL INTENSIFIED OFF.\r\n      WRITE:\/1 sy-vline,\r\n             2 jtab-obj_name HOTSPOT ON,\r\n            21 sy-vline ,\r\n            22 modsapt-modtext,\r\n            95 sy-vline.\r\n    ENDLOOP.\r\n\r\n    WRITE:\/(95) sy-uline.\r\n    DESCRIBE TABLE jtab.\r\n    SKIP.\r\n    FORMAT COLOR COL_TOTAL INTENSIFIED ON.\r\n    WRITE:\/ 'No of Exits:' , sy-tfill.\r\n  ELSE.\r\n    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.\r\n    WRITE:\/(95) 'No User Exit exists'.\r\n  ENDIF.\r\nELSE.\r\n  FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.\r\n  WRITE:\/(95) 'Transaction Code Does Not Exist'.\r\nENDIF.\r\n\r\nAT LINE-SELECTION.\r\n  GET CURSOR FIELD field1.\r\n  CHECK field1(4) EQ 'JTAB'.\r\n  SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).\r\n  CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.<\/pre>\n<p>Program output for i.e. TCode MM01:<br \/>\n<a href=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/user_exits_program1.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"796\" data-permalink=\"https:\/\/oprsteny.cz\/?attachment_id=796\" data-orig-file=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/user_exits_program1.png\" data-orig-size=\"680,853\" 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;}\" data-image-title=\"User exits for ME01\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/user_exits_program1.png\" class=\"alignleft size-medium wp-image-796\" alt=\"User exits for ME01\" src=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/user_exits_program1-239x300.png\" width=\"239\" height=\"300\" srcset=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/user_exits_program1-239x300.png 239w, https:\/\/oprsteny.cz\/wp-content\/uploads\/user_exits_program1.png 680w\" sizes=\"auto, (max-width: 239px) 100vw, 239px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I believe all of you were searching for a list of available user exits that are triggered after a specific transaction code is executed. Here I&#8217;d like to present simple program, that will discover and display exactly that &#8211; list &hellip; <a href=\"https:\/\/oprsteny.cz\/?p=792\">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_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":"","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,9,106],"tags":[446,211,56],"class_list":["post-792","post","type-post","status-publish","format-standard","hentry","category-abap","category-development","category-transactions","tag-abap","tag-me01","tag-user-exit"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3nYbe-cM","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/792","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=792"}],"version-history":[{"count":6,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/792\/revisions"}],"predecessor-version":[{"id":801,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/792\/revisions\/801"}],"wp:attachment":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}