Skip to Content
0
Former Member
Jan 05, 2009 at 12:11 PM

Regarding Emailing an Attachment

24 Views

Hi,

I have an Requirement, that i need to mail an Excel file attachment to recipient mail ID.

I have used FM --> 'SO_DOCUMENT_REPOSITORY_MANAGER' for Uploading an Excel file from an Presentation server.

But using this FM when i pass method = 'SAVE' an pop-up window will come, then i need to press send button then only the mail will be sent to sap inbox of recipient.

But my Question is i need to Supress that window and mail needs to be sent to sapmailbox.

How can i proceed ?? Please find my below source code pasted.

Please correct me if i'm wrong.

PARAMETERS : ws_file(4096) TYPE c DEFAULT

'C:\Documents and Settings\rd76685\Desktop\test.xls'.

g_user-sapname = sy-uname.

CALL FUNCTION 'SO_USER_READ_API1'

EXPORTING

user = g_user

IMPORTING

user_data = g_user_data.

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-objdes = 'Detail Activity Report'.

g_document-folrg = 'O'.

g_document-objlen = '0'.

g_document-file_ext = 'XLS'.

g_header-objdes = 'Detail Activity Report'.

g_header-file_ext = 'XLS'.

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.

  • 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 = 'LC2242'.

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.

Thanks and Regards

Raghavendra.D.S