Autor Tema: Problema con mail archivo .TXT  (Leído 8153 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado johan

  • Novato
  • *
  • Mensajes: 1
    • Ver Perfil
Problema con mail archivo .TXT
« en: 26 de Junio de 2008, 12:13:55 am »
Buenas tardes, le comento mi problema estoy enviando un correo con un archivo .TXT, el correo llega bien en el formato TXT, pero resulta que la primera fila del archivo llega en blanco, compañeros por favor como hago para que archivo llegue bien o sea sin espacios.

Gracias
John

Este es el código
*&---------------------------------------------------------------------*
*& Report ZTEST40
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ztest40.

DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
DATA l_num(3).

CONSTANTS: ret(5) TYPE c VALUE cl_abap_char_utilities=>cr_lf.

* Creation of the document to be sent
doc_chng-obj_name = 'SENDFILE'.
* Mail Subject
doc_chng-obj_descr = 'Prueba de Correo via Sap'.
* Mail Contents
objtxt = 'Este es el contenido del mensaje'.
APPEND objtxt.

DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
* Creation of the entry for the compressed document
CLEAR 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.

* Creation of the document attachment


DATA: wa TYPE solisti1.
DATA: saltolinea TYPE c.

saltolinea = '0D'.

DO 5 TIMES.
CONCATENATE 'ABAP4' 'COMUNIDAD ABAP CASTELLANO' '2006' 'By gvm_ncg' 'n' 'abcdfadadadasdadasdada' saltolinea INTO wa.
CONCATENATE ret wa INTO wa.
APPEND wa TO objbin.
CLEAR wa.
ENDDO.
* ENDLOOP.

DESCRIBE TABLE objbin LINES tab_lines.
objhead = 'panchoPepeGonzalez.txt'.
APPEND objhead.

** Creation of the entry for the compressed attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
objpack-obj_name = 'WEBSITE'.
objpack-obj_descr = 'PANCHOPEPE.TXT'.
objpack-doc_size = tab_lines * 255.
APPEND objpack.

CLEAR reclist.
reclist-receiver = 'mpradac@consultoriaorganizacional.com'.
reclist-express = 'X'.
reclist-rec_type = 'U'.
reclist-copy = 'X'.
APPEND reclist.

* Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
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.

WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = ''
AND RETURN.