{"id":288,"date":"2025-04-04T15:40:00","date_gmt":"2025-04-04T13:40:00","guid":{"rendered":"https:\/\/blog.oldwisebear.com\/?p=288"},"modified":"2025-03-31T13:14:18","modified_gmt":"2025-03-31T11:14:18","slug":"sending-idoc-from-production-to-test-system","status":"publish","type":"post","link":"https:\/\/blog.oldwisebear.com\/index.php\/2025\/04\/04\/sending-idoc-from-production-to-test-system\/","title":{"rendered":"Sending idoc from production to test system"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"156\" src=\"http:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2022\/09\/Homepage_bear_up-1024x156.png\" alt=\"\" class=\"wp-image-39\" srcset=\"https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2022\/09\/Homepage_bear_up-1024x156.png 1024w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2022\/09\/Homepage_bear_up-300x46.png 300w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2022\/09\/Homepage_bear_up-768x117.png 768w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2022\/09\/Homepage_bear_up-1536x235.png 1536w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2022\/09\/Homepage_bear_up.png 1847w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-7387b849 wp-block-group-is-layout-flex\">\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"has-text-align-left wp-block-paragraph\">This topic comes to me once in a while, but since I usually need one or two idocs it is always quicker to do the saving and downloading via we19 and standard programs. However lately there came a request &#8211; We need to transfer 100 idocs from one system to another, to discover a defect&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-verse\">It's a SAP technology again, so like with reduction topic, of course there is a well documented standard approach...<\/pre>\n\n\n\n<p class=\"has-text-align-left wp-block-paragraph\"><\/p>\n<\/div>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"3256\" height=\"4696\" src=\"https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/Drabon_level_final-1.png\" alt=\"\" class=\"wp-image-314\" style=\"width:415px;height:auto\" srcset=\"https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/Drabon_level_final-1.png 3256w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/Drabon_level_final-1-768x1108.png 768w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/Drabon_level_final-1-1065x1536.png 1065w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/Drabon_level_final-1-1420x2048.png 1420w\" sizes=\"auto, (max-width: 3256px) 100vw, 3256px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"wp-block-paragraph\">If you needed to recreate a test subject fromm a production environment, you sometimes need to transfer the idoc from one system to another, because &#8220;it&#8217;s not possible&#8221; to do it from the 3rd party system. Of course you most likely seen the approach of saving the idoc to file, downloading it locally and uploading to correct system [1], however it&#8217;s not a viable option for the mass idoc transfer. Another approach is if you own PO\/SIS connected to that system and the idocs are going through it, you can always download it and than pass through another channel to the right system, however this is also a manual way and a no go for bigger amount.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If we think about the standard automation tools like lsmw or migration cockpit this should also be possible though its not cost efficient. Why? Simply because you would need to define route for each idoc, with mappings (recordings are even worse). On the other hand in the migration cockpit, you could most likely synchronize the tables for idocs, but to tell the truth you could do the same with sap edit and then you would still need to reprocess them manually, which is not a big help.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1538\" height=\"801\" src=\"https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/Blog_transform-1.png\" alt=\"\" class=\"wp-image-339\" style=\"width:530px;height:auto\" srcset=\"https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/Blog_transform-1.png 1538w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/Blog_transform-1-768x400.png 768w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/Blog_transform-1-1536x800.png 1536w\" sizes=\"auto, (max-width: 1538px) 100vw, 1538px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So actually why there is no report that would allow to select idocs and resend them to another system? Actually even though SAP have all of the tools required there is nothing that will do it automatically, that&#8217;s why I wrote the following code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>REPORT ZTEST_IDOC_MIGRATION.\n\n* Data declarations\nDATA: lt_idoc_list TYPE TABLE OF edidc-docnum,\n      lv_idoc_num  TYPE edidc-docnum.\n\n\n* Selection screen\nSELECTION-SCREEN BEGIN OF BLOCK b1. \"WITH FRAME TITLE text-001.\nPARAMETERS: p_idoc TYPE edidc-docnum.\nSELECTION-SCREEN END OF BLOCK b1.\n\nSELECTION-SCREEN BEGIN OF BLOCK b2. \"WITH FRAME TITLE text-002.\nSELECT-OPTIONS: s_idoc FOR lv_idoc_num.\nSELECTION-SCREEN END OF BLOCK b2.\n\nSELECTION-SCREEN BEGIN OF BLOCK b3. \"WITH FRAME TITLE text-002.\nPARAMETERS: p_dest TYPE string.\nSELECTION-SCREEN END OF BLOCK b3.\n\n** Text elements\n*TEXT-001 = 'Single IDoc Entry'.\n*TEXT-002 = 'Multiple IDoc Entries'.\n\n* Start-of-selection event\nSTART-OF-SELECTION.\n\n* Process single IDoc entry\nIF p_idoc IS NOT INITIAL.\n  APPEND INITIAL LINE TO lt_idoc_list ASSIGNING FIELD-SYMBOL(&lt;fs_idoc&gt;).\n  &lt;fs_idoc&gt; = p_idoc.\nENDIF.\n\n* Process multiple IDoc entries\nLOOP AT s_idoc INTO DATA(ls_idoc_range).\n  APPEND INITIAL LINE TO lt_idoc_list ASSIGNING FIELD-SYMBOL(&lt;fs_idoc2&gt;).\n  &lt;fs_idoc2&gt; = ls_idoc_range-low.\nENDLOOP.\n\n* Further processing of IDocs\nLOOP AT lt_idoc_list INTO DATA(ls_idoc).\n  \" Add your processing logic here\n  WRITE: \/ 'Processing IDoc:', ls_idoc.\n\n\nDATA: lv_idoc_number TYPE edi_docnum,\n      lv_rc          TYPE sy-subrc,\n      lt_idoc_data   TYPE TABLE OF edidd,\n      lt_idoc_data2  TYPE TABLE OF EDI_DD40,\n      lt_idoc_control2 TYPE TABLE OF EDI_DC40,\n      ls_idoc_control2 TYPE EDI_DC40,\n      ls_idoc_control TYPE edidc.\n\n  REFRESH lt_idoc_data2.\n  REFRESH lt_idoc_control2.\n\n*   IDoc number to be sent\n*  lv_idoc_number = '0000000000281012'. \" Replace with your IDoc number\n  lv_idoc_number = ls_idoc.\n\n*   Retrieve IDoc control and data records\n  CALL FUNCTION 'IDOC_READ_COMPLETELY'\n    EXPORTING\n      DOCUMENT_NUMBER = lv_idoc_number\n    IMPORTING\n      IDOC_CONTROL = ls_idoc_control\n    TABLES\n      INT_EDIDD = lt_idoc_data\n    EXCEPTIONS\n      OTHERS = 1.\n\n  IF sy-subrc = 0.\n  MOVE-CORRESPONDING lt_idoc_data TO lt_idoc_data2.\n  MOVE-CORRESPONDING ls_idoc_control TO ls_idoc_control2.\n  ls_idoc_control2-IDOCTYP = ls_idoc_control-IDOCTP.\n  APPEND ls_idoc_control2 to lt_idoc_control2.\n*   Send IDoc to another SAP system\n    CALL FUNCTION 'IDOC_INBOUND_ASYNCHRONOUS' DESTINATION p_dest\n      TABLES\n        IDOC_CONTROL_REC_40 = lt_idoc_control2\n        IDOC_DATA_REC_40 = lt_idoc_data2\n      EXCEPTIONS\n        OTHERS = 1.\n\n    IF sy-subrc = 0.\n      WRITE: 'IDoc sent successfully'.\n    ELSE.\n      WRITE: 'Error sending IDoc', ls_idoc.\n    ENDIF.\n  ELSE.\n    WRITE: 'Error retrieving IDoc:', ls_idoc.\n  ENDIF.\nENDLOOP.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Of course it&#8217;s a bit crude and it could be a bit better, for example with a alv report to choose the idoc in style of WE02 etc. and possibly it might need definition of additional data in segments (for example receiver partner), but it worked for my end.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Initial screen consist of the following fields where<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1425\" height=\"194\" src=\"https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/image-5.png\" alt=\"\" class=\"wp-image-294\" srcset=\"https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/image-5.png 1425w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/image-5-768x105.png 768w\" sizes=\"auto, (max-width: 1425px) 100vw, 1425px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In case of success the program will show the following log<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"996\" height=\"207\" src=\"https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/image-6.png\" alt=\"\" class=\"wp-image-295\" srcset=\"https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/image-6.png 996w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2025\/03\/image-6-768x160.png 768w\" sizes=\"auto, (max-width: 996px) 100vw, 996px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">And with this quick program migrating idocs, between two connected SAP systems is no longer a problem.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There are standard tools, that can do the job manually, however for some reason SAP doesn&#8217;t have a mass transfer one. With this build I will finally forget about manual process.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Sources:<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/community.sap.com\/t5\/technology-blogs-by-members\/copying-test-idocs-from-another-system\/ba-p\/13076039\">https:\/\/community.sap.com\/t5\/technology-blogs-by-members\/copying-test-idocs-from-another-system\/ba-p\/13076039<\/a><\/li>\n<\/ol>\n<\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"148\" src=\"http:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2022\/09\/Homepage_bear_down-1024x148.png\" alt=\"\" class=\"wp-image-40\" srcset=\"https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2022\/09\/Homepage_bear_down-1024x148.png 1024w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2022\/09\/Homepage_bear_down-300x43.png 300w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2022\/09\/Homepage_bear_down-768x111.png 768w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2022\/09\/Homepage_bear_down-1536x221.png 1536w, https:\/\/blog.oldwisebear.com\/wp-content\/uploads\/2022\/09\/Homepage_bear_down.png 1755w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This topic comes to me once in a while, but since I usually need one or two idocs it is always quicker to do the saving and downloading via we19 and standard programs. However lately there came a request &#8211; We need to transfer 100 idocs from one system to another, to discover a defect&#8230; [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[9,10],"tags":[19,26,25,15],"class_list":["post-288","post","type-post","status-publish","format-standard","hentry","category-sap","category-tutorial","tag-abap","tag-dragon","tag-idoc","tag-integration"],"_links":{"self":[{"href":"https:\/\/blog.oldwisebear.com\/index.php\/wp-json\/wp\/v2\/posts\/288","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.oldwisebear.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.oldwisebear.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.oldwisebear.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.oldwisebear.com\/index.php\/wp-json\/wp\/v2\/comments?post=288"}],"version-history":[{"count":9,"href":"https:\/\/blog.oldwisebear.com\/index.php\/wp-json\/wp\/v2\/posts\/288\/revisions"}],"predecessor-version":[{"id":341,"href":"https:\/\/blog.oldwisebear.com\/index.php\/wp-json\/wp\/v2\/posts\/288\/revisions\/341"}],"wp:attachment":[{"href":"https:\/\/blog.oldwisebear.com\/index.php\/wp-json\/wp\/v2\/media?parent=288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.oldwisebear.com\/index.php\/wp-json\/wp\/v2\/categories?post=288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.oldwisebear.com\/index.php\/wp-json\/wp\/v2\/tags?post=288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}