Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

MIGO - Read spool and send e-mail

Former Member
0 Kudos
132

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

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos
83

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.
3 REPLIES 3

former_member156446
Active Contributor
0 Kudos
84

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.

0 Kudos
83

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

0 Kudos
83

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]