Code: Alles auswählen.
DATA: lt_objpack TYPE TABLE OF sopcklsti1,
ls_objpack TYPE sopcklsti1,
lt_objhead TYPE TABLE OF solisti1,
ls_objhead TYPE solisti1,
lt_objbin TYPE TABLE OF solisti1,
ls_objbin TYPE solisti1,
lt_objtxt TYPE TABLE OF solisti1,
ls_objtxt TYPE solisti1,
lt_reclist TYPE TABLE OF somlreci1,
ls_reclist TYPE somlreci1,
ls_document_data TYPE sodocchgi1,
lv_tab_lines TYPE sy-tabix.
loop at lt_zzadbfa into la_zzadbfa.
*** Erstellen des zu versendenden Dokuments
ls_document_data-obj_name = ' ... '.
ls_document_data-obj_descr = ' ... '.
ls_objtxt = ' ... '.
APPEND ls_objtxt to lt_objtxt.
ls_objtxt = la_zzadbfa-id .
Append ls_objtxt to lt_objtxt.
ls_objtxt = ' ... '.
APPEND ls_objtxt to lt_objtxt.
ls_objtxt = ' ... '.
APPEND ls_objtxt to lt_objtxt.
DESCRIBE TABLE lt_objtxt LINES lv_tab_lines.
READ TABLE lt_objtxt INTO ls_objtxt INDEX lv_tab_lines.
ls_document_data-doc_size = ( lv_tab_lines - 1 ) * 255 + STRLEN( ls_objtxt ).
*** Erstellen des Eintrags zum komprimierten Dokument
CLEAR ls_objpack.
ls_objpack-transf_bin = ''.
ls_objpack-head_start = 1.
ls_objpack-head_num = 0.
ls_objpack-body_start = 1.
ls_objpack-body_num = lv_tab_lines.
ls_objpack-doc_type = 'RAW'.
APPEND ls_objpack to lt_objpack.
*** Füllen der Empfängerliste
clear ls_reclist.
ls_reclist-receiver = la_zzadbfa-email.
ls_reclist-rec_type = 'U'.
APPEND ls_reclist to lt_reclist.
ENDLOOP.
** Versenden des Dokuments
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = ls_document_data
put_in_outbox = ' '
commit_work = 'X'
TABLES
object_header = lt_objhead
OBJECT_CONTENT = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.