12-20-2006 8:52 AM
Hi experts,
I am working on an email Attachment application. All my mails are getting sent with an attachment... My problem is
that the attachment is <u><b>Blank</b></u>.
Can some one help me out and tell me what is the problem...
Please donot send any sample code..
just tell me where is the problem with my code.
Collect all the receiver email address l_t_receivers.
IF NOT s_email IS INITIAL.
LOOP AT s_email.
l_t_receivers-receiver = s_email-low.
l_t_receivers-rec_type = 'U'.
APPEND l_t_receivers.
ENDLOOP.
Subject of the mail
REFRESH: l_t_doc_data.
CLEAR : l_t_doc_data.
CONCATENATE text-012 l_error_type
INTO l_t_doc_data-obj_descr SEPARATED BY l_separator.
APPEND l_t_doc_data.
Body of the mail
IF g_error_type = 'E'.
l_error_type = 'Errors'.
CONCATENATE 'During pre-editing of bank recon file' p_filenm
INTO l_t_con_text-line SEPARATED BY l_separator.
APPEND l_t_con_text.
CONCATENATE 'During pre-editing of bank recon file' p_filenm
INTO l_t_con_text-line SEPARATED BY l_separator.
APPEND l_t_con_text.
ENDIF.
Total number of lines in the document
DESCRIBE TABLE l_t_con_text LINES l_tablines.
Creation of the entry for the compressed document
l_t_pack-transf_bin = 'X'.
l_t_pack-head_start = 1.
l_t_pack-head_num = 1.
l_t_pack-body_start = 1.
l_t_pack-body_num = l_tablines.
l_t_pack-doc_type = 'DOC'.
l_t_pack-doc_size = l_tablines * 255.
APPEND l_t_pack.
Attachment document name
l_t_objhead-line = text-011.
APPEND l_t_objhead.
Calling a function module to send an attachment.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = l_t_doc_data
sender_address = sy-uname
sender_address_type = 'INT'
TABLES
packing_list = l_t_pack
object_header = l_t_objhead
contents_txt = l_t_con_text
receivers = l_t_receivers
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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
COMMIT WORK.
ENDIF.
ENDIF.
Can some one please help.
12-20-2006 9:05 AM
Rashmi,
Just try with setting l_t_pack-transf_bin = 'X' to space.
Kyamuddin.
12-20-2006 9:11 AM
12-20-2006 9:12 AM
hi
good
go through this code
report y_cr17_mail.
data method1 like sy-ucomm.
data g_user like soudnamei1.
data g_user_data like soudatai1.
data g_owner like soud-usrnam.
data g_receipients like soos1 occurs 0 with header line.
data g_document like sood4 .
data g_header like sood2.
data g_folmam like sofm2.
data g_objcnt like soli occurs 0 with header line.
data g_objhead like soli occurs 0 with header line.
data g_objpara like selc occurs 0 with header line.
data g_objparb like soop1 occurs 0 with header line.
data g_attachments like sood5 occurs 0 with header line.
data g_references like soxrl occurs 0 with header line.
data g_authority like sofa-usracc.
data g_ref_document like sood4.
data g_new_parent like soodk.
data: begin of g_files occurs 10 ,
text(4096) type c,
end of g_files.
data : fold_number(12) type c,
fold_yr(2) type c,
fold_type(3) type c.
parameters ws_file(4096) type c default 'c:\debugger.txt'.
Can me any file fromyour pc ....either xls or word or ppt etc ...
g_user-sapname = sy-uname.
call function 'SO_USER_READ_API1'
exporting
user = g_user
PREPARE_FOR_FOLDER_ACCESS = ' '
importing
user_data = g_user_data
EXCEPTIONS
USER_NOT_EXIST = 1
PARAMETER_ERROR = 2
X_ERROR = 3
OTHERS = 4
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
fold_type = g_user_data-outboxfol+0(3).
fold_yr = g_user_data-outboxfol+3(2).
fold_number = g_user_data-outboxfol+5(12).
clear g_files.
refresh : g_objcnt,
g_objhead,
g_objpara,
g_objparb,
g_receipients,
g_attachments,
g_references,
g_files.
method1 = 'SAVE'.
g_document-foltp = fold_type.
g_document-folyr = fold_yr.
g_document-folno = fold_number.
g_document-objtp = g_user_data-object_typ.
*g_document-OBJYR = '27'.
*g_document-OBJNO = '000000002365'.
*g_document-OBJNAM = 'MESSAGE'.
g_document-objdes = 'sap-img.com testing by program'.
g_document-folrg = 'O'.
*g_document-okcode = 'CHNG'.
g_document-objlen = '0'.
g_document-file_ext = 'TXT'.
g_header-objdes = 'sap-img.com testing by program'.
g_header-file_ext = 'TXT'.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = sy-uname
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
FOLMEM_DATA =
RECEIVE_DATA =
.
File from the pc to send...
method1 = 'ATTCREATEFROMPC'.
g_files-text = ws_file.
append g_files.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
.
method1 = 'SEND'.
g_receipients-recnam = 'MK085'.
g_receipients-recesc = 'B'.
g_receipients-sndex = 'X'.
append g_receipients.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header.
*-- End of Program
thanks
mrutyun^