Ver Mensaje Individual
  #2  
Viejo 16/08/11, 14:58:18
SAPING SAPING is offline
Senior Member
 
Fecha de Ingreso: may 2010
Localización: Buenos Aires, Argentina
Mensajes: 199
Thumbs up

Fijate si el mail destinatario esta cargado en la trx SCOT.
Proba agregando uno a mano.
Tambien proba haciendo un COMMIT al final de la funcion. Yo tuve un inconveniente similar, donde me dejaba encolados los mails y no los enviaba. Luego de poner el COMMIT se soluciono el problema.

El codigo que use yo es el siguiente:

FORM f_enviar_mail TABLES pt_notificadores
pt_log.

DATA: w_notificadores TYPE pa0105-usrid_long.

*** Estructuras para mails
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.

CONSTANTS: lc_docu(12) TYPE c VALUE 'Documentos:',
lc_det(8) TYPE c VALUE 'Detalle:'.

***********************************************************************

* seteo el ASUNTO
READ TABLE pt_log INDEX 1.
IF sy-subrc IS INITIAL.
* Si son registros OK
IF pt_log-error IS INITIAL.

wsubject = 'registros ok'.

ELSE."son registros erroneos

wsubject = 'registros no ok'.

ENDIF.

ENDIF.
* Seteo datos de cabecera de mensaje
object_hd_change-objla = sy-langu.
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'.

* Coloco en el cuerpo del mens los docs
i_text-line = lc_docu.
APPEND i_text.
CLEAR i_text.
LOOP AT pt_log. "mi tabla de registros procesados

i_text-line = 'mensaje'.
APPEND i_text.
CLEAR i_text.

ENDLOOP.

* Ingreso las cuentas de mails obtenidas en un form anterior
REFRESH i_receivers.
CLEAR i_receivers.
i_receivers-rcdat = sy-datum.
i_receivers-rctim = sy-uzeit.
i_receivers-recesc = 'U'.
i_receivers-sndex = 'X'. " Express-Mail

LOOP AT pt_notificadores INTO w_notificadores.

MOVE w_notificadores TO i_receivers-recextnam.
APPEND i_receivers.
CLEAR i_receivers-recextnam.

ENDLOOP.


* envio los mails
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 IS NOT INITIAL.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

COMMIT WORK.
ENDFORM. " f_enviar_mail

Desde la SCOT vas a Utilidades/Resumenes de ordenes de envio y te tira el listado y status de los mails.

Saludos.
Responder Con Cita