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

populate body of the mail when smartform is triggered.

Hi Guru's,

i have configured the smartform, and when i execute the transaction the smartform is being triggered and i am getting the smartform as pdf in a mail.

i want to populate the body of the mail. i am not using the function modules like to convert smartform to pdf then triggering mail. it is triggering from output options.

how to poulate the body of the mail

Best regards,

Chetan.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2008 at 03:25 PM

    Hello,

    declare the following

    data :

    i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,

    in the program write the below cod as following

    i_objtxt = 'Find attached the output of the smart form.'. --> this is the body of the mail.

    APPEND i_objtxt.

    now pass this to the call function.

    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    EXPORTING

    document_data = w_doc_chng

    put_in_outbox = 'X'

    IMPORTING

    sent_to_all = v_sent_all

    TABLES

    packing_list = i_objpack ...... and also the other parameters

    This shall trigger the body.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      I am having the same problem.

      I am generating an email with a Smart Form attached as PDF. The email is sent successfully, but there is no text in the body of the email.

      The email is being built within FM Open_Form, as defined in the procedure for Output Type ZNE2. NACE is configured with medium 5. Everything is working fine.

      Since the code is using OPEN_FORM and is not using 'SO_NEW_DOCUMENT_ATT_SEND_API1', is there a parameter I can populate to build the body of the email message?

  • author's profile photo Former Member
    Former Member
    Posted on May 01, 2008 at 02:05 AM

    Hello all,

    I recently did an object which sends an email with the body.

    Step 1.

    Do not send the email directly by SAP functionality using smartform function module.

    Set the parameter control_parameters-getotf = 'X' of the smartform function module.

    step 2.

    Use function module CONVERT_OTF

    CALL FUNCTION 'CONVERT_OTF'

    EXPORTING

    format = 'PDF'

    IMPORTING

    bin_filesize = lf_bin_filesize

    • BIN_FILE =

    TABLES

    otf = gs_job_output_info-otfdata

    lines = gt_lines

    EXCEPTIONS

    err_max_linewidth = 1

    err_format = 2

    err_conv_not_possible = 3

    err_bad_otf = 4

    OTHERS = 5.

    Step 3

    Use function module QCE1_CONVERT

    CALL FUNCTION 'QCE1_CONVERT'

    TABLES

    t_source_tab = gt_lines

    t_target_tab = outbin.

    Step 3.

    Fill up the details for Email Body + Attachment for the function module SO_NEW_DOCUMENT_ATT_SEND_API1

    internal table objtxt will have body of email (txt format)

    DESCRIBE TABLE objtxt LINES tab_lines.

    READ TABLE objtxt INDEX tab_lines.

    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).

    CLEAR objpack-transf_bin.

    objpack-head_start = 1.

    objpack-head_num = 0.

    objpack-body_start = 1.

    objpack-body_num = tab_lines.

    objpack-doc_type = 'HTM'.

    APPEND objpack.

    • -----------

    • Packing Info Attachment

    • -----------

    att_type = 'PDF'

    DESCRIBE TABLE objbin LINES tab_lines.

    READ TABLE outbin INDEX tab_lines.

    objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).

    objpack-transf_bin = 'X'.

    objpack-head_start = 1.

    objpack-head_num = 0.

    objpack-body_start = 1.

    objpack-body_num = tab_lines.

    objpack-doc_type = att_type.

    objpack-obj_name = 'ATTACHMENT'.

    objpack-obj_descr = 'description'.

    APPEND objpack.

    docdata-obj_name = name.

    docdata-obj_descr = description.

    step 4 :- use function module 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    EXPORTING

    document_data = docdata

    put_in_outbox = 'X'

    TABLES

    packing_list = objpack

    object_header = objhead

    contents_bin = objbin

    contents_txt = objtxt

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

    Hope this helps. Let me know if you have any questions

    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.