Skip to Content
0
May 22, 2020 at 06:55 PM

Save archived PDF to local pc

743 Views

Hi, my requirement is to save multiple archived pdf files to destination on local PC. I am trying to use "ARCHIV_GET_TABLE" to get the archived pdf in binary form and than pass it do "GUI_DOWNLOAD". It is kinda working but saved pdf is corrupted. What i found out is that i am getting weird data from "ARCHIV_GET_TABLE" even tho sy-subrc after execution is 0. When i open the saved pdf in notepad apparently something is wrong. Here is the content of opened pdf.

<!DOCTYPE html>
<html lang="sk-sk" dir="ltr">
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />    
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1"/>    
<link rel="shortcut icon" href="ecm/widget/resources/images/favicon.png"/>  
<style>  @import "ecm/widget/resources/dojo.css.jgz";  @import "ecm/themes/oneui/dojo.css.jgz";  @import "ecm/widget/resources/ecm.css.jgz";  @import "ecm/themes/oneui/oneui.css.jgz"; @import "pvd/themes/pvd.css.jgz"; @import "pvr/themes/pvr.css.jgz"; @import "ecm/widget/viewer/crocodoc/viewer_min.css";   .loadingText { text-align: center; }     
</style>  
  <script src="dojo/dojo.js.jgz" data-dojo-config="locale: 'sk-sk', extraLocale: ['en'], parseOnLoad: true, has: {'dojo-bidi': false, 'text-direction': '', 'calendar-type': ''}, isDebug: false,aliases: [['dijit/BackgroundIframe', 'ecm/BackgroundIframe']],packages: [{name: 'idx', location: '../idx'}]"></script>  <script src="ecm/ecm.js.jgz"></script>  <script>  dojo.require("ecm.Logger");  ecm.logger.initLogger(0,false);  require(["dojo/domReady!", "dojo/dom"], function(domReady, dom){    var node = dom.byId("ECMWebUIloadingText"); if(node){ var loadingMsg = ""; if (navigator.appVersion.indexOf("MSIE 8") > 0) { var image = dom.byId("ECMWebUIloadingAnimationImage"); if (image && image.style) { image.style.display = "none"; } if (ecm && ecm.messages && ecm.messages.ie8_not_supported_browser) { loadingMsg = ecm.messages.ie8_not_supported_browser; } else { loadingMsg = "IE8 is not a supported browser."; } } else { if (ecm && ecm.messages) { loadingMsg = ecm.messages.progress_message_getDesktop; } else { loadingMsg = "An error occurred when the browser attempted to load the ecm.js.jgz file from the application server.<br>The ecm.js.jgz file is required by IBM Content Navigator.<br><br>Please contact your system administrator and ask them to check the network or application server environment."; node.style.textAlign = "left"; var loadingAnimation = dom.byId("ECMWebUIloadingAnimationImage"); if (loadingAnimation) { loadingAnimation.style.display = "none"; } } } node.innerHTML = loadingMsg; } });  </script></head>
<body style="width: 100%; height: 100%; position: absolute;">
<script type="text/javascript"> require(["ecm/widget/BookmarkPane"], function(BookmarkPane) { // Adding the bookmark pane programmatically since searchCriteriaJson may contain markup that would cause the Dojo parser to fail var pane = new BookmarkPane({ id: "ECMWebUI", browserLocale: "sk-sk", searchCriteriaJson: "", style: "width: 100%; height: 100%" }); pane.placeAt(dojo.body(), "first"); pane.startup(); });</script></body></html>

Here is the code i am using. Archived object surely exist, i can open it through OAAD using IBM content manager. Migh be the problem in using IBM archive ? Thanks for any advice.

CALL FUNCTION 'ARCHIV_GET_TABLE'
 EXPORTING
 AR_OBJECT = 'ZOZEO'
 OBJECT_ID = '9000000887'
 SAP_OBJECT = 'VBRK'
 IMPORTING
* LENGTH =
 BINLENGTH = LV_BINFILESIZE
 TABLES
 ARCHIVOBJECT = GT_ARCHIVOBJECT[]
 BINARCHIVOBJECT = GT_BINARCHIVOBJECT[]

CALL FUNCTION 'GUI_DOWNLOAD'
 EXPORTING
" BIN_FILESIZE = LV_BINFILESIZE
 FILENAME = lv_filename
 FILETYPE = 'BIN'
 TABLES
 DATA_TAB = GT_BINARCHIVOBJECT[]