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

Email sending from abap program

Hi all,

does anyone give me a suggestion on how to solve this problem?

I'm trying to send an email with an excel attachment from an abap program. All works fine, but when i open the attachemnt i realize that if the line in the excel sheet ( which splitted in more columns ) is exceeding 255 then it is truncated. I'm using function module 'SO_DOCUMENT_SEND_API1' and i guess i have to compress in some way the lines that, for my purposes, will for sure exceed 255 characters.

Thanks in advance.

Angelo.

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2004 at 06:16 AM

    Is it possible for you to send each row as multiple lines ?

    for eg:

    MYFIRSTNAME MYLASTNAME MYAGE MYADDREsS

    If that is the case, you can use <b>RKD_WORD_WRAP</b> (Function Module) and set a length of 255 and the end of each line can probably use a delimiter. So the contents would actually go as:

    [start of row]

    MYFIRSTNAME MYLASTNAME MYAGE

    MYADDRESS

    [end of row]

    [start of row]

    .......

    ....

    [end of row]

    If you have found out any other way to solve your problem, please share with us.

    Regards,

    Subramanian V.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2004 at 04:19 PM

    Hi Angelo,

    Make sure your SAP Internet Mail Gateway is version 4.6D7 or higher (See OSS Note 680358).

    Cheers,

    Ramki.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2004 at 11:55 PM

    pass the data as RAW and use '0D' and line feed.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2004 at 09:10 PM

    Hi guys,

    thank you very much for your hints.

    I solved the problem using a more powerful function module: SO_NEW_DOCUMENT_ATT_SEND_API1.

    I will provide you peaces of code tomorrow about the logic for filing the function's module interface in order to overtake the limit of 255 that the interface has.

    Regards,

    Angelo.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      You can send binary attachments using FM SO_OBJECT_SEND.

      For example:

      data:

      tb_message like soli occurs 0 with header line,

      tb_recipients like soos1 occurs 0 with header line,

      tb_packing_list like soxpl occurs 0 with header line,

      tb_attachment like soli occurs 0 with header line,

      l_object_hd like sood1,

      l_originator type soos1-recextnam.

      data:

      l_filepath(40),

      l_filename(40),

      l_fileext(6),

      l_filespec(80),

      l_len type i.

      *

      • Set up recipient(s) table

      *

      clear tb_recipients.

      tb_recipients-recesc = 'U'. "recipient type = internet

      tb_recipients-sndart = 'INT'. "output device (internet)

      tb_recipients-recextnam = 'fred.bloggs@foobar.com'.

      append tb_recipients.

      *

      • A text message

      *

      tb_message = 'Here is a file from SAP'.

      append tb_message.

      *

      • Originator

      *

      l_originator = 'myname@somewhere.com'.

      *

      • === Attached file ===

      *

      l_filepath = '/home/myuser/'.

      l_filename = 'myfile'.

      l_fileext = 'xls'.

      concatenate l_filepath l_filename '.' l_fileext into l_filespec.

      *

      • Initialise the packing list

      *

      clear tb_packing_list.

      describe table tb_attachment.

      tb_packing_list-body_start = sy-tfill + 1.

      tb_packing_list-transf_bin = 'X'.

      tb_packing_list-objtp = 'EXT'.

      tb_packing_list-objnam = 'ATTACH'.

      concatenate l_filename '.' l_fileext into tb_packing_list-objdes.

      tb_packing_list-file_ext = l_fileext.

      translate tb_packing_list-file_ext to upper case.

      *

      • open file in binary read and add to tb_attachment

      *

      open dataset l_filespec in binary mode for input.

      do.

      read dataset l_filespec into tb_attachment length l_len.

      if sy-subrc <> 0.

      exit.

      endif.

      append tb_attachment.

      add 1 to tb_packing_list-body_num.

      add l_len to tb_packing_list-objlen.

      enddo.

      if l_len <> 0.

      append tb_attachment.

      add 1 to tb_packing_list-body_num.

      add l_len to tb_packing_list-objlen.

      endif.

      close dataset l_filespec.

      *

      • update the packing list

      *

      append tb_packing_list.

      *

      • Header data

      *

      l_object_hd-objla = sy-langu. "Language

      l_object_hd-objnam = 'EMAIL'. "Object name (can be anything)

      l_object_hd-file_ext = 'TXT'. "message type (TXT or HTM)

      l_object_hd-objdes = 'File from SAP'. "Subject

      *

      • Send it

      *

      call function 'SO_OBJECT_SEND'

      EXPORTING

      object_hd_change = l_object_hd

      object_type = 'RAW' "must be RAW

      originator = l_originator

      originator_type = 'U' "U=Internet address

      TABLES

      objcont = tb_message

      receivers = tb_recipients

      packing_list = tb_packing_list

      att_cont = tb_attachment

      EXCEPTIONS

      ACTIVE_USER_NOT_EXIST = 1

      COMMUNICATION_FAILURE = 2

      COMPONENT_NOT_AVAILABLE = 3

      FOLDER_NOT_EXIST = 4

      FOLDER_NO_AUTHORIZATION = 5

      FORWARDER_NOT_EXIST = 6

      NOTE_NOT_EXIST = 7

      OBJECT_NOT_EXIST = 8

      OBJECT_NOT_SENT = 9

      OBJECT_NO_AUTHORIZATION = 10

      OBJECT_TYPE_NOT_EXIST = 11

      OPERATION_NO_AUTHORIZATION = 12

      OWNER_NOT_EXIST = 13

      PARAMETER_ERROR = 14

      SUBSTITUTE_NOT_ACTIVE = 15

      SUBSTITUTE_NOT_DEFINED = 16

      SYSTEM_FAILURE = 17

      TOO_MUCH_RECEIVERS = 18

      USER_NOT_EXIST = 19

      ORIGINATOR_NOT_EXIST = 20

      X_ERROR = 21

      OTHERS = 22.

      Basically, tb_attachement is a block of binary attachment data and tb_packing_list describes tb_attachment so you can send several data files in one go (as attachments). tb_message is just text so you can include a message.

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.