Die Tabelle I_TLINE hat eine Struktur mit zwei Spalten die I_OBJBIN hat eine Struktur mit einer Spalte, die aber die gesamte Länge aufnehmen kann. Für die SEND-API dürfen aber die Zeilen keine LEERZEICHEN enthalten.SAP_ENTWICKLER hat geschrieben:* Object with PDF.
i_objbin = i_tline.
Code: Alles auswählen.
* Weil lesbarerFolgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
SAP_ENTWICKLER
Code: Alles auswählen.
i_otf = w_return_mail-otfdata. <---- From SmartForm Print
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
bin_file = w_pdf_daten
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL METHOD cl_bcs_convert=>xstring_to_solix
EXPORTING
iv_xstring = w_pdf_daten
RECEIVING
et_solix = i_record.
* Object with PDF.
DESCRIBE TABLE i_record LINES v_lines_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
* Packing as PDF.
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'Smartform'.
CONCATENATE 'XXXX' '.pdf'
INTO i_objpack-obj_descr.
APPEND i_objpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = w_objhead
contents_txt = i_objtxt
contents_hex = i_record
receivers = i_reclist
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.