{"id":1227,"date":"2014-12-11T08:13:00","date_gmt":"2014-12-11T07:13:00","guid":{"rendered":"http:\/\/oprsteny.cz\/?p=1227"},"modified":"2014-12-11T08:13:00","modified_gmt":"2014-12-11T07:13:00","slug":"abap-check-transport-request","status":"publish","type":"post","link":"https:\/\/oprsteny.cz\/?p=1227","title":{"rendered":"ABAP &#8211; Check transport request"},"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\" src=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/SAP.jpg\" alt=\"SAP\" width=\"44\" height=\"50\" \/>If you want to restrict creation of transports (and their release to further systems) based on rules applied on a transport description, you can use method described in this example.<!--more--><\/p>\n<p>Transport request descriptions are not checked anyhow by default. But if you have a system, where you e.g. link the transports you&#8217;re creating to a QM notification, you might want to restrict the format of the transport description.<\/p>\n<p>This can be achieved by running TCode SE18 and implementing BAdI called <em>CTS_REQUEST_CHECK <\/em>and its methods\u00a0<em>CHECK_BEFORE_CREATION <\/em>and\u00a0<em>CHECK_BEFORE_RELEASE.<\/em><\/p>\n<p>For your reference, here&#8217;s a list of BAdIs available regarding transport request checks:<\/p>\n<ul>\n<li><strong><em>CTS_REQUEST_CHECK (Request checks)<\/em><\/strong><\/li>\n<li>CTS_EXPORT_FEEDBACK (Feedback after export of a transport request)<\/li>\n<li>CTS_IMPORT_FEEDBACK (Feedback after import of transport requests)<\/li>\n<li>CTS_INT_REQUEST_CHCK (Internal: Request Checks)<\/li>\n<li>CTS_TASKDOC_TEMPLATE (Determine template for the task documentation)<\/li>\n<li>CTS_CURRENT_PROJECT (Determine the current CTS project)<\/li>\n<li>CTS_ES_TADIR_POPUP (Screen BAdI of TADIR Dialog Box)<\/li>\n<\/ul>\n<p>Let&#8217;s assume you have a rule that each transport must have it&#8217;s description in format<\/p>\n<p><em>&lt;QM_Notification&gt; &lt;Description_free_text&gt;<\/em><\/p>\n<p>Now you just have to implement method <em>CHECK_BEFORE_CREATION <\/em>where initially we extract the QM notification number from transport description. This number is then checked by BAPI_QUALNOT_GETDETAIL for it&#8217;s existence in system which prevents users from creation of a transport without providing a correct QM notification number.<\/p>\n<pre lang=\"abap\">DATA:\r\n  lv_notif    TYPE string,\r\n  lv_text     TYPE string,\r\n  lv_qmnum    TYPE qmnum,\r\n  lt_bapiret  TYPE TABLE OF bapiret2.\r\n\r\n* Extract Notification - be aware of translation transports!!!\r\n* Translation transport (TCode SLXT) automatically prepends \r\n* description text like: 'LANG enUS' -  this part will be ignored \r\nif text(4) = 'LANG'.\r\n  shift text LEFT by 10 PLACES.\r\nendif.\r\n\r\nSPLIT text AT space INTO lv_notif lv_text.\r\nIF lv_notif IS INITIAL.\r\n  MESSAGE 'Please provide QM notification' TYPE 'E'.\r\n  RAISE cancel.\r\nENDIF.\r\nCALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'\r\n  EXPORTING\r\n    input  = lv_notif\r\n  IMPORTING\r\n    output = lv_qmnum.\r\n\r\n* Make sure the given QM notification exist\r\nCALL FUNCTION 'BAPI_QUALNOT_GETDETAIL'\r\n  EXPORTING\r\n    number = lv_qmnum\r\n  TABLES\r\n    return = lt_bapiret.\r\n\r\nLOOP AT lt_bapiret TRANSPORTING NO FIELDS \r\n  WHERE type CA 'EA'\r\n\r\n  MESSAGE 'Please provide valid QM notification' TYPE 'E'.\r\n  RAISE cancel. \r\nENDLOOP.<\/pre>\n<p>Of course you are able to create a transport using QM notification number you manually find in QM system and then you just rename the transport afterwards to some free text.<\/p>\n<p>To prevent releasing transport with such modified description you have to check the transport name also at time of it&#8217;s release to further system. This is done by implementing the second BAdI method called <em>CHECK_BEFORE_RELEASE <\/em>e.g. like this:<\/p>\n<pre lang=\"abap\">DATA:\r\n  lv_att TYPE SCTS_ATTRS.\r\n\r\nCALL METHOD me-&gt;if_ex_cts_request_check~check_before_creation\r\n  EXPORTING  type       = type\r\n  CHANGING   text       = text\r\n             attributes = lv_att\r\n  EXCEPTIONS cancel     = 1\r\n             others     = 2.\r\nIF sy-subrc &lt;&gt; 0.\r\n  RAISE cancel.\r\nENDIF.<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you want to restrict creation of transports (and their release to further systems) based on rules applied on a transport description, you can use method described in this example.<\/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":"ABAP - Check transport request","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,233,9,39,5],"tags":[446,57,76],"class_list":["post-1227","post","type-post","status-publish","format-standard","hentry","category-abap","category-customizing","category-development","category-infrastructure","category-tools","tag-abap","tag-badi","tag-transport"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3nYbe-jN","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/1227","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=1227"}],"version-history":[{"count":1,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/1227\/revisions"}],"predecessor-version":[{"id":1228,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/1227\/revisions\/1228"}],"wp:attachment":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}