Envío de tabla interna como adjunto en correo

Colapsar
X
 
  • Tiempo
  • Mostrar
Limpiar Todo
nuevos mensajes
  • felix_cid
    Member
    • mar
    • 73

    #1

    Envío de tabla interna como adjunto en correo

    Amigos:

    Tengo una tabla interna, la cual le realizo un loop y la paso a otra tabla interna la que está definida de la siguiente manera:

    t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE.

    El loop que hago es el siguiente:

    loop at t_form.
    t_attachment-line = t_form-linda.
    append t_attachment.
    endloop.

    La tabla t_form es igual a la estructura PC408.

    EL problema que tengo es que en la función SO_DOCUMENT_SEND_API1, me atacha el archivo como PDF y envía el correo, pero al tratar de abrirlo me da error y dice que no se puede abrir el documento adjunto, ¿sabe alguien de ustedes que otra cosa adicional se debería hacer para poder convertir la tabla interna a una tabla tipo PDF?.

    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
    document_data = gd_doc_data
    put_in_outbox = 'X'
    sender_address = ld_sender_address
    sender_address_type = 'INT'
    commit_work = 'X'
    IMPORTING
    sent_to_all = gd_sent_all
    TABLES
    packing_list = it_packing_list
    contents_txt = it_message
    contents_bin = t_attachment
    receivers = it_receivers
    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.

    Quedo atento a sus noticias, muchas gracias por vuestra ayuda.
  • Neo_25
    Member
    • jun
    • 51

    #2
    Yo añado la tabla de la siguiente manera:

    ************************************************** ********
    *** Adjuntar PDF o DOC
    ************************************************** ********
    **////////////////////////////////////////
    ** A Ñ A D I M O S E L P D F
    **////////////////////////////////////////
    *
    *DATA: BEGIN OF lt_pdf OCCURS 0.
    * INCLUDE STRUCTURE solisti1.
    *DATA: END OF lt_pdf.
    *
    *CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
    *EXPORTING
    ** LINE_WIDTH_SRC =
    * line_width_dst = '255'
    ** TRANSFER_BIN = ' '
    *TABLES
    * content_in = li_tline[]
    * content_out = lt_pdf[] "TABLA A MANDAR
    *EXCEPTIONS
    * err_line_width_src_too_long = 1
    * err_line_width_dst_too_long = 2
    * err_conv_failed = 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.
    *
    ** Calculamos datos de la tabla a mandar
    *i_objbin[] = lt_pdf[].
    *
    *i_objpack-transf_bin = 'X'.
    *i_objpack-head_start = 1.
    *i_objpack-head_num = 0.
    *i_objpack-body_start = 1.
    *
    *
    *DESCRIBE TABLE i_objbin LINES v_lines_bin.
    *READ TABLE i_objbin INDEX v_lines_bin.
    *i_objpack-doc_size = v_lines_bin * 255 .
    *
    *i_objpack-body_num = v_lines_bin.
    *i_objpack-doc_type = 'PDF'. "Tipo de documento
    *i_objpack-obj_name = 'fichero'. "Nombre del objeto
    *i_objpack-obj_descr = 'PDFEMAIL'. "NOMBRE DEL DOCUMENTO ADJUNTO
    *APPEND i_objpack.
    ************************************************** ********

    En tu caso la tabla a mandar es: it_packing_list
    en la mía es: i_objpack.
    Sustituye una por otra y prueba a ver.

    Comentario

    Trabajando...