08-20-2007 9:05 AM
Hi:
I need help, I'd like send spool of program as attachment PDF file,
so, my solution is...
1.Get Spool Number
I get the Spool Number from table:TSP01, to get the last one.
2.Get Spool Data, useing function 'RSPO_RETURN_SPOOLJOB'
3.Sendmail use function 'SO_DOCUMENT_SEND_API1'
Let the program running at background job, then I checked the job,
result as below...
Status: Frontend unavailable
Message: Request on hold
Time: 2007/08/20 15:52:58
Job status: On hold
Error class: Delayed
Area: Data transfer
Printout: Not printed
can anybody know about it? plz help me, thanks a lot!...
following is my code (partial of parameters)
.
.
.
.
Get Spool Number (get the spool last one)
select tsp01~rqident into v_spool
from tsp01
where tsp01~rqowner = 'SAPMIS'
order by tsp01~rqident descending.
exit.
endselect.
Get the spool data.
call function 'RSPO_RETURN_SPOOLJOB'
exporting
rqident = v_spool
first_line = 1
last_line = 0
desired_type = ' '
importing
real_type = real_type
sp_lang = sp_lang
tables
buffer = so_ali
exceptions
no_such_job = 1
job_contains_no_data = 2
selection_empty = 3
no_permission = 4
can_not_access = 5
read_error = 6
type_no_match = 7
others = 8.
if sy-subrc <> 0.
message s208(00) with 'Error'.
leave list-processing.
endif.
Prepare the data.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 0.
plist-body_num = 0.
plist-doc_type = 'RAW'.
plist-obj_descr = 'ReadMe'.
append plist.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 1.
describe table so_ali lines plist-body_num.
plist-doc_type = real_type.
Get the size.
read table so_ali index plist-body_num.
plist-doc_size = ( plist-body_num - 1 ) * line_size
+ strlen( so_ali ).
append plist.
.
.
.
Send the email.
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data = document_data
sender_address = v_name
sender_address_type = 'B'
tables
packing_list = plist
contents_bin = so_ali
receivers = rec_tab
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.
if sy-subrc <> 0.
message e208(00) with 'Error'.
endif.
commit work.
Send the email immediately.
submit rsconn01
with mode = 'INT'
and return.
08-20-2007 9:10 AM
Hi Alchie Chou,
please have a look at one of my blogs: <a href="/people/pere.diaz/blog/2005/07/14/broadcasting-reports-via-mail-with-pdf-attachment reports via mail with PDF-attachment</a>.
I think it can be useful. Best regards,
Alvaro
08-20-2007 9:10 AM
Hi Alchie Chou,
please have a look at one of my blogs: <a href="/people/pere.diaz/blog/2005/07/14/broadcasting-reports-via-mail-with-pdf-attachment reports via mail with PDF-attachment</a>.
I think it can be useful. Best regards,
Alvaro
08-20-2007 9:14 AM
hi
chk this statement
if sy-subrc <> 0.
message s208(00) with 'Error'. --> where will the status bar msg. occur in bground
leave list-processing.
endif.
maybe the subrc might be false, and triggering this condition, which i believe will not work in background
if helpful, reward
Sathish. R
08-20-2007 9:25 AM
Hi Sathish:
I agree with you, then I try to remark these code of Program (every about msg statement)
but I got the same of result.....