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

Want to send a text in BOLD via email

Hi all,

I want to send a text in BOLD via email,

Right now i ma using the Function Module: SO_NEW_DOCUMENT_ATT_SEND_API1 for sending attachments via mail.

But i do not know how i can send some text in BOLD.

<b>****NOTE: I want the text in BOLD is in the BODY of the mail</b>

I checked the Import and tables parameters inthat FM.But there is no option in those parameters.

So, can any one plz help me to solve this issue.

Thanks&Regards,

Srikanth T

Message was edited by:

srikanth T

Message was edited by:

srikanth T

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2007 at 11:39 AM

    hi

    good

    Look at PRINT-CONTROL command.This might help you.

    http://docs.hp.com/en/hpr3_61tn2-v2enUS/hpr3_61tn2enUS.pdf

    thanks

    mrutyun^

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2007 at 11:48 AM

    Hi

    The below code will definately help you..

    REPORT test.

    DATA: att_size TYPE i, " att Size

    att_itab_size TYPE i, " Attachment size

    mailtxt_size TYPE i. " Text in mail size

    DATA:

    it_mailpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE, " Dist details

    it_mailhead LIKE solisti1 OCCURS 1 WITH HEADER LINE," Header data

    it_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE, " Rec List

    it_mailtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE, " Mail Text

    it_att_data LIKE solisti1 OCCURS 0 WITH HEADER LINE, " Attachment data

    it_doc_att LIKE sodocchgi1. " Attri of new doc

    • Text in the mail.

    it_mailtxt-line =

    '<BODY BGCOLOR="#FFFFCC">' &

    '<B> This is a test mail, Line Number--1</B><BR>'

    .

    APPEND it_mailtxt.

    it_mailtxt-line = '<I> This is a test mail, Line Number--2' &

    ' This is a test mail, Line Number--2</I><BR>'.

    APPEND it_mailtxt.

    it_mailtxt-line = '<U> This is a test mail, Line Number--3' &

    ' This is a test mail, Line Number--3' &

    ' This is a test mail, Line Number--3</U>'.

    APPEND it_mailtxt.

    DESCRIBE TABLE it_mailtxt LINES mailtxt_size.

    • Create the att File

    concatenate '<BODY><B>Attachment Line Number 1</B><BR>' space into

    it_att_data-line.

    APPEND it_att_data.

    concatenate '<I>Attachment Line Number 2</I><BR>' space into

    it_att_data-line.

    APPEND it_att_data.

    concatenate '<U>Attachment Line Number 3</U>' space into

    it_att_data-line.

    APPEND it_att_data.

    DESCRIBE TABLE it_att_data LINES att_itab_size.

    • Attributes of new doc

    CONCATENATE 'Attach' space 'mail'

    INTO it_doc_att-obj_descr SEPARATED BY space.

    it_doc_att-sensitivty = 'F'.

    it_doc_att-doc_size = mailtxt_size * 255.

    • Create Pack to text in mail body.

    it_mailpack-transf_bin = space.

    it_mailpack-head_start = 1.

    it_mailpack-head_num = 0.

    it_mailpack-body_start = 1.

    it_mailpack-body_num = mailtxt_size.

    it_mailpack-doc_type = 'HTM'.

    APPEND it_mailpack.

    • Create Pack for Attach.

    it_mailpack-transf_bin = 'X'.

    it_mailpack-head_start = 1.

    it_mailpack-head_num = 1.

    it_mailpack-body_start = 1.

    it_mailpack-body_num = att_itab_size.

    it_mailpack-doc_type = 'HTM'.

    CONCATENATE 'My' space 'Attachment' INTO it_mailpack-obj_descr.

    it_mailpack-doc_size = att_itab_size * 255.

    APPEND it_mailpack.

    it_reclist-receiver = 'yourname@domain.com'.

    it_reclist-express = 'X'.

    it_reclist-rec_type = 'U'.

    *it_reclist-notif_del = 'X'. " request delivery notification

    APPEND it_reclist.

    • Call FM to send email

    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    EXPORTING

    document_data = it_doc_att

    put_in_outbox = 'X'

    TABLES

    packing_list = it_mailpack

    object_header = it_mailhead

    contents_txt = it_mailtxt

    contents_bin = it_att_data

    receivers = it_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.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    Mark if helpful

    Regards

    Tushar mundlik

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Srikanth

      The data it_doc_att is of type sodocchgi1.

      in which the field "sensitivty" can have below values.It describes the sensitivity of the attached object.

      <b>P Confidential

      F Functional

      O Standard</b>

      Hope it helps

      <b>Please Mark if Helpful</b>

      Regards

      Tushar

  • author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2007 at 11:35 AM

    Convert them into smartform or SAP Script from report then convert into pdf format and then send an email ...

    See the example code :

    report zemail.

    data: itcpo like itcpo,

    tab_lines like sy-tabix.

    • Variables for EMAIL functionality

    data: maildata like sodocchgi1.

    data: mailpack like sopcklsti1 occurs 2 with header line.

    data: mailhead like solisti1 occurs 1 with header line.

    data: mailbin like solisti1 occurs 10 with header line.

    data: mailtxt like solisti1 occurs 10 with header line.

    data: mailrec like somlrec90 occurs 0 with header line.

    data: solisti1 like solisti1 occurs 0 with header line.

    perform send_form_via_email.

    ************************************************************************

    • FORM SEND_FORM_VIA_EMAIL *

    ************************************************************************

    form send_form_via_email.

    clear: maildata, mailtxt, mailbin, mailpack, mailhead, mailrec.

    refresh: mailtxt, mailbin, mailpack, mailhead, mailrec.

    • Creation of the document to be sent File Name

    maildata-obj_name = 'TEST'.

    • Mail Subject

    maildata-obj_descr = 'Subject'.

    • Mail Contents

    mailtxt-line = 'Here is your file'.

    append mailtxt.

    • Prepare Packing List

    perform prepare_packing_list.

    • Set recipient - email address here!!!

    mailrec-receiver = 'you@yourcompany.com'.

    mailrec-rec_type = 'U'.

    append mailrec.

    • Sending the document

    call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    exporting

    document_data = maildata

    put_in_outbox = ' '

    tables

    packing_list = mailpack

    object_header = mailhead

    contents_bin = mailbin

    contents_txt = mailtxt

    receivers = mailrec

    exceptions

    too_many_receivers = 1

    document_not_sent = 2

    operation_no_authorization = 4

    others = 99.

    if sy-subrc = 0.

    submit rsconn01 with mode = 'INT' and return.

    endif.

    endform.

    ************************************************************************

    • Form PREPARE_PACKING_LIST

    ************************************************************************

    form prepare_packing_list.

    clear: mailpack, mailbin, mailhead.

    refresh: mailpack, mailbin, mailhead.

    describe table mailtxt lines tab_lines.

    read table mailtxt index tab_lines.

    maildata-doc_size = ( tab_lines - 1 ) * 255 + strlen( mailtxt ).

    • Creation of the entry for the compressed document

    clear mailpack-transf_bin.

    mailpack-head_start = 1.

    mailpack-head_num = 0.

    mailpack-body_start = 1.

    mailpack-body_num = tab_lines.

    mailpack-doc_type = 'RAW'.

    append mailpack.

    mailhead = 'TEST.TXT'.

    append mailhead.

    • File 1

    mailbin = 'This is file 1'.

    append mailbin.

    describe table mailbin lines tab_lines.

    mailpack-transf_bin = 'X'.

    mailpack-head_start = 1.

    mailpack-head_num = 1.

    mailpack-body_start = 1.

    mailpack-body_num = tab_lines.

    mailpack-doc_type = 'TXT'.

    mailpack-obj_name = 'TEST1'.

    mailpack-obj_descr = 'Subject'.

    mailpack-doc_size = tab_lines * 255.

    append mailpack.

    *File 2

    mailbin = 'This is file 2'.

    append mailbin.

    data: start type i.

    data: end type i.

    start = tab_lines + 1.

    describe table mailbin lines end.

    mailpack-transf_bin = 'X'.

    mailpack-head_start = 1.

    mailpack-head_num = 1.

    mailpack-body_start = start.

    mailpack-body_num = end.

    mailpack-doc_type = 'TXT'.

    mailpack-obj_name = 'TEST2'.

    mailpack-obj_descr = 'Subject'.

    mailpack-doc_size = tab_lines * 255.

    append mailpack.

    endform.

    With PDF Attachment:CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

    EXPORTING

    formname = 'Z_TEST'

    IMPORTING

    fm_name = v_fname.

    CALL FUNCTION v_fname

    EXPORTING

    control_parameters = x_ctrl_p

    IMPORTING

    job_output_info = x_output_data.

    CALL FUNCTION 'CONVERT_OTF'

    EXPORTING

    format = 'PDF'

    max_linewidth = 134

    IMPORTING

    bin_filesize = v_size

    TABLES

    otf = x_output_data-otfdata

    lines = it_lines

    EXCEPTIONS

    err_max_linewidth = 1

    err_format = 2

    err_conv_not_possible = 3

    OTHERS = 4.

    CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'

    EXPORTING

    line_width_dst = 255

    TABLES

    content_in = it_lines

    content_out = it_soli

    EXCEPTIONS

    err_line_width_src_too_long = 1

    err_line_width_dst_too_long = 2

    err_conv_failed = 3

    OTHERS = 4.

    CALL FUNCTION 'FUNC_CONVERT_DATA_ODC01'

    EXPORTING

    iv_byte_mode = 'X'

    TABLES

    it_data = it_lines

    et_data = it_table.

    *-----To caluculate total number of lines of internal table

    DESCRIBE TABLE it_table LINES v_lines.

    *-----Create Message Body and Title and Description

    it_mess = 'successfully converted smartform from otf format to pdf' .

    APPEND it_mess.

    wa_doc_data-obj_name = 'smartform'.

    wa_doc_data-expiry_dat = sy-datum + 10.

    wa_doc_data-obj_descr = 'smartform'.

    wa_doc_data-sensitivty = 'F'.

    wa_doc_data-doc_size = v_lines * 255.

    APPEND it_pcklist.

    *-----PDF Attachment

    it_pcklist-transf_bin = 'X'.

    it_pcklist-head_start = 1.

    it_pcklist-head_num = 0.

    it_pcklist-body_start = 1.

    it_pcklist-doc_size = v_lines_bin * 255 .

    it_pcklist-body_num = v_lines.

    it_pcklist-doc_type = 'PDF'.

    it_pcklist-obj_name = 'smartform'.

    it_pcklist-obj_descr = 'smart_desc'.

    it_pcklist-obj_langu = 'E'.

    it_pcklist-doc_size = v_lines * 255.

    APPEND it_pcklist.

    *-----Giving the receiver email-id

    CLEAR it_receivers.

    it_receivers-receiver = abcd@yahoo.com'.

    it_receivers-rec_type = 'U'.

    APPEND it_receivers.

    *-----Calling the function module to sending email

    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    EXPORTING

    document_data = wa_doc_data

    put_in_outbox = 'X'

    commit_work = 'X'

    TABLES

    packing_list = it_pcklist

    contents_txt = it_mess

    contents_hex = it_table

    receivers = it_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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Seshu,

      Thanks a lot for your responce.

      But I am able to send the text with attachments, My code is working properly.

      But my issue is:

      Some part of the text lines in the Body of the mail(not in the attached doc.) should be in BOLD.

      My logic is sending the attachments properly.I do not want to include any other text in the attached file. I wnat it in the BODY of the mail.

      Could you plz help me to solave this issue.

      Thankyou..

      Regards,

      Srikanth T.

  • author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2007 at 01:51 PM

    See the below thread

    /people/thomas.jung3/blog/2004/09/07/sending-e-mail-from-abap--version-46d-and-lower--api-interface

    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.