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

Mail to be send with subject >250 characters - Urgent

Hi,

Can somebody pls help me with any standard function modules to send a mail with subjext greater than 250 characters.

Thnx in advance.

regards,

Leeza.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2005 at 12:45 PM

    Hi please check whteher the following code helps u.

    REPORT z_email_abap_report.

    ----


    • E-mail an Abap report *

    ----


    ----


    DATA : w_name TYPE sos04-l_adr_name.

    SELECT-OPTIONS :

    • Recipient address

    s_name FOR w_name DEFAULT sy-uname NO INTERVALS.

    ----


    START-OF-SELECTION.

    • E-mail Abap report

    PERFORM f_send_mail.

    ----


    • Form f_send_mail

    ----


    FORM f_send_mail.

    • Data Declaration

    DATA:

    l_datum(10),

    ls_docdata TYPE sodocchgi1,

    lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE,

    lt_objhead TYPE TABLE OF solisti1 WITH HEADER LINE,

    lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE,

    lt_objbin TYPE TABLE OF solisti1 WITH HEADER LINE,

    lt_reclist TYPE TABLE OF somlreci1 WITH HEADER LINE,

    lt_listobject TYPE TABLE OF abaplist WITH HEADER LINE,

    l_tab_lines TYPE i,

    l_att_type LIKE soodk-objtp.

    WRITE sy-datum TO l_datum.

    • List of Users According to Logon Date and Password Change

    • NOTE: Create ALI/OTF Document in Spool

    SUBMIT rsusr200 WITH valid = 'X'

    WITH notvalid = space

    WITH unlocked = 'X'

    WITH locked = space

    EXPORTING LIST TO MEMORY AND RETURN.

    • Read list from memory into table

    CALL FUNCTION 'LIST_FROM_MEMORY'

    TABLES

    listobject = lt_listobject

    EXCEPTIONS

    not_found = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    • Error in function module &1

    MESSAGE ID '61' TYPE 'E' NUMBER '731'

    WITH 'LIST_FROM_MEMORY'.

    ENDIF.

    • Because listobject is of size RAW(1000)

    • and objbin is of size CHAR(255) we make this table copy

    CALL FUNCTION 'TABLE_COMPRESS'

    TABLES

    in = lt_listobject

    out = lt_objbin

    EXCEPTIONS

    compress_error = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    • Error in function module &1

    MESSAGE ID '61' TYPE 'E' NUMBER '731'

    WITH 'TABLE_COMPRESS'.

    ENDIF.

    • NOTE: Creation of attachment is finished yet.

    • For your report, the attachment should be placed into table

    • objtxt for plain text or

    • objbin for binary content.

    • Now create the message and send the document.

    • Create Message Body

    • Title and Description

    ls_docdata-obj_name = 'USERS_LIST'.

    CONCATENATE 'List of Users' sy-sysid '-' l_datum "#EC *

    INTO ls_docdata-obj_descr SEPARATED BY space.

    • Main Text

    lt_objtxt = 'List of Users According to Logon Date' &

    ' and Password Change'. "#EC *

    APPEND lt_objtxt.

    • Write Packing List (Main)

    DESCRIBE TABLE lt_objtxt LINES l_tab_lines.

    READ TABLE lt_objtxt INDEX l_tab_lines.

    ls_docdata-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).

    CLEAR lt_objpack-transf_bin.

    lt_objpack-head_start = 1.

    lt_objpack-head_num = 0.

    lt_objpack-body_start = 1.

    lt_objpack-body_num = l_tab_lines.

    lt_objpack-doc_type = 'RAW'.

    APPEND lt_objpack.

    • Create Message Attachment

    • Write Packing List (Attachment)

    l_att_type = 'ALI'.

    DESCRIBE TABLE lt_objbin LINES l_tab_lines.

    READ TABLE lt_objbin INDEX l_tab_lines.

    lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objbin ).

    lt_objpack-transf_bin = 'X'.

    lt_objpack-head_start = 1.

    lt_objpack-head_num = 0.

    lt_objpack-body_start = 1.

    lt_objpack-body_num = l_tab_lines.

    lt_objpack-doc_type = l_att_type.

    lt_objpack-obj_name = 'ATTACHMENT'.

    lt_objpack-obj_descr = 'List_of_Users'. "#EC *

    APPEND lt_objpack.

    • Create receiver list

    LOOP AT s_name.

    lt_reclist-receiver = s_name-low.

    lt_reclist-rec_type = 'B'.

    APPEND lt_reclist.

    ENDLOOP.

    • Send Message

    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    EXPORTING

    document_data = ls_docdata

    put_in_outbox = ''

    TABLES

    packing_list = lt_objpack

    object_header = lt_objhead

    contents_bin = lt_objbin

    contents_txt = lt_objtxt

    receivers = lt_reclist

    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.

    • Document sent

    MESSAGE ID 'SO' TYPE 'S' NUMBER '022'.

    ELSE.

    • Document <&> could not be sent

    MESSAGE ID 'SO' TYPE 'S' NUMBER '023'

    WITH ls_docdata-obj_name.

    ENDIF.

    ENDFORM.

    Satish

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 18, 2005 at 12:33 PM

    Hi Leeza,

    Check this link.They are using a FM called 'Table_compress'.Check whether that can help you.

    http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html

    Check this also.

    how-to-email-an-attachment-with-more-than-255-char

    Message was edited by: Jayanthi Jayaraman

    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.