Send an smartform as body of a mail

Hello,
I would like know if there is another way of doing this: "Send an smartform as body of a mail". Now it is sending attached as pdf but the user prefers to view the smartform on the body of the message.
This is a CS formulary and I think that (perhaps) at the options of  "output_options     TYPE ssfcompop," should be another of this.
Thanks

I have included our code to process/send our smartform via email. you should be able to see the solution in there.....
form process_webform
* activate XSF Output Mode
  ls_output_options-xsf        = c_charx.        " XSF Output active
  ls_output_options-xsfcmode   = c_charx.        " Get XSF params from program
  ls_output_options-xsfoutmode = c_application.  " Application
  ls_output_options-xsfformat  = c_charx.       " Formatting ON
  clear ls_output_options-xsfoutdev.
  ls_xsfparam_line-name  = 'GRAPHICS'.
  ls_xsfparam_line-value = 'EXTRACT'.
  append ls_xsfparam_line to ls_output_options-xsfpars.
  ls_xsfparam_line-name  = 'GRAPHICS-DIRECTORY'.            "#EC NOTEXT
  ls_xsfparam_line-value = c_gr_dir.
  append ls_xsfparam_line to ls_output_options-xsfpars.
  ls_xsfparam_line-name  = 'CONTENT-ID'.                    "#EC NOTEXT
  ls_xsfparam_line-value = 'ENABLE'.                        "#EC NOTEXT
  append ls_xsfparam_line to ls_output_options-xsfpars.
* silent mode ON
  ls_output_options-tdimmed = space.
  ls_output_options-tdnewid = space.
  ls_control_parameters-no_dialog = c_charx.
  call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
      formname           = pi_form
    importing
      fm_name            = l_fm_name
    exceptions
      no_form            = 1
      no_function_module = 2
      others             = 3.
  if sy-subrc <> 0.
*   error handling
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    exit.
  endif.
  call function l_fm_name
    exporting
      control_parameters = ls_control_parameters
      output_options     = ls_output_options
      user_settings      = space
    importing
      job_output_info    = ls_output_data
    exceptions
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      others             = 5.
  if sy-subrc <> 0.
*   error handling
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
  po_html       = ls_output_data-xmloutput-trfresult.
  po_t_graphics = ls_output_data-xmloutput-xsfgr.
endform.                    "process_webform
form send_webform
  clear l_html_xstr.
  loop at pi_s_html-content into l_html_raw.
    concatenate l_html_xstr l_html_raw into l_html_xstr in byte mode.
  endloop.
  l_html_xstr = l_html_xstr(gs_html_data-length).
  call function 'SCP_TRANSLATE_CHARS'
    exporting
      inbuff       = l_html_xstr
      incode       = '4110'                                 " utf-8
      csubst       = c_charx
      substc_space = c_charx
    importing
      outbuff      = l_html_str
      outused      = l_html_len
    exceptions
      others       = 1.
  if sy-subrc ne 0.
    "do nothing
  endif.
* change encoding utf-8 to latin1
  replace all occurrences of 'utf-8' in l_html_str with 'latin1' ignoring case.
  replace all occurrences of 'absolute' in l_html_str with 'relative' ignoring case.
  replace all occurrences of 'overflow : auto'
              in l_html_str with 'overflow : hidden' ignoring case.
* The following code will replace the standard text shown in an html link
* such as (www.sap.com) with the text passed along with the link (contained in
* brackets [ ] ).  An example would be: "www.sap.com[Click me]" will then be
* displayed as a link on the email with "... Click me ..." as the text.  HTML links
* without brackets will be displayed normally (ie. www.sap.com)+
  do.
*   Get the length for the entire HTML code for the URL and Name
    find '<a href="' in section offset l_aref_end of l_html_str match offset l_aref_start.
    if sy-subrc ne 0.
      exit.
    endif.
    find '</a>' in section offset l_aref_start of l_html_str match offset l_aref_end.
    l_aref_length = ( l_aref_end + 4 ) - l_aref_start.
*   Find the URL/name
    l_lnk_start = l_aref_start + 9.
    find '">' in section offset l_aref_start of l_html_str match offset l_lnk_end.
    l_lnk_length = l_lnk_end - l_lnk_start.
*   Save the URL/name
    l_link_all = l_html_str+l_lnk_start(l_lnk_length).
*   Find where the name starts and ends
    find '[' in l_link_all match offset l_name_start.
    if sy-subrc ne 0.
      continue.
    endif.
    find ']' in l_link_all match offset l_name_end.
    if sy-subrc ne 0.
      continue.
    endif.
*   Seperate out the URL
    l_link_url = l_link_all+0(l_name_start).
*   Seperate out the name
    l_name_start = l_name_start + 1.
    l_name_length = l_name_end - l_name_start.
    l_link_name = l_link_all+l_name_start(l_name_length).
*   Replace the first URL/Name occurence with just the URL
    replace first occurrence of l_link_all
            in section offset l_aref_start length l_aref_length
            of l_html_str with l_link_url.
*   Replace the second URL/Name occurence with just the Name - first
*   substitute special characters.
    replace all occurrences of '&' in l_link_all with '&'.
    replace all occurrences of '>' in l_link_all with '>'.
    replace all occurrences of '<' in l_link_all with '<'.
    replace first occurrence of l_link_all
            in section offset l_aref_start length l_aref_length
            of l_html_str with l_link_name.
*   Reset ending point
    l_aref_end = l_aref_end - ( l_lnk_length + 2 ).
  enddo.
  l_html_len = strlen( l_html_str ).
  l_offset = 0.
  l_length = 255.
  while l_offset < l_html_len.
    l_diff = l_html_len - l_offset.
    if l_diff > l_length.
      ls_soli-line = l_html_str+l_offset(l_length).
    else.
      ls_soli-line = l_html_str+l_offset(l_diff).
    endif.
    append ls_soli to lt_soli.
    add l_length to l_offset.
  endwhile.
  create object lo_mime_helper.
  call method lo_mime_helper->set_main_html
    exporting
      content = lt_soli.
  loop at pi_t_graphics into gs_graphic.
    clear l_gr_xstr.
    loop at gs_graphic-content into l_gr_raw.
      concatenate l_gr_xstr l_gr_raw-line into l_gr_xstr in byte mode.
    endloop.
    l_gr_xstr = l_gr_xstr(gs_graphic-length).
    l_offset = 0.
    l_length = 255.
    clear lt_solix[].
    while l_offset < gs_graphic-length.
      l_diff = gs_graphic-length - l_offset.
      if l_diff > l_length.
        ls_solix-line = l_gr_xstr+l_offset(l_length).
      else.
        ls_solix-line = l_gr_xstr+l_offset(l_diff).
      endif.
      append ls_solix to lt_solix.
      add l_length to l_offset.
    endwhile.
    concatenate c_gr_dir gs_graphic-graphics '.bmp' into l_filename.
    concatenate c_gr_dir gs_graphic-graphics '.bmp' into l_content_id.
    l_content_type = gs_graphic-httptype.
    l_obj_len      = gs_graphic-length.
    call method lo_mime_helper->add_binary_part
      exporting
        content      = lt_solix
        filename     = l_filename
        extension    = 'BMP'
        content_type = l_content_type
        length       = l_obj_len
        content_id   = l_content_id.
  endloop.
  try.
      l_standard_txt = pi_smartform.
      call function 'READ_TEXT'
        exporting
          id       = 'ST'
          language = sy-langu
          name     = l_standard_txt
          object   = 'TEXT'
        tables
          lines    = lt_lines.
      read table lt_lines into ls_lines index 1.
      replace '&1' in ls_lines-tdline with pi_belnr.
      replace '&2' in ls_lines-tdline with pi_bukrs.
        move ls_lines-tdline to l_subject.
     lo_doc_bcs = cl_document_bcs=>create_from_multirelated(
                                    i_subject          = l_subject
                                    i_multirel_service = lo_mime_helper ).
* Add Attachment
*      types: begin of email_docs,
*                   type    type so_obj_tp,
*                   subject type so_obj_des,
*                   content_text type soli_tab,
*                   content_hex  type solix_tab,
*             end of email_docs.
*      types: email_docs_t type standard table of email_docs.
*      data: documents type        email_docs_t,
*      documents_line like line of documents.
*      data: soli_tab type soli_tab,
*            soli type soli.
*      soli = 'This is line one'.
*      append soli to soli_tab.
*      soli = 'And this is line two'.
*      append soli to soli_tab.
*      documents_line-type = 'RAW'.
*      documents_line-subject = 'Subject'.
*      documents_line-content_text = soli_tab.
*      append documents_line to documents.
*      call method lo_doc_bcs->add_attachment
*        EXPORTING
*          i_attachment_type    = documents_line-type
*          i_attachment_subject = documents_line-subject
*          i_att_content_text   = documents_line-content_text.
    catch cx_document_bcs.
*   error handling
      exit.
    catch cx_bcom_mime.
*   error handling
      exit.
    catch cx_gbt_mime.
*   error handling
      exit.
  endtry.
* create send_request
  try.
      lo_bcs = cl_bcs=>create_persistent( ).
    catch cx_send_req_bcs.
*   error handling
      exit.
  endtry.
  try.
      lo_bcs->set_document( i_document = lo_doc_bcs ).
    catch cx_send_req_bcs.
*   error handling
      exit.
  endtry.
* create recipient
  if pi_recipient ns '@'.
    l_username = pi_recipient.
    translate l_username to upper case.                     "#EC *
    try.
        lo_recipient = cl_sapuser_bcs=>create( l_username ).
      catch cx_address_bcs.
*     error handling
        exit.
    endtry.
  else.
    l_mail_address = pi_recipient.
    try.
        lo_recipient = cl_cam_address_bcs=>create_internet_address( i_address_string = l_mail_address ).
      catch cx_address_bcs.
*     error handling
        exit.
    endtry.
  endif.
  try.
      lo_bcs->add_recipient( i_recipient = lo_recipient ).
    catch cx_send_req_bcs.
*   error handling
      exit.
  endtry.
* send
  try.
*     RECEIPTS ONLY FOR ERRORS
      call method lo_bcs->send_request->set_requested_status
        exporting
          i_requested_status = 'N'.                         "#EC NOTEXT
      lo_bcs->send( ).
      commit work.
    catch cx_send_req_bcs.
*   error handling
      exit.
  endtry.
endform.                    "send_webform

Similar Messages

  • Problem in sending the Smartform Output as PDF through Mail

    Dear All,
    I am sending the Smartform Output as an attachment by converting it into PDF. But when I am recieve this attachment I am unable to open the PDF file, it is giving error that FILE IS DAMAGED. Below is the code:
    REPORT  Y_SEND_MAIL2.
    TABLES: vbrk, vbrp.
    TYPE-POOLS: abap.
    DATA: it_vbrk TYPE TABLE OF vbrk WITH HEADER LINE.
    DATA: i_formname      TYPE       tdsfname,
          i_fm_name       TYPE       rs38l_fnam,
          it_vbak TYPE TABLE OF vbak WITH HEADER LINE,
          it_ekko TYPE TABLE OF ekko WITH HEADER LINE.
    DATA:  is_bil_invoice TYPE lbbil_invoice,
           output_options      TYPE ssfcompop,
           control_parameters  TYPE ssfctrlop,
           e_devtype           TYPE rspoptype,
           job_output_info     TYPE ssfcrescl,
           bin_file            TYPE xstring,
           lines               TYPE TABLE OF tline WITH HEADER LINE,
           doctab_archive      TYPE TABLE OF docs WITH HEADER LINE,
           filelength          TYPE i,
           bin_filesize        TYPE i,
           docs          TYPE TABLE OF docs WITH HEADER LINE.
    *"Types
    TYPES: t_document_data TYPE sodocchgi1,
           t_packing_list TYPE sopcklsti1,
           t_attachment TYPE solisti1,
           t_body_msg TYPE solisti1,
           t_receivers TYPE somlreci1,
           t_pdf TYPE tline.
    *"Workareas
    DATA :w_document_data TYPE t_document_data,
          w_packing_list TYPE t_packing_list,
          w_attachment TYPE t_attachment,
          w_body_msg TYPE t_body_msg,
          w_receivers TYPE t_receivers,
          w_pdf TYPE t_pdf.
    *internal tables
    DATA : i_document_data TYPE STANDARD TABLE OF t_document_data,
           i_packing_list TYPE STANDARD TABLE OF t_packing_list,
           i_attachment TYPE STANDARD TABLE OF t_attachment,
           i_body_msg TYPE STANDARD TABLE OF t_body_msg,
           i_receivers TYPE STANDARD TABLE OF t_receivers,
           i_pdf TYPE STANDARD TABLE OF t_pdf.
    DATA: BEGIN OF line_bin,
             data(1024) TYPE x,
          END OF line_bin.
    DATA: data_tab_bin LIKE STANDARD TABLE OF line_bin.
    So please suggest a solution.
    Regards,
    Vishal

    Continued:
    SELECT-OPTIONS: s_vbeln FOR vbrk-vbeln,
                    s_fkdat FOR vbrk-fkdat OBLIGATORY DEFAULT sy-datum.
    SELECT * FROM vbrk
    INTO TABLE it_vbrk
    WHERE fkdat IN s_fkdat
          AND vbeln IN s_vbeln.
    i_formname = 'Z_SD_JINDAL_INVOICE10'.
    output_options-tddest        = 'LP02'.
    output_options-tdimmed       = 'X'.
    output_options-tdnewid       = 'X'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname           = i_formname
      IMPORTING
        fm_name            = i_fm_name
      EXCEPTIONS
        no_form            = 1
        no_function_module = 2
        OTHERS             = 3.
    IF sy-subrc <> 0.          "checking subrc
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.                     "IF sy-subrc <> 0
    READ TABLE it_vbrk INDEX 1.
    IF sy-subrc = 0.
      is_bil_invoice-hd_gen-bil_number = it_vbrk-vbeln.
    ENDIF.
    control_parameters-no_dialog = 'X'.
    control_parameters-getotf = 'X'.
    CALL FUNCTION i_fm_name        "'/1BCDWB/SF00000097'
      EXPORTING
       control_parameters         = control_parameters
       output_options             = output_options
       user_settings              = space
       is_bil_invoice             = is_bil_invoice
    IMPORTING
       job_output_info            = job_output_info
    TABLES
       it_vbak                    = it_vbak
    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.
    *FORM convert_otf_2_pdf.
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
    *      EXPORTING
    *        USE_OTF_MC_CMD               = 'X'
    *        ARCHIVE_INDEX                =
        IMPORTING
          bin_filesize                 = bin_filesize
        TABLES
          otf                          = job_output_info-otfdata[]
          doctab_archive               = docs[]
          lines                        = lines[]
        EXCEPTIONS
          err_conv_not_possible        = 1
          err_otf_mc_noendmarker       = 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.
    *ENDFORM.                    "convert_otf_2_pdf

  • Separate program to send a smartform converted into pdf, thru mail

    Hi Folks,
    I had created a smartform and converted it into a PDF format.
    Now I want a separate program where in if i submit this program it should sent it throuogh mail.
    Note:-<b>I want a separate program not the one where in you design a smartform,convert into pdf and then send thru mail all in one program</b>
    Points will be given.
    K.Kiran.

    hi kiran
    the program is as follows
    The user is provided with
    a) file name
    b) email address to send mail
    and it sends ANY FILE (.xls,.pdf .xyz..)
    Instantaneously !
    4. Make two things first :
    1. Include with the name : ZAMI_INCLFOR_MAIL
    2. Report with the name : ZAM_TEMP147 (any name will do)
    3. Activate both and execute (2)
    4. After providing filename, email adress
    5. Code for Include :
    Data
    DATA: docdata LIKE sodocchgi1,
    objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
    objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
    objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objhex LIKE solix OCCURS 10 WITH HEADER LINE,
    reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    DATA: tab_lines TYPE i,
    doc_size TYPE i,
    att_type LIKE soodk-objtp.
    DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
    FORM
    FORM ml_customize USING objname objdesc.
    Clear Variables
    CLEAR docdata.
    REFRESH objpack.
    CLEAR objpack.
    REFRESH objhead.
    REFRESH objtxt.
    CLEAR objtxt.
    REFRESH objbin.
    CLEAR objbin.
    REFRESH objhex.
    CLEAR objhex.
    REFRESH reclist.
    CLEAR reclist.
    REFRESH listobject.
    CLEAR listobject.
    CLEAR tab_lines.
    CLEAR doc_size.
    CLEAR att_type.
    Set Variables
    docdata-obj_name = objname.
    docdata-obj_descr = objdesc.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addrecp USING preceiver prec_type.
    CLEAR reclist.
    reclist-receiver = preceiver.
    reclist-rec_type = prec_type.
    APPEND reclist.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addtxt USING ptxt.
    CLEAR objtxt.
    objtxt = ptxt.
    APPEND objtxt.
    ENDFORM. "ml_customize
    FORM
    FORM ml_prepare USING bypassmemory whatatt_type whatname.
    IF bypassmemory = ''.
    Fetch List From Memory
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = listobject
    EXCEPTIONS
    OTHERS = 1.
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'LIST_FROM_MEMORY'.
    ENDIF.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    COMPRESSED_SIZE =
    TABLES
    in = listobject
    out = objbin
    EXCEPTIONS
    OTHERS = 1
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'TABLE_COMPRESS'.
    ENDIF.
    ENDIF.
    Header Data
    Already Done Thru FM
    Main Text
    Already Done Thru FM
    Packing Info For Text Data
    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 = 'TXT'.
    APPEND objpack.
    Packing Info Attachment
    att_type = whatatt_type..
    DESCRIBE TABLE objbin LINES tab_lines.
    READ TABLE objbin 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 = whatname.
    APPEND objpack.
    Receiver List
    Already done thru fm
    ENDFORM. "ml_prepare
    FORM
    FORM ml_dosend.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = docdata
    put_in_outbox = 'X'
    commit_work = 'X' "used from rel. 6.10
    IMPORTING
    SENT_TO_ALL =
    NEW_OBJECT_ID =
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    CONTENTS_HEX = objhex
    OBJECT_PARA =
    object_parb =
    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
    IF sy-subrc <> 0.
    MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
    WITH docdata-obj_name.
    ENDIF.
    ENDFORM. "ml_customize
    FORM
    FORM ml_spooltopdf USING whatspoolid.
    DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
    Call Function
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    src_spoolid = whatspoolid
    TABLES
    pdf = pdf
    EXCEPTIONS
    err_no_otf_spooljob = 1
    OTHERS = 12.
    Convert
    PERFORM doconv TABLES pdf objbin.
    ENDFORM. "ml_spooltopdf
    FORM
    FORM doconv TABLES
    mypdf STRUCTURE tline
    outbin STRUCTURE solisti1.
    Data
    DATA : pos TYPE i.
    DATA : len TYPE i.
    Loop And Put Data
    LOOP AT mypdf.
    pos = 255 - len.
    IF pos > 134. "length of pdf_table
    pos = 134.
    ENDIF.
    outbin+len = mypdf(pos).
    len = len + pos.
    IF len = 255. "length of out (contents_bin)
    APPEND outbin.
    CLEAR: outbin, len.
    IF pos < 134.
    outbin = mypdf+pos.
    len = 134 - pos.
    ENDIF.
    ENDIF.
    ENDLOOP.
    IF len > 0.
    APPEND outbin.
    ENDIF.
    ENDFORM. "doconv
    CODE FOR PROGRAM
    5.
    REPORT zam_temp147 .
    INCLUDE zami_inclfor_mail.
    DATA
    DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA : file_name TYPE string.
    data : path like PCFILE-PATH.
    data : extension(5) type c.
    data : name(100) type c.
    SELECTION SCREEN
    PARAMETERS : receiver TYPE somlreci1-receiver lower case.
    PARAMETERS : p_file LIKE rlgrap-filename
    OBLIGATORY.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CLEAR p_file.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    file_name = p_file.
    START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM ml_customize USING 'Tst' 'Testing'.
    PERFORM ml_addrecp USING receiver 'U'.
    PERFORM upl.
    PERFORM doconv TABLES itab objbin.
    PERFORM ml_prepare USING 'X' extension name.
    PERFORM ml_dosend.
    SUBMIT rsconn01
    WITH mode EQ 'INT'
    AND RETURN.
    FORM
    FORM upl.
    file_name = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file_name
    filetype = 'BIN'
    TABLES
    data_tab = itab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    path = file_name.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    CHECK_DOS_FORMAT =
    IMPORTING
    DRIVE =
    EXTENSION = extension
    NAME = name
    NAME_WITH_EXT =
    PATH =
    EXCEPTIONS
    INVALID_DRIVE = 1
    INVALID_EXTENSION = 2
    INVALID_NAME = 3
    INVALID_PATH = 4
    OTHERS = 5
    ENDFORM. "upl
    regards,
    navjot
    reward if helpfull

  • Pdf as in the body of e-mail.

    Hello experts,
    we are sending a pdf as an attachment of an e-mail.what im trying to do is to send pdf in the body of e-mail.
    i have search and couldnt find any help in the documents or discussions.
    here is my code:
    FORM SEND_MAIL
    DATA: lv_formname TYPE  tdsfname,
             lv_fm_name  TYPE  rs38l_fnam,
             ls_control_parameters TYPE ssfctrlop,
             ls_output_options     TYPE ssfcompop,
             lv_user_settings      TYPE tdbool VALUE 'X',
             ls_job_output_info    TYPE ssfcrescl,
             ls_job_output_options TYPE ssfcresop.
       DATA: lt_otfdata TYPE TABLE OF itcoo,
             lt_pdfdata TYPE TABLE OF tline WITH HEADER LINE.
       DATA: ls_data TYPE zfi_s_satici_mutabakat.
       DATA: ls_document_data       LIKE  sodocchgi1,
             lv_put_in_outbox       LIKE  sonv-flag,
             lv_sender_address      LIKE  soextreci1-receiver,
             lv_sender_address_type LIKE  soextreci1-adr_typ,
             lv_commit_work         LIKE  sonv-flag VALUE space,
             lt_packing_list  TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
             lt_object_header TYPE TABLE OF solisti1   WITH HEADER LINE,
             lt_contents_bin  TYPE TABLE OF solisti1   WITH HEADER LINE,
             lt_contents_txt  TYPE TABLE OF solisti1   WITH HEADER LINE,
             lt_contents_hex  TYPE TABLE OF solix      WITH HEADER LINE,
             lt_object_para   TYPE TABLE OF soparai1   WITH HEADER LINE,
             lt_object_parb   TYPE TABLE OF soparbi1   WITH HEADER LINE,
             lt_receivers     TYPE TABLE OF somlreci1  WITH HEADER LINE.
       DATA: lv_len TYPE i,
             lv_pos TYPE i,
             lv_tab_lines TYPE i.
       DATA: lt_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
       CLEAR: lv_formname, lv_fm_name.
       lv_formname = 'ZLIMIT_REQUEST_FORM2'.
       PERFORM smartform_fm_name USING lv_formname
                                 CHANGING lv_fm_name .
    *get PDF Data
       ls_control_parameters-getotf    = 'X'.
       ls_control_parameters-no_dialog = 'X'.
       ls_output_options-tdnoprev      = 'X'.
       LOOP AT itab WHERE sel eq 'X'.
         concatenate sy-datum+6(2)'.'sy-datum+4(2)
             '.'sy-datum(4) into datum.
         CALL FUNCTION lv_fm_name
           EXPORTING
             control_parameters = ls_control_parameters
             output_options     = ls_output_options
             user_settings      = 'X'
             datum              = datum
             EPAYMENT_T1        = EPAYMENT_T1
             EPAYMENT_T2        = EPAYMENT_T2
             EPAYMENT_D1        = EPAYMENT_D1
             EPAYMENT_D2        = EPAYMENT_D2
             NAME1              = name1
    "        itab               = itab[]
           IMPORTING
             job_output_info    = ls_job_output_info
           TABLES
             ITAB               = itab
         FREE: lt_otfdata, lt_pdfdata.
         lt_otfdata[] = ls_job_output_info-otfdata[].
         PERFORM convert_otf TABLES lt_otfdata lt_pdfdata.
         FREE: lt_receivers, lt_packing_list,
               lt_contents_bin, lt_contents_txt.
    * Assigning the Description of the object sent in the mail
         CLEAR ls_document_data.
         ls_document_data-obj_name = 'Limit Talep Formu'.
         ls_document_data-obj_descr = 'Limit Talep Formu'.
         ls_document_data-expiry_dat  = sy-datum + 10.
         ls_document_data-sensitivty = 'F'.
         LOOP AT gt_mail.
           CLEAR : lt_receivers.
           lt_receivers-receiver = gt_mail-ZZSAHAMUDUREMAIL. " """reciever list
           lt_receivers-rec_type = 'U'.
           lt_receivers-com_type = 'INT'.
           APPEND lt_receivers.
           lt_receivers-COPY = mail_bm.
           lt_receivers-rec_type = 'U'.
           lt_receivers-com_type = 'INT'.
           APPEND lt_receivers.
         ENDLOOP.
         CLEAR: lt_contents_txt.
         lt_contents_txt-line = 'Sayın yetkili,'.
         APPEND lt_contents_txt.CLEAR lt_contents_txt.
         APPEND lt_contents_txt.
         CONCATENATE 'Ekte tarafınıza ait limit formu'
         ' bulunmaktadır.' INTO lt_contents_txt-line
         SEPARATED BY space.
         APPEND lt_contents_txt.CLEAR lt_contents_txt.
         APPEND lt_contents_txt.
         lt_contents_txt-line = 'Saygılarımızla,'.
         APPEND lt_contents_txt.CLEAR lt_contents_txt.
         CLEAR lt_packing_list.
         lt_packing_list-transf_bin  = space.
         lt_packing_list-head_start  = 1.
         lt_packing_list-head_num    = 0.
         lt_packing_list-body_start  = 1.
         lt_packing_list-body_num    = LINES( lt_contents_txt ).
         lt_packing_list-doc_type    = 'RAW'.
         APPEND lt_packing_list. CLEAR lt_packing_list.
         ls_document_data-doc_size = LINES( lt_contents_txt ) * 255.
         CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
           EXPORTING
             line_width_src              = 134
             line_width_dst              = 255
           TABLES
             content_in                  = lt_pdfdata
             content_out                 = lt_contents_bin
           EXCEPTIONS
             err_line_width_src_too_long = 1
             err_line_width_dst_too_long = 2
             err_conv_failed             = 3
             OTHERS                      = 4.
    *Filling the details in SAPoffice: Description of Imported Object
    *Components table
         DESCRIBE TABLE lt_contents_bin LINES lv_tab_lines.
         CLEAR lt_contents_bin.
         READ TABLE lt_contents_bin INDEX lv_tab_lines.
         IF sy-subrc = 0.
           CLEAR: lt_packing_list.
           lt_packing_list-transf_bin = 'X'.
           lt_packing_list-head_start = 1.
           lt_packing_list-head_num = 1.
           lt_packing_list-body_start = 1.
           lt_packing_list-body_num = lv_tab_lines.
           lt_packing_list-obj_langu = sy-langu.
           lt_packing_list-doc_type = 'PDF'.
           lt_packing_list-obj_name = 'ATTACHMENT'.
           lt_packing_list-obj_descr = 'RISK TALEP FORMU.PDF'.
           lt_packing_list-doc_size = lv_tab_lines * 255.
           APPEND lt_packing_list.CLEAR lt_packing_list.
         ENDIF.
         lv_put_in_outbox = lv_commit_work = 'X'.
         CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
             document_data              = ls_document_data
             put_in_outbox              = lv_put_in_outbox
             sender_address             = lv_sender_address
             sender_address_type        = lv_sender_address_type
             commit_work                = lv_commit_work
           TABLES
             packing_list               = lt_packing_list
             object_header              = lt_object_header
             contents_bin               = lt_contents_bin
             contents_txt               = lt_contents_txt
             contents_hex               = lt_contents_hex
             object_para                = lt_object_para
             object_parb                = lt_object_parb
             receivers                  = lt_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 eq 0.
    *      gt_data-gonderx = 'X'.
    *      modify gt_data.
    *      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
         ENDIF.
       ENDLOOP.
    ENDFORM.                    " SEND_MAIL

    Hi Matthew Billingham,
    i struggled quite a while if i should write a reply or not.
    The fact that one of my posts got rejected by suggesting FM SO_DOCUMENT_SEND_API1 finally made me do so. (maybe the rejection was ok for the context i wrote my post for but reading through the forum i feel like some people going to panic if they read the FM-name).
    I totally agree with u using CL_BC-Classes instead of old fashioned-FMs for new development.
    But that should not lead us in handling the name SO_DOCUMENT_SEND_API1 like they did with the name Lord Voldemort in Harry Potter.
    Wanting to display a PDF in email body instead of adding it as attchment, aint nescessary worth a complete redesign of the existing programm - as Cem Unal already posted his code and told us he just want to change it.
    As long as there are programms out that use this FM, there will be questions on how to handle this FM no matter if its obsolete or not. And where should they ask, when they wont be able to ask in the scn-forum?
    Reading the FMs documentation, there is nothing mentioning this FM is obsolete.
    So the strategie of suggesting to use newer technics because of personal preference should (in my opinion) not lead into deleting posts regarding the old technic on the other hand.
    regards
    Stefan Seeburger

  • Sending Smartform output as a body of the mail not as the attachement

    Hi All,
      my requirement is like this...
      I need to send a smartform output as the body of a mail. and not as the attachment.
      Hope you got my question
    Regards
      Raghu

    Hi,
           I hope the following links might help you,
    Smartform output as Email.
    Smartform to PDF and e_mail? Urgent
    Regards,
    Hema.
    Reward points if it is useful.

  • 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.

    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

  • Hw to write txt in mail body using UTL mail when sending mail with attachme

    hi all
    i m using oracle demo mail package to send csv file as attachment to different users its successfull and i can also able to attach text file to it
    but i m unable to write any text in mail body .
    e.g.
    mail body can be--
    hi
    This is test mail.
    Regds
    Sender.
    can anyone suggest some way?

    u can try this code
    this code takes the file from database and attach with mail and also send the body with it
    it works fine.
    CREATE OR REPLACE
    procedure pdf_mail(
    p_sender varchar2, -- sender, example: 'Me '
    p_recipients varchar2, -- recipients, example: 'Someone '
    p_subject varchar2, -- subject
    p_text long, -- text
    p_case_id number,
    p_email_log_id number
    -- p_filename varchar2, -- name of pdf file
    p_blob   blob     pdf file
    ) is
    conn utl_smtp.connection;
    i number;
    len number;
    p_message_part varchar2(32767);
    cursor c1 is
    select file_name,document_pic
    from clm_case_attachments ca,email_log_detail em
    where
    case_id = p_case_id
    and ca.CASE_ATTACHMENT_ID = em.ATTACHMENT_ID
    and em.ACTIVE = 'Y'
    and em.EMAIL_LOG_ID = p_email_log_id;
    BEGIN
    conn := demo_mail.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => demo_mail.MULTIPART_MIME_TYPE);
    demo_mail.attach_text(
    conn => conn,
    data => p_text,
    mime_type => 'text/html');
    for lp in c1 loop
    demo_mail.begin_attachment(
    conn => conn,
    mime_type => 'application/pdf',
    inline => TRUE,
    filename => lp.file_name,
    transfer_enc => 'base64');
    -- split the Base64 encoded attachment into multiple lines
    i := 1;
    len := DBMS_LOB.getLength(lp.document_pic);
    WHILE (i < len) LOOP
    IF(i + demo_mail.MAX_BASE64_LINE_WIDTH < len)THEN
    UTL_SMTP.Write_Raw_Data (conn
    , UTL_ENCODE.Base64_Encode(
    DBMS_LOB.Substr(lp.document_pic, demo_mail.MAX_BASE64_LINE_WIDTH, i)));
    ELSE
    UTL_SMTP.Write_Raw_Data (conn
    , UTL_ENCODE.Base64_Encode(
    DBMS_LOB.Substr(lp.document_pic, (len - i)+1, i)));
    END IF;
    UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
    i := i + demo_mail.MAX_BASE64_LINE_WIDTH;
    END LOOP;
    demo_mail.end_attachment(conn => conn);
    end loop;
    demo_mail.end_mail( conn => conn );
    END;
    /

  • How to send a smartform result through mail?

    How to send a smartform result through mail?

    HI,
    YOu can convert the output of Smartform into a attachment say PDF file & then send it across through mail.
    Refer following program:
    <a href="http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm">http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm</a>
    Best regards,
    Prashant

  • How do I send a page via email in the body of the mail and not as an attachment?

    I wish to send a page via email in the body of the mail. The only option to send a page appears to be to save it first and then attatch to the mail.

    When you are in the Plan View, right click on the icon for the page that you want to omit from the menu. Near the bottom, you'll see Menu Options, click on that and you'll have the choice to Exclude Page from Menus.

  • Problem in sending the smartform as an email in a country specific language

    Hi,
    I am facing a problem in sending a smartform as a email for all other Languages except english and another problem is its sending the email but the output status is still in RED in the messages tab.
    the program is working fine for english.
    Please do find the below code using which i would be sending the smartform as an email for a PO along with the line item attachments.
    Please help.
    Arun.
    Determine smartform function module for purchase document
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = lf_formname
        IMPORTING
          fm_name            = lf_fm_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
    error handling
        ent_retco = sy-subrc.
        IF sy-subrc = 1.
          MESSAGE e001(/smb40/ssfcomposer).
        ENDIF.
        IF sy-subrc = 2.
          MESSAGE e002(/smb40/ssfcomposer) WITH tnapr-sform.
        ENDIF.
        PERFORM protocol_update_i.
      ENDIF.
    *Start of changes <Arun K Singarapu> C082493 <04/28/2008>
    *for print preview
      IF sy-ucomm = 'PREVOUTPUT' OR sy-ucomm = 'VIEW'.
        CALL FUNCTION lf_fm_name                  "'/1BCDWB/SF00000197'
          EXPORTING
            control_parameters = wa_ctrlop
            output_options     = wa_compop
            user_settings      = 'X'
            is_ekko            = l_doc-xekko
            is_pekko           = l_doc-xpekko
            is_nast            = l_nast
            iv_from_mem        = l_from_memory
            iv_druvo           = iv_druvo
            iv_xfz             = iv_xfz
          IMPORTING
            job_output_info    = wa_return
          TABLES
            it_ekpo            = l_doc-xekpo[]
            it_ekpa            = l_doc-xekpa[]
            it_pekpo           = l_doc-xpekpo[]
            it_eket            = l_doc-xeket[]
            it_tkomv           = l_doc-xtkomv[]
            it_ekkn            = l_doc-xekkn[]
            it_ekek            = l_doc-xekek[]
            it_komk            = l_xkomk[]
          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.
        EXIT.
      ELSE.
        wa_ctrlop-LANGU = nast-spras.
        wa_ctrlop-getotf = 'X'.
        wa_ctrlop-no_dialog = 'X'.
        wa_compop-tdnoprev = 'X'.
        CALL FUNCTION lf_fm_name                  "'/1BCDWB/SF00000197'
          EXPORTING
            control_parameters = wa_ctrlop
            output_options     = wa_compop
            user_settings      = 'X'
            is_ekko            = l_doc-xekko
            is_pekko           = l_doc-xpekko
            is_nast            = l_nast
            iv_from_mem        = l_from_memory
            iv_druvo           = iv_druvo
            iv_xfz             = iv_xfz
          IMPORTING
            job_output_info    = wa_return
          TABLES
            it_ekpo            = l_doc-xekpo[]
            it_ekpa            = l_doc-xekpa[]
            it_pekpo           = l_doc-xpekpo[]
            it_eket            = l_doc-xeket[]
            it_tkomv           = l_doc-xtkomv[]
            it_ekkn            = l_doc-xekkn[]
            it_ekek            = l_doc-xekek[]
            it_komk            = l_xkomk[]
          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.
    *Convert the data from OTF to PDF format
        it_otf[] = wa_return-otfdata[].
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
            max_linewidth         = 132
          IMPORTING
            bin_filesize          = l_len_in
            bin_file              = lp_xcontent
          TABLES
            otf                   = it_otf
            lines                 = it_tline
          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.
        TRY.
      ---------- create persistent send request ----------------------
            send_request = cl_bcs=>create_persistent( ).
            len = XSTRLEN( lp_xcontent ).
    transform to solix tab
            lt_solix =
              cl_document_bcs=>xstring_to_solix(
                ip_xstring = lp_xcontent ).
    Create Body to the E-mail.
            APPEND Text-005 TO l_text.
    Attachment Name
            l_ponumber = text-004.
            CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
    Subject for the E-Mail.
            l_subject = text-001.
            CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
    *create document E-Mail.
            CALL METHOD cl_document_bcs=>create_document
              EXPORTING
                i_type    = 'RAW'
                i_subject = l_subject
                i_length  = '13'
                i_text    = l_text
              RECEIVING
                result    = l_email_object.
    *Create PDF Document
            bcs_doc =  cl_document_bcs=>create_document(
                                            i_type     = 'PDF'
                                            i_subject  = l_ponumber
                                            i_length   = len
                                            i_language = nast-spras
                                            i_hex     = lt_solix
    *Type casting
            obj_pdf_file ?= bcs_doc.
    Add PDF document as an attachment
            CALL METHOD l_email_object->add_document_as_attachment
              EXPORTING
                im_document = obj_pdf_file.
    get the attachments of the PO for each line item
            SELECT ebeln
                   ebelp
                   FROM ekpo
                   INTO TABLE it_ekpo
                   WHERE ebeln = l_doc-xekko-ebeln.
    concatenate PO and the Line Item Numebr to get the Object key
            LOOP AT it_ekpo INTO wa_ekpo.
              CONCATENATE wa_ekpo-ebeln wa_ekpo-ebelp INTO wa_temp-objky.
              APPEND wa_temp TO it_temp.
              CLEAR: wa_temp,wa_ekpo.
            ENDLOOP.
    *Get data from table DRAD
            IF it_temp[] IS NOT INITIAL.
              SELECT dokar
                     doknr
                     dokvr
                     doktl
                     objky
                     FROM drad
                     client specified
                     INTO TABLE it_drad
                     FOR ALL ENTRIES IN it_temp
                     WHERE mandt = sy-mandt
                     AND objky = it_temp-objky.
            ENDIF.
            IF NOT it_drad IS INITIAL.
              SELECT * FROM dms_doc2loio
                       INTO TABLE it_dms_doc2loio
                       FOR ALL ENTRIES IN it_drad
                       WHERE dokar = 'SRM'
                         AND doknr = it_drad-doknr
                         AND dokvr = it_drad-dokvr
                         AND doktl = it_drad-doktl.
            ENDIF.
    Get the Physical object class and Object ID of the attachment
            IF NOT it_dms_doc2loio IS INITIAL.
              SELECT * FROM dms_ph_cd1
                       INTO TABLE it_dms_ph_cd1
                       FOR ALL ENTRIES IN it_dms_doc2loio
                       WHERE loio_id = it_dms_doc2loio-lo_objid.
            ENDIF.
    Get the file from the DMS server using the below function module.
            LOOP AT it_dms_ph_cd1 INTO wa_dms_ph_cd1.
              wa_object_id-class = wa_dms_ph_cd1-ph_class.
              wa_object_id-objid = wa_dms_ph_cd1-phio_id.
              CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
                EXPORTING
                  object_id           = wa_object_id
                  client              = sy-mandt
                TABLES
                  file_access_info    = it_file_access_info
                  file_content_binary = it_sdokcntbin
                EXCEPTIONS
                  not_existing        = 1
                  not_authorized      = 2
                  no_content          = 3
                  bad_storage_type    = 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.
              READ TABLE it_file_access_info INTO wa_file_access_info INDEX 1.
              IF wa_file_access_info-mimetype = 'application/msword'.
                l_doc_type = 'DOC'.
                CLEAR: a_xstring,len.
                LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
                  CONCATENATE a_xstring wa_sdokcntbin-line
                         INTO a_xstring IN BYTE MODE.
                ENDLOOP.
                len = XSTRLEN( a_xstring ).
        transform to solix tab - adding additional attachments
                REFRESH lt_solix.
                lt_solix =
                  cl_document_bcs=>xstring_to_solix(
                    ip_xstring = a_xstring ).
                CLEAR l_filename.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                bcs_doc1 =  cl_document_bcs=>create_document(
                                                i_type     = l_doc_type
                                                i_subject  = l_filename
                                                i_length   = len
                                                i_language = sy-langu
                                                i_hex     = lt_solix
    *Type casting
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
    for PDF document
              ELSEIF wa_file_access_info-mimetype = 'application/pdf'.
                l_doc_type = 'PDF'.
                file_size = wa_file_access_info-file_size.
    Convert the 1022 binary data to xstring
                CLEAR a_xstring.
                CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
                  EXPORTING
                    input_length = file_size
                  IMPORTING
                    buffer       = a_xstring
                  TABLES
                    binary_tab   = it_sdokcntbin
                  EXCEPTIONS
                    failed       = 1
                    OTHERS       = 2.
                IF sy-subrc <> 0.
                  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
                ENDIF.
                DATA: w_output_length TYPE i.
    Convert Xstring to 255 RAW
                CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
                  EXPORTING
                    buffer        = a_xstring
                  IMPORTING
                    output_length = w_output_length
                  TABLES
                    binary_tab    = lt_content_bin.
                len = w_output_length.
                CLEAR l_filename.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                bcs_doc1 =  cl_document_bcs=>create_document(
                                                i_type     = l_doc_type
                                                i_subject  = l_filename
                                                i_length   = len
                                                i_language = sy-langu
                                                i_hex     = lt_content_bin
           type casting
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
    for Excel Document
              ELSEIF wa_file_access_info-mimetype = 'application/msexcel'.
                l_doc_type = 'XLS'.
                CLEAR: a_xstring,len.
                LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
                  CONCATENATE a_xstring wa_sdokcntbin-line
                         INTO a_xstring IN BYTE MODE.
                ENDLOOP.
                len = XSTRLEN( a_xstring ).
        transform to solix tab - adding additional attachments
                REFRESH lt_solix.
                lt_solix =
                  cl_document_bcs=>xstring_to_solix(
                    ip_xstring = a_xstring ).
                CLEAR l_filename.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                bcs_doc1 =  cl_document_bcs=>create_document(
                                                i_type     = l_doc_type
                                                i_subject  = l_filename
                                                i_length   = len
                                                i_language = sy-langu
                                                i_hex     = lt_solix
    *Type casting
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
    for text doxument
              ELSEIF wa_file_access_info-mimetype = 'plain/text'.
                l_doc_type = 'TXT'.
                file_size = wa_file_access_info-file_size.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
                  EXPORTING
                    input_length = file_size
                  TABLES
                    binary_tab   = it_sdokcntbin
                    text_tab     = file_data
                  EXCEPTIONS
                    failed       = 1
                    OTHERS       = 2.
                IF sy-subrc <> 0.
                  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
                ENDIF.
                CALL METHOD cl_document_bcs=>create_document
                  EXPORTING
                    i_type    = l_doc_type
                    i_subject = l_filename
                    i_text    = file_data
                  RECEIVING
                    result    = bcs_doc1.
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
              ENDIF.
              CLEAR:it_file_access_info,it_sdokcntbin.
              CLEAR:wa_object_id,wa_file_access_info,file_size.
            ENDLOOP.
            CALL METHOD send_request->set_document( l_email_object ).
    *Get the address number for the vendor
            SELECT SINGLE adrnr
                          FROM lfa1
                          INTO l_adrnr
                          WHERE lifnr = l_doc-xekko-lifnr.
            MOVE l_adrnr TO l_addrno.
    Get the Email Address for the vendor using address number
            CALL FUNCTION 'ADDR_GET_REMOTE'
              EXPORTING
                addrnumber        = l_addrno
              TABLES
                adsmtp            = it_adsmtp
              EXCEPTIONS
                parameter_error   = 1
                address_not_exist = 2
                internal_error    = 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.
            sender = cl_sapuser_bcs=>create( sy-uname ).
            CALL METHOD send_request->set_sender
              EXPORTING
                i_sender = sender.
            READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flg_nouse = 'X'.
            IF sy-subrc = 0.
              LOOP AT it_adsmtp INTO wa_adsmtp WHERE flg_nouse = 'X'.
                CALL METHOD cl_cam_address_bcs=>create_internet_address
                  EXPORTING
                    i_address_string = wa_adsmtp-smtp_addr
                  RECEIVING
                    result           = recipient.
                CALL METHOD send_request->add_recipient
                  EXPORTING
                    i_recipient = recipient
                    i_express   = 'X'.
              ENDLOOP.
            ELSE.
              READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flgdefault = 'X'.
              IF sy-subrc = 0.
                CALL METHOD cl_cam_address_bcs=>create_internet_address
                  EXPORTING
                    i_address_string = wa_adsmtp-smtp_addr
                  RECEIVING
                    result           = recipient.
                CALL METHOD send_request->add_recipient
                  EXPORTING
                    i_recipient = recipient
                    i_express   = 'X'.
              ENDIF.
            ENDIF.
            CALL METHOD send_request->send(
             EXPORTING
               i_with_error_screen = 'X'
              RECEIVING
                result              = l_sent_to_all ).
          CATCH cx_bcs INTO bcs_exception.
            WRITE: 'Fehler aufgetreten.'(001).
            WRITE: 'Fehlertyp:'(002), bcs_exception->error_type.
            EXIT.
        ENDTRY.
      ENDIF.

    Hi,
    I am facing a problem in sending a smartform as a email for all other Languages except english and another problem is its sending the email but the output status is still in RED in the messages tab.
    the program is working fine for english.
    Please do find the below code using which i would be sending the smartform as an email for a PO along with the line item attachments.
    Please help.
    Arun.
    Determine smartform function module for purchase document
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = lf_formname
        IMPORTING
          fm_name            = lf_fm_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
    error handling
        ent_retco = sy-subrc.
        IF sy-subrc = 1.
          MESSAGE e001(/smb40/ssfcomposer).
        ENDIF.
        IF sy-subrc = 2.
          MESSAGE e002(/smb40/ssfcomposer) WITH tnapr-sform.
        ENDIF.
        PERFORM protocol_update_i.
      ENDIF.
    *Start of changes <Arun K Singarapu> C082493 <04/28/2008>
    *for print preview
      IF sy-ucomm = 'PREVOUTPUT' OR sy-ucomm = 'VIEW'.
        CALL FUNCTION lf_fm_name                  "'/1BCDWB/SF00000197'
          EXPORTING
            control_parameters = wa_ctrlop
            output_options     = wa_compop
            user_settings      = 'X'
            is_ekko            = l_doc-xekko
            is_pekko           = l_doc-xpekko
            is_nast            = l_nast
            iv_from_mem        = l_from_memory
            iv_druvo           = iv_druvo
            iv_xfz             = iv_xfz
          IMPORTING
            job_output_info    = wa_return
          TABLES
            it_ekpo            = l_doc-xekpo[]
            it_ekpa            = l_doc-xekpa[]
            it_pekpo           = l_doc-xpekpo[]
            it_eket            = l_doc-xeket[]
            it_tkomv           = l_doc-xtkomv[]
            it_ekkn            = l_doc-xekkn[]
            it_ekek            = l_doc-xekek[]
            it_komk            = l_xkomk[]
          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.
        EXIT.
      ELSE.
        wa_ctrlop-LANGU = nast-spras.
        wa_ctrlop-getotf = 'X'.
        wa_ctrlop-no_dialog = 'X'.
        wa_compop-tdnoprev = 'X'.
        CALL FUNCTION lf_fm_name                  "'/1BCDWB/SF00000197'
          EXPORTING
            control_parameters = wa_ctrlop
            output_options     = wa_compop
            user_settings      = 'X'
            is_ekko            = l_doc-xekko
            is_pekko           = l_doc-xpekko
            is_nast            = l_nast
            iv_from_mem        = l_from_memory
            iv_druvo           = iv_druvo
            iv_xfz             = iv_xfz
          IMPORTING
            job_output_info    = wa_return
          TABLES
            it_ekpo            = l_doc-xekpo[]
            it_ekpa            = l_doc-xekpa[]
            it_pekpo           = l_doc-xpekpo[]
            it_eket            = l_doc-xeket[]
            it_tkomv           = l_doc-xtkomv[]
            it_ekkn            = l_doc-xekkn[]
            it_ekek            = l_doc-xekek[]
            it_komk            = l_xkomk[]
          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.
    *Convert the data from OTF to PDF format
        it_otf[] = wa_return-otfdata[].
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
            max_linewidth         = 132
          IMPORTING
            bin_filesize          = l_len_in
            bin_file              = lp_xcontent
          TABLES
            otf                   = it_otf
            lines                 = it_tline
          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.
        TRY.
      ---------- create persistent send request ----------------------
            send_request = cl_bcs=>create_persistent( ).
            len = XSTRLEN( lp_xcontent ).
    transform to solix tab
            lt_solix =
              cl_document_bcs=>xstring_to_solix(
                ip_xstring = lp_xcontent ).
    Create Body to the E-mail.
            APPEND Text-005 TO l_text.
    Attachment Name
            l_ponumber = text-004.
            CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
    Subject for the E-Mail.
            l_subject = text-001.
            CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
    *create document E-Mail.
            CALL METHOD cl_document_bcs=>create_document
              EXPORTING
                i_type    = 'RAW'
                i_subject = l_subject
                i_length  = '13'
                i_text    = l_text
              RECEIVING
                result    = l_email_object.
    *Create PDF Document
            bcs_doc =  cl_document_bcs=>create_document(
                                            i_type     = 'PDF'
                                            i_subject  = l_ponumber
                                            i_length   = len
                                            i_language = nast-spras
                                            i_hex     = lt_solix
    *Type casting
            obj_pdf_file ?= bcs_doc.
    Add PDF document as an attachment
            CALL METHOD l_email_object->add_document_as_attachment
              EXPORTING
                im_document = obj_pdf_file.
    get the attachments of the PO for each line item
            SELECT ebeln
                   ebelp
                   FROM ekpo
                   INTO TABLE it_ekpo
                   WHERE ebeln = l_doc-xekko-ebeln.
    concatenate PO and the Line Item Numebr to get the Object key
            LOOP AT it_ekpo INTO wa_ekpo.
              CONCATENATE wa_ekpo-ebeln wa_ekpo-ebelp INTO wa_temp-objky.
              APPEND wa_temp TO it_temp.
              CLEAR: wa_temp,wa_ekpo.
            ENDLOOP.
    *Get data from table DRAD
            IF it_temp[] IS NOT INITIAL.
              SELECT dokar
                     doknr
                     dokvr
                     doktl
                     objky
                     FROM drad
                     client specified
                     INTO TABLE it_drad
                     FOR ALL ENTRIES IN it_temp
                     WHERE mandt = sy-mandt
                     AND objky = it_temp-objky.
            ENDIF.
            IF NOT it_drad IS INITIAL.
              SELECT * FROM dms_doc2loio
                       INTO TABLE it_dms_doc2loio
                       FOR ALL ENTRIES IN it_drad
                       WHERE dokar = 'SRM'
                         AND doknr = it_drad-doknr
                         AND dokvr = it_drad-dokvr
                         AND doktl = it_drad-doktl.
            ENDIF.
    Get the Physical object class and Object ID of the attachment
            IF NOT it_dms_doc2loio IS INITIAL.
              SELECT * FROM dms_ph_cd1
                       INTO TABLE it_dms_ph_cd1
                       FOR ALL ENTRIES IN it_dms_doc2loio
                       WHERE loio_id = it_dms_doc2loio-lo_objid.
            ENDIF.
    Get the file from the DMS server using the below function module.
            LOOP AT it_dms_ph_cd1 INTO wa_dms_ph_cd1.
              wa_object_id-class = wa_dms_ph_cd1-ph_class.
              wa_object_id-objid = wa_dms_ph_cd1-phio_id.
              CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
                EXPORTING
                  object_id           = wa_object_id
                  client              = sy-mandt
                TABLES
                  file_access_info    = it_file_access_info
                  file_content_binary = it_sdokcntbin
                EXCEPTIONS
                  not_existing        = 1
                  not_authorized      = 2
                  no_content          = 3
                  bad_storage_type    = 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.
              READ TABLE it_file_access_info INTO wa_file_access_info INDEX 1.
              IF wa_file_access_info-mimetype = 'application/msword'.
                l_doc_type = 'DOC'.
                CLEAR: a_xstring,len.
                LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
                  CONCATENATE a_xstring wa_sdokcntbin-line
                         INTO a_xstring IN BYTE MODE.
                ENDLOOP.
                len = XSTRLEN( a_xstring ).
        transform to solix tab - adding additional attachments
                REFRESH lt_solix.
                lt_solix =
                  cl_document_bcs=>xstring_to_solix(
                    ip_xstring = a_xstring ).
                CLEAR l_filename.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                bcs_doc1 =  cl_document_bcs=>create_document(
                                                i_type     = l_doc_type
                                                i_subject  = l_filename
                                                i_length   = len
                                                i_language = sy-langu
                                                i_hex     = lt_solix
    *Type casting
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
    for PDF document
              ELSEIF wa_file_access_info-mimetype = 'application/pdf'.
                l_doc_type = 'PDF'.
                file_size = wa_file_access_info-file_size.
    Convert the 1022 binary data to xstring
                CLEAR a_xstring.
                CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
                  EXPORTING
                    input_length = file_size
                  IMPORTING
                    buffer       = a_xstring
                  TABLES
                    binary_tab   = it_sdokcntbin
                  EXCEPTIONS
                    failed       = 1
                    OTHERS       = 2.
                IF sy-subrc <> 0.
                  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
                ENDIF.
                DATA: w_output_length TYPE i.
    Convert Xstring to 255 RAW
                CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
                  EXPORTING
                    buffer        = a_xstring
                  IMPORTING
                    output_length = w_output_length
                  TABLES
                    binary_tab    = lt_content_bin.
                len = w_output_length.
                CLEAR l_filename.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                bcs_doc1 =  cl_document_bcs=>create_document(
                                                i_type     = l_doc_type
                                                i_subject  = l_filename
                                                i_length   = len
                                                i_language = sy-langu
                                                i_hex     = lt_content_bin
           type casting
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
    for Excel Document
              ELSEIF wa_file_access_info-mimetype = 'application/msexcel'.
                l_doc_type = 'XLS'.
                CLEAR: a_xstring,len.
                LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
                  CONCATENATE a_xstring wa_sdokcntbin-line
                         INTO a_xstring IN BYTE MODE.
                ENDLOOP.
                len = XSTRLEN( a_xstring ).
        transform to solix tab - adding additional attachments
                REFRESH lt_solix.
                lt_solix =
                  cl_document_bcs=>xstring_to_solix(
                    ip_xstring = a_xstring ).
                CLEAR l_filename.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                bcs_doc1 =  cl_document_bcs=>create_document(
                                                i_type     = l_doc_type
                                                i_subject  = l_filename
                                                i_length   = len
                                                i_language = sy-langu
                                                i_hex     = lt_solix
    *Type casting
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
    for text doxument
              ELSEIF wa_file_access_info-mimetype = 'plain/text'.
                l_doc_type = 'TXT'.
                file_size = wa_file_access_info-file_size.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
                  EXPORTING
                    input_length = file_size
                  TABLES
                    binary_tab   = it_sdokcntbin
                    text_tab     = file_data
                  EXCEPTIONS
                    failed       = 1
                    OTHERS       = 2.
                IF sy-subrc <> 0.
                  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
                ENDIF.
                CALL METHOD cl_document_bcs=>create_document
                  EXPORTING
                    i_type    = l_doc_type
                    i_subject = l_filename
                    i_text    = file_data
                  RECEIVING
                    result    = bcs_doc1.
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
              ENDIF.
              CLEAR:it_file_access_info,it_sdokcntbin.
              CLEAR:wa_object_id,wa_file_access_info,file_size.
            ENDLOOP.
            CALL METHOD send_request->set_document( l_email_object ).
    *Get the address number for the vendor
            SELECT SINGLE adrnr
                          FROM lfa1
                          INTO l_adrnr
                          WHERE lifnr = l_doc-xekko-lifnr.
            MOVE l_adrnr TO l_addrno.
    Get the Email Address for the vendor using address number
            CALL FUNCTION 'ADDR_GET_REMOTE'
              EXPORTING
                addrnumber        = l_addrno
              TABLES
                adsmtp            = it_adsmtp
              EXCEPTIONS
                parameter_error   = 1
                address_not_exist = 2
                internal_error    = 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.
            sender = cl_sapuser_bcs=>create( sy-uname ).
            CALL METHOD send_request->set_sender
              EXPORTING
                i_sender = sender.
            READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flg_nouse = 'X'.
            IF sy-subrc = 0.
              LOOP AT it_adsmtp INTO wa_adsmtp WHERE flg_nouse = 'X'.
                CALL METHOD cl_cam_address_bcs=>create_internet_address
                  EXPORTING
                    i_address_string = wa_adsmtp-smtp_addr
                  RECEIVING
                    result           = recipient.
                CALL METHOD send_request->add_recipient
                  EXPORTING
                    i_recipient = recipient
                    i_express   = 'X'.
              ENDLOOP.
            ELSE.
              READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flgdefault = 'X'.
              IF sy-subrc = 0.
                CALL METHOD cl_cam_address_bcs=>create_internet_address
                  EXPORTING
                    i_address_string = wa_adsmtp-smtp_addr
                  RECEIVING
                    result           = recipient.
                CALL METHOD send_request->add_recipient
                  EXPORTING
                    i_recipient = recipient
                    i_express   = 'X'.
              ENDIF.
            ENDIF.
            CALL METHOD send_request->send(
             EXPORTING
               i_with_error_screen = 'X'
              RECEIVING
                result              = l_sent_to_all ).
          CATCH cx_bcs INTO bcs_exception.
            WRITE: 'Fehler aufgetreten.'(001).
            WRITE: 'Fehlertyp:'(002), bcs_exception->error_type.
            EXIT.
        ENDTRY.
      ENDIF.

  • Problem in sending the smartform as email for other language except english

    Hi Experts,
    I could not send the smartform as an attachment for other languages, but where as i could send it in english.
    The program is working fine with print priview but not when sending the SF as an attachment
    (in other languages except english).
    Please do find the below code which i used to send the smartform as an attachment.
    Please let me know if there is any mistake in the code.
        wa_ctrlop-LANGU = nast-spras.
        wa_ctrlop-getotf = 'X'.
        wa_ctrlop-no_dialog = 'X'.
        wa_compop-tdnoprev = 'X'.
        CALL FUNCTION lf_fm_name                  "'/1BCDWB/SF00000197'
          EXPORTING
            control_parameters = wa_ctrlop
            output_options     = wa_compop
            user_settings      = 'X'
            is_ekko            = l_doc-xekko
            is_pekko           = l_doc-xpekko
            is_nast            = l_nast
            iv_from_mem        = l_from_memory
            iv_druvo           = iv_druvo
            iv_xfz             = iv_xfz
          IMPORTING
            job_output_info    = wa_return
          TABLES
            it_ekpo            = l_doc-xekpo[]
            it_ekpa            = l_doc-xekpa[]
            it_pekpo           = l_doc-xpekpo[]
            it_eket            = l_doc-xeket[]
            it_tkomv           = l_doc-xtkomv[]
            it_ekkn            = l_doc-xekkn[]
            it_ekek            = l_doc-xekek[]
            it_komk            = l_xkomk[]
          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.
    *Convert the data from OTF to PDF format
        it_otf[] = wa_return-otfdata[].
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
            max_linewidth         = 132
          IMPORTING
            bin_filesize          = l_len_in
            bin_file              = lp_xcontent
          TABLES
            otf                   = it_otf
            lines                 = it_tline
          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.
        TRY.
      ---------- create persistent send request ----------------------
            send_request = cl_bcs=>create_persistent( ).
            len = XSTRLEN( lp_xcontent ).
    transform to solix tab
            lt_solix =
              cl_document_bcs=>xstring_to_solix(
                ip_xstring = lp_xcontent ).
    Create Body to the E-mail.
            APPEND Text-005 TO l_text.
    Attachment Name
            l_ponumber = text-004.
            CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
    Subject for the E-Mail.
            l_subject = text-001.
            CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
    *create document E-Mail.
    *TRY.
    CALL METHOD cl_document_bcs=>create_document
      EXPORTING
        i_type        = 'RAW'
        i_subject     = l_subject
        i_length      = '13'
        i_language    = nast-spras
       i_importance  =
       i_sensitivity =
        i_text        = l_text
       i_hex         =
       i_header      =
       i_sender      =
      receiving
        RESULT        = l_email_object
    CATCH cx_document_bcs .
    *ENDTRY.
           CALL METHOD cl_document_bcs=>create_document
             EXPORTING
               i_type    = 'RAW'
               i_subject = l_subject
               i_length  = '13'
               i_text    = l_text
             RECEIVING
               result    = l_email_object.
    *Create PDF Document
            bcs_doc =  cl_document_bcs=>create_document(
                                            i_type     = 'PDF'
                                            i_subject  = l_ponumber
                                            i_length   = len
                                            i_language = nast-spras
                                            i_hex     = lt_solix
    *Type casting
            obj_pdf_file ?= bcs_doc.
    Add PDF document as an attachment
            CALL METHOD l_email_object->add_document_as_attachment
              EXPORTING
                im_document = obj_pdf_file.

    hi,
    i tried with ur problem.but i am able send mail in other languages also.actaullly i wrote a msg whether the mail has been sent or not.i got success message. i am placing my code here please go thorugh it,and do relavant modifications.
    *& Report  ZPPS_SMARTFORM_TO_PDF
    REPORT  ZPPS_SMARTFORM_TO_PDF.
    PARAMETER: p_date LIKE sy-datum.
    PARAMETER: p_rea TYPE char255.
    DATA: t_otfdata TYPE ssfcrescl,
          t_lines LIKE tline OCCURS 0 WITH HEADER LINE,
          t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          t_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    Objects to send mail.
    DATA:T_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i,
          w_bin_filesize TYPE i,
          wa_ctrlop TYPE ssfctrlop,
          wa_outopt TYPE ssfcompop,
          WA_BUFFER TYPE STRING,          "To convert from 132 to 255
          WA_OBJHEAD TYPE SOLI_TAB,
          WA_DOC_CHNG TYPE SODOCCHGI1,
          W_DATA TYPE SODOCCHGI1.
    DATA: form_name TYPE rs38l_fnam,
          V_LINES_TXT TYPE I,
          V_LINES_BIN TYPE I,
          nast-spras type sy-langu value 'DE'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSR_DEMO1'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = 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.
    wa_ctrlop-LANGU = nast-spras.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION form_name
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = wa_ctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = wa_outopt
       USER_SETTINGS              = 'X'
        MYDATE                     = p_date
        REASON                     = p_rea
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       JOB_OUTPUT_INFO            = t_otfdata
      JOB_OUTPUT_OPTIONS         =
    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.
    t_otf[] = t_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
       MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
      PDF_DELETE_OTFTAB           = ' '
    IMPORTING
       BIN_FILESIZE                = w_bin_filesize
      BIN_FILE                    =
      TABLES
        OTF                         = t_otf
        LINES                       = t_lines
    EXCEPTIONS
       ERR_MAX_LINEWIDTH           = 1
       ERR_FORMAT                  = 2
       ERR_CONV_NOT_POSSIBLE       = 3
       ERR_BAD_OTF                 = 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.
    loop at t_lines.
    TRANSLATE t_lines USING '~'.
      CONCATENATE WA_BUFFER T_LINES INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
      t_RECORD = WA_BUFFER.
      APPEND t_RECORD.
      SHIFT WA_BUFFER LEFT BY 255 PLACES.
      IF WA_BUFFER IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    Attachment
    REFRESH: T_RECLIST,
    T_OBJTXT,
    T_OBJBIN,
    T_OBJPACK.
    CLEAR WA_OBJHEAD.
    T_OBJBIN[] = T_RECORD[].
    Create Message Body Title and Description
    T_OBJTXT = 'test with pdf-Attachment!'.
    APPEND T_OBJTXT.
    DESCRIBE TABLE T_OBJTXT LINES V_LINES_TXT.
    READ TABLE T_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 T_OBJPACK-TRANSF_BIN.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    T_OBJPACK-BODY_NUM = V_LINES_TXT.
    T_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND T_OBJPACK.
    Attachment (pdf-Attachment)
    T_OBJPACK-TRANSF_BIN = 'X'.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE T_OBJBIN LINES V_LINES_BIN.
    READ TABLE T_OBJBIN INDEX V_LINES_BIN.
    T_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    T_OBJPACK-BODY_NUM = V_LINES_BIN.
    T_OBJPACK-DOC_TYPE = 'PDF'.
    T_OBJPACK-OBJ_NAME = 'smart'.
    T_OBJPACK-OBJ_DESCR = 'test'.
    APPEND T_OBJPACK.
    CLEAR T_RECLIST.
    T_RECLIST-RECEIVER = 'MAIL-ID'.
    T_RECLIST-REC_TYPE = 'U'.
    APPEND T_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               = T_OBJPACK
        OBJECT_HEADER              = WA_OBJHEAD
        CONTENTS_BIN               = T_OBJBIN
        CONTENTS_TXT               = T_OBJTXT
        RECEIVERS                  = T_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.
    and i thought of one more soluyion u can write
    wa_ctrlop-langu = T002-spras. i think it will also help for u.
    revert back if any questions.
    please reward me if helpful.
    gupta.pullipudi

  • Class CL_BCS Query for body part of mail

    HI,
    I want to send the mail with out attachement using Class CL_BCS. Can any body help me on how to send the message body in the mail using CL_BCS class....
    Thanx & Regards,
    Sameer

    Hi Sameer
    I've been struggling with this class CL_BCS too for a while and I want to give my experience with that class. Following a code example which will submit a report to memory and send the report as an attachment by mail thru the SMTP interface.
    *& Report  ZOBR_SEND_TRIP_SIM_BY_MAIL                                  *
    *& This program does following:
    *& 1. Submit a travel expense report to memory
    *& 2. Read the travel expense report from memory
    *& 3. Convert the travel expense report to HTML format
    *& 4. Copy the travel expense report from format RAW(1000) to RAW(255)
    *& 5. Send an email with body text and attachtments
    REPORT  zobr_send_trip_sim_by_mail                                  .
    DATA:
    gi_abaplist     TYPE TABLE OF abaplist,
    gi_html         TYPE          w3htmltab,
    gs_html         LIKE LINE OF  gi_html,
    gw_string       TYPE          string,
    gw_length       TYPE          i,
    gw_length_c     TYPE          so_obj_len,
    gi_solix        TYPE          solix_tab,
    gs_solix        LIKE LINE OF  gi_solix,
    gi_soli         TYPE          soli_tab,
    gs_soli         LIKE LINE OF  gi_soli,
    go_send_request TYPE REF TO   cl_bcs,
    go_document     TYPE REF TO   cl_document_bcs,
    go_sender       TYPE REF TO   cl_sapuser_bcs,
    go_recipient    TYPE REF TO   if_recipient_bcs,
    go_exception    TYPE REF TO   cx_bcs.
    * Submit report to memory
    SUBMIT rprtef00 "USER sy-uname
      EXPORTING LIST TO MEMORY AND RETURN
      WITH pnppernr EQ '00001000'
      WITH pnptimra EQ 'X'
      WITH pnpxabkr EQ 'D2'
      WITH pnppabrp EQ '11'
      WITH pnppabrj EQ '2006'
      WITH s_reisen EQ '0002600221'
      WITH hinz_dru EQ space
      WITH hinz_weg EQ space
      WITH hinz_dyn EQ 'X'
      WITH allesdru EQ 'X'
      WITH reisepro EQ 'X'
      WITH reisetxt EQ 'X'
      WITH sw_antrg INCL 'X'
      WITH addinfo EQ 'X'
      WITH extperio EQ '000'
      WITH simulate EQ space
      WITH einkopf EQ space.
    * Read report from memory
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = gi_abaplist
      EXCEPTIONS
        not_found  = 1
        OTHERS     = 2.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    * Convert report to HTML format
    CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
    * EXPORTING
    *   REPORT_NAME         =
    *   TEMPLATE_NAME       = 'WEBREPORTING_REPORT'
      TABLES
        html                = gi_html
        listobject          = gi_abaplist.
    LOOP AT gi_html INTO gs_html.
      CONCATENATE gw_string
                  gs_html
             INTO gw_string.
    ENDLOOP.
    gw_length = STRLEN( gw_string ).
    gw_length_c = gw_length.
    * copy table from format raw(1000) to raw(255)
    CALL FUNCTION 'TABLE_COMPRESS'
      TABLES
        in  = gi_abaplist
        out = gi_solix.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    TRY.
    *   Create persistent send request
        go_send_request = cl_bcs=>create_persistent( ).
    *   Create document (body text in text format)
        gs_soli = 'Trip is now settled, see attachment.'.
        APPEND gs_soli TO gi_soli.
        gs_soli = 'Reimbursement is paid out by your next salary.'.
        APPEND gs_soli TO gi_soli.
        go_document = cl_document_bcs=>create_document( i_type    = 'RAW'
                                                        i_text    = gi_soli
                                                        i_subject = 'Trip reimbursement' ).
    *   Add attachment (ABAP list format)
        CALL METHOD go_document->add_attachment
          EXPORTING
            i_attachment_type    = 'ALI'
            i_attachment_subject = 'Expense report(ALI)'
            i_att_content_hex    = gi_solix.
    *   Add attachment (HTML format)
        CALL METHOD go_document->add_attachment
          EXPORTING
            i_attachment_type    = 'HTM'
            i_attachment_subject = 'Expense report(HTM)'
            i_att_content_text   = gi_html.
    *   Add note (Text format)
        CALL METHOD go_send_request->set_note( gi_soli ).
    *   Add document to send request
        CALL METHOD go_send_request->set_document( go_document ).
    *   Get sender object
        go_sender = cl_sapuser_bcs=>create( sy-uname ).
    *   Add sender
        CALL METHOD go_send_request->set_sender
          EXPORTING
            i_sender = go_sender.
        go_recipient = cl_cam_address_bcs=>create_internet_address( '[email protected]' ).
    *   Add recipient with its respective attributes to send request
        CALL METHOD go_send_request->add_recipient
          EXPORTING
            i_recipient  = go_recipient
            i_express    = ' '
            i_copy       = ' '
            i_blind_copy = ' '
            i_no_forward = ' '.
    *   set send immediately flag
        go_send_request->set_send_immediately( 'X' ).
    *   Send document
        CALL METHOD go_send_request->send( ).
        COMMIT WORK.
    * Exception handling
      CATCH cx_bcs INTO go_exception.
        EXIT.
    ENDTRY.
    Notice that the only way to put a body text in the email is to call the method cl_document_bcs=>create_document with input of a type 'RAW'.
    Be aware of the settings of the SMTP node in SAPConnect (transaction SCOT) because the seetings could cource an unwanted conversion of the email.
    1. Doubbelclick on the TMTP node and a popup screen will show.
    2. Click on the 'Set' button next to 'Internet' under 'Supported address type' and a       popup screen will show.
    3. Set output format for SAP documents as 'SAPscript/Smart forms' = 'PDF', 'ABAP list' = 'PDF', 'RAW text' = 'TXT'.
    This setting will convert 'SAPscript/Smartforms', 'ABAP list' to PDF format. If 'RAW text' = 'PDF' the body text wil be converted to 'PDF' format and change to an attachment and the body text will disappear.
    Hope this is usefull for you and others.
    Best regards
    Ove Bryntesson
    Applicon A/S

  • Cannot Read Body of my Mail on MacBook Pro

    I am using Mail with the latest Mavericks on my MacBook Pro....and it is all updated to the latest software  updates. For the past 5 or 6 days, I cannot read the body of my mail. The headers etc. are visible but in the preview pane below, nothing shows. I think this started because I had left the computer for a few hours and it went to sleep. When I tried to get back on, nothing happened. I pressed the enter and other keys but it still kept 'sleeping'. I finally resorted to turning the power switch off and was presented with this problem. I have searched these forums and though there are a few instances of this, they either seemed to be with older OS systems or on the initial installation of Mavericks....I have had Mavericks since it first came out with no issues.  Also, the majority of these type issues seemed to be with the iPhone or iPad...and I still have not been able to get to the bottom of this. 
    I have tried to Rebuild the mailbox several times but to no avail. Sometimes the Mail also quits unexpectedly and I am given an error statement. Any help will be greatly appreciated. Thank you.
    I have a 2008 MacBook Pro with a 2.53 GHz Intel Core and 8 Gb RAM....and about 40 Gb of free space.

    Humm,
    In the Mail > Preferences I have it set to display in Classic view.
    Side bar or Accounts in-boxes and other folders
    Then a top window of Messages left or new in the In-boxes and the messages being "read" below that.
    There are occasions when deleting a messages in the top window does not automatically select another.
    This can mean nothing displays in the bottom box  (I just can't re-create it right now ).
    If I change to the regular/default view I see the Side Bar still, then the Summary column followed by the Messages column.
    The Summary I have chosen has three Messages related to it.
    In the Messages column I have scrolled the first to reveal the contents but also show the Header of the next.  (I chose to show Full Headers so there is a lot of info here or not only the Sender but the Server(s) it came through to get to me).
    I take you do mean the actual Header to the actual message  (the lower right item in the pic) rather than calling one of the columns "Headers" ?
    7:48 pm      Sunday; August 3, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Sending email  with message body contain data  in table   displayed in one

    Hi,
    I have one jsp page where I am dispalying the table data retrieved fron database.
    Now i am trying to send this table as message body of the mail to the user.I am doing same stuff last from six days but unable to send such data.
    Please help me Sir,as i am newbie here.
    Here is an jsp page.
        Document   : evaluationeventtable
        Created on : Jul 24, 2008, 6:52:37 PM
        Author     : user1
    --%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@ page language ="java" %>
    <%@ page import="java.sql.*, javax.sql.*, javax.naming.*,java.io.*,java.util.*" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>IGIDR</title>
            <link rel="stylesheet" href="../styles/styles.css" type="text/css">
        </head>
        <body>
             <table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr>
    <td><%@ include file="/includes/logohead.jsp" %></td>
    </tr>
    <tr><td><%@ include file="/toplinks.jsp"%></td></tr>
    <tr>
    <td width="100%" valign="top">
    <table width="100%" cellspacing="0" cellpadding="0" border="1" borderColor=#000066>
        <tr>
    <td width="80%"> 
        <%  int QNO;
             String message=null;
             //String message1=null;
             //String message2=null;
             String noA,noB,noC,noD;                
            String ID=request.getParameter("id");       
            String EVENTID=request.getParameter("event");       
            Connection connection = null;
            Statement st = null;
            Statement st1 = null;
            Statement st2 = null;
            Statement st3 = null;
            Statement st4 = null;
            Statement st5 = null;
            ResultSet rs= null;
            ResultSet rs1= null;
            ResultSet rs2= null;
            ResultSet rs3= null;
            ResultSet rs4= null;
            ResultSet rs5= null;
            Class.forName("com.mysql.jdbc.Driver");
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mynewdatabase","root", "root123");
                           st=con.createStatement();
                    try  {              
                      rs = st.executeQuery("SELECT * FROM Questionbank where Questionid='"+ID+"'");
                   %>
                <table border="1" cellpadding="2" cellspacing="3" bgcolor="#E6E6FA" align="center"><tr><th>Questions</th><th>A</th><th>B</th><th>C</th><th>D</th></tr>
                 <%  message="<table border=1 cellpadding=2 cellspacing=3 bgcolor=#E6E6FA align=center><tr><th>Questions</th><th>A</th><th>B</th><th>C</th><th>D</th></tr>";%>
                   <%
                  while ( rs.next() )
                            //String NO=rs.getString("Qserialno");
                            //session.setAttribute("no",NO);
                            //String NAME=rs.getString("questionname");
                            //session.setAttribute("name",NAME);                                    
                       %>
                       <tr><td><%=rs.getString("Qserialno") + "." + rs.getString("questionname")%></td>
                       <%
                        message=message+"<tr><td>"+rs.getString("Qserialno") + "." + rs.getString("questionname")+"</td>";
                       st1=con.createStatement(); 
                       try
                          rs1=st1.executeQuery("select count(*) as total  from final where questionid='"+ID+"'and Eventid='"+EVENTID+"'and Qserialno='"+rs.getString("Qserialno")+"'and Answer='A'");
                         rs1.next();
                         noA=rs1.getString("total");
                         session.setAttribute("NOA",noA);
                          rs1=st1.executeQuery("select count(*)  as total from final where questionid='"+ID+"'and Eventid='"+EVENTID+"'and Qserialno='"+rs.getString("Qserialno")+"'and Answer='B'");
                       rs1.next();
                         noB=rs1.getString("total");
                         session.setAttribute("NOB",noB);
                          rs1=st1.executeQuery("select count(*) as total  from final where questionid='"+ID+"'and Eventid='"+EVENTID+"'and Qserialno='"+rs.getString("Qserialno")+"'and Answer='C'");
                        rs1.next();
                         noC=rs1.getString("total");
                         session.setAttribute("NOC",noC);
                          rs1=st1.executeQuery("select count(*) as total  from final where questionid='"+ID+"'and Eventid='"+EVENTID+"'and Qserialno='"+rs.getString("Qserialno")+"'and Answer='D'");
                          rs1.next();
                         noD=rs1.getString("total");                   
                         session.setAttribute("NOD",noD);
                         message=message+"<td>"+noA+"</td><td>"+noB+"</td><td>"+noC+"</td><td>"+noD+"</td></tr></table>";
                         %>                     
                     <td><%=noA%></td><td><%=noB%></td><td><%=noC%></td><td><%=noD%></td></tr>
                   <%        
                         } finally
                               if (rs1 != null)
                                   rs1.close();
                                   rs1 = null;
                               } if (st1 != null)
                                   st1.close();
                                   st1 = null;
                                       finally
                               if (rs != null)
                                   rs.close();
                                   rs = null;
                               if (st != null)
                                   st.close();
                                   st = null;
                                   con.close();
                      %></table>   
                      <table align="center" width="50%" cellspacing="0" cellpadding="0" border="1" borderColor=#D2691E>
                      <form name="sendmail" action="/student/servletmail" method="POST">
                       <tr class="CellColor">
              <td>To</td>
              <td class="CellColor" width="1%">
              </td>
              <td class="CellColor">
                   <input type="text" name="to" size="25" value="">
              </td>
                    <td>From</td>
              <td class="CellColor" width="1%">
              </td>
              <td class="CellColor">
                   <input type="text" name="from" size="25" value="">
              </td>
         </tr>
            <input type="hidden" name="message" value="<%=message%>">
            <tr class="CellColor">
              <td class="CellColor" colspan="9" align="center">
                   <input type="submit" name="tn1" value="Send" >
              </td>
         </tr>   
      </form></table></td></tr></table>
                  </table>
                         </body></html>    And here is an servlet where i am trying to send the mail
    package com.student.igidr.test;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.event.*;
    import javax.mail.internet.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    * @author user1
    public class servletmail extends HttpServlet
            public  void doPost(HttpServletRequest request,HttpServletResponse response)
                                      throws ServletException, IOException
            PrintWriter out=response.getWriter();
            response.setContentType("text/html");
            try
               Properties props=new Properties();
               props.put("mail.smtp.host","webmail.igidr.ac.in");   //  'localhost' for testing
       Session   session1  =  Session.getDefaultInstance(props,null);
               String s1 = request.getParameter("to");
               String s2 = request.getParameter("from");
               //String s3 = request.getParameter("sub");
               String s4 = request.getParameter("message");
              // out.println(s4);
         Message message =new MimeMessage(session1);
         message.setFrom(new InternetAddress(s2));
          message.setRecipients
                 (Message.RecipientType.TO,InternetAddress.parse(s1,false));
              // message.setSubject(s3);
               message.setText(s4);       
              message.setContent(s4,"text/html");
               Transport.send(message);
               out.println("mail has been sent");
            catch(Exception ex)
               System.out.println("ERROR....."+ex);
    }I am using the message variable to send the message also as input variable in servlet.
    Whether it is write Way to represent hole table body into message variable in jsp page.
    Please help me.
    Thanks and Regards
    haresh
    Edited by: HARSHAL_GURAV on Aug 13, 2008 11:15 PM
    Edited by: HARSHAL_GURAV on Aug 13, 2008 11:56 PM

    Hi bshannon ,
    Thanks you very much for your reply.
    I am trying to send html formated mail to the user.
    The message body contains the table that is displayed in above jsp page as:
    <table border="1" cellpadding="2" cellspacing="3" bgcolor="#E6E6FA" align="center"><tr><th>Questions</th><th>A</th><th>B</th><th>C</th><th>D</th></tr>
    <tr><td><%=rs.getString("Qserialno") + "." + rs.getString("questionname")%></td>
    <td><%=noA%></td><td><%=noB%></td><td><%=noC%></td><td><%=noD%></td></tr>In above code I am displaying the data from table i jsp page in table format. The data is related to analysis of particular event and i am trying to send this data as message body of the email.
    As table displayed in html form can you assist me in how to send html data?
    I am using variable message to store all this table data .
    <%  message="<table border=1 cellpadding=2 cellspacing=3 bgcolor=#E6E6FA align=center><tr><th>Questions</th><th>A</th><th>B</th><th>C</th><th>D</th></tr>";%>
    message=message+"<tr><td>"+rs.getString("Qserialno") + "." + rs.getString("questionname")+"</td>";
      message=message+"<td>"+noA+"</td><td>"+noB+"</td><td>"+noC+"</td><td>"+noD+"</td></tr></table>";i am sending this variable through form.At servlet I am retrieving it like:
    String s1 = request.getParameter("to");
               String s2 = request.getParameter("from");
               //String s3 = request.getParameter("sub");
               *String s4 = request.getParameter("message");*Will this possible ?
    Please help meas i am troubling same with last from 7-8 days.
    I had gone through Faqs but unable to collect required information.
    Thanks and Regards
    Haresh
    Edited by: HARSHAL_GURAV on Aug 15, 2008 9:22 PM

  • Error send a smartform PDF by Email to Vendor

    Hi Expert,
    Please help me.........................
    I want to send a PO (Smartform) as Email to Vendor.
    In SAPScript the PO send by Email is working fine, but in Smartforms it is not working.
    Normally, I will use via Smartforms the Program = YBAA_FM06P, FORM routine = ENTRY_NEU, PDF/Smartform Form = ZYBAA_MMPO1.
    A communication strategy has communication type as INT has been defined.
    This communication strategy has been set as default in the output type ZNEU. The transmission medium has been set to 5 (External Send) and the partner function as VN (Vendor).
    The e-mail address of the vendor has also been maintained.
    In transaction MN04, i have also made an entry for output type ZNEU and set the document type as NB.
    But message output do not create.
    How to send a smartform PDF by Email to vendor?
    Thanks,

    Hi,
    I can convert the PO output in to PDF from SOST I can sent it to external vendor using the Mail triggering configuration settings but meassage output do not create.
    Please tell me how can I do.
    Thank,

Maybe you are looking for

  • HOW do I get the "watch" to stay on and not shut off on my 6th GEN  NANO?

    After purchasing a $70 cool watchband for my new 6th GEN NANO, I'm very disapointed that I can't get the "watch" function to stay on more than 15 seconds.  AppleCare says that it isn't meant to stay on, it would run down the battery.  Then why put on

  • Problem in using output type for purchase order

    Hi experts,      I am using output type for first time so may be i have done wrong configuration for po output type.The steps i have done are :- 1) Going to  tcode NACE->Selected  the row u201CEF Purchase Orderu201D and clicked on u201CProcedures". 2

  • Burn itunes movie to dvd

    I purchased a few movies and want to burn them to a dvd.  How can I do this?  Apple seems to make this very difficult to do.

  • No sound in videos with Safari, Chrome, Firefox

    Hello, When I try to watch videos on any site (Youtube, Vimeo, News site, video tutorials...) with these 3 browsers the sound is" blocked" (an x appears besides the loudspeaker icon). I have no problem listening to iTunes, watching my videos with Qui

  • Arabic text(font) in report 11g

    Hi, I am converting 6i reports to 11g where I am using "Arabic Transparent" as font but in 11g it is not coming, I want to know how to configure Arabic fonts in 11g reports