pedido -enviar mail externo- URGENTE

Colapsar
X
 
  • Tiempo
  • Mostrar
Limpiar Todo
nuevos mensajes
  • caralbgro
    Senior Member
    • sep
    • 478

    #1

    pedido -enviar mail externo- URGENTE

    tengo este codigo de envio de mail

    DATA: BEGIN OF i_text OCCURS 0.
    INCLUDE STRUCTURE soli.
    DATA: END OF i_text.

    DATA: wspoolnumber LIKE sy-spono ,
    wmailname LIKE sood1-objnam,
    wsubject LIKE sood1-objdes ,
    wrecepient(40) TYPE c ,
    wdli LIKE soos1-dlinam.

    DATA: object_hd_change LIKE sood1 OCCURS 0 WITH HEADER LINE,
    objpara LIKE selc OCCURS 0 WITH HEADER LINE,
    receivers LIKE soos1 OCCURS 0 WITH HEADER LINE.

    DATA: BEGIN OF i_receivers OCCURS 0.
    INCLUDE STRUCTURE receivers.
    DATA: END OF i_receivers.



    wsubject = 'Entrega numero....1234567890.'.
    wrecepient = 'carlos.grossi@emgasud.com.ar'.



    object_hd_change-objla = sy-langu.
    object_hd_change-objnam = wmailname.
    object_hd_change-objdes = wsubject.
    object_hd_change-objsns = 'F'.
    object_hd_change-vmtyp = 'T'.
    object_hd_change-skips = 'X'.
    object_hd_change-acnam = 'SP01'.
    object_hd_change-objcp = 'X'.



    REFRESH i_text.
    CLEAR i_text.
    i_text-line = 'Texto del mensaje'.
    APPEND i_text.



    REFRESH i_receivers.
    CLEAR i_receivers.
    i_receivers-rcdat = sy-datum.
    i_receivers-rctim = sy-uzeit.
    i_receivers-recextnam = wrecepient.
    i_receivers-recesc = 'U'.
    i_receivers-sndex = 'X'. " Express-Mail
    APPEND i_receivers.


    objpara-name = 'SPI'.
    objpara-low = wspoolnumber.
    APPEND objpara.


    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    object_hd_change = object_hd_change
    object_type = 'RAW'
    owner = sy-uname
    TABLES
    objcont = i_text
    receivers = i_receivers
    EXCEPTIONS
    active_user_not_exist = 1
    communication_failure = 2
    component_not_available = 3
    folder_not_exist = 4
    folder_no_authorization = 5
    forwarder_not_exist = 6
    note_not_exist = 7
    object_not_exist = 8
    object_not_sent = 9
    object_no_authorization = 10
    object_type_not_exist = 11
    operation_no_authorization = 12
    owner_not_exist = 13
    parameter_error = 14
    substitute_not_active = 15
    substitute_not_defined = 16
    system_failure = 17
    too_much_receivers = 18
    user_not_exist = 19
    originator_not_exist = 20
    x_error = 21
    OTHERS = 22.

    IF sy-subrc <> 0.
    WRITE: /'Error al enviar el mail'.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

    pero me marca error ADDR_PERS_COMP_COMM_GET que me falta???

    Slds-
    Consultor FI-CO
  • abaper_biz
    Junior Member
    • oct
    • 27

    #2
    funcion SO_NEW_DOCUMENT_ATT_SEND_API1'

    Originalmente publicado por caralbgro
    tengo este codigo de envio de mail

    DATA: BEGIN OF i_text OCCURS 0.
    INCLUDE STRUCTURE soli.
    DATA: END OF i_text.

    DATA: wspoolnumber LIKE sy-spono ,
    wmailname LIKE sood1-objnam,
    wsubject LIKE sood1-objdes ,
    wrecepient(40) TYPE c ,
    wdli LIKE soos1-dlinam.

    DATA: object_hd_change LIKE sood1 OCCURS 0 WITH HEADER LINE,
    objpara LIKE selc OCCURS 0 WITH HEADER LINE,
    receivers LIKE soos1 OCCURS 0 WITH HEADER LINE.

    DATA: BEGIN OF i_receivers OCCURS 0.
    INCLUDE STRUCTURE receivers.
    DATA: END OF i_receivers.



    wsubject = 'Entrega numero....1234567890.'.
    wrecepient = 'carlos.grossi@emgasud.com.ar'.



    object_hd_change-objla = sy-langu.
    object_hd_change-objnam = wmailname.
    object_hd_change-objdes = wsubject.
    object_hd_change-objsns = 'F'.
    object_hd_change-vmtyp = 'T'.
    object_hd_change-skips = 'X'.
    object_hd_change-acnam = 'SP01'.
    object_hd_change-objcp = 'X'.



    REFRESH i_text.
    CLEAR i_text.
    i_text-line = 'Texto del mensaje'.
    APPEND i_text.



    REFRESH i_receivers.
    CLEAR i_receivers.
    i_receivers-rcdat = sy-datum.
    i_receivers-rctim = sy-uzeit.
    i_receivers-recextnam = wrecepient.
    i_receivers-recesc = 'U'.
    i_receivers-sndex = 'X'. " Express-Mail
    APPEND i_receivers.


    objpara-name = 'SPI'.
    objpara-low = wspoolnumber.
    APPEND objpara.


    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    object_hd_change = object_hd_change
    object_type = 'RAW'
    owner = sy-uname
    TABLES
    objcont = i_text
    receivers = i_receivers
    EXCEPTIONS
    active_user_not_exist = 1
    communication_failure = 2
    component_not_available = 3
    folder_not_exist = 4
    folder_no_authorization = 5
    forwarder_not_exist = 6
    note_not_exist = 7
    object_not_exist = 8
    object_not_sent = 9
    object_no_authorization = 10
    object_type_not_exist = 11
    operation_no_authorization = 12
    owner_not_exist = 13
    parameter_error = 14
    substitute_not_active = 15
    substitute_not_defined = 16
    system_failure = 17
    too_much_receivers = 18
    user_not_exist = 19
    originator_not_exist = 20
    x_error = 21
    OTHERS = 22.

    IF sy-subrc <> 0.
    WRITE: /'Error al enviar el mail'.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

    pero me marca error ADDR_PERS_COMP_COMM_GET que me falta???

    Slds-



    Hola podrias probar con la siguiente funcion:



    *-----------------------------------------------------------
    DESCRIBE TABLE objtxt LINES w_lines.
    CLEAR reclist.
    reclist-receiver = 'destinatario@correo.com'.
    reclist-express = 'X'.
    reclist-rec_type = 'U'.
    reclist-copy = 'X'.
    APPEND reclist. " aqui va la lista de destinatarios.


    CONCATENATE
    'Sociedad' 'Usuario' 'Fecha Venc' 'Ejercicio' 'Solicitud'
    'Secuencia' 'Cliente' 'Razón Social'
    'Importe ' 'Banco' INTO
    i_contents_bin SEPARATED BY con_tab.


    CONCATENATE con_cret i_contents_bin INTO i_contents_bin.
    APPEND i_contents_bin.
    APPEND i_contents_bin.
    APPEND i_contents_bin.
    APPEND i_contents_bin.




    DESCRIBE TABLE objtxt LINES w_lines.
    objpack-transf_bin = ' '.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = w_lines * 255.
    objpack-doc_type = 'RAW'.
    objpack-obj_name = 'File.Xls'.
    objpack-obj_descr = 'Aqui ingresas el mensaje del correo '.
    APPEND objpack.
    DESCRIBE TABLE i_contents_bin LINES objpack-body_num.
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num = 1.
    objpack-body_start = 1.
    objpack-doc_size = objpack-body_num * 255.
    objpack-doc_type = 'XLS'. " --> aqui le indicas el formato
    APPEND objpack.
    *------------------------------------------------

    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = doc_chng "-> este es el asunto del mail
    put_in_outbox = 'X' "-> salida a sapoffice.
    commit_work = 'X'
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = i_contents_bin " contenido del alv.
    contents_txt = objtxt " nombre archivo adjunto
    receivers = reclist " lista de destinatarios
    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.



    Jhon Riders Juscamaita Rico
    --------------------------------------------
    CONSULTOR SAP / ABAP4 DEVELOPER

    Comentario

    Trabajando...