MUNDOSAP

Regresar   MUNDOSAP > DESARROLLO > Programación ABAP IV
Nombre de Usuario
Contraseña
Home Descargas Registrar FAQ Miembros Calendario Buscar Temas de Hoy Marcar Foros Como Leídos




 
Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Viejo 16/08/11, 13:13:38
marianoboni marianoboni is offline
Member
 
Fecha de Ingreso: abr 2008
Mensajes: 75
Smile Problema enviando email -RESUELTO

Buenos días

Problema:
Aplicación no envía email; tampoco acusa ningún tipo de error.
El codigo que utilizo para enviar el email esta tomado de los ejemplos de SAP ( BCS_EXAMPLE_7 u BCS_EXAMPLE_8). Si corro estos ejemplos SAP envía el email correctamente; Funciona también si copio estos programas y los corro con la trz SE38.

La diferencia entre éstos radica en que mi programa no es un Report, si no que invoco el procedimiento desde un DYNPRO.

Otros datos:
-para el envío uso SAPConnect ( funciona correctamente ).
-verifico los emails con SOST

Todo parece indicar que hay alguna propiedad de mi aplicación que esta imposibilitando el envío y al no haber exepción alguna se dificulta ver el problema.
Desde ya agradezco cualquier tipo de orientación.

Mariano

Úlima edición por marianoboni fecha: 16/09/11 a las 18:17:19.
Responder Con Cita
  #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
  #3  
Viejo 16/08/11, 15:13:04
marianoboni marianoboni is offline
Member
 
Fecha de Ingreso: abr 2008
Mensajes: 75

Hola,
mirá ese no es el problema, ya que utilizando la misma cuenta y codigo en un report funciona, puedo ver el email ( en vez de acceder por la SCOT uso la transaccion SOST ) en la cola de salida; en cambio cuando "copio y pego" el codigo con los mismos datos en el mismso entorno no funciona; ni siquiera aparece en la cola de salida.
Gracias po la ayuda, voy a seguir renegando
Responder Con Cita
  #4  
Viejo 16/08/11, 15:16:45
SAPING SAPING is offline
Senior Member
 
Fecha de Ingreso: may 2010
Localización: Buenos Aires, Argentina
Mensajes: 199
oks... igualmente podrias probar de esta manera, como para descartar posibilidades..je..

Si lo solucionas, compartilo !!

Saludos y suerte.
(perdon por no poder ayudarte mas)
Responder Con Cita
  #5  
Viejo 16/08/11, 22:45:21
jossnet jossnet is offline
Member
 
Fecha de Ingreso: oct 2007
Mensajes: 61
Haz hecho un debug de tu aplicación?,postea tu código,no deberia haber problema si lo lanzas desde un dynpro.
Responder Con Cita
  #6  
Viejo 17/08/11, 14:32:34
marianoboni marianoboni is offline
Member
 
Fecha de Ingreso: abr 2008
Mensajes: 75
Codigo de mi aplicacion

Este framgmento de codigo lo saque de un report: BCS_EXAMPLE_7


form send.
data send_request type ref to cl_bcs.
data document type ref to cl_document_bcs.
data recipient type ref to if_recipient_bcs.
data bcs_exception type ref to cx_bcs.

data main_text type bcsy_text.
data binary_content type solix_tab.
data size type so_obj_len.
data sent_to_all type os_boolean.
data mailto type ad_smtpadr.

mailto = 'mariano.boni@aguasdesantafe.com.ar'.
try.

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

* -------- create and set document with attachment ---------------
* create document object from internal table with text
append 'Hello world!' to main_text. "#EC NOTEXT
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = main_text
i_subject = 'Test Created By BCS_EXAMPLE_7' ). "#EC NOTEXT

* add the spread sheet as attachment to document object
document->add_attachment(
i_attachment_type = 'xls' "#EC NOTEXT
i_attachment_subject = 'ExampleSpreadSheet' "#EC NOTEXT
i_attachment_size = size
i_att_content_hex = binary_content ).

* 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.

if sent_to_all is initial.
message i500(sbcoms) with mailto.
else.
message s022(so).
endif.

* ------------ exception handling ----------------------------------
* replace this rudimentary exception handling with your own one !!!
catch cx_bcs into bcs_exception.
message i865(so) with bcs_exception->error_type.
endtry.
endform. "send
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Reglas de Mensajes
no puedes crear nuevos temas
no puedes responder temas
no puedes adjuntar archivos
no puedes editar tus mensajes

El código vB está On
Las caritas están On
Código [IMG] está On
Código HTML está Off
Saltar a Foro


Husos Horarios son GMT. La hora en este momento es 05:06:09.


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