MUNDOSAP

MUNDOSAP (foro/index.php)
-   Programación ABAP IV (foro/forumdisplay.php?f=4)
-   -   Enviar PDF por email (foro/showthread.php?t=40656)

Cristiana 27/12/10 17:03:04

Enviar PDF por email
 
Hola Foro

Alguien me puede decir como enviar un Pdf por email... es una orden de compra la hize en smartforms ya logre hacer la conversion a Pdf solo me falta enviarla por email.

Gracias por su ayuda.

Felices Fiestas....

kiboqac 28/12/10 12:19:24

La idea es pasar el PDF a Hexa y despues usar la funcion: "SO_NEW_DOCUMENT_ATT_SEND_API1" para adjuntarlo al mail.

Te pego un pedazo de codigo que te va a ser de mucha ayuda



CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = w_pdf
TABLES
binary_tab = wt_hex.

DESCRIBE TABLE wt_hex LINES w_lines.
CONCATENATE 'Adobe Form ' space wi_id '.pdf' INTO wa_head.
APPEND wa_head TO wt_head.

wa_pack-transf_bin = 'X'.
wa_pack-head_start = 1.
wa_pack-head_num = 1.
wa_pack-body_start = 1.
wa_pack-body_num = w_lines.
wa_pack-doc_type = 'PDF'.
wa_pack-obj_name = 'Adobe Form'.
wa_pack-doc_size = w_lines * 255.
CONCATENATE 'Adobe Form ' space wi_id '.pdf' INTO wa_pack-obj_descr.

APPEND wa_pack TO wt_pack.

ENDIF.

ENDIF.

LOOP AT gt_mails INTO w_mail.

* A cuenta de mail externa.
wa_rec-receiver = w_mail.
wa_rec-rec_type = 'U'.
APPEND wa_rec TO wt_rec.

ENDLOOP.


* Envío el mail.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_data
commit_work = 'X'
TABLES
packing_list = wt_pack
object_header = wt_head
contents_txt = wt_txt
contents_hex = wt_hex
receivers = wt_rec
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.

conrad10ar 28/12/10 13:28:06

Hola!

acá tienes resuelto lo que necesitas:



Saludos!

esterg 13/09/11 20:34:05

multiples pdfs por mail?
 
hola, alguien tiene el codigo de como attachear varios pds en un mismo mail?
muchas gracias desde ya.

marianoboni 16/09/11 17:46:44

Las clases que utilizo son :

data:
pdf_content type solix_tab,
send_request type ref to cl_bcs,
document type ref to cl_document_bcs,

Hola, te paso el fragmento de codigo en el que hago esto:





TRY.
* -------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).

* -------- create and set document -------------------------------
pdf_content = cl_document_bcs=>xstring_to_solix( pdf_xstring ).

pdf_content2 = cl_document_bcs=>xstring_to_solix( pdf_xstring2 ).

APPEND 'Hello world!' TO text.

document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = text-001 ).

* Creo el attachment
TRY.

document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = motivo_email
i_att_content_hex = pdf_content ).


document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = text-002
i_att_content_hex = pdf_content2 ).

CATCH cx_document_bcs INTO lx_document_bcs.
CONCATENATE SY-MSGID '|' SY-MSGTY '|' SY-MSGNO ':' SY-MSGV1 '|' SY-MSGV2 '|' SY-MSGV3 '|' SY-MSGV4 INTO MSG_ID.
EXPORT MSG_ID TO MEMORY ID 'MSG_ID'.
EXIT.
ENDTRY.

* add document object to send request
send_request->set_document( document ).

* --------- add recipient (e-mail address) -----------------------
* create recipient object
recipient = cl_cam_address_bcs=>create_internet_address( mailto ).

* add recipient object to send request
send_request->add_recipient( recipient ).

* ---------- send document ---------------------------------------
sent_to_all = send_request->send( i_with_error_screen = 'X' ).

commit work.

*------------------------------------------------

ENDTRY.

izak 27/03/12 18:03:04

Hola, saben como puedo pasar el contenido de un PDF para usarlo en la funcion 'SCMS_XSTRING_TO_BINARY'?

En pocas palabras, quisiera saber como lleno el dato:

EXPORTING
buffer = xxxxxx

Otra consulta, referente a lo que pusiste marianoboni,

pdf_content = cl_document_bcs=>xstring_to_solix( pdf_xstring ).

Puedo setear pdf_xstring con un archivo pdf directo o tengo que pasarlo a xstring, en todo caso como haría eso?

Gracias de antemano a todos.

vamp_01 26/08/15 17:54:20


marianoboni hola me puedes ayudar tengo que hacer algo parecido, generar 3 pdf y adjuntarlos a un correo, creo que con esta explicacion me queda claro, pero quiero preguntarte como generas los pdf, a mi me aparecen con vista previa o hay que generarlos de otra manera...
Muchas GRacias


Husos Horarios son GMT. La hora en este momento es 22:48:44.

www.mundosap.com 2006 - Spain
software crm, crm on demand, software call center, crm act, crm solutions, crm gratis, crm web