SO NEW DOCUMENT SEND API1

Aus SAP Wiki ツ

Deklaration

lt_receivers                   TYPE TABLE OF somlreci1,
ls_receivers                   LIKE LINE OF  lt_receivers,
ls_docdata                     TYPE sodocchgi1,
lt_content                     TYPE TABLE OF solisti1,
ls_content                     LIKE LINE OF  lt_content,

Codeschnipsel

 "E-Mail-Receiver
 ls_receivers-receiver = lv_emailaddress.
 ls_receivers-rec_type = 'U'.                  "E-Mailadresse
 ls_receivers-com_type = 'INT'.                "Internet
 ls_receivers-notif_del = .
 ls_receivers-notif_ndel = .
 APPEND ls_receivers TO lt_receivers.
 
 "Subject
 ls_docdata-doc_size = ( lines( lt_content ) - 1 ) * 255 + strlen( ls_content ).
 ls_docdata-obj_langu = sy-langu.
 ls_docdata-sensitivty = 'F'.
 ls_docdata-obj_name = 'ExChangeRates'.
 ls_docdata-obj_sort = 'ExChangeRates'.
 CONCATENATE 'Subject' sy-sysid INTO ls_docdata-obj_descr SEPARATED BY space.
 
"Content in E-Mail
 ls_content-line = 'Dear ladies and gentlemen / Drogie Panie i Panowie'.
 APPEND ls_content TO lt_content.
 CLEAR: ls_content-line.
 APPEND ls_content TO lt_content.

 CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
   EXPORTING
     document_data              = ls_docdata
     document_type              = 'RAW'
     put_in_outbox              = 'X'
     commit_work                = 'X'
   TABLES
     object_content             = lt_content
     receivers                  = lt_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.