MUNDOSAP

Regresar   MUNDOSAP > DESARROLLO > Formularios - SAPScript - Smartforms
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 19/12/07, 11:38:06
rodisa rodisa is offline
Member
 
Fecha de Ingreso: jul 2007
Mensajes: 49
Pasarlo a PDF y mandarlo por Email

Tengo un smartforms y lo tengo que pasar a PDF el resultado y mandarlo por E-mail. ¿Me podéis echar una mano? Es que no tengo ni idea y lo tengo que hacer yo solito...
Responder Con Cita
  #2  
Viejo 28/04/08, 01:52:18
123porcristina 123porcristina is offline
Junior Member
 
Fecha de Ingreso: jul 2007
Mensajes: 14
Smartform a pdf y envio mail



hola rodisa espero te sirva a mi me sirve!!1

w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
*lst_control_parameters-device = 'PRINTER'.
w_ctrlop-preview = space.
w_compop-tdnewid = 'X'.
w_compop-tdimmed = 'X'.
w_compop-tddelete = 'X'.
*lst_output_options-TDDEST = 'LOCL'.
w_compop-tddest = 'LOC'. "Dispositivo de salida - Nombre corto
w_compop-tdnoprev = 'X'.
w_compop-tdcopies = 1.

call function sf_function_module_name
exporting
control_parameters = w_ctrlop
output_options = w_compop
user_settings = space
tab_estadoc = itab_estadoc
tab_total = itab_total
bukrs = pbukrs
fechac = pfechac
importing
job_output_info = w_return.


if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.


read table itab_estadoc index 1 into wa_estadoc.
select single adrnr from kna1 into vadrnr where kunnr = wa_estadoc-kunnr.
if sy-subrc = 0.
select single smtp_addr from adr6 into vmail where addrnumber = vadrnr.
if sy-subrc = 0.
i_otf[] = w_return-otfdata[].

call function 'CONVERT_OTF_2_PDF'
importing
bin_filesize = ld_filesize
tables
otf = i_otf[]
doctab_archive = lt_docs
lines = lt_lines
exceptions
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.

perform correo_user using sy-uname
changing ld_correo_user.

perform send_mail using vmail "ld_correo_user
'Estado Cuenta Clientes'
'Estado Cuenta Clientes'
lt_lines[].

endif.
endif.
endif.
clear itab_estadoc.
clear wa_estadoc.
clear itab_total.
clear wa_total.
endat.
endloop.



form correo_user using i_user changing o_email.
data: ld_username like bapibname-bapibname.
data: lt_return like bapiret2 occurs 0 with header line.
data: lt_addsmtp like bapiadsmtp occurs 0 with header line.
clear o_email.
* Rescato el correo segun el usuario .
call function 'BAPI_USER_GET_DETAIL'
exporting
username = i_user
tables
return = lt_return
addsmtp = lt_addsmtp.
read table lt_addsmtp with key std_no = 'X'.
if sy-subrc eq 0.
move lt_addsmtp-e_mail to o_email.
endif.
if not o_email is initial.
translate o_email to lower case.
endif.
endform. "correo_user


*&---------------------------------------------------------------------*
*& Form send_mail
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->VMAIL text
* -->I_SUBJECT text
* -->I_OBJ_NAME text
* -->I_LT_LINES text
*----------------------------------------------------------------------*
form send_mail using vmail
i_subject
i_obj_name
i_lt_lines type table.
* Variables para PDF y enviar por e-mail
data: ld_bin_filesize type i,
lt_otf type table of itcoo,
lt_docs type table of docs,
lt_lines type table of tline,
lt_pdf255 type so_text255 occurs 0,
ls_doc_chng like sodocchgi1,
ld_tab_lines like sy-tabix,
lt_objtxt like solisti1 occurs 0 with header line,
lt_objpack like sopcklsti1 occurs 6 with header line,
ls_body type solisti1,
lt_body type table of solisti1,
lt_recipients type table of somlreci1,
ls_recipients type somlreci1.
data ld_subject(50) type c.
data ld_body(100) type c.
data ld_field_name(50) type c.
data: begin of lt_objbin occurs 0.
include structure solisti1.
data: end of lt_objbin.



call function 'SX_TABLE_LINE_WIDTH_CHANGE'
exporting
* line_width_src =
* line_width_dst =
transfer_bin = 'X'
tables
content_in = i_lt_lines
content_out = lt_pdf255
exceptions
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
others = 4.
*----------------------------------------------------------------------*
* Control Data
*----------------------------------------------------------------------*
ls_doc_chng-obj_name = 'URGENT'.
ls_doc_chng-sensitivty = 'P'.
ls_doc_chng-no_change = 'X'.
ls_doc_chng-priority = '1'.
ls_doc_chng-obj_prio = '1'.
ls_doc_chng-obj_langu = sy-langu.
ls_doc_chng-no_change = 'X'.
* Email Subject
ls_doc_chng-obj_descr = i_subject.
* Email Body
ld_body = 'Anexo Estado Cuenta de Cliente'.
ls_body-line = ld_body.
append ls_body to lt_body.
clear ls_body.
append ls_body to lt_body.
ld_body = 'Atte.'.
ls_body-line = ld_body.
append ls_body to lt_body.
ld_body = sy-uname.
ls_body-line = ld_body.
append ls_body to lt_body.
lt_objtxt[] = lt_body[].
clear lt_objtxt.
describe table lt_objtxt lines ld_tab_lines.
if ld_tab_lines gt 0.
read table lt_objtxt index ld_tab_lines.
ls_doc_chng-doc_size = ( ld_tab_lines - 1 ) * 255 + strlen( lt_objtxt ).
clear lt_objpack-transf_bin.
lt_objpack-body_start = 1.
lt_objpack-body_num = ld_tab_lines.
lt_objpack-doc_type = 'RAW'.
append lt_objpack.
endif.
* Attachment
* Move the binary attachment to other internal table.
lt_objbin[] = lt_pdf255[].
lt_objpack-transf_bin = 'X'.
lt_objpack-body_start = 1.
ld_field_name = i_obj_name.
*Get the number of lines in the Attachment (PDF FILE)
describe table lt_objbin lines ld_tab_lines.
lt_objpack-body_num = ld_tab_lines.
lt_objpack-doc_type = 'PDF'.
lt_objpack-obj_name = ld_field_name.
concatenate ld_field_name '.pdf'
into lt_objpack-obj_descr.
lt_objpack-doc_size = ld_tab_lines * 255.
append lt_objpack.
*RECIPIENTS
ls_recipients-rec_type = 'U'.
ls_recipients-express = 'X'.
ls_recipients-receiver = vmail.
ls_recipients-copy = ' '.
append ls_recipients to lt_recipients.
if not vmail is initial.
* Call the function to send the PDF file by email
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = ls_doc_chng
put_in_outbox = 'X'
tables
packing_list = lt_objpack
contents_bin = lt_objbin
contents_txt = lt_objtxt
receivers = lt_recipients
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.
commit work.
if sy-subrc = 0.
message i000(0k) with i_subject
'enviado con exito'.
else.
message i000(0k) with i_subject
'error en envío'.
endif.
endif.
endform. "send_mail
Responder Con Cita
  #3  
Viejo 12/08/08, 18:15:48
Gregoryg Gregoryg is offline
Senior Member
 
Fecha de Ingreso: abr 2006
Localización: Caracas, Venezuela
Mensajes: 115
Samrtforms a PDF

Hola

Puedes mirar este programa RSTXPDF4

Primero debes indicarle al smartfomrs que te retorne la tabla OTF y posteriormente debes convertir dicha tabla a PDF, Mira parte de este codigo.

Por Ultimo en la tabla st_job_output_info-otfdata[] tienes el pdf.

Espera haberte ayudado..

Saludos
__________________
GregoryG

Úlima edición por Gregoryg fecha: 12/08/08 a las 18:17:55.
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 20:30:59.


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