Code: Alles auswählen.
data: document_data like sodocchgi1,
object_txt like solisti1 occurs 10 with header line,
object_pack like sopcklsti1 occurs 1 with header line,
object_bin like solisti1 occurs 10 with header line,
receiver_list like somlreci1 occurs 1 with header line,
tab_lines type i.
*Umwandeln des PDFs in das richtige Format
CALL FUNCTION 'TABLE_COMPRESS'
* IMPORTING
* COMPRESSED_SIZE =
TABLES
IN = uncompressed_pdf
OUT = object_bin
EXCEPTIONS
COMPRESS_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Titel und Beschreibung
document_data-obj_name = 'TEST_PDF'.
document_data-obj_descr = 'Test mit einem angeh�ngten PDF'.
* Text der Email
object_txt = 'Hallo Benutzername,'.
append object_txt.
object_txt = 'hier Ihre Email.'.
append object_txt.
object_txt = 'Mit freundlichen Gr��en'.
append object_txt.
object_txt = 'Der Versender'.
append object_txt.
* Packing List(Haupt-Email)
* Zaehlen der Zeile von object_txt
describe table object_txt lines tab_lines.
read table object_txt index tab_lines.
document_data-doc_size = ( tab_lines - 1 ) * 255 + strlen( object_txt ).
* Erzeugen der Packing List
clear object_pack-transf_bin.
object_pack-head_start = 1.
object_pack-head_num = 0.
object_pack-body_start = 1.
object_pack-body_num = tab_lines.
object_pack-doc_type = 'RAW'.
append object_pack.
* Erzeugen des Anhangs
* Packing List(Anhang)
describe table object_bin lines tab_lines.
read table object_bin index tab_lines.
* object_pack-doc_size = ( tab_lines - 1 ) * 255 + strlen( object_bin ).
object_pack-transf_bin = 'X'.
object_pack-head_start = 1.
object_pack-head_num = 0.
object_pack-body_start = 1.
object_pack-body_num = tab_lines.
object_pack-doc_type = 'PDF'.
object_pack-obj_name = 'SPOOL'.
object_pack-obj_descr = 'ZNAK_S2_REPORT1'.
object_pack-doc_size = tab_lines * 255.
append object_pack.
* Erstellen der Empf�nger-Liste
* Externer Benutzer
receiver_list-receiver = 'mail@mail.de'.
receiver_list-rec_type = 'U'.
append receiver_list.
*Interner Benutzer
receiver_list-receiver = sy-uname.
receiver_list-rec_type = 'B'.
append receiver_list.
*Sender der Email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = document_data
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
PACKING_LIST = object_pack
* OBJECT_HEADER =
CONTENTS_BIN = object_bin
CONTENTS_TXT = object_txt
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
RECEIVERS = receiver_list
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.
Wo kommt das PDF denn her? Wenn das PDF mittels FuBa CONVERT_OTF aus einem OTF erstellt wird, muss die Zeilenlänge der Rückgabetabelle von 132 auf 255 convertiert werden.Folkmen hat geschrieben:danke für die schnelle Antwort, aber genau das mache ich. Ich habe kein TABLE_COMPRESS eingebaut.