Ver Mensaje Individual
  #5  
Viejo 11/07/13, 17:01:39
minerva0112 minerva0112 is offline
Senior Member
 
Fecha de Ingreso: nov 2009
Mensajes: 116
hola



Debo de tener algo de mas o me esta faltando algo porque no me genera el correo ni en linea ni en proceso de fondo, please si me puedes ayudar te anexo el codigo

FORM f_generar_archivo_pdf.


* Funcion para llamar el formulario
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZHRO_LSTD_NTFCCNS'(031)
IMPORTING
fm_name = g_funcion
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.


g_control_parameters-getotf = 'X'.
g_control_parameters-no_dialog = 'X'.
g_output_options-tdnoprev = 'X'.
g_output_options-tddest = 'PDF '.
g_output_options-tdnewid = 'X'.
g_output_options-tdimmed = 'X'.



CALL FUNCTION g_funcion
EXPORTING
indicador = g_indicador
texto = g_texto
output_options = g_output_options
control_parameters = g_control_parameters
user_settings = space
IMPORTING
job_output_info = t_otf_from_fm
TABLES
it_data = it_data
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.


IF sy-subrc EQ 0.
t_otf[] = t_otf_from_fm-otfdata[].
ENDIF.

ENDFORM. "f_generar_archivo_pdf



FORM f_enviar_correo.


SELECT *
FROM pa0105
INTO TABLE it_pa0105a
WHERE pernr IN p_remit
AND endda EQ '99991231'
AND subty EQ '0010'.

LOOP AT it_pa0105a.
MOVE: it_pa0105a-usrid_long TO it_correo-correo.
APPEND it_correo.
ENDLOOP.


LOOP AT it_correo.
* TOMAR OTF Y PASARLO A PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = filesize
TABLES
otf = t_otf
lines = t_lines
EXCEPTIONS
err_conv_not_possible = 1.

* File Name
doc_chng-obj_name = 'MESSAGE'.
* Mail Subject
CONCATENATE 'Reclamo N° ' sy-datum
INTO doc_chng-obj_descr
SEPARATED BY space.

* PACKING INFO TEXT DATA
objtxt-line = 'Anexo Listado de Notificacion.'.
APPEND objtxt.

DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).

* CLEAR OBJHEAD.
* OBJHEAD = 'MiPDF.PDF'.
* APPEND OBJHEAD.

CLEAR objpack.
objpack-transf_bin = ''.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.

CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = t_lines
t_target_tab = objbin
EXCEPTIONS
convert_not_possible = 1.


DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.

CLEAR objpack.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'PDF'.
objpack-obj_name = 'COTIPDF'.

CONCATENATE 'Listado Notificacion' sy-datum INTO objpack-obj_descr.

* OBJPACK-OBJ_DESCR = 'Click para ver archivo'.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
APPEND objpack.

* Completing the recipient list target recipent
CLEAR reclist.
* SELECT SINGLE addrnumber persnumber
* INTO (v_addrnumber, v_persnumber)
* FROM usr21
* WHERE bname = sy-uname.
*
* IF sy-subrc EQ 0.
* SELECT SINGLE smtp_addr INTO reclist-receiver
* FROM adr6
* WHERE addrnumber = v_addrnumber
* AND persnumber = v_persnumber.
* IF sy-subrc EQ 0.
* reclist-rec_type = 'U'.
* APPEND reclist.
* ELSE.
** Si no encuentra el correo externo del usuario,
** mandamos al correo interno de SAP.
* reclist-receiver = sy-uname.
* reclist-rec_type = 'B'.
* APPEND reclist.
* ENDIF.
* ENDIF.
reclist-receiver = it_correo-correo.
reclist-rec_type = 'B'.
APPEND reclist.

* Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
TABLES
packing_list = objpack
* OBJECT_HEADER = OBJHEAD
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.

ENDLOOP.
Responder Con Cita