2008 Apr 15 11:13 PM
Hi Guys,
When I save in MIGO Transaction, I need to select the Spool Number and send by e-mail the print form.
Do you have any idea?
Thanks a lot.
Mile
2008 Apr 15 11:20 PM
data: list type table of abaplist with header line.
data: htmllines type table of w3html with header line.
data: maildata like sodocchgi1.
data: mailtxt like solisti1 occurs 10 with header line.
data: mailrec like somlrec90 occurs 0 with header line.
start-of-selection.
* Produce a list
do 100 times.
write:/ sy-index, at 30 sy-index, at 50 sy-index.
enddo.
* Save the list
call function 'SAVE_LIST'
tables
listobject = list
exceptions
list_index_invalid = 1
others = 2.
* Convert the list
call function 'WWW_LIST_TO_HTML'
tables
html = htmllines.
* Send mail
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test Subject'.
loop at htmllines.
mailtxt = htmllines.
append mailtxt.
endloop.
mailrec-receiver = 'you at yourcompany.com'.
mailrec-rec_type = 'U'.
append mailrec.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'HTM'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
2008 Apr 15 11:20 PM
data: list type table of abaplist with header line.
data: htmllines type table of w3html with header line.
data: maildata like sodocchgi1.
data: mailtxt like solisti1 occurs 10 with header line.
data: mailrec like somlrec90 occurs 0 with header line.
start-of-selection.
* Produce a list
do 100 times.
write:/ sy-index, at 30 sy-index, at 50 sy-index.
enddo.
* Save the list
call function 'SAVE_LIST'
tables
listobject = list
exceptions
list_index_invalid = 1
others = 2.
* Convert the list
call function 'WWW_LIST_TO_HTML'
tables
html = htmllines.
* Send mail
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test Subject'.
loop at htmllines.
mailtxt = htmllines.
append mailtxt.
endloop.
mailrec-receiver = 'you at yourcompany.com'.
mailrec-rec_type = 'U'.
append mailrec.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'HTM'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
2008 Apr 16 12:04 AM
Hi Jackandjay
But, How can I know the Spool Number ? Because I can have a lot of spools number in my list and I need the spool related with my material document.
Thanks
2008 Apr 16 12:17 AM
The simplest method is to read the spool table directly, table TSP01.
also check this [link|http://searchsap.techtarget.com/tip/1,289483,sid21_gci1121833,00.html?track=NL-42&ad=527944&FromTaxonomy=%2Fpr%2F283958%22%20rel=%22nofollow%22%3Ehttp://searchsap.techtarget.com/tip/1,289483,sid21_gci1121833,00.html?track=NL-42&ad=527944&FromTaxonomy=%2Fpr%2F283958]