Code: Alles auswählen.
DATA: entries LIKE sy-tabix.
DATA content TYPE STANDARD TABLE OF solisti1.
DATA: emailaddress TYPE c,
subjectline TYPE c,
mailtyp TYPE c,
returncode LIKE sy-subrc,
document TYPE sodocchgi1,
lcontents TYPE STANDARD TABLE OF solisti1,
contents1 LIKE LINE OF content,
recvlist TYPE STANDARD TABLE OF somlreci1,
recvlist1 LIKE LINE OF recvlist,
fieldlen TYPE p,
tablines TYPE p.
METHOD emailsender.
CLEAR: content, document, recvlist, contents1.
REFRESH: content, recvlist.
returncode = 12.
contents1 = 'Missing Document with Barcode:." '." && h-barcode && ' please Scan!'.
APPEND contents1 TO content.
document-obj_name = 'EMAIL'.
document-obj_descr = 'test'.
document-obj_langu = sy-langu.
document-obj_expdat = loesch_datum.
document-sensitivty = 'F'.
document-obj_prio = 3.
document-no_change = 'X'.
document-priority = 3.
document-expiry_dat = loesch_datum.
DESCRIBE TABLE content LINES entries.
READ TABLE content INDEX entries TRANSPORTING NO FIELDS.
document-doc_size = ( entries - 1 ) * 255 + strlen( contents1 ).
CLEAR recvlist.
recvlist1-rec_type = 'B'.
recvlist1-express = 'X'.
APPEND recvlist1 TO recvlist.
CLEAR recvlist.
recvlist1-receiver = h-smtp_addr.
APPEND recvlist1 TO recvlist.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = document
document_type = 'INT'
commit_work = 'X'
TABLES
object_content = content
receivers = recvlist
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.
WRITE 'sent email'.
ENDIF.
ENDMETHOD.
Ja, habe ich. In den unendlichen Methoden der API ist ein paar mal sy-subrc = 4. Allerdings finde/sehe ich da keinen Zusammenhang mit meinen Parametern. Bin noch ziemlich neu in der ABAP Programmierung.a-dead-trousers hat geschrieben:Hast du den Baustein schon mal gedebugged?
Normalerweise solltest du auf diesem Weg schneller zum problematischen Parameter finden, als wenn wir hier statisch dein Coding analysieren.
Code: Alles auswählen.
CLEAR recvlist.
recvlist1-rec_type = 'B'.
recvlist1-express = 'X'.
APPEND recvlist1 TO recvlist.
CLEAR recvlist.
recvlist1-receiver = h-smtp_addr.
APPEND recvlist1 TO recvlist.
Code: Alles auswählen.
APPEND recvlist1 TO recvlist.
CLEAR recvlist.