on 05-19-2017 11:02 AM
Hello All ,
i use the cl_abap_gzip to compress an xstring buffer and after compressing i assigned the value of the compressed document to the initial one
the problem is when i go to VF03/VF02 or OAAD and when i want to display the archive i have the message
"File does not begin with %PDF"
Thank u in advance
* document is a pdfxstring
*pdflen is a int with the length of pdfxstring
CALL METHOD cl_abap_gzip=>compress_binary
EXPORTING
raw_in = document
raw_in_len = pdflen
compress_level = 6
IMPORTING
gzip_out = gzip_out
gzip_out_len = gzip_out_len.
if sy-subrc = 0 .
clear document.
clear pdflen.
document = gzip_out.
pdflen = gzip_out_len.
ENDIF.
I have the feeling that the compression should be a major feature of any Content Management System (I could see that it's the default behavior of SAP Content Server). Shouldn't you first ask if this is possible to compress automatically with your CMS ? (then, the best place is the web site of the CMS, not the SAP forums).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if i have the content_bin and the size of this binary content , how can i unzip this data with CL_ABAP_ZIP , to avoid GZIP ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Quite deep in the process, maybe function module SCMS_DOC_URL_READ could be called. I think it calls SCMS_AO_TABLE_GET to retrieve the document. Add an external break-point there to confirm my guess. Be careful to only unzip if it's a ZIP file (four first bytes should be hexadecimal 504B0102). I'm still not talking about GZIP that you should really avoid.
(thank you, but as per forum rules, no private discussion for discussion follow-up : other people might help, and the solution may be helpful to other people seeking for the same question)
Yes , i confirm for the first function module SCMS_DOC_URL_READ but for the second SCMS_AO_TABLE_GET it's not called ( and for compressing i'll use CL_ABAP_ZIP but i should search how to decompress with this class ) ,
and the question is where can i retrieve this zip archivefile ?
thank you again
Okay. Do a little more debug in SCMS_DOC_URL_READ. As far as I can see, I guess there's a "data provider callback" (method dp_callback in local class LCL_CMS_DP). I can see later on from this method that there's a call to function module SCMS_DOC_READ. Maybe this is the one which retrieves the file's content.
Yes . i test with that size and the content_bin but i have the same problem in displaying the archivefile , i think that the place where i enhace the standard is wrong
i enhaced the standard on the top of FM ARCHIV_CREATE_OUTGOINGDOC_MULT because i have the information which is the document on xstring that i compressed
can you suggest another place for compressing the file ?
Don't think. Be sure. I don't understand how you can be uncertain that it is not the right data. When you zip the file, you can see via the debugger the length and the bytes, and you can even download it to your laptop. When you're running SCMS_DOC_READ, why don't you compare them?
If your feeling is that another place is better, then do it.
I won't propose you a solution, because there are lots of places where you can do it. Anyway, my proposition is "don't do that", it sounds me very risky. Where does this requirement come from? Can't you customize the content management software to automatically zip the data?
If the question is "which standard code is to enhance to unzip the archived PDF file (zipped by your custom code) while displaying it via the GOS toolbox ?", then maybe the concerned code is the function module ARCHIVOBJECT_DISPLAY. Add an external break-point (as the display is probably asynchronous) to make sure this is the one called.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's not very clear, but I assume you made a custom program to gzip a PDF archive, and now when you try to open it, there's an error message which says it's not a PDF file.
The error message makes sense, if the file name has still the extension .pdf, SAP/Windows expects a PDF file, not a GZIP file.
By the way, you should better use ZIP, not GZIP ! GZIP cannot be opened from standard Windows installation. A ZIP file can. Use CL_ABAP_ZIP instead of CL_ABAP_GZIP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Sandra ,
yes i agree with you , the problem that i'm not in a specific code i work under the standard of SAP and if i give the extension(.ZIP) after compressing they raise an error i'm exactly , i enhaced the standard program on the top of FM ARCHIV_CREATE_OUTGOINGDOC_MULT
and if i forced the ZIP format i will have
if documentclass <> 'PDF'.
raise error_format.
endif.
* get table content of links to be created
* describe table arc_i_tab lines arc_i_tab_count.
loop at arc_i_tab.
i_arc_i_tab = arc_i_tab.
append i_arc_i_tab.
if arc_i_tab-reserve = 'COMMIT'.
sw_commit = 'X'.
endif.
endloop.
and i also try with the CL_ABAP_ZIP i have the same problem
Thanks again for ur response ,
Yes , it makes sense that what i'm trying to do now but i didn't found the right location to unzip before displaying the compressed archive
that's the problem
can u have a discussion here on https://messages.sap.com/ ?
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.