Send SmartForm as Email Body

Hi All!
I need to send a SmarForm by email as an email body.
The SmartForm is a simple plain text form.
Does someone know how to do it?
Regards,
Alejandro.

hi,
try this link u will have two codes.
Email Body
even if u dont understand check this code.
Here is the code to send the Smartform to mail as PDF attachment.
REPORT ZTEST_PDF_MAIL.
Internal Table declarations
DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
I_RECEIVERS TYPE TABLE OF SOMLRECI1 WITH HEADER LINE,
I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
WA_OBJHEAD TYPE SOLI_TAB,
W_CTRLOP TYPE SSFCTRLOP,
W_COMPOP TYPE SSFCOMPOP,
W_RETURN TYPE SSFCRESCL,
WA_DOC_CHNG TYPE SODOCCHGI1,
W_DATA TYPE SODOCCHGI1,
WA_BUFFER TYPE STRING, "To convert from 132 to 255
Variables declarations
V_FORM_NAME TYPE RS38L_FNAM,
V_LEN_IN LIKE SOOD-OBJLEN,
V_LEN_OUT LIKE SOOD-OBJLEN,
V_LEN_OUTN TYPE I,
V_LINES_TXT TYPE I,
V_LINES_BIN TYPE I.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZTEST'
IMPORTING
FM_NAME = V_FORM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
W_CTRLOP-GETOTF = 'X'.
W_CTRLOP-NO_DIALOG = 'X'.
W_COMPOP-TDNOPREV = 'X'.
CALL FUNCTION V_FORM_NAME
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = 'X'
IMPORTING
JOB_OUTPUT_INFO = W_RETURN
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I_OTF] = W_RETURN-OTFDATA[.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = V_LEN_IN
TABLES
OTF = I_OTF
LINES = I_TLINE
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
IF SY-SUBRC 0.
ENDIF.
LOOP AT I_TLINE.
TRANSLATE I_TLINE USING '~'.
CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
ENDLOOP.
TRANSLATE WA_BUFFER USING '~'.
DO.
I_RECORD = WA_BUFFER.
APPEND I_RECORD.
SHIFT WA_BUFFER LEFT BY 255 PLACES.
IF WA_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Attachment
REFRESH: I_RECLIST,
I_OBJTXT,
I_OBJBIN,
I_OBJPACK.
CLEAR WA_OBJHEAD.
I_OBJBIN] = I_RECORD[.
Create Message Body Title and Description
I_OBJTXT = 'test with pdf-Attachment!'.
APPEND I_OBJTXT.
DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
READ TABLE I_OBJTXT INDEX V_LINES_TXT.
WA_DOC_CHNG-OBJ_NAME = 'smartform'.
WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
WA_DOC_CHNG-SENSITIVTY = 'F'.
WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
Main Text
CLEAR I_OBJPACK-TRANSF_BIN.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
I_OBJPACK-BODY_NUM = V_LINES_TXT.
I_OBJPACK-DOC_TYPE = 'RAW'.
APPEND I_OBJPACK.
Attachment (pdf-Attachment)
I_OBJPACK-TRANSF_BIN = 'X'.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
READ TABLE I_OBJBIN INDEX V_LINES_BIN.
I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
I_OBJPACK-BODY_NUM = V_LINES_BIN.
I_OBJPACK-DOC_TYPE = 'PDF'.
I_OBJPACK-OBJ_NAME = 'smart'.
I_OBJPACK-OBJ_DESCR = 'test'.
APPEND I_OBJPACK.
CLEAR I_RECLIST.
I_RECLIST-RECEIVER = 'mail id'.
I_RECLIST-REC_TYPE = 'U'.
APPEND I_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = I_OBJBIN
CONTENTS_TXT = I_OBJTXT
RECEIVERS = I_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.
WRITE:/ 'Error When Sending the File', SY-SUBRC.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF.
If you want to send some text as Body of the Mail then follow this once
when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
I_OBJPACK-TRANSF_BIN = ' '.
I_OBJPACK-HEAD_START = 000000000000001.
I_OBJPACK-HEAD_NUM = 000000000000001.
I_OBJPACK-BODY_START = 000000000000002
I_OBJPACK-BODY_NUM = 000000000000010.
I_OBJPACK-DOC_TYPE = 'RAW'.
append I_OBJPACK-.
by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = I_OBJBIN
CONTENTS_TXT = I_OBJTXT
RECEIVERS = I_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.
reward me ig helpful.

Similar Messages

  • Send Smartform as Email body not PDF attachment

    Hello Experts,
    I have a requirement where I need to send Smartform as Email body and NOT as PDF attachment.
    I have spool ID generated for the smartform, how can I send this spool in Email body rather than as an attachment.

    Hi K C
    Try this.. Get the OTF data from the SMARTFORM, use the OTF data and pass this to FM'CONVERT_OTF', and use the format as PDF.
    Then use the resultant converted PDF data as attachment while calling the  'SO_NEW_DOCUMENT_ATT_SEND_API1' FM.
    let us know if this works.
    Thanks
    Rajesh Chowdary

  • How to send smartform output in body of email?

    Hi all ,
    I have to send smartform output in body of email (not as an attachement in mail) .PLease help me in this regard.
    Thanks,
    Ananth S.

    Hi Ananth
    See these threads.
    [https://forums.sdn.sap.com/click.jspa?searchID=23497094&messageID=6889194]
    [https://forums.sdn.sap.com/click.jspa?searchID=23497094&messageID=6861330]
    [https://forums.sdn.sap.com/click.jspa?searchID=23497094&messageID=6855364]
    Regards
    Hareesh Menon

  • Send smartforms via email using action profiles

    hi,
    i am trying to send smartforms via email using action profiles and i would like to know if anyone has any document or know any steps to do the same. i have created the smartform and i created the action in an action profile. i selected the option "Smartforms Mail". and i have mentioned my smartform in it.
    I have previously worked with action profiles to trigger workflows which sent a mail. That was relatively easier as i could mention that the mail be sent to my mailbox. But in the smartforms option, i dont know how to give the instruction that it be sent to my mailbox.. is there any place i can set it? The action is not person dependant and is done whenever saving a document.
    Please guide.
    Thanks,
    Nisha

    Hi Nisha,
    As u worked on Action profiles, i recommend u use action profile with permitted Process type as Smart Forms Mail to send the mails which contains the data in Smartform u created.
    Use below mail setting
    Form Name              (u r ZSmartform)
    Processing Class      CL_DOC_PROCESSING_CRM_ORDER
    Processing Method    CRM_ACTIVITY_EXEC_SMART_FORM
    Archive Mode            1 Mail only User
    In Action definition details u can mentioned the Processing time, Partner dependent for action to who u want to send the mail, further in action condition using schedule and start condition u can set the criteria to mail trigger.
    Hope it'll help u.
    Regards,
    Dipesh.

  • Sending smartform as email

    Hi All
    I have a requirement like we are sending a smart form as a body of email . For this we copied a class CL_DOC_PROCESSING_CRM_ORDER into YCL_DOC_PROCESSING_CRM_ORDER and in that there is one method ie CRM_ORDER_EXEC_SMART_FORM , In this method we are calling smart form to trigger this as an automatic mail.
    we are passing subject line to field  SSFCOMPOP-TDTITLE . But this field length is currently 50 chars.
    We need to extend this field length to 150 chars.
    So could you please guid  me the solution if any one faces this type of issue in their career or can you please advice me is there any alternate solution for this.
    Regards,
    CHANDU

    HI CHANDUPANDAVULA,
    You can send smartform directly right . Is there any issue in that.
    Regards,
    Madhu.
    Edited by: madhurao123 on Feb 22, 2011 4:29 PM

  • Email Smartforms with Email Body

    Hello SAP Community,
    Sorry if my question has been asked before, but I did not find any answeres yet.
    I am using BO SOFMFOL and these FM to send my smartforms to external email:
    - CREATE_RECIPIENT_OBJ_PPF
    - CREATE_SENDER_OBJECT_PPF
    - SO_USER_AUTOMATIC_INSERT
    This is working fine.  My question is: How do you add an Email  Body?  I am on ECC 6.0.
    Appreciate any inputs on this issue.
    Many thanks,
    Kim

    Hi Kim,
    I had a requirement to convert the out put into PDF format and send an email using the function module SO_NEW_DOCUMENT_ATT_SEND_API1.
    I am providing my coding, hope it helps: 
    form SEND_EMAIL .
    DATA:   t_mailpack   TYPE sopcklsti1 OCCURS 0 WITH HEADER LINE,
              t_mailhead   TYPE solisti1   OCCURS 0 WITH HEADER LINE,
              t_mailbin    TYPE solisti1   OCCURS 0 WITH HEADER LINE,
              t_mailtxt    TYPE solisti1   OCCURS 0 WITH HEADER LINE,
              t_mailrec    TYPE somlreci1  OCCURS 0 WITH HEADER LINE.
      DATA: wa_maildata    TYPE sodocchgi1,
            l_filename(50) TYPE c,
            l_fldname(30)  TYPE c,
            l_fldval(100)  TYPE c,
            l_lines        TYPE i,
            l_text         TYPE text128 .
      DATA: w_email_subrc  TYPE i.
      DATA: w_ship like vbfa-vbeln.
      CLEAR: wa_maildata,
             t_mailtxt,
             t_mailbin,
             t_mailpack,
             t_mailhead,
             t_mailrec.
      REFRESH: t_mailtxt,
               t_mailbin,
               t_mailpack,
               t_mailhead,
               t_mailrec.
    *-- Fill output file
    *- Fill header
      CLEAR: t_mailbin.
    t_mailbin[] = pdf_tab[].
      t_mailbin[] = it_att[].     "Uthaman
    *This line is added to get the shipment no in Subject Line
    SELECT SINGLE * FROM vbfa WHERE vbelv EQ nast-objky
                                AND vbtyp_v EQ c_vbtyp_v_j
                                AND vbtyp_n EQ c_vbtyp_n_8.
    w_ship = vbfa-vbeln.
    shift w_ship left deleting leading '0'.
    *-- File name
    if nast-kschl EQ 'ZFPL'.
      CLEAR l_filename.
      CONCATENATE 'Packing List -'
                  sy-datum4(2) sy-datum6(2) sy-datum(4) '.PDF' INTO l_filename.
    *-- Creation of the document to be sent File Name
      wa_maildata-obj_name = 'Packing List'.
    *-- Mail Subject
      CONCATENATE l_filename '-' 'Shipment No -' w_ship INTO wa_maildata-obj_descr SEPARATED BY space.
    *-- Mail Contents
      t_mailtxt-line = 'Packing List'.
      APPEND t_mailtxt.
    ENDIF.
    if nast-kschl EQ 'ZFBA'.
      CLEAR l_filename.
      CONCATENATE 'Booking Advice -'
                  sy-datum4(2) sy-datum6(2) sy-datum(4) '.PDF'
                  INTO l_filename.
    *-- Creation of the document to be sent File Name
      wa_maildata-obj_name = 'Booking Advice'.
    *-- Mail Subject
      CONCATENATE l_filename '-' 'Shipment No -' w_ship INTO wa_maildata-obj_descr SEPARATED BY space.
    *-- Mail Contents
      t_mailtxt-line = 'Packing List'.
      APPEND t_mailtxt.
    ENDIF.
    *-- Prepare Packing List
    *-- Write Packing List (Main Subject)
      CLEAR: l_lines, t_mailpack.
      DESCRIBE TABLE t_mailtxt LINES l_lines.
    READ TABLE t_mailtxt INDEX l_lines.
      t_mailpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( t_mailtxt ).
    CLEAR t_mailpack-transf_bin.
      t_mailpack-transf_bin = ' '.
      t_mailpack-head_start = 1.
      t_mailpack-head_num = 0.
      t_mailpack-body_start = 1.
      t_mailpack-body_num = l_lines.
      t_mailpack-doc_type = 'RAW'.
      APPEND t_mailpack.
      t_mailhead = l_filename.
      APPEND t_mailhead.
    *-- Write Packing List (Attachment)
      CLEAR: l_lines, t_mailpack.
      DESCRIBE TABLE pdf_tab[] LINES l_lines.
    READ TABLE pdf_tab INDEX l_lines.
      t_mailpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( t_mailbin ).
      t_mailpack-transf_bin = 'X'.
      t_mailpack-head_start = 1.
      t_mailpack-head_num = 1.
      t_mailpack-body_start = 1.
      t_mailpack-body_num = l_lines.
      t_mailpack-doc_type = 'PDF'.
      t_mailpack-obj_name = l_filename.
      t_mailpack-obj_descr = l_filename.
      t_mailpack-obj_langu = 'E'.
      APPEND t_mailpack.
    *-- Set recipients
    tables :  ztotcemail.
    SELECT SINGLE * FROM vbfa WHERE vbelv EQ nast-objky
                                AND vbtyp_v EQ c_vbtyp_v_j
                                AND vbtyp_n EQ c_vbtyp_n_8.
    CLEAR vttk.
    SELECT SINGLE * FROM vttk WHERE tknum EQ vbfa-vbeln.
    SELECT SINGLE * FROM ztotcemail WHERE tplst = vttk-tplst
                                      AND lifnr = vttk-tdlnr.
    IF SY-SUBRC EQ 0.
      t_mailrec-receiver = ztotcemail-smtp_addr. .
      t_mailrec-rec_type  = 'U'.
      APPEND t_mailrec.
    ENDIF.
    **-- Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_maildata
          put_in_outbox              = 'X'
         commit_work                = 'X'  " N-16
        TABLES
          packing_list               = t_mailpack
          object_header              = t_mailhead
          contents_bin               = t_mailbin[]
          contents_txt               = t_mailtxt[]
          receivers                  = t_mailrec
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      w_email_subrc = sy-subrc.
      IF sy-subrc EQ 0.
        MESSAGE s000(zotc) WITH 'Email output sent successfully'.
      ELSE.
        MESSAGE s000(zotc) WITH 'Can not send email output'.
      ENDIF.
    endform.                    " SEND_EMAIL
    Regards,
    Kittu

  • Sending smartform through email as PDF attachment

    Hi,
    I want to send a smartform through email as pdf attachment.In the code I have hardcoded the receiver mail id.But I don't want this to be sent only to a particular receiver.I want this to be sent as many people as I can without hardcoding their mail id's in the program.How can I do that?
    Regards,
    Hema

    **Data Declarations
    **Internal Table
    DATA : BEGIN OF it_spfli OCCURS 0,
              carrid LIKE spfli-carrid,
              connid LIKE spfli-connid,
           END OF it_spfli.
    DATA:   it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            it_contents     LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    storing receivers      
            it_receivers    LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    **storing file attachment data
            it_attachment   LIKE solisti1 OCCURS 0 WITH HEADER LINE,                    gd_doc_data     LIKE sodocchgi1,
            gd_error        TYPE sy-subrc,
            l_gntxt         LIKE t357g_t-gntxt,
            lv_message(100) TYPE c.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE. "storing mail body
    DATA : psubject(30) TYPE c VALUE 'Sample Mail'. "subject of the mail
    DATA : ld_format TYPE so_obj_tp , "file format
           ld_attfilename TYPE so_obj_des, "file name
           w_cnt TYPE i.
    **Selecting the data
    SELECT carrid connid INTO TABLE it_spfli FROM spfli WHERE carrid EQ 'AA'.
    **Perform for populating mail body
    PERFORM populate_message.
    **Perform for populating file attachment
    PERFORM populate_attachment.
    **Perform for populating mail characteristic info
    PERFORM populate_pack.
    **Perform for populating receivers
    PERFORM populate_receivers.
    **Perform to send mail
    PERFORM send_mail.
    *&      Form  populate_message
          text
    -->  p1        text
    <--  p2        text
    FORM populate_message .
    **Populating the body
      lv_message = 'Sample mail for testing purpose.'.
      APPEND lv_message TO it_message.
    ENDFORM.                    " populate_message
    *&      Form  populate_attachment
          text
    -->  p1        text
    <--  p2        text
    FORM populate_attachment .
    **Populating the attachment file with the data from final intenal table
      CONCATENATE 'CARRIER ID'
                  'CONNECTION ID'
                  INTO it_attachment SEPARATED BY
                  cl_abap_char_utilities=>horizontal_tab.
      CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO
      it_attachment.
      APPEND it_attachment.
      LOOP AT it_spfli.
        CONCATENATE it_spfli-carrid it_spfli-connid INTO it_attachment SEPARATED BY
                 cl_abap_char_utilities=>horizontal_tab.
        CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO
        it_attachment.
        APPEND it_attachment.
      ENDLOOP.
    ENDFORM.                    " populate_attachment
    *&      Form  populate_receivers
          text
    -->  p1        text
    <--  p2        text
    FORM populate_receivers .
    **Populating Mail Recepients
    **If there are more than one mail recepient then loop and append them to it_receivers
      it_receivers-receiver = '[email protected]'.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      it_receivers-express = 'X'.
      APPEND it_receivers.
    ENDFORM.                    " populate_receivers
    *&      Form  populate_pack
          text
    -->  p1        text
    <--  p2        text
    FORM populate_pack .
    **File Type
      ld_format = 'XLS'.
    **File Name
      ld_attfilename = 'File1'.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      gd_doc_data-obj_name = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject .
      gd_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR gd_doc_data.
    Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      READ TABLE it_attachment INDEX w_cnt.
      gd_doc_data-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_attachment ).
      gd_doc_data-obj_name  = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    Describe the body of the message
      CLEAR it_packing_list.
      REFRESH it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      APPEND it_packing_list.
    **Describe the attachment info
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 1.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_attachment LINES  it_packing_list-body_num.
      it_packing_list-doc_type = ld_format.
      it_packing_list-obj_name = ld_attfilename.
      it_packing_list-obj_descr = ld_attfilename.
      it_packing_list-doc_size = it_packing_list-body_num * 255.
      APPEND it_packing_list.
    ENDFORM.                    " populate_pack
    *&      Form  send_mail
          text
    -->  p1        text
    <--  p2        text
    FORM send_mail .
    **Function Module to send mail
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = gd_doc_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = it_packing_list
          contents_bin               = it_attachment
          contents_txt               = it_message
          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.
    ENDFORM.                    " send_mail

  • Sending Textmodule in email body text

    Hallo,
    can some body tell me how can I send a textmodule in email body with all of its fomats in a print program. I am successed to send email in print program. I read the text module in internal table but not able to import the formats of text module.
    can somebody help me
    regards
    waseem

    As a start, you can convert the ITF formatted text to HTML formatted text (using one of the available function modules) then send your e-mail body as type 'HTM'.  Otherwise, start from scratch and generate the HTML content yourself using CSS.

  • Smartform as Email Body

    Hi,
      I have a requirement to send the smartform as mail body. I was able to send the smartform as PDF attachment but we need it mail body. I tried converting to html but the data, tables and images are displaying in the distored way. Will it be possible to convert the smartform data to image and send as mail body? Please respond.
    Thanks!

    Hi,
         Try by below way
    1) Generate a spool of that smartform.
    2) Get the spool number from TSP01 table.
    3) Get the html content of the spool, it can be done by below way
        a) Use FM 'RSPO_DISPLAY_SPOOLJOB' providing the spool number,
        b) Use FM 'LIST_FROM_MEMORY' to get content from memory.
        c) Pass the content got by above FM to 'WWW_HTML_FROM_LISTOBJECT' to get the HTML content.
    4) Now process using the CL_DOCUMENT_BCS, using the I_TYPE = html and I_TEXT = HTML content from above. 
    Thanks & Regards
    Bala Krishna.

  • How to send smartform as email (smartform content in the email body)

    Hi,
    When I call my smartform, I want to send the smartform content as email. I am seeing one structure : MAIL_RECIPIENT.
    I have the mail id in my hand : xyz. However, based on this email id, how to populate the structure MAIL_RECIPIENT since it has Object ID, Object type and descrption. But No field for Email ID.
    Can any one help me out, in this.
    Thanks,
    Sandeep

    Hi,
    No not the PDF. The content it self should go as email.
    For that only we need to populate MAIL_RECIPIENT structure.
    But my doubt is how to populate this structure. It has no field for email ID.
    Thanks,
    Sandeep

  • Actions - Smartform in Email body

    Hey all,
    I have a peculiar client requirement. On triggering an action from the CRM system from transactions, i need to send an email containing a samrtform.
    I understand that the standard SAP pracitice is to send the smartform as an attachment to the email. But what my client wants is that the content of the smartform should come in the body of the email.
    Would this be possible? If yes, how? If its not possible, is there an work around solution for this?
    Please Help.
    Thanks.
    Julius

    I have not found a simple solution to this problem, other than below.
    Using fm SO_DOCUMENT_SEND_API1 . There are a ton of examples in the abap forums on using this fm. The fm documentation also has some ssample code.
    My approach has been to create my email message body as an html string.
    i.e.
    data: str type string,
             name_org1 type but000-name_org1.
    concatenate '<html><head></head><body><h3>Customer Name: '  name_org1 '
                       '</h3></body></html>
           into str.
    Then pass the html string into the fm as the message body. Not pretty but functional.

  • Send smartforms via email

    Hi,
    can anyone tell me how to send an smartform to an external email.
    Here my DISPLAY report:
    TABLES: MARA.
    DATA: SSFCTRLOP LIKE SSFCTRLOP.
    DATA: SWOTOBJID like SWOTOBJID.
    DATA: IMARA TYPE TABLE OF MARA.
    INITIALIZATION.
      SSFCTRLOP-NO_DIALOG = 'X'.
      SSFCTRLOP-PREVIEW   = 'X'.
    START-OF-SELECTION.
      SELECT * FROM MARA INTO TABLE IMARA UP TO 10 ROWS.
      CALL FUNCTION '/1BCDWB/SF00000003'
        EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
          CONTROL_PARAMETERS = SSFCTRLOP
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             = SWOTOBJID
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
          ADRNR              = '0000012427'
          STR_POBOX          = 'S'
        TABLES
          TMARA              = IMARA.
    END-OF-SELECTION.
    i will send the smartform for example direct to [email protected]
    Is that possible, and when yes, wich paramater must i fill?
    thanks.
    Regards, Dieter

    Hi Dieter,
    Check the following code. It sends the smartfrom output as Email.
    START-OF-SELECTION.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname = 'Z_SMTF
        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 'ZFUNC_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.
    *-----Function module to download the output file.
      CALL FUNCTION 'DOWNLOAD'
        EXPORTING
          bin_filesize = v_size
          filename     = ' '
          filetype     = 'BIN'
        IMPORTING
          act_filename = v_filename
        TABLES
          data_tab     = it_lines.
    *-----Create Message Body and Title and Description
      it_mess =
    'i have successfully converted smartform from otf format to pdf' .
      " and i have attached that in mail'.
      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 = '[email protected]'.
      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.
      IF sy-subrc = 0.
        SUBMIT rsconn01   WITH mode       = 'INT'
                          WITH output     = 'X'
                          WITH rfcgroup   = 'iwdf7ytc_YD3_94'
                          AND RETURN.
        REFRESH: it_receivers,
                 it_mess,
                 it_pcklist.
      ENDIF.
    Ashvender

  • Sending Smartforms by Email

    Hi,
    I am trying to e-mail a smartform as attachement through mail. I am using the FM
    SO_NEW_DOCUMENT_ATT_SEND_API1. On the execution of the program, the mail goes and sits in the outbox of my sap bussiness workplace and does not go to the external email address specified. Are there any parameters to be set, The mail is not going to external address specified.
    Thanks,
    Navneeth K.

    *& Report  ZEMAIL_GM
    REPORT  zemail_gm.
    *********Variable Declarations *****************************
    DATA: gv_form_name TYPE rs38l_fnam,   " Used to store the function module generated by Smartform
          gv_bin_filesize TYPE i,         " Store the file size
          gv_pos TYPE i,
          gv_len TYPE i,
          gv_tab_lines TYPE i.
    ********Constants *******************************************
    Data : gc_text(11) type c value 'Form Output',
           gc_tst(3) type c value 'TST',
           gc_testing(7) type c value 'Testing'.
    *********Work Area Declarations *****************************
    DATA: gs_docdata TYPE sodocchgi1,     " Data of an object which can be changed
          gs_ctrlop TYPE ssfctrlop,       " Smart Forms: Control structure
          gs_outopt TYPE ssfcompop,       " SAP Smart Forms: Smart Composer (transfer) options
          gs_otfdata TYPE ssfcrescl,      " Smart Forms: Return value at end of form printing
          gs_reclist TYPE somlreci1,      " SAPoffice: Structure of the API Recipient List
          gs_pdf_tab TYPE tline,          " Workarea for SAP Script Text Lines
          gs_objbin TYPE solisti1,        " SAPoffice: Single List with Column Length 255
          gs_objpack TYPE sopcklsti1.     " SAPoffice: Description of Imported Object Components
    *********Internal tables Declarations *****************************
    DATA: gt_reclist TYPE TABLE OF somlreci1,      " SAPoffice: Structure of the API Recipient List
          gt_pdf_tab TYPE TABLE OF tline,          " SAPscript: Text Lines
          gt_otf TYPE TABLE OF itcoo,              " OTF Structure
          gt_objbin TYPE TABLE OF solisti1,        " SAPoffice: Single List with Column Length 255
          gt_objpack TYPE TABLE OF sopcklsti1.     " SAPoffice: Description of Imported Object Components
    CLEAR : gv_form_name,
            gs_ctrlop,
            gs_outopt,
            gs_otfdata,
            gv_bin_filesize,
            gv_pos,
            gv_len,
            gv_tab_lines.
    START-OF-SELECTION.
    Generate Function Module name
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = 'ZPDF_G'
        IMPORTING
          fm_name            = gv_form_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Assigning values to Form Control Structure and Form Composer
      gs_ctrlop-getotf = 'X'.
      gs_ctrlop-no_dialog = 'X'.
      gs_outopt-tdnoprev = 'X'.
    Getting the OTFDATA
      CALL FUNCTION gv_form_name
        EXPORTING
          control_parameters = gs_ctrlop
          output_options     = gs_outopt
          user_settings      = 'X'
        IMPORTING
          job_output_info    = gs_otfdata
        EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4
          OTHERS             = 5.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Assigning the OTFDATA to OTF Structure table
      CLEAR gt_otf.
      gt_otf[] = gs_otfdata-otfdata[].
    Convert the OTF DATA to SAP Script Text lines
      CLEAR gt_pdf_tab.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
          max_linewidth         = 132
        IMPORTING
          bin_filesize          = gv_bin_filesize
        TABLES
          otf                   = gt_otf
          lines                 = gt_pdf_tab
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          OTHERS                = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Assigning the Description of the object sent in the mail
      CLEAR gs_docdata.
      gs_docdata-obj_name = gc_tst.
      gs_docdata-obj_descr = gc_testing.
    Assigning the email id to Structure of the API Recipient List table
      CLEAR : gt_reclist, gs_reclist.
      gs_reclist-receiver = '[email protected]'.
      gs_reclist-rec_type = 'U'.
      APPEND gs_reclist TO gt_reclist.
    Passing the SAP Script text lines to SAPoffice: Single List with Column Length 255 table
      CLEAR : gs_objbin, gs_pdf_tab.
      LOOP AT gt_pdf_tab INTO gs_pdf_tab.
        gv_pos = 255 - gv_len.
        IF gv_pos > 134. "length of pdf_table
          gv_pos = 134.
        ENDIF.
        gs_objbin+gv_len = gs_pdf_tab(gv_pos).
        gv_len = gv_len + gv_pos.
        IF gv_len = 255. "length of out (contents_bin)
          APPEND gs_objbin TO gt_objbin.
          CLEAR: gs_objbin, gv_len.
          IF gv_pos < 134.
            gs_objbin = gs_pdf_tab+gv_pos.
            gv_len = 134 - gv_pos.
          ENDIF.
        ENDIF.
      ENDLOOP.
      IF gv_len > 0.
        APPEND gs_objbin TO gt_objbin.
      ENDIF.
    Filling the details in SAPoffice: Description of Imported Object Components table
      DESCRIBE TABLE gt_objbin LINES gv_tab_lines.
      CLEAR gs_objbin.
      READ TABLE gt_objbin INTO gs_objbin INDEX gv_tab_lines.
      IF sy-subrc = 0.
        gs_objpack-doc_size = ( gv_tab_lines - 1 ) * 255 + STRLEN( gs_objbin ).
        gs_objpack-transf_bin = 'X'.
        gs_objpack-head_start = 1.
        gs_objpack-head_num = 0.
        gs_objpack-body_start = 1.
        gs_objpack-body_num = gv_tab_lines.
        gs_objpack-doc_type = 'PDF'.
        gs_objpack-obj_name = 'ATTACHMENT'.
        gs_objpack-obj_descr = 'test'.
        APPEND gs_objpack TO gt_objpack.
      ENDIF.
    Sending the Form Output in the PDF format to email
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data                    = gs_docdata
         put_in_outbox                    = 'X'
         commit_work                      = 'X'
        TABLES
          packing_list                     = gt_objpack
          contents_bin                     = gt_objbin
          receivers                        = gt_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.
      ELSE.
        WRITE 'Sent Successfully'.
      ENDIF.
      SUBMIT rsconn01
      WITH mode EQ 'INT'
      AND RETURN.
    END-OF-SELECTION.
    Rewards if useful................
    Minal

  • Sending smartform through email or fax

    Hi,
    I have to send the smartform output through email if the email address is present else it has to be sent through fax.
    When I tested the program it is giving information message as 'Output was successfully issued'.But I am not able to see any entry in SOST transaction.What would be the reason for this?

    In SAP Table USR21, put enter the username in field BNAME, from there you will get the ADDRNUMBER

  • Smartforms as email body looses format

    Hi experts,
    I´m using Badi BBP_OUTPUT_CHANGE_SF to change standard Smartforms, and when I use parameter CV_SMARTFORM_MAIL to send my own form, I see the result on tr. SCOT without any of the Smartform font styles, and format; it´s only plain text there!
    Can anybody help me?
    Thanks a lot!
    Federico Alvarez

    Dear Pradeep,
    I really apreciate your help, thank you very much.
    However, none of this Notes where helpful since we already have implemented Support Package 13, which includes all of them (Notes have been available with SP 12 and previous).
    Regarding to the thread provided, I´m doing exactly that: just changing Smartform_mail parameter inside de Badi with my own form, and I get the Smartform data inside the mail body, but without any format or style: it´s like the whole Smartform were converted into plain text.
    Any idea? Am I not supposed to get the Samrtform with font formats and borders, etc, inside de mail body?
    The attached Smartform (which the system automatically converts into PDF) looks good. But the other one, as mail body, really sucks as plain text...
    Kind regards,
    Federico.

Maybe you are looking for

  • Oracle 8.1.7 install fails on RH Enterprise Linux  3

    Hi! I've been desperately trying to install Oracle 8i database to RedHat Enterprise Linux 3 (actually it's Whitebox 3.0 that is exactly the same as RH but the logos and other RH stuff stripped), with no luck. I tried to follow the numerous instructio

  • Minimum Value Sucharge not calculated

    Hi Gurus, I created condition record ZMIW for material 1234 1000 Euro but in the Salesorder Condion Tab SD Minimum Value Sucharge is same with Minumum Order Value Mat 1234 1 pc 200 Euro Minimum Order Value                            1000 Euro Minumum

  • Does cs6 allow you to select ALL frames in a document?

    I am doing a wedding book.  So I have many image frames on each page. I want to add a border (stroke) to all these frames.  But to my surprise, it appears that the Select All command only selects the frames in the current spread.  I did a bit of rese

  • Upgrade Intel Core Duo iMac to Core 2 Duo?

    I know that, in theory a Merom processor is compatible with a motherboard made for a Yonah CPU, which is what's in the original Intel iMacs. However, I know that most Wintel laptops require a BIOS flash in order to support the newer processor. My que

  • Razr Maxx , Who Uses Most Data?

    >Duplicate post deleted and thread locked< Message was edited by: Verizon Moderator