Skip to Content
0
Former Member
Dec 20, 2006 at 08:52 AM

Email attachment

24 Views

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.