05-22-2020 7:55 PM
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[]
05-23-2020 11:11 AM
You can try below Logic.
Get ARCHIV_ID and ARC_DOC_ID from TOA01 Table by passing SAP_OBJECT and OBJECT_ID.
In LT_BIN, you will have the binary data
SELECT *
FROM TOA01
INTO ls_toa01
WHERE SAP_OBJECT = 'VBRK' AND
OBJECT_ID = '9000000887'.
CALL FUNCTION 'SCMS_DOC_READ'
EXPORTING
mandt = sy-mandt
stor_cat = lv_stor
crep_id = ls_toa01-archiv_id
doc_id = ls_toa01-arc_doc_id
TABLES
access_info = lt_acess
* CONTENT_TXT =
content_bin = lt_bin
EXCEPTIONS
bad_storage_type = 1
bad_request = 2
unauthorized = 3
comp_not_found = 4
not_found = 5
forbidden = 6
conflict = 7
internal_server_error = 8
error_http = 9
error_signature = 10
error_config = 11
error_format = 12
error_parameter = 13
error = 14
OTHERS = 15.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
05-23-2020 7:15 PM
I tried your Logic, but result is same, corrupted PDF file which has weird content as i posted in my original question..
05-23-2020 11:31 AM
What I see is that you correctly decided to work with the files as binary (BINARCHIVOBJECT, FILETYPE = 'BIN')
But if you don't use this parameter in GUI_DOWNLOAD:
BIN_FILESIZE = LV_BINFILESIZE
then you'll get extra 00 bytes which don't exist in the archived file...
05-23-2020 8:56 PM
Excuse me, but did you really say "i open the saved pdf in notepad"? notepad for PDF? What do you mean? Could you show a screenshot because I don't understand what you mean?
05-24-2020 11:43 AM
Well u can open pretty much everything in notepad... Opening PDF file in notepad is of course not optimal but when pdf file is corrupted and u cant open it in pdf reader, opening It in notepad gives u rough idea whats in that file and if its is right or wrong.For some reason i cant insert file even its .txt file and it should be permitted... So atleast i uploaded the .png screen of pdf file opened in notepad.
05-24-2020 1:23 PM
Okay. I had not understood that you were really thinking that the HTML in your question was PDF. A true PDF file starts with ASCII characters %PDF-1.3 or something close (depends on version).
So, your problem is that you access the Content Management system incorrectly. Can you explain your ABAP program, what is around ARCHIV_GET_TABLE, how you get the archive ID and so on? And how you archived the PDF file?
05-24-2020 1:52 PM
PDF file was archived using FM ARCHIV_CREATE_TABLE.
I was doing little bit of research and what i found out is:
1. I tried ARCHIVE_GET_TABLE, ARCHIVEOBJECT_GET_TABLE, ALINK_RFC_TABLE_GET and SCMS_HTTP_GET. Result is same, binary version of corrupted PDF (uploaded .png screen).
2. No matter what FILE i am trying to retrieve using FMs above, result (binary result) is always SAME. So i guess the content server is giving me some output no matter of request... or does not understand my request...
Other helpful info:
In OAC0 content is defined:
Document type = ARCHLINK
Storage type = HTTP content server
Link table is TOA01. Stored object type is SEPAMANDAT with custom document type.
09-08-2023 1:09 PM
I am also facing similiar kind of issue when downloading PDF to desktop using Archive Function module. Is this issue solved by any chance ?
09-08-2023 7:27 PM
Please use the COMMENT button for comments, asking for complements, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.