Skip to Content
author's profile photo Former Member
Former Member

Email attachment

Is it possible to send a bigger file (greater than 255 characters) using FM SO_NEW_DOCUMENT_ATT_SEND_API1. If not how else can I send such a file?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2005 at 09:42 PM

    Hi,

    You should be able to do this. It is an internal table to which one specifies the contents of all the attachments, when calling the mentioned FM. (Also you can have more than one attachment when sending the mail.)

    I donot have access to an SAP system right now...so i am unable to give you the interface parameter names. Pls check for documentation of the FM.

    Thanks & Regards,

    Renjith

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 10, 2005 at 04:39 AM

    Hi,

    You can send email and include the file contents as body of email or as attachment. You can send how email of any length as you are writing from a file.

    I am attaching the code for the same

    The following is the code to send an email.

    This program extract does two things

    1. Sends file contents as body of the mail

    2. Sends a file as attachment.

    Before going through the code, just check

    the unix command for sending email, given below.

    _____________________________________________

    (cat 'filename containing the body of email' ; uuencode 'name of file to be attached' 'Name of attached file to be displayed in the email') | /bin/mailx -s "

    Subject of the mail " 'To email address'

    ______________________________________________

    Cat sends the file contents as body of email and uuencode sends the file as attachment

    (cat content ; uuencode filename fname) | /bin/mailx -s "

    'Subject of the mail' " 'To email address'

    _____________________________________________

    FORM mail_message USING username filename.

    DATA: BEGIN OF file OCCURS 0,

    line(250),

    END OF file.

    • Attached file will be displayed in the mail as fname

    • filename is the file that will be send as attachment in the email.

    DATA : filename(100) TYPE c VALUE '/data/logs/lfile.txt'

    DATA : fname(25) VALUE 'Logfile.txt'.

    DATA: parcom(300) TYPE c,

    pbody1(50) VALUE

    'Please find the log details as an attachment

    (This is the body of email) '

    • Content contains the file which contains the body of the mail.

    • Username contains the email address to which the mail has to be sent.

    DATA : content(50) VALUE '/usr/sap/tmp/body'.

    DATA : username(50) VALUE 'susmitha.thomas@wipro.com'.

    CLEAR parcom.

    TRANSLATE username TO LOWER CASE.

    TRANSLATE filename TO LOWER CASE.

    • Writing the body of the mail to the file

    OPEN DATASET content FOR OUTPUT IN TEXT MODE.

    TRANSFER pbody1 TO content.

    CLOSE DATASET content.

    CONCATENATE '(cat ' content '; uuencode ' filename fname ') |' '/bin/mailx -s "'

    'Subject of the mail' '"' username

    INTO parcom SEPARATED BY space.

    *

    REFRESH file.

    CLEAR file.

    • Send The Message.

    CALL 'SYSTEM' ID 'COMMAND' FIELD parcom

    ID 'TAB' FIELD file-sys.

    • if sy-subrc = '0'.

    • write: / 'Mail message successfully sent'.

    • else.

    • write: / 'Mail message failed'.

    • endif.

    ENDFORM.

    ___________________________________________________

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.