Download PDF File from Archiv to SAP Application Server
Hi,
I need to download the PDF file from an NAST-Dataset (how is stored from the message via SAP ArchivLink) to the SAP Application Server.
1) At first i read the Archiv-Link data via function module WFMC_GET_ARCHIVE_OBJECT_TYPE
2) Then i get the Connection-Infos via function module ARCHIV_GET_CONNECTIONS_INT
3) Now i read the file from archiv as table via function module ARCHIVOBJECT_GET_BYTES
4) Save to the SAP Appl.Server via:
- OPEN DATASET ld_dpfad FOR OUTPUT IN BINARY MODE
- LOOP and TRANSFER lf_archivobject TO ld_dpfad.
- CLOSE DATASET ld_dpfad.
In the dialog of NAST-Dataset (Messages) i can open the PDF-File without any errors (display originals). But after the filetransfer to the SAP Appl.Server i get the following errors during the file opening dialog from Adobe Acrobat Reader:
- the embedded font u201CArialu201D cant to be extract
- not enough data for the picture
The reader can display the PDF-File but only without the picture (Logo) and with alternative font.
The same transfer from archiv and sending as an attachement to the BOR-Object via function module SO_DOCUMENT_INSERT_API1 works very fine and without any errors.
Can any one please help me to solve this Issue?
Thanks in Advance,
Thomas
Hello Keith,
Many thanks for your answer.
In the past i didnu2019t need the BINARCHIVOBJECT-Parameter and so i overlook this option.
Now, the File looks a little bit different, but only in the STREAM-section.
During the Fileopen-Dialog i get only one message now - "not enough data for image" and the image will not displayed. The rest seems to be correct.
The relevant coding is now:
ld_doc_typ = pf_connections-reserve.
CALL FUNCTION 'ARCHIVOBJECT_GET_BYTES'
EXPORTING
archiv_id = pf_connections-archiv_id
archiv_doc_id = pf_connections-arc_doc_id
document_type = ld_doc_typ
length = ld_length1
offset = ld_offset
IMPORTING
binlength = ld_length
offset = ld_offset
TABLES
binarchivobject = lt_binarchivobj
EXCEPTIONS
error_archiv = 1
error_communicationtable = 2
error_kernel = 3
OTHERS = 4.
Zieldatei zum Schreiben öffnen
OPEN DATASET ld_dpfad FOR OUTPUT IN BINARY MODE.
Inhalte in Zieldatei schreiben
LOOP AT lt_binarchivobj INTO lf_binarchivobj.
TRANSFER lf_binarchivobj TO ld_dpfad NO END OF LINE.
ENDLOOP.
Zieldatei schließen
CLOSE DATASET ld_dpfad.
Where is the error for the image data?
Ciao Thomas
Push up by: Thomas Engler on May 3, 2010 4:54 PM
Similar Messages
-
Uploading PDF-file from unix to SAP internal table
Hi,
i have to write an abap that sends a pdf-file from a unix (SAP server) by mail to some people.
The mailing part is done, but for creating the attachment. I'm reading the pdf-file into an internal table (in a binary way). Then i'm using this int.table to send the mail.
The email is sent with an attachment, but i cannot open the pdf-file because of an error ( file damaged ). So before sending it by mail, i'm downloading the pdf file to my pc by using WS_DOWNLOAD with the same internal table. The download file gives the same error.
If i look at the size :
- originally pdf file 71743 bytes
- resulting pdf file 71665 bytes (281 lines x 255)
The creation of the internal table is as follows :
open dataset g_file for input in binary mode.
check sy-subrc eq 0.
do.
* read dataset g_file MAXIMUM LENGTH 255 into wa_pdf.
read dataset g_file into wa_pdf.
if sy-subrc ne 0. exit. endif.
append wa_pdf_hex to i_pdf.
enddo.
close dataset g_file.
where:
types: tt_pdf type table of soli, "raw 255 long
data: i_pdf type tt_pdf,
wa_pdf like line of i_pdf
Is there a better way to read in the pdf-file ? Any suggestions ?
regards,
Hans
[email protected]Hello Hans,
this is a little example from a program to send mail with picture. The problem is the same
form p_create_mail tables itab_html.
data : object_hd_change like sood1 occurs 0 with header line,
objpara like selc occurs 0 with header line,
receivers like soos1 occurs 0 with header line,
packing_list like soxpl occurs 0 with header line,
fic_attach like soli occurs 0 with header line,
struct_user_adress like usaddress ,
v_file(80) type c ,
v_buff(255) type c ,
v_num(9) type n,
v_length type i ,
v_total_length type i,
v_len(9) type n.
move : 'HTM' to object_hd_change-file_ext ,
'PIOU' to object_hd_change-objdes.
append object_hd_change.
* Find email addr for the username.
loop at s_bname.
call function 'SUSR_USER_READ'
exporting
user_name = s_bname-low
importing
user_address = struct_user_adress
exceptions
user_name_not_exists = 1
internal_error = 2
others = 3.
select single smtp_addr
into receivers-recextnam
from adr6
where addrnumber eq struct_user_adress-addrnumber
and persnumber eq struct_user_adress-persnumber.
if sy-subrc eq space.
move 'U' to receivers-recesc.
append receivers.
endif.
endloop.
* Get the picture.
move '/sap_interfaces/D27/pzr_00/data/test/logopharma.gif'
to v_file.
open dataset v_file for input in binary mode.
do.
read dataset v_file into v_buff length v_length.
v_total_length = v_length + v_total_length.
move v_buff+0(v_length) to fic_attach-line+0(v_length).
append fic_attach.
if sy-subrc ne space.
exit.
endif.
enddo.
describe table fic_attach lines v_num.
describe field fic_attach-line length v_len.
move : 'Logo' to packing_list-objdes ,
'Logo' to packing_list-objnam ,
'1' to packing_list-body_start ,
'raw' to packing_list-objtp ,
'GIF' to packing_list-file_ext .
packing_list-body_num = v_num.
packing_list-objlen = v_num * v_len.
append packing_list.
* Send mail.
call function 'SO_OBJECT_SEND'
exporting
object_hd_change = object_hd_change
object_type = 'RAW'
owner = sy-uname
tables
objcont = itab_html
objpara = objpara
receivers = receivers
packing_list = packing_list
att_cont = fic_attach
exceptions
others = 01.
endform. " P_CREATE_MAIL.
Regards
Frédéric -
HELP111 Unable to download PDF files from website
I can download PDF files from my emails but I can not download (or open I guess you might call it)PDF files from a website. Can anyone help? I have reader 9 with vista home and use norton 360.
Thanks,
GregI had vers 8 and upgraded to 9 without removing the previous version. When I click on the PDF icon to open the document the little window comes, the circle goes round and round but the file never downloads.
Help!!!
Greg -
Unable to download pdf files from emails or websites
I used to be able to download pdf files from emails and websites on my Windows vista 2007 computer, but am now unable to save or download them. Is there something I need to adjust in my security system which hasn't changed?
If you're using Vista it's the same procedure as with Windows 7 (which I use) From Tools>Internet Options, click the Programs tab, and then click the Set Programs button. In Windows 7 this will open the Control Panel>Default Programs window. From there you want to click Associate a file type or protocol with a program. Scroll down the list to Portable Document Format (PDF). click it and click the Change Program button. Choose Adobe Reader as the default program, click Ok and then PDFs will download instead of opening in IE.
-
Cannot download pdf files from internet site with either acrobat pro X or pro XI on windows 8 comput
cannot download pdf files from internet website with either acrobat pro x or proXI on windows 8 computer. windows 7, no problem.
Hi valerieross,
Acrobat can be used to view pdf's or edit pdf's not download them.
Check your browser settings.
If you are referring to viewing pdf's in browser, then please check the following : http://helpx.adobe.com/acrobat/kb/cant-view-pdf-web.html -
What to do to correct problem?
Duplicate, see:
My Photoshop Elements 9 will not download a file from new Apple photo application on iMac (installed 4-9-15) What to do? -
Corrupted content error when trying to download .pdf file from one website.
Unable to download .pdf file from a website, but IE8 provided the download without hesitation.
Both v7 and v8 produced the same message:
"Corrupted content error"
The page you are trying to view cannot be shown because an error in the data transmission was detected.
This may be a particular website problem, or it may be common to the particular industry segment and their protocols.
I have followed the help leads and examined the profile for Firefox as used in this instance. Nothing untoward seemed to pop out as a causal factor.Reworked some of the javascript for our webserver and fixed the problem.
-
Downloading PDF files from reliable web-sites U-R-G-E-N-T
Hi,
Since last year I encounter regular (close to 100%) problems downloading PDF files from reliable web-sites (for sure web-sites from which I could troubleless download PDF files in the past) The result on my HDD : 0KB pdf file ! = An empty file
This is very anoying and I am sure I am not the only one who encounters this.
Please review your procedures and make this possible again.
Note: I uninstalled Adobe Reader, reset Safari, closed Safari, re-installed Adobe Reader : no results !
THANKS FOR HELPING ASAP !
I travel a lot and have to bring my files with me as internet is not always available in the countries where I work
ChristianHi Christian,
I've had problems for ages with this but I did notice that after I went through the reinstall with Apple yesterday I now have a couple of different options that are working.
Yesteday I uninstalled reader, restarted my computer and then reinstalled again. I didn't think it had worked for me but after some extra experimentation I have discovered a couple of things.
On some websites eg: https://www.gatewaycu.com.au/uploadedFiles/PDF/Forms/Quick%20Debit%20Authority.pdf
it is coming up with a toolbar (I suppose it's called) at the top of the PDF and it is allowing me to print and save to my desktop, open the pdf and print YEAH.
Also with another website the PDF is showing up differently. eg http://media.wix.com/ugd/99e891_6110f024d956431abb7b66dd24f19251.pdf
This shows up like it used to but the difference is that if you try to save as or print throught the safari options like I used too it doesn't work, BUT if you hover down the bottom of the PDF it brings up a bar type box (sorry I don't know the technical word for this) then you can print, save to desktop, documents etc and then print from there too.
YEAH! It looks like (I hope) that the problem is solved. You have to go about it in a couple of different ways depending on the website, but hey, I don't think that's so bad as long as I can actually print my PDF's. It's better that not being able to access any of them which is what's been happening for the last few months.
I hope this helps you guys out and if you have any problems just let me know and I'll try and explain it better for you.
Cheers
Andrea -
Cannot download PDF files from Internet with Safari.
What must I do (after resetting Safari) to be able to coherently download PDF files from the Internet
Back up all data.
Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
/Library/Internet Plug-ins
In the Finder, select
Go ▹ Go to Folder
from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
If you still have the issue, repeat with this line:
~/Library/Internet Plug-ins
If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again. -
Hi, since installing mountain lion on my macbook, it wont download pdf files from internet sites, the same problem does not exist on my mac mini, i am using firefox on both macs, please help!
Back up all data.
Quit Safari. In the Finder, select Go ▹ Go to Folder... from the menu bar, or press the key combination shift-command-G. Copy the line of text below into the box that opens, and press return:
/Library/Internet Plug-ins
From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then launch Safari and test.
If you still have the issue, repeat with this line:
~/Library/Internet Plug-ins
If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again. -
Pdf file in txt format in application server
Hi all,
can we use open datset to store pdf file in text format in application server.
when i am using this some data was getting correctly stored in appl server.but some data is getting converted to # symbols.of course the pdf data also contains some different characters in that place.
but i want that pdf data in that format,i dont want that change of # symbols...how can i do that...
and while storing it,it is allowing only open dataset in binary mode only ..can anybody explain why?
regards,
sharma.<b>Check this example....</b>
report ztest.
data: begin of itab occurs 0,
field(256),
end of itab.
data: dsn(100) value '/usr/sap/xfr/FIS/testpdf',
length like sy-tabix,
lengthn like sy-tabix.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\temp\test.pdf'
filetype = 'BIN'
importing
filelength = length
tables
data_tab = itab.
open dataset dsn for output in binary mode.
loop at itab.
transfer itab-field to dsn.
endloop.
close dataset dsn.
clear itab.
refresh itab.
*- To crosscheck if it went well
open dataset dsn for input in binary mode.
do.
read dataset dsn into itab-field.
if sy-subrc = 0.
append itab.
else.
exit.
endif.
enddo.
call function 'GUI_DOWNLOAD'
exporting
filename = 'c:\temp\testn.pdf'
filetype = 'BIN'
bin_filesize = length
importing
filelength = lengthn
tables
data_tab = itab.
<b>TIP</b>
Use the TCode
CG3Z or CG3Y
for downloading to Application Server.
Regards,
Pavan -
Transfer file from UNIX to windows application server G:\ drive
Dear Expert,
Really need some help on this, very urgent !
The download program schedule in background to allow file store in unix.
Can we do a unix command in abap program to transfer the file from unix to windows application server G:\ drive.
The gateway for that application server is ukblmqg02.emea.astrazeneca.net .
Anyone have the sample source code ?
Thanks®ards
NislinaHi,
1.
There is a FM 'ARCHIVFILE_SERVER_TO_CLIENT'.
If the requirement need not necessarily require a FM to transfer a file, then you can also use transaction 'CG3Y' to transfer a file
from application server to presentation server.
2.
Try to use FM DOCFILE_SERVER_TO_CLIENT. I am using it to download a file from SAP application server to desktop.
Source path should be application server file path along with file name i.e. /tmp/sample.xls.
Target path should be something like c:\file.xls.
Best regards,
Prashant -
Download PDF file from Application Server in BSP
Hello,
We have a requirement on which we want to download a PDF file stored in Application server using BSP application. I have used function module ARCHIVFILE_SERVER_TO_CLIENT but this FM will help only if i want to download file from GUI it won't work in BSP application.
Further i have used class CL_BSP_UTILITY and download method to download file from application server but it is not working in desired manner.
I am attaching my code for your reference:
DATA: BUTTON_EVENT TYPE REF TO CL_HTMLB_EVENT_BUTTON ,
EVENT TYPE REF TO IF_HTMLB_DATA.
DATA: LS_HOURS LIKE LINE OF GT_HOURS.
DATA STR TYPE STRING.
DATA: OUTPUT TYPE STRING ,
L_XSTRING TYPE XSTRING ,
APP_TYPE TYPE STRING.
EVENT = CL_HTMLB_MANAGER=>GET_EVENT( REQUEST ).
DATA PHY_NAME_OUT TYPE SAPB-SAPPFAD.
IF EVENT IS NOT INITIAL AND EVENT->EVENT_NAME = HTMLB_EVENTS=>BUTTON .
BUTTON_EVENT ?= EVENT .
CASE EVENT->EVENT_SERVER_NAME.
WHEN 'test' .
IF GT_HOURS IS NOT INITIAL.
PHY_NAME_OUT = '/usr/sap/put/form16//01000200_2007.PDF'.
OPEN DATASET PHY_NAME_OUT FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC IS INITIAL.
DO.
READ DATASET PHY_NAME_OUT INTO STR.
IF SY-SUBRC IS INITIAL.
CONCATENATE
OUTPUT
str
cl_abap_char_utilities=>cr_lf
INTO output SEPARATED BY space. "cl_abap_char_utilities=>horizontal_tab
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
*LOOP AT gt_hours INTO ls_hours.
*CONCATENATE
*OUTPUT
*ls_hours-hour
*cl_abap_char_utilities=>cr_lf
*INTO output SEPARATED BY space. "cl_abap_char_utilities=>horizontal_tab
*ENDLOOP.
APP_TYPE = 'APPLICATION/PDF;charset=utf-16le'.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = OUTPUT
MIMETYPE = 'APPLICATION/PDF;charset=utf-16le'
IMPORTING
BUFFER = L_XSTRING.
CONCATENATE CL_ABAP_CHAR_UTILITIES=>BYTE_ORDER_MARK_LITTLE
L_XSTRING
INTO L_XSTRING IN BYTE MODE.
CALL METHOD CL_BSP_UTILITY=>DOWNLOAD
EXPORTING
OBJECT_S = L_XSTRING
CONTENT_TYPE = APP_TYPE
CONTENT_DISPOSITION = 'attachment;filename=webforms.pdf'
RESPONSE = _M_RESPONSE
NAVIGATION = NAVIGATION.
ENDIF.
ENDCASE.
ENDIF.
From this code i am able to download PDF file but it is not opening in local machine.
If any other way to download file then please suggest.
waiting for ur reply.
Regards,
GaganHi,
you do the file reading wrong:
have a look at:
Local declarations.
data:
components type stringtab,
component type string,
path type text255,
file type text255,
line_length type i,
filecontent_binary type sdokcntbin,
rows type sytabix,
content type sdokcntbin,
exception type ref to cx_sy_file_access_error,
exception_tmf type ref to cx_sy_too_many_files ,
block_size type i value 1022,
length type i.
field-symbols:
<hex_container> type x.
constants:
c_dms_blk_size type i value 2550.
clear file_size.
try.
open dataset file_name for input in binary mode message message.
catch cx_sy_file_open into exception.
case exception->textid.
when '4182174D03030063000000000A1551B1'. raise access_error.
when '41825AD355C3005E000000000A1551B1'. raise open_error.
when '47E8B03AECE5BA07E10000000A114829'. raise already_open.
when others.
endcase.
catch cx_sy_file_authority into exception.
case exception->textid.
when '4182174D03030063000000000A1551B1'. raise access_error.
when 'A70BB8396F051547E10000000A11447B'. raise authority_error.
when others.
endcase.
catch cx_sy_too_many_files into exception_tmf.
case exception_tmf->textid.
when '8708B73915F6B645E10000000A11447B'. raise too_many_files.
when others.
endcase.
endtry.
do.
try.
read dataset file_name into filecontent_binary-line.
if sy-subrc <> 0.
add line_length to file_size.
append filecontent_binary to file_content_binary.
exit.
else.
add line_length to file_size.
append filecontent_binary to file_content_binary.
endif.
catch cx_sy_file_open_mode into exception.
case exception->textid.
when '9207B73915F6B645E10000000A11447B'. raise cx_sy_file_open_mode.
when '9807B73915F6B645E10000000A11447B'. raise read_only.
when '9E07B73915F6B645E10000000A11447B'. raise not_open.
when '409D273A2D824360E10000000A11447B'. raise incompatible_mode.
when others.
endcase.
endtry.
enddo.
try.
close dataset file_name.
catch cx_sy_file_close into exception.
case exception->textid.
when '4182174D03030063000000000A1551B1'. raise access_error.
when 'C10BB8396F051547E10000000A11447B'. raise close_error.
when others.
endcase.
catch cx_sy_file_access_error into exception.
case exception->textid.
when '4182174D03030063000000000A1551B1'. raise access_error.
when others.
endcase.
endtry.
Get file size.
split file_name at '/' into table components.
describe table components lines sy-tfill.
read table components into component index sy-tfill.
path = file_name.
replace component in path with ''.
file = component.
call function '/EUH/MMS_GET_FILE_SIZE'
exporting
dir_name = path
file_name = file
importing
file_size = file_size.
and function /euh/mms_get_file_size.
""Local Interface:
*" IMPORTING
*" VALUE(DIR_NAME) TYPE TEXT255
*" VALUE(FILE_NAME) TYPE TEXT255
*" EXPORTING
*" VALUE(FILE_SIZE) TYPE SDOK_FSIZE
*" EXCEPTIONS
*" NO_AUTHORITY
*" ACTIVITY_UNKNOWN
*" NOT_A_DIRECTORY
*" NO_MEDIA_IN_DRIVE
*" TOO_MANY_ERRORS
*" TOO_MANY_FILES
*" BRACKET_ERROR_IN_FILENAME
*" NO_SUCH_PARAMETER
types: begin of files,
line like ocs_file,
end of files.
data: file type files,
f_subrc like sy-subrc value 0,
errno(3) type c,
errmsg(40) type c,
pos type i,
len type i,
parameter(120) type c,
help1(120) type c,
help2(120) type c,
error_counter type i.
data:
dir_list like ocs_file occurs 0 with header line.
CASE sy-subrc.
WHEN 1. f_subrc = 64.
WHEN 2. f_subrc = 65.
WHEN 0.
search dir_name for 'SY-HOST'. "Is SY-HOST used in directory name?
if sy-subrc = 0.
pos = sy-fdpos + 7.
move dir_name(sy-fdpos) to help1.
move dir_name+pos to help2.
concatenate help1 sy-host help2 into dir_name.
endif.
do 12 times. " To avoid endless loop
if dir_name cs '$('. " Replace parameter by their value
pos = sy-fdpos + 2.
if dir_name cs ')'.
len = sy-fdpos - pos.
if len le 0.
f_subrc = 4. exit.
else.
parameter = dir_name+pos(len).
call 'C_SAPGPARAM' id 'NAME' field parameter
id 'VALUE' field parameter.
if sy-subrc = 0.
len = pos + len + 1.
pos = pos - 2.
if pos > 0.
move dir_name(pos) to help1.
else.
help1 = ''.
endif.
pos = strlen( dir_name ).
if pos > len.
move dir_name+len to help2.
else.
help2 = ''.
endif.
concatenate help1 parameter help2 into dir_name.
else.
f_subrc = 8. exit.
endif.
endif.
else.
exit.
endif.
else.
exit.
endif.
enddo.
shift dir_name right deleting trailing '/\ '.
shift dir_name left deleting leading space.
call 'C_DIR_READ_FINISH' " this is from RSWATCH0
id 'ERRNO' field errno
id 'ERRMSG' field errmsg.
call 'C_DIR_READ_START'
id 'DIR' field dir_name
id 'FILE' field file_name
id 'ERRNO' field errno
id 'ERRMSG' field errmsg.
case sy-subrc.
when 1.
case errno.
when 2 or 20. f_subrc = f_subrc + 66.
when ' '. f_subrc = f_subrc + 67.
endcase.
when 0.
clear error_counter.
do.
clear file.
clear dir_list.
call 'C_DIR_READ_NEXT'
id 'TYPE' field file-line-type
id 'NAME' field file-line-name
id 'LEN' field file-line-len
id 'OWNER' field file-line-owner
id 'MTIME' field file-line-mtime
id 'MODE' field file-line-acc_mode
id 'ERRNO' field errno
id 'ERRMSG' field errmsg. "sy-subrc = 3 is e.g. if return
if sy-subrc = 0 or sy-subrc = 3."data do not fit into variables
perform p6_to_date_time_tz(rstr0400) using
file-line-mtime
file-line-mod_time
file-line-mod_date.
file_size = file-line-len.
dir_list = file-line.
append dir_list.
elseif sy-subrc = 1. " nothing (more) found
exit.
else.
if error_counter > 50.
call 'C_DIR_READ_FINISH'
id 'ERRNO' field errno
id 'ERRMSG' field errmsg.
pos = f_subrc mod 2.
if pos = 0. f_subrc = f_subrc + 1. endif.
exit.
endif.
add 1 to error_counter.
endif.
if sy-index > 1000.
pos = f_subrc mod 4.
if pos = 0. f_subrc = f_subrc + 2. endif.
exit.
endif.
enddo.
call 'C_DIR_READ_FINISH'
id 'ERRNO' field errno
id 'ERRMSG' field errmsg.
if sy-opsys(3) = 'Win' and not ( file_name cs '*' ).
describe table dir_list lines len.
if len = 0.
help1 = file_name.
translate help1 to upper case.
translate help1 using
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
call 'C_DIR_READ_START'
id 'DIR' field dir_name
id 'FILE' field help1.
if sy-subrc = 0.
clear error_counter.
do.
clear file.
clear dir_list.
call 'C_DIR_READ_NEXT'
id 'TYPE' field file-line-type
id 'NAME' field file-line-name
id 'LEN' field file-line-len
id 'OWNER' field file-line-owner
id 'MTIME' field file-line-mtime
id 'MODE' field file-line-acc_mode
id 'ERRNO' field errno
id 'ERRMSG' field errmsg.
if sy-subrc = 0 or sy-subrc = 3.
help2 = file_name.
translate help2 to upper case.
help1 = file-line-name.
translate help1 to upper case.
if help1 = help2.
perform p6_to_date_time_tz(rstr0400) using
file-line-mtime
file-line-mod_time
file-line-mod_date.
dir_list = file-line.
append dir_list.
endif.
elseif sy-subrc = 1.
exit.
else.
if error_counter > 50.
call 'C_DIR_READ_FINISH'
id 'ERRNO' field errno
id 'ERRMSG' field errmsg.
pos = f_subrc mod 2.
if pos = 0. f_subrc = f_subrc + 1. endif.
exit.
endif.
add 1 to error_counter.
endif.
if sy-index > 1000.
pos = f_subrc mod 4.
if pos = 0. f_subrc = f_subrc + 2. endif.
exit.
endif.
enddo.
call 'C_DIR_READ_FINISH'
id 'ERRNO' field errno
id 'ERRMSG' field errmsg.
endif.
endif.
endif.
endcase.
ENDCASE.
CASE f_subrc.
WHEN 1 OR 3. RAISE too_many_errors.
WHEN 2. RAISE too_many_files.
WHEN 4 OR 5 OR 6 OR 7 OR 70 OR 71.
RAISE bracket_error_in_filename.
WHEN 8 OR 9 OR 10 OR 11 OR 74 OR 75.
RAISE no_such_parameter.
WHEN 64. RAISE no_authority.
WHEN 65. RAISE activity_unknown.
WHEN 66. RAISE not_a_directory.
WHEN 67. RAISE no_media_in_drive.
ENDCASE.
endfunction.
Now you will be able to get the filesize and the file in SDOK format sdokbin.
Okay.
You have to build an request and push the content to the user like:
call method server->response->set_header_field( name = 'Content-Type' value = value ).
describe field file_content_binary-line length line_length in byte mode.
bytes_rest = file-size.
loop at file_content_binaries assigning <file_content_binary>.
move <file_content_binary>-line to data.
if bytes_rest <= 0. "mismatch between line values and size
exit.
endif.
if bytes_rest >= line_length.
call method server->response->append_data( data = data
length = line_length ).
else.
call method server->response->append_data( data = data
length = bytes_rest ).
endif.
bytes_rest = bytes_rest - line_length.
endloop.
This will work.
You can set the header fields like you want. Have also a look at sicf node contentserver
and its handler: CL_HTTP_EXT_CSIF -
When I download .pdf files from my office they are converted to .ashx files
When I download a .pdf file from my Outlook mail box at my office, Firefox reads it as an .ashx file. However if I use Safari, it is read correctly as a .pdf file.
How can I fix my Firefox browser?
An IT person at my office said I should reset the download actions by deleting mime.Types.rdf, but I can't even find this file.See [[/en-US/questions/894442]]
-
Error while downloading PDF file from FTP Server
Hi Friends,
I have sent a PDF file with data to FTP , Then i want to check that uploaded pdf file , whether that is correct or not?
for that , i have downloaded that file from FTP and i am trying to open the file . but it is giving this problem .
"There was an error opening the document . The file is damaged and could not be repaired."
will you suggest me regarding this.
thanks in advance.
balaji.T.CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = spoolno
src_spoolid = wa_file-rqident
no_dialog = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
OTF_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11.
because of this one PDF internal table is obtained.
OPEN DATASET L_FILENAME FOR OUTPUT in text mode MESSAGE MSG.
LOOP AT pdf.
CONCATENATE pdf-tdformat "Material group
pdf-TDLINE "Basic Material
INTO ITEXT-TLINE ..
APPEND ITEXT.
TRANSFER ITEXT TO L_FILENAME.
ENDLOOP.
Maybe you are looking for
-
Dear All, All of a sudden, my "attach to email" function no longer works. If I open a PDF in Acrobat 9.0, and I try to "attach to email," nothing happens. This feature has always worked for me in the past. When I check for updates, Acrobat reports
-
The attempt to burn disc failed. An unknown error occurred (4310).
This is a fairly brand new Windows 8 laptop with all hardware and most software out of the box. I did have Virtual Clone Drive installed, but I unistalled it to rule it out as a culprit. Every time I try to burn a disk, it briefly says "Initializing.
-
How do I stop my iphone from turning on photo stream AFTER I turned it off?
I have this problem that happens constantly and I cannot figure out a premenant solution for it. I have the Iphone 4. Since the IOS 7 upgrade, the photo stream option will not stay turned off. It seems to turn it on by itself. It will be on after a r
-
E65: pdf shows boxes instead of letters
I can't read any pdf files in my E65. it shows the image contents properly, but does not show any letters, intead, it shows boxes! i am not sure whether it's a problem with the fonts or not. and i m not sure how to fix it. could anyone help me out pl
-
Why can't apple's Pages be programmed to export only iTunes acceptable ePub files, suggesting corrections with options?