2011 Jul 26 8:46 AM
Hi All,
I want to write PDF file to application server while downloading its writing but in this manner
%PDF-1.6#%####
108 0 obj#<</First 17/Length 108/Filter/FlateDecode/N 3/Type/ObjStm>>stream
xڲT0P04Q07W05#2,#ll##K#J*#R#C####Sbq#[^##GjNYjIfr##SN##kr~Jf#~xf#c^q&##Ҧ##agG#a####X###T##XR### ##b#
Please let me know where i am doing wrong.
Please see below my code .
(the scenario is when i download the pdf file i want to write the same file in to app server )
call function fm_name
exporting
/1bcdwb/docparams = fp_docparams "
ls_header = ls_waste
lt_item = gt_rkpf
aufnr = lv_aufnr
importing
/1bcdwb/formoutput = fp_formoutput
exceptions
usage_error = 1
system_error = 2
internal_error = 3
others = 4.
concatenate 'D:\temp\PROCESSORDER_' ls_waste-rsnum '.PDF' into lv_file.
pr_file = lv_file.
open dataset pr_file for output in binary mode."text mode encoding NON-UNICODE.
if sy-subrc 0.
exit.
endif.
transfer fp_formoutput-pdf to pr_file.
close dataset pr_file.
clear :fp_formoutput-pdf,lv_file.
Please any one help me thanks,
Thanks,
Kumar
2011 Jul 26 9:57 AM
Hi,
can you explain what exactly the problem? Do you have the file on the application server after execution your program is complete? How do you manage to see the file with these symbols?
2011 Jul 26 10:01 AM
Thanks a lot for reply.
after writing my file i can see using AL11 transaction , why i want to see is after writer user want to change that data and he want to move that file into archive folder in server then i have to read right now they can't modify becz it is not in text mode it is like symbols they don't no where they want to modify.
please tell me what i have to do.
2011 Jul 26 10:13 AM
You need to try checking you file, if it is correct. If the file on server is not correct, you need to add catching exceptions (like CX_SY_FILE_OPEN, CX_SY_CODEPAGE_CONVERTER_INIT etc.).
2011 Jul 26 10:43 AM
Hi Alexander and Jose,
Thanks for quick reply , where i have to pass these exceptions right now i am passing to fm call function fm_name but in debug i can see sy-subrc = 0 and is there any other way to write file to server.
And one more thing i am wondering is i downloaed the file using cg3y from server it is showing correct data and in pdf format
but after upload why it is showing in correct format (not readable format) ,
can you please help me is there any other way i can write pdf file to application server
Thanks
Kumar
2011 Jul 26 11:05 AM
As said you won't see pdf via AL11.
Just a thought, try to write extension "pdf" in lower case.
2011 Jul 26 10:00 AM
You can't tranfer the whole PDF data with just one transfer statement, instead you have to loop that table and transfer the data to the file until you reach the last row.
open dataset pr_file for output in binary mode."text mode encoding NON-UNICODE.
if sy-subrc 0.
exit.
endif.
loop at fp_formoutput-pdf *****************
transfer fp_formoutput-pdf to pr_file.
endloop.
close dataset pr_file.
clear :fp_formoutput-pdf,lv_file.
2011 Jul 26 10:08 AM
Hi Jose ,
Thanks for reply, fp_formoutput-pdf is structure not a table from fm i am getting only one string not a table i changed to table and loop and transferd but the problem is same .
Please tell me what i have to do
Thanks
Kumar
2011 Jul 26 10:19 AM
Hi
I still don't know what is wrong, if the PDF file is created succesfully and you can see it in the AL11, I don't see where the problem is. Obviously you won't get to see the PDF file via AL11 to check whether the file is corrupted or not after creating it.
One thing you can do to check that out is using the standard FM ARCHIVEFILE_SERVER_TO_CLIENT. This way you can download the file you've just created to your PC and open it there, so you can check if the file in the server is OK.
2011 Jul 26 10:46 AM
Hi Jose,
i can't se this FM in my system ARCHIVEFILE_SERVER_TO_CLIENT (ECC 6)
2011 Jul 26 11:18 AM
2011 Jul 28 3:21 AM
2012 Jan 13 5:40 AM
Hi,
I am also facing the same problem can you give me some idea how you solved.....
Regards,
Ramesh.