Stroring the pdf file in database
Hi,
I am generating a pdf file from report server and in the trigger I want to push this file to Oracle database. How will I do if I do have a blob column in the database table. What could be the way inserting this Blob object into the table in the report trigger.
Prashant
hi
try the following link.
Re: Store PDF files in database.
sarah
Similar Messages
-
Write PDF files from database to file system
Hi,
I have a requirement of writing PDF files that are stored in Oracle 10g's BLOB column to the FILE SYSTEM using PL/SQL (Not java or any external stored Proc), since i need to write a shell script which will load the PDF files from database on a timely basis.
Could anyone suggest me the way of executing this?
Environment: Oracle 10G (10.2.0.1.0) with Windows 2003 server.
Regards,
Nagarjun.You could try to use the UTL_FILE package that is able to read/write text and binary data in a file located on the box hosting the database instance.
-
How to save pdf file in database
Dear All,
my application is forms 6i and database is 8i,requirement is that how to save pdf file in database and users can view through formsI'll apologize up front for the length of this post. I have a few database procedures I created that write a file to a BLOB column in a table as well as retrieve the BLOB from the column after it stored there. I have successfully stored many different types of binary file to the database using these procedures - including PDF files. I have not used these procedures in a Form so I can confirm that they will work, but theoretically they should work. I'm including the code for each procedure in this posting - hence the apology for the long post! :-)
Also, since these procedures reside on the database you will need to use Forms TEXT_IO built-in package to write your file to the server before you can use these procedures to store and retrieve the file from the database.
These procedures reads and writes a binary file to a table called "LOB_TABLE." You will need to modify the procedure to write to your table.
-- Author : Craig J. Butts (CJB)
-- Name : load_file_to_blob.sql
-- : This procedure uses an Oracle Directory called "IN_FILE_LOC". If you
-- already have a directory defined in the database or would prefer to use
-- a different Directory name, make sure you modify line 21 to reflect the
-- new Directory name.
-- ==================================================================================
-- History
-- DATE WHO DESCRIPTION
-- 12/11/07 CJB Created.
CREATE OR REPLACE PROCEDURE load_file_to_blob (p_filename IN VARCHAR2) IS
out_blob BLOB;
in_file BFILE;
blob_length INTEGER;
vErrMsg VARCHAR2(2000);
BEGIN
-- set the in_file
in_file := BFILENAME('IN_FILE_LOC',p_filename);
-- Get the size of the file
dbms_lob.fileopen(in_file, dbms_lob.file_readonly);
blob_length := dbms_lob.getlength(in_file);
dbms_lob.fileclose(in_file);
-- Insert a new Record into the tabel containing the
-- filename specified in P_FILENAME and a LOB_LOCATOR.
-- Return the LOB_LOCATOR and assign it to out_blob.
INSERT INTO lob_table (filename, blobdata)
VALUES (p_filename, EMPTY_BLOB())
RETURNING blobdata INTO out_blob;
-- Load the file into the database as a blob.
dbms_lob.open(in_file, dbms_lob.lob_readonly);
dbms_lob.open(out_blob, dbms_lob.lob_readwrite);
dbms_lob.loadfromfile(out_blob, in_file, blob_length);
-- Close handles to blob and file
dbms_lob.close(out_blob);
dbms_lob.close(in_file);
commit;
-- Confirm insert by querying the database
-- for Lob Length information and output results
blob_length := 0;
BEGIN
SELECT dbms_lob.getlength(blobdata) into blob_length
FROM lob_table
WHERE filename = p_filename;
EXCEPTION WHEN OTHERS THEN
vErrMsg := 'No data Found';
END;
vErrMsg := 'Successfully inserted BLOB '''||p_filename||''' of size '||blob_length||' bytes.';
dbms_output.put_line(vErrMsg);
END;
-- Author : Craig J. Butts (CJB)
-- Name : write_blob_to_file.sql
-- Descrip : This procedure takes a BLOB object from a database table and writes it
-- to the file system
-- ==================================================================================
-- History
-- DATE WHO DESCRIPTION
-- 12/11/07 CJB Created.
CREATE OR REPLACE PROCEDURE write_blob_to_file ( p_filename IN VARCHAR2 ) IS
v_blob BLOB;
blob_length INTEGER;
out_file UTL_FILE.FILE_TYPE;
v_buffer RAW(32767);
chunk_size BINARY_INTEGER := 32767;
blob_position INTEGER := 1;
vErrMsg VARCHAR2(2000);
BEGIN
-- Retrieve the BLOB for reading
BEGIN
SELECT blobdata
INTO v_blob
FROM lob_table
WHERE filename = p_filename;
EXCEPTION WHEN OTHERS THEN
vErrMsg := 'No data found';
END;
-- Retrieve the SIZE of the BLOB
blob_length := DBMS_LOB.GETLENGTH(v_blob);
-- Open a handle to the location where you are going to write the blob
-- Note: The 'WB' parameter means "Write in Byte Mode" and is only
-- available in the UTL_FILE pkg with Oracle 10g or later.
-- USE 'W' instead for pre Oracle 10q databases.
out_file := UTL_FILE.FOPEN('OUT_FILE_LOC',p_filename, 'wb', chunk_size);
-- Write the BLOB to the file in chunks
WHILE blob_position <= blob_length LOOP
IF ( ( blob_position + chunk_size - 1 ) > blob_length ) THEN
chunk_size := blob_length - blob_position + 1;
END IF;
dbms_lob.read(v_blob, chunk_size, blob_position, v_buffer );
UTL_FILE.put_raw ( out_file, v_buffer, TRUE);
blob_position := blob_position + chunk_size;
END LOOP;
END;Hope this helps.
Craig...
-- If my response or the response of another is helpful or answers your question please mark the response accordingly. Thanks! -
How to batch upload PDF files into database BLOB
Hello.
I have a requirement to batch upload PDF files into BLOB column of an Oracle 8.1.7 table from Forms 6i Web. The content of the blob column (ie. the PDF content) MUST be displayable from all client software (eg. Oracle Web forms, HTML forms, etc.)
Our environment is
Middle-tier is 9iAS on Windows/2000
Database is Oracle 8.1.7.0.0 on VMS
Oracle Web Forms 6i Patch 10
Basically my Oracle web form program will display a list of PDF files to upload and then the user can click on the <Upload> button to do the batch upload. I have experimented the following approaches but with no luck.
1. READ_IMAGE_FILE forms built-in = does NOT work because it cannot read PDF file. I got error FRM-47100: Cannot read image file
2. OCX and OLE form item = cannot use this because it does NOT work on the Web. I got error FRM-41344 OLE object not defined
3. I cannot use DBMS_LOB to do the load because the PDF files are not in the database machine.
4. Metalink Note 1682771.1 (How to upload binary documents back to database blob column from forms). When I used this, I got ORA-6502 during the hextoraw conversion. In using this solution, I have downloaded a bin2hex.exe from the Google site. I've noticed that when I looked at the converted HEX file, each line has the character : (colon) at the beginning of each line. I know the PDF file has been converted correctly to HEX format because when I convert the HEX file back to BIN format using hex2bin.exe, I'm able to display the converted bin file in Acrobat Reader. When I removed the : (colon) in the HEX file, I did NOT get the ORA-6502 error but I CANNOT display the file in Acrobat Reader. It gives an error "corrupted file".
5. upload facility in PL/SQL Web toolkit - I tried to automatically submit the html form (with htp.p) but it does NOT load the contents of the file. I called the URL from Oracle forms using web.show_document. There seems to be issues with Oracle Web forms (JInitiator) and HTML (+ htp.p).
The other options I can think of at this point are:
1. Use SQL*Loader to do the batch upload via SQL*Net connection and use HOST() built-in from Oracle Webforms to execute SQL*Loader from the 9iAS.
2. Write a Visual Basic program that reads a binary file and output the contents of the file into a byte array. Then build a DLL that can be called from Oracle webforms 6i via ORA_FFI. I don't prefer this because it means the solution will only work for Windows.
3. Write a JSP program that streams the PDF file and insert the contents of the PDF file into blob column via JDBC. Call JSP from forms using web.show_document. With this I have to do another connection to the database when I load the file.
4. Maybe I can use dbms_lob by using network file system (NFS) between the application server and VMS. But this will be network resource hungry as far as I know because the network connection has to be kept open.
Please advise. Thank you.
Regards,
ArmandoI have downloaded a bin2hex.exe from the Google site.
... each line has the character : (colon) at the
beginning of each line. I'm afraid it isn't a correct utility. I hope you'll find the source code of a correct one at metalink forum:
Doc ID: 368771.996
Type: Forum
Subject: Uploading Binary Files: bin2hex and hex2bin do not reproduce the same file
There is some links to metalink notes and some example about working with BLOB at http://www.tigralen.spb.ru/oracle/blob/index.htm. Maybe it helps. Sorry for my English. If there is any problem with code provided there, let me know by e-mail. -
hi all,
i need a pl/sql code to store the pdf file into the oracle database using blob.
help me.
Thanks in advancerabbott wrote:
My first question is "where is the PDF file located"? If the answer is "on a file system accessible to the Oracle database" Then you can use directory objects and the DBMS_LOB package. It would look something like this:
as SYS user do:
-- assume the PDF files are in /data/documents <font face="tahoma,verdana,sans-serif" size="1" color="#000">files</font>ystem directory
create or replace directory pdfdir as '/data/documents';
grant read on directory pdfdir to <USER>;
as USER do:
create table mydocs (id integer primary key, doc blob);
declare
bf bfile;
b blob;
src_offset integer := 1;
dest_offset integer := 1;
begin
-- insert a new blob and return it to local variable
insert into mydocs values(1, empty_blob()) returning doc into b;
-- open the bfile for file "summary.pdf"
bf := bfilename('PDFDIR', 'summary.pdf');
dbms_lob.loadBlobFromFile(b, bf, dbms_lob.lobmaxsize, dest_offset, src_offset);
-- done
commit;
end;
/I have the issue which is similar to what you have faced, I'll follow what you said to take a try, Thanks a lot! -
Store PDF files in database.
hi all
how to store PDF files in database and how to retreive plz guide me thanks in davance.
sarahSarah,
so your pdf-document is stored in the database.
we jump over step 4 what would be the code for sending the pdf-file to the database ...
Step 5 open the stored pdf-file:
Please create a when-mouse-doubleclick trigger on your filename-item:
declare
l_temp_file constant varchar2(255) := client_win_api_environment.get_environment_string ( 'Temp' ) || '\temp.pdf';
begin
if
:pdf.filename is not null
then
if
webutil_file_transfer.db_to_client ( l_temp_file, 'PDF', 'PDF', ' id_pdf = ''' || :pdf.id_pdf || '''' )
then
client_host ( 'cmd /C start ' || l_temp_file );
else
Message ( 'Failure while downloading ' || :pdf.filename || ' from the database. ' || dbms_error_text );
Message ( ' ' );
clear_message;
end if;
else
Message ( 'No PDF-file selected.' );
Message ( ' ' );
clear_message;
end if;
end;Save your form, compile and run it.
Execute a query on the pdf-block and doubleclick your filename item.
Now you can read your forms reference pdf direct from the database :).
Regards -
can any one help how can i save pdf file in database???
hi
try the following link.
Re: Store PDF files in database.
sarah -
I have Windows 98 and need Acrobat to open up the pdf files for 5.0
I have the old system, Windows 98 and presently have the free Adobe 5.0 version on my Compaq Presario Computer, and it is a 5242 model desktop.
I have inadvertanly switched over to Compaq Carbon Copy 32 Version 5.0 but since, have uninstalled it and now, on each of what was the pdf files initially of which I have, of which is at least 16 or more, on each of those files, an error message comes up and says "PROGRAM NOT FOUND," and states the following: "Windows cannot find CCW32EXE. This program is needed for opening the pdf files." And then it has a dialogue box with the computer operational symbol in it as C:\ and then it wants me to locate it. I cannot locate it through the "auto" because, this sytem being so old, doesn't have a magnifying glass or a "search" tool to do this in the "My Computer Icon on the Desktop as the Compaq people wanted me to do. I would have to do this manually. I have already talked to the Compaq people on their chat line and because of this, they said they couldn't help me with this problem and referred me over to you.
I've tried to find a download for 5.0, though I really don't think I need one since it is currently installed. I believe the proper way to fix this is to just convert the CCW32EXE over to the Acrobat pdf files and have those files opened and should open up all of my 15 or so files altogether at the same time because they all converted over to something else at the same time prior.
Are you able to help me?
But I believe to alleviate this problem, if you could just give me the information to be able to open up the pdf files to 5.0 and find out what download I may pursue, it might be able to correct this problem. I already have the 5.0 Acrobat installed, however.Hi Aandi,
I have followed your directions and I have the old system of Windows 98, so I had to go to "programs" and come up to Acrobat 5.0 and once in there, all of the Window there is greyed out, although I can still go to the tool bars above in it. I went to "file" and went to "open" and from there, I received an "open" window with a dialogue box in it and in that dialogue box as I scrolled down, it wants me to put in there, one of the following, "desktop," "my documents," "3 1/2 floppy [A:]," "[C:]," "system _save [D:]," ""[E:," "[F:]," ete; of these which do I pick in the "open" dialogue box? and down at the bottom, is the FILE NAME and what do I put in there? Just below that, it has the FILES OF TYPE which has there Adobe pdf Files, in it's dialogue box. I hit these, but I still get an error message of which basically says, "NOT FOUND, please put in proper file name given." And I don't know actually where it is given.
So, as you see, I am a novice in all of this and you can contact me at my e mail address which is [email protected]
and should a reply be needed, I'll come back to the forum for a reply.
I really need to open up the Adobe 5.0 pdf files. All of the pdf files, simultaneously went over to Compaq Carbon Copy 32 of which I since, uninstalled. But I really need to get back and open the Adobe 5.0 pdf files.
And I want to thank you for your support and eagerly awaiting your help.
Thanks,
Now, I did do one of the following: I went to C: which came to Acobat 3 and I hit that which came to Reader and I hit that which came to the following: ACROBAT which gave me ACTIVE X - BROWSER - FONTS - HELP - OPTIONAL - PLUG-INS -
While converting spool to PDF, no data is coming in the PDF file.
Hi All,
I am submitting a z program ZPR022_INNCOMETAX_REPORT_COPY1 (which has some output display) from Z_ITSLIP_MAIL. I am creating a job, submitting the above program via JOB to SAP-SPOOL.
In program ZPR022_INNCOMETAX_REPORT_COPY1 , I am getting the run time job information and from there I am getting the spool id. Now I am converting the spool id to a PDF. This PDF should contain the output of the program ZPR022_INNCOMETAX_REPORT_COPY1. This output is normal output using Write statement only. But once the program is executed, I could find no data in the PDF file. When I check in SM37 and SP02, both the JOB and the SPOOL are created. What I feel is the program is not picking the spool id at the run time. Could any one help me in this regard how to proceed.
Please find the code below.
Program 1.
LOOP AT pernr.
CLEAR p_job.
p_stim = p_stim + 120.
CONCATENATE'ITSlip' pernr-low p_job sy-datum INTO p_job SEPARATED BY
space.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = p_job
sdlstrtdt = p_sdat
sdlstrttm = p_stim
IMPORTING
jobcount = l_jobcount.
SUBMIT ZPR022_INNCOMETAX_REPORT_COPY1
WITH pnptimr6 = 'X'
WITH pnpbegda = period-low
WITH pnpendda = period-high
WITH pnppernr-low = pernr-low
WITH pnpabkrs-low = 'IN'
VIA JOB p_job
NUMBER l_jobcount
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS ls_params
WITH immediately = 'X'
KEEP IN SPOOL = 'X'
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = p_job
strtimmed = 'X'
PRDMINS = 2.
sdlstrtdt = p_sdat
sdlstrttm = p_stim.
ENDLOOP.
Program 2.
IF sy-batch EQ 'X'.
LOOP AT pnppernr.
SELECT SINGLE * FROM pa0105
WHERE pernr EQ pnppernr-low
AND subty EQ '0010'
AND endda EQ '99991231'.
p_email1 = pa0105-usrid_long..
PERFORM get_job_details.
PERFORM obtain_spool_id.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
IF sy-sysid = c_dev.
WAIT UP TO 5 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ENDLOOP.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool'
'request to be created.'.
EXPORT gd_spool_nr TO MEMORY ID 'SPOOLTOPDF'.
ENDIF.
ENDFORM. " SEND_MAIL
*& Form get_job_details
text
--> p1 text
<-- p2 text
FORM get_job_details .
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM. " get_job_details
*& Form obtain_spool_id
text
--> p1 text
<-- p2 text
FORM obtain_spool_id .
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
MESSAGE s004(zdd) WITH gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM. " obtain_spool_id
*& Form convert_spool_to_pdf
text
--> p1 text
<-- p2 text
FORM convert_spool_to_pdf .
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 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
OTHERS = 12.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " convert_spool_to_pdf
*& Form process_email
text
--> p1 text
<-- p2 text
FORM process_email .
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
ENDFORM. "process_email
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'IT Declaration'.
CONCATENATE 'ITSLIP' ' ' INTO gd_attachment_name.
it_mess_bod = 'IT FORM for this month'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
TABLES it_mess_bod
it_mess_att
USING p_email1
'MindTree Payroll team'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
CHANGING gd_error
gd_reciever.
ENDFORM. " process_email
*& Form send_file_as_email_attachment
text
-->P_IT_MESS_BOD text
-->P_IT_MESS_ATT text
-->P_P_EMAIL text
-->P_4422 text
-->P_4423 text
-->P_GD_ATTACHMENT_NAME text
-->P_GD_ATTACHMENT_DESC text
-->P_P_SENDER text
-->P_GD_SENDER_TYPE text
<--P_GD_ERROR text
<--P_GD_RECIEVER text
FORM send_file_as_email_attachment TABLES it_message
it_attach
USING p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
CHANGING p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM. "send_file_as_email_attachment
Points will be rewarded.
Regards,
BalajiHi,
I think you are retrieving the spool before the entire spool is generated.
Put the following logic to retrieve spool iD
CHECK WHETHER STATUS OF JOB IS COMPLETED OR CANCELLED
WHILE 1 = 1.
GET THE JOB STEPLIST WHICH HAS THE SPOOL NUMBER
CALL FUNCTION 'BP_JOB_READ'
EXPORTING
job_read_jobcount = w_jobcount
job_read_jobname = w_jobname
job_read_opcode = '35'
JOB_STEP_NUMBER =
IMPORTING
job_read_jobhead = wa_jobhead
TABLES
job_read_steplist = i_jobsteplist
CHANGING
RET =
EXCEPTIONS
invalid_opcode = 1
job_doesnt_exist = 2
job_doesnt_have_steps = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
BEGIN OF INSERTION U179942 E1BK928781
IF STATUS OF JOB IS COMPLETED(F) OR CANCELLED(A)
READ THE JOBSTEPLIST & GET THE SPOOL NUMBER
IF wa_jobhead-status = c_a OR wa_jobhead-status = c_f.
READ TABLE i_jobsteplist INTO wa_jobsteplist INDEX 1.
CHECK wa_jobsteplist-listident <> space.
w_spool_number = wa_jobsteplist-listident.
EXIT.
ENDIF.
ENDWHILE.
Best regards,
Prashant -
Safari doesn't open the PDF file (articles, book page, etc). It appears a black page. Before that it was working perfectly. Thank for your help
Try this ...
Open a Finder window then from the menu bar click Go > Go to Folder
Type or copy paste the following:
/Library/Internet Plug-Ins
Click Go.
If you see the: AdobePDFViewer plugin (or anything Adobe related) in the Internet Plug-Ins folder, move it to the trash.
Restart your Mac and try opening a PDF file. -
How to read the and Write the PDF file give me the solution
Hi all,
How to read the and Write the PDF file give me the solution
My coding is
import java.io.File;
import com.asprise.util.pdf.PDFImageWriter;
import com.asprise.util.pdf.PDFReader;
import java.io.*;
import java.io.FileOutputStream;
public class example {
// public example() {
public static void main(String a[])
try
PDFReader reader = new PDFReader(new File("C:\\AsprisePDF-DevGuide.pdf"));
reader.open(); // open the file.
int pages = reader.getNumberOfPages();
for(int i=0; i < pages; i++) {
String text = reader.extractTextFromPage(i);
System.out.println("Page " + i + ": " + text);
// perform other operations on pages.
PDFImageWriter writer = new PDFImageWriter(new FileOutputStream("c:\\new11.pdf"));
writer.open();
writer.addImage("C:\\sam.doc");
writer.close();
System.out.println("DONE.");
reader.close();
catch(Exception e){System.out.println("error:"+e);
e.printStackTrace();
I get the pdf content then it returns the string value but ther is no option to write the string to PDF, and we only add a image file to PDF,but i want to know how to wrote the string value to PDF file,
Please give response immtly
i am waiting for your reply.
thanks,
Suresh.GI have some question flow
How library to use this code.
I try runing but have not libary.
Please send me it'library
Thank you very much! -
I have few PDf files on my computer and I want to add them to my ipod touch, please tell me the procedure on how should I do that? Secondly I want to run these Pdf files through the ibook app, as it also have the Pdf file sections
You should be able to just place them in your Books library in iTunes and check to ensure that your Book library is configured to sync to your iPod when you sync your iPod to iTunes.
-
How can I move a single pdf file from my pc to my ipad without overwriting all the pdf files already in my ipad?
Email PDF to iPad.
-
Just converted a PDF document to Word, none of the graphics from the PDF file show up in the Word document?
What do I need to do to bring the graphics and exhibits from the PDF file to the Word file?Hi jackp52432917,
How was that PDF file created? Please see Will Adobe ExportPDF convert both text and form... | Adobe Community
It could be that the PDF file you're converting was created using a third-party application, and it doesn't contain all the information necessary to ensure a clean conversion. Have you had similar troubles converting other PDF files?
Best,
Sara -
Error opening the PDF file while sending the PDF as an attachment
Hi All,
I am sending a PDF as an attachment in the mail. I am using the code pasted on 'Jul 28, 2006 8:59 AM' subject OTF Format of Purchase Order in email unreadable.
My problem is when I open the attachment in SOST or in the mail, I get the error message "Adobe could not open *.PDF because it is either not a supported file type or because the file type has been corrupted."
Please let me know if anybody has faced such an issue.
The code is found below.
FORM MAIL_OBJECT *
This routine receives OTF data. OTF data is converted to PDF
format and send to the Partner's email address
FORM mail_object TABLES otf_data STRUCTURE itcoo .
DATA: pdf_size TYPE i, " PDF Size
pdf_itab_size TYPE i, " Attachment size
mailtxt_size TYPE i, " Text in mail size
l_vbeln LIKE vbdka-vbeln. " Order Doc
DATA:
it_mailtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE, " Mail Text
it_pdf TYPE TABLE OF tline WITH HEADER LINE, " OTF output
it_mailpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE, " Dist details
it_mailhead LIKE solisti1 OCCURS 1 WITH HEADER LINE," Header data
it_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE, " Rec List
it_pdfdata LIKE solix OCCURS 0 WITH HEADER LINE. " Attachment data
DATA: it_doc_att LIKE sodocchgi1. " Attri of new doc
DATA: BEGIN OF it_pdfout OCCURS 0, " PDF in 255 length
tline TYPE char255,
END OF it_pdfout.
Sales doc and Customer
DATA: BEGIN OF i_vbeln OCCURS 0,
vbeln LIKE vbpa-vbeln, " Sales Document
adrnr LIKE vbpa-adrnr, " Customer
END OF i_vbeln.
Sender Address no and SMTP address
DATA: BEGIN OF i_addrs OCCURS 0,
addrnumber LIKE adr6-smtp_addr,
smtp_addr LIKE adr6-smtp_addr,
END OF i_addrs.
Convert OTF to PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = pdf_size
TABLES
otf = otf_data
lines = it_pdf.
Make each line 255 characters
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
TABLES
content_in = it_pdf
content_out = it_pdfout.
Create the PDF File
CLEAR it_pdfdata.
REFRESH it_pdfdata.
it_pdfdata[] = it_pdfout[].
LOOP AT it_pdfout.
MOVE it_pdfout-tline TO it_pdfdata-line.
APPEND it_pdfdata.
CLEAR it_pdfdata.
ENDLOOP.
DESCRIBE TABLE it_pdfdata LINES pdf_itab_size.
Text in the mail.
it_mailtxt-line = 'ORDER ACKNOWLEDGEMENT'.
APPEND it_mailtxt.
it_mailtxt-line = ' This is a test mail, Line Number--1'.
APPEND it_mailtxt.
it_mailtxt-line = ' This is a test mail, Line Number--2' &
' This is a test mail, Line Number--2'.
APPEND it_mailtxt.
it_mailtxt-line = ' This is a test mail, Line Number--3' &
' This is a test mail, Line Number--3' &
' This is a test mail, Line Number--3'.
APPEND it_mailtxt.
it_mailtxt-line = ' This is a test mail, Line Number--4' &
' This is a test mail, Line Number--4' &
' This is a test mail, Line Number--4' &
' This is a test mail, Line Number--4'.
APPEND it_mailtxt.
it_mailtxt-line = ' This is a test mail, Line Number--5' &
' This is a test mail, Line Number--5' &
' This is a test mail, Line Number--5' &
' This is a test mail, Line Number--5' &
' This is a test mail, Line Number--5'.
APPEND it_mailtxt.
DESCRIBE TABLE it_mailtxt LINES mailtxt_size.
Document Number for Output
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = vbdka-vbeln
IMPORTING
output = l_vbeln.
Attributes of new doc
CONCATENATE 'Order' space 'Acknowledgement' space l_vbeln
INTO it_doc_att-obj_descr SEPARATED BY space.
it_doc_att-sensitivty = 'F'.
it_doc_att-doc_size = mailtxt_size * 255.
Create Pack to text in mail body.
CLEAR it_mailpack-transf_bin.
it_mailpack-head_start = 1.
it_mailpack-head_num = 0.
it_mailpack-body_start = 1.
it_mailpack-body_num = mailtxt_size.
it_mailpack-doc_type = 'RAW'.
APPEND it_mailpack.
Create Pack to PDF Attach.
it_mailpack-transf_bin = 'X'.
it_mailpack-head_start = 1.
it_mailpack-head_num = 1.
it_mailpack-body_start = 1.
it_mailpack-body_num = pdf_itab_size.
it_mailpack-doc_type = 'PDF'.
CONCATENATE l_vbeln '.pdf' INTO it_mailpack-obj_name.
CONCATENATE 'Order Ack' space l_vbeln INTO it_mailpack-obj_descr.
it_mailpack-doc_size = pdf_itab_size * 255.
APPEND it_mailpack.
*Get email addresses based on Sales document.
SELECT vbeln adrnr INTO TABLE i_vbeln
FROM vbpa
WHERE vbeln = vbdka-vbeln AND
parvw = nast-parvw.
IF NOT i_vbeln[] IS INITIAL.
SELECT addrnumber smtp_addr INTO TABLE i_addrs
FROM adr6 FOR ALL ENTRIES IN i_vbeln
WHERE addrnumber = i_vbeln-adrnr AND
smtp_addr NE space.
ENDIF.
IF i_addrs[] IS NOT INITIAL.
LOOP AT i_addrs.
it_reclist-receiver = i_addrs-smtp_addr.
it_reclist-express = 'X'.
it_reclist-rec_type = 'U'.
it_reclist-notif_del = 'X'. " request delivery notification
it_reclist-notif_ndel = 'X'. " request not delivered notification
APPEND it_reclist.
CLEAR: i_addrs.
ENDLOOP.
ENDIF.
Call FM to send email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = it_doc_att
put_in_outbox = 'X'
TABLES
packing_list = it_mailpack
object_header = it_mailhead
contents_txt = it_mailtxt
contents_hex = it_pdfdata
receivers = it_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorizationfiltered= 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " MAIL_OBJECT
Regards,
AjithHi Ajith !!
Please refer this link :
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
Here a spool output is converted into PDF and then sent as an email.
I think instead of using FM to change the width, try the logic mentioned in the link.
Also instead of FM CONVERT_TO_OTF use :
1. CONVERT_OTFSPOOLJOB_2_PDF
I hope this should solve the problem.
I had referred the same program from the link and it worked absolutely fine. Also check the adobe acrobat version, i guess old version doesnt support SAP, though not very sure.
Best regards,
Prashant
Maybe you are looking for
-
My app runs on 4S but not on 3GS on iOS5
I am running my app in debug mode with XCode 4.3.3 and it runs fine on an iPhone 4S running iOS 5.1.1. For what it's worth, it also runs fine under the simulator and on an iPad also running 5.1.1 If I try to run it on an iPhone 3GS with exactly the
-
How to enable the prebooking tab in ESS
Hi, In our environment, the prebooking tab is disabled in ESS. Please advise how to enable this tab. Where to do this configuration (e.g. in ESS or R/3) Regards, Tony
-
Read word/excel doc and convert to pdf
Can any one suggest a way or source to read a word/excel document and convert it to an PDF.. using Java
-
How to close the main window from Popup
hello all, i need to close the main window from a popup, so i create a popup and after clicking on close button of this popup, should also the main window be closed. how can do this please? BR
-
10.4.11 update troubles
OK, so I updated to 10.4.11. 1st thing that happens is Safari doesn't work anymore--spontaneously quits immediately after opening. Now I can't even install software I've downloaded to try to solve this problem, for example the Combo update I got from