Problem in mailing smartforms output using SO_DOCUMENT_SEND_API1

Hi all,
Iam using the function module SO_DOCUMENT_SEND_API1 to email purchase order through driver program.
the code goes like this:
first iam calling the function module of smartform
CALL FUNCTION lv_fm_name
where iam passing the desired paramets.
from where iam taking the otfdata returned from the fm
like:
IMPORTING
         job_output_info  = w_return
where w_return is declared as TYPE ssfcrescl.
then iam writing this code
i_otf[] = w_return-otfdata[].
DELETE w_return-otfdata WHERE tdprintcom = '//'.
READ TABLE i_otf WITH KEY tdprintcom = 'EP'.
my_tabix = sy-tabix + 1.
INSERT lines of w_return-otfdata INTO i_otf INDEX my_tabix.
then iam calling the fm
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
          max_linewidth         = 132
        IMPORTING
          bin_filesize          = v_len_in
        TABLES
          otf                   = i_otf
          lines                 = i_tline
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          OTHERS                = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
then converting it to 255 using
DATA: gd_buffer TYPE string.
DATA: w_cnt TYPE i,
            i_record LIKE solix OCCURS 0 WITH HEADER LINE.
      LOOP AT i_tline.
        TRANSLATE i_tline USING ' ~'.
        CONCATENATE gd_buffer i_tline INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        i_record-line = gd_buffer.
        APPEND i_record.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
the to test whether its converting into pdf iam using the fm
CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          bin_filesize = bin_filesize
          filename     = 'C:\TESTPDF.PDF'
          filetype     = 'BIN'
        TABLES
          data_tab     = i_record.
then calling my main fm
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = w_doc_chng
         put_in_outbox               =  'X'
       sender_address              = sender
       sender_address_type         = 'INT'
       commit_work                  = 'X'
        TABLES
          packing_list               = it_packing_list
          object_header              = w_objhead
        CONTENTS_BIN               = I_OBJBIN
          contents_txt               = i_objtxt
         contents_hex                = i_objbin            
          receivers                  = it_receivers
EXCEPTIONS
   too_many_receivers               = 1
   document_not_sent                = 2
   document_type_not_exist          = 3
   operation_no_authorization       = 4
   parameter_error                  = 5
   x_error                          = 6
   enqueue_error                    = 7
   OTHERS                           = 8
      IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
all the parametrs for the above fm are passed correctly like populating  it_packing_list,w_objhead, i_objtxt, i_objbin,it_receivers.iam using this fm because i need to pass sender email id.
the first problem iam facing is when iam using the fm gui_download iam not able to view the smartform
the error is "adobe reader could not open "test.pdf" as it is not supported etc..."
second is same problem iam facing while trying to open the attachment in pdf which is emailed to reciever.
i think there is some problem in converting 132 to 255 characters.
can some one please help on this.(might be a problem where iam passing DO
        i_record-line = gd_buffer.)
thanks in advance.
regards
sunil

CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = <b>255 "132</b>
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
I guess it will solve your problem.
CLose the thread if your question is answered.
Regards,
SaiRam

Similar Messages

  • Mailing smartform output

    Hi,
    i am mailing a smartform output as pdf attachment from the report using
    SO_NEW_DOCUMENT_ATT_SEND_API1
    im receiving it to....but the problem is while opening the pdf file it says....there was an error processing the page.Wrong no of arguments for a setcolor parameter.......and is not opening....
    also Is there a possibility of mailing the smartform output directly from the smartform itself.........bcoz we have an option email in output device....pls advice
    pls help........
    Thanks ,
    Will.

    hi,
    try this code.hope this will use for u. rewards if usefull to u,dont forget....
    *& Report  Z50818_PDF_MAIL
    REPORT  z50818_pdf_mail.
    DATA:    formname TYPE  tdsfname,
             fm_name TYPE  rs38l_fnam,
             control_parameters     TYPE     ssfctrlop,
             output_options     TYPE     ssfcompop,
             job_output_info   TYPE   ssfcrescl,
             otf_data TYPE          tsfotf.
    DATA: otf     TYPE TABLE OF     itcoo WITH HEADER LINE,
          doctab_archive     TYPE TABLE OF docs WITH HEADER LINE,
          lines     TYPE TABLE OF tline WITH HEADER LINE,
          bin_filesize TYPE i.
    INITIALIZATION.
      formname = 'Z50818_PDF_SMART'.
    START-OF-SELECTION.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname                 = formname
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
       IMPORTING
         fm_name                  = fm_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.
      control_parameters-no_dialog = 'X'.
      control_parameters-getotf = 'X'.
      CALL FUNCTION fm_name
       EXPORTING
      ARCHIVE_INDEX              = ARCHIVE_INDEX
      ARCHIVE_INDEX_TAB          = ARCHIVE_INDEX_TAB
      ARCHIVE_PARAMETERS         = ARCHIVE_PARAMETERS
          control_parameters         = control_parameters
      MAIL_APPL_OBJ              = MAIL_APPL_OBJ
      MAIL_RECIPIENT             = MAIL_RECIPIENT
      MAIL_SENDER                = MAIL_SENDER
      OUTPUT_OPTIONS             = OUTPUT_OPTIONS
      USER_SETTINGS              = 'X'
       IMPORTING
      DOCUMENT_OUTPUT_INFO       = DOCUMENT_OUTPUT_INFO
          job_output_info            = job_output_info
      JOB_OUTPUT_OPTIONS         = 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.
      otf_data[] = job_output_info-otfdata[].
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
    EXPORTING
      USE_OTF_MC_CMD               = 'X'
      ARCHIVE_INDEX                = ARCHIVE_INDEX
       IMPORTING
         bin_filesize                 = bin_filesize
        TABLES
          otf                          = otf_data[]
          doctab_archive               = doctab_archive[]
          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.
      DATA: filename TYPE string.
      filename = 'c:\test\smarttest.pdf'.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
         bin_filesize                    = bin_filesize
          filename                        = filename
          filetype                        = 'BIN'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      = FILELENGTH
        TABLES
          data_tab                        = lines
      FIELDNAMES                      = FIELDNAMES
       EXCEPTIONS
         file_write_error                = 1
         no_batch                        = 2
         gui_refuse_filetransfer         = 3
         invalid_type                    = 4
         no_authority                    = 5
         unknown_error                   = 6
         header_not_allowed              = 7
         separator_not_allowed           = 8
         filesize_not_allowed            = 9
         header_too_long                 = 10
         dp_error_create                 = 11
         dp_error_send                   = 12
         dp_error_write                  = 13
         unknown_dp_error                = 14
         access_denied                   = 15
         dp_out_of_memory                = 16
         disk_full                       = 17
         dp_timeout                      = 18
         file_not_found                  = 19
         dataprovider_exception          = 20
         control_flush_error             = 21
         OTHERS                          = 22
      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: document_data LIKE  sodocchgi1 ,
            contents_txt TYPE TABLE OF  solisti1  WITH HEADER LINE,
            contents_bin     TYPE TABLE OF     solisti1 WITH HEADER LINE,
            tab_lines TYPE i,
            packing_list TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
            OBJECT_HEADER type table of SOLISTI1 with header line,
            RECEIVERS     TYPE TABLE OF      SOMLRECI1 WITH HEADER LINE,     
            l_str(255) ,
            v1 TYPE i,
            v2 TYPE i,
            v3 type i.
      CONSTANTS: c_raw TYPE so_obj_tp VALUE 'RAW',
                 c_pdf TYPE so_obj_tp VALUE 'PDF',
                 c_255 TYPE i VALUE 255,
                 c_134 TYPE i VALUE 134,
                 C_X TYPE C VALUE 'X',
                 C_U TYPE C VALUE 'U'.
      document_data-obj_name = 'EMAIL'.
      document_data-obj_descr = 'subject'.
      contents_txt = 'THIS IS first line DATA'.
      APPEND contents_txt.
      CLEAR contents_txt.
      contents_txt = 'THIS IS second line DATA'.
      APPEND contents_txt.
      CLEAR contents_txt.
      APPEND contents_txt.
      APPEND contents_txt.
      DESCRIBE TABLE contents_txt LINES tab_lines.
      READ TABLE contents_txt INDEX tab_lines.
    document_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( contents_txt ).
      document_data-doc_size =  tab_lines .
      CLEAR packing_list-transf_bin.
      packing_list-head_start = 1.
      packing_list-head_num = 0.
      packing_list-body_start = 1.
      packing_list-body_num = tab_lines.
      packing_list-doc_type = c_raw.
      packing_list-doc_size = document_data-doc_size.
      APPEND packing_list.
      LOOP AT lines.
        CLEAR l_str.
        l_str+0(2) = lines-tdformat.
        l_str+2(132) = lines-tdline.
        v2 = v1 + c_134.
        IF v2 LE c_255.
          contents_bin-line+v1(c_134) = l_str. v1 = v2.
        ELSE.
          v3 = v2 - c_255.
          v2 = c_255 - v1.
          IF NOT v2 IS INITIAL.
            contents_bin-linev1(v2) = l_str0(v2).
          ENDIF.
          APPEND contents_bin.
          CLEAR contents_bin.
          v1 = v3.
          v3 = 134 - v1.
          IF NOT v1 IS INITIAL.
            contents_bin-line0(v1) = l_strv3(v1).
          ENDIF.
        ENDIF.
      ENDLOOP.
      APPEND contents_bin.
      CLEAR contents_bin.
      DESCRIBE TABLE contents_bin LINES tab_lines.
      READ TABLE contents_bin INDEX tab_lines.
    OBJECT_HEADER = 'objhead'.
    APPEND OBJECT_HEADER.
    packing_list-transf_bin = c_x.
    packing_list-head_start = 1.
    packing_list-head_num = 1.
    packing_list-body_start = 1.
    packing_list-body_num = tab_lines.
    packing_list-doc_type = c_pdf.
    packing_list-obj_name = 'text1'.
    packing_list-obj_descr = 'filename'.
    packing_list-doc_size = tab_lines * 255  + STRLEN( contents_bin ).
    APPEND packing_list.
    RECEIVERS-receiver = '[email protected]'.
    RECEIVERS-rec_type = c_u.
    APPEND RECEIVERS.
    CLEAR RECEIVERS.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data                    = document_data
       PUT_IN_OUTBOX                    = 'X'
      SENDER_ADDRESS                   = SY-UNAME
      SENDER_ADDRESS_TYPE              = 'B'
       COMMIT_WORK                      = 'X'
    IMPORTING
      SENT_TO_ALL                      =
      NEW_OBJECT_ID                    = NEW_OBJECT_ID
      SENDER_ID                        = SENDER_ID
      TABLES
        packing_list                     = packing_list
       OBJECT_HEADER                    = OBJECT_HEADER
       CONTENTS_BIN                     = CONTENTS_BIN
       CONTENTS_TXT                     = CONTENTS_TXT
      CONTENTS_HEX                     = CONTENTS_HEX
      OBJECT_PARA                      = OBJECT_PARA
      OBJECT_PARB                      = OBJECT_PARB
        receivers                        = receivers
    EXCEPTIONS
      TOO_MANY_RECEIVERS               = 1
      DOCUMENT_NOT_SENT                = 2
      DOCUMENT_TYPE_NOT_EXIST          = 3
      OPERATION_NO_AUTHORIZATION       = 4
      PARAMETER_ERROR                  = 5
      X_ERROR                          = 6
      ENQUEUE_ERROR                    = 7
      OTHERS                           = 8
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Mail smartform output

    Hi
    i want send my smartform output in mail
    pls help me on this.
    Regards
    Rajan Mehta
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Feb 6, 2008 11:21 AM

    Hi
    send your Smart Form output via e-mail as a PDF attachment.
    How to convert smartform output into pdf?
    There is a way to download smartform in PDF format.
    Please do the following:
    1. Print the smartform to the spool.
    2. Note the spool number.
    3. Download a PDF file (Acrobat Reader) version of the spool by running Program RSTXPDFT4 and entering the
    noted spool number. 
    or use this program:
    *& Report ZPDF_DNLD_TEST2 *
    *& DEVK904540 *
    REPORT ZPDF_DNLD_TEST2 .
    data: i_otf LIKE itcoo OCCURS 100 WITH HEADER LINE,
    i_pdf LIKE tline OCCURS 100 WITH HEADER LINE.
    data: op_option type SSFCTRLOP,
    job_output type SSFCRESCL.
    op_option-getotf = 'X'.
    CALL FUNCTION '/1BCDWB/SF00000005'
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS = op_option
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    itab1 = itab1
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO = job_output
    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.
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    ARCHIVE_INDEX = ' '
    COPYNUMBER = 0
    ASCII_BIDI_VIS2LOG = ' '
    PDF_DELETE_OTFTAB = ' '
    IMPORTING
    BIN_FILESIZE =
    BIN_FILE =
    TABLES
    otf = job_output-otfdata
    lines = i_pdf
    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.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE =
    filename = 'c:\test_pdf_sf.pdf'
    FILETYPE = 'BIN'
    tables
    data_tab = i_pdf
    FIELDNAMES =
    EXCEPTIONS
    FILE_WRITE_ERROR = 1
    NO_BATCH = 2
    GUI_REFUSE_FILETRANSFER = 3
    INVALID_TYPE = 4
    NO_AUTHORITY = 5
    UNKNOWN_ERROR = 6
    HEADER_NOT_ALLOWED = 7
    SEPARATOR_NOT_ALLOWED = 8
    FILESIZE_NOT_ALLOWED = 9
    HEADER_TOO_LONG = 10
    DP_ERROR_CREATE = 11
    DP_ERROR_SEND = 12
    DP_ERROR_WRITE = 13
    UNKNOWN_DP_ERROR = 14
    ACCESS_DENIED = 15
    DP_OUT_OF_MEMORY = 16
    DISK_FULL = 17
    DP_TIMEOUT = 18
    FILE_NOT_FOUND = 19
    DATAPROVIDER_EXCEPTION = 20
    CONTROL_FLUSH_ERROR = 21
    OTHERS = 22
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • I have a problem in converting smartform output to pdf format.

    Hi,
    While converting the smartform output to pdf format.
    It is showing this error.
    otf end command // missing in otf data.
    I have used this function.
    Assigning the OTFDATA to OTF Structure table
        CLEAR gt_otf.
        gt_otf[] = gs_otfdata-otfdata[].
    Convert the OTF DATA to SAP Script Text lines
        CLEAR gt_pdf_tab.
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
            max_linewidth         = 132
          IMPORTING
            bin_filesize          = gv_bin_filesize
          TABLES
            otf                   = gt_otf
            lines                 = gt_pdf_tab
          EXCEPTIONS
            err_max_linewidth     = 1
            err_format            = 2
            err_conv_not_possible = 3
            OTHERS                = 4.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Please help me in this regard. Thanks in advance.

    Hi ,
    I am getting this exception "err_conv_not_possible"
    CALL FUNCTION f_name " '/1BCDWB/SF00000092'
          EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
            CONTROL_PARAMETERS       = st_control_parameters
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
         OUTPUT_OPTIONS             = st_output_options
      USER_SETTINGS              = 'X'
            ZST_TEXTSYMBOLS            = ZST_TEXTSYMBOLS
            wa_kna1                    = wa_kna1
            wa_claim_header            = wa_claim_header
       IMPORTING
         DOCUMENT_OUTPUT_INFO       = st_document_output_info
         JOB_OUTPUT_INFO            = st_job_output_info
         JOB_OUTPUT_OPTIONS         = st_job_output_options
          TABLES
            IT_CLAIM_VERSION           = IT_CLAIM_VERSION
            IT_CLAIM_ITEM              = IT_CLAIM_ITEM
            IT_CLAIM_PARTNER           = IT_CLAIM_PARTNER
            IT_FINAL                   = IT_FINAL
       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.
        ELSE.
    CALL FUNCTION 'CONVERT_OTF_2_PDF'
          EXPORTING
             USE_OTF_MC_CMD               = 'X'
        ARCHIVE_INDEX                =
          IMPORTING
          BIN_FILESIZE   = v_bin_filesize
          TABLES
          OTF = st_job_output_info-OTFDATA[]
          DOCTAB_ARCHIVE = it_docs
          LINES  = it_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.
        ENDIF.
    HERE when i tried to debug it i got SY-SUBRC = 1.
    Please help me in this regard. Thanks in advance.

  • Purchase order smart form - e-mail smartform output and item attachments

    Hi,
    Our release is ECC5.0. By configuration the PO smartform can be e-mailed to vendor as PDF attachment by standard output medium,external send. And this already works. However, the additional functionality required is:
    1.) The documents attached to the actual PO line items should also be e-mailed as attachments to the vendor.
    How can I accomplish this?
    Do I need to write addition logic in my print program to retrieve these attachments by PO number and send them as a seperate e-mail with attachment? OR
    Is there any way to send these attachments on the same e-mail where the PO is sent as a PDF attachment. OR
    Can this be done by configuration?
    Regards,
    K..

    Hi Ahmad ,
    I got the same problem with a little more complexity because the mail can b send to several mails adresses ( some in copy ).
    For the requirement to send also the document linked in PO's item , there's no standard solution . So you need to write a specific program for this .
    You can have a look at this Sending DMS documents  as Email attachments , you will find information on how to retrieve the content of the document.
    Let me know if you need more explanation.
    Best regards.

  • Problem in converting smartforms output in pdf

    Hi all..
    I am trying to convert smartform's output in PDF file..
    I am able to convert smartforms's output in PDF but after that i can't see Print Preview..
    Code is following...
    REPORT ZMM_R402_FORM_TEST11.
    TABLES : VBRK,J_1IEXCHDR.
    SELECTION-SCREEN : BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-000.
    *PARAMETERS : EXNUM TYPE EXNUM OBLIGATORY.
    SELECT-OPTIONS : EXNUM FOR J_1IEXCHDR-EXNUM NO-EXTENSION OBLIGATORY.
    PARAMETERS : EXDAT LIKE J_1IEXCHDR-EXDAT OBLIGATORY.
    PARAMETERS : KUNNR LIKE VBRK-KUNAG OBLIGATORY.
    PARAMETERS : SR_NO(12) TYPE C.
    PARAMETERS : DATE1 TYPE EXDAT.
    SELECTION-SCREEN : END OF BLOCK BLK.
    DATA : FM_NAME(30) TYPE C.
    DATA : SR(12) TYPE C.
    UNPACK EXNUM-LOW TO EXNUM-LOW.
    UNPACK EXNUM-HIGH TO EXNUM-HIGH.
    DATA:
          it_otf                 TYPE STANDARD TABLE OF itcoo,
          it_docs               TYPE STANDARD TABLE OF docs,
          it_lines               TYPE STANDARD TABLE OF tline.
    Declaration of local variables.
    DATA:
          st_job_output_info            TYPE ssfcrescl,
          st_document_output_info  TYPE ssfcrespd,
          st_job_output_options       TYPE ssfcresop,
          st_output_options              TYPE ssfcompop,
          st_control_parameters       TYPE ssfctrlop,
          v_len_in                              TYPE so_obj_len,
          v_language                         TYPE sflangu VALUE 'E',
          v_e_devtype                      TYPE rspoptype,
          v_bin_filesize                      TYPE i,
          v_name                               TYPE string,
          v_path                                TYPE string,
          v_fullpath                           TYPE string,
          v_filter                                TYPE string,
          v_uact                                TYPE i,
          v_guiobj                             TYPE REF TO
    cl_gui_frontend_services,
          v_filename                         TYPE string,
          v_fm_name                        TYPE rs38l_fnam.
    CONSTANTS c_formname        TYPE tdsfname VALUE 'ZTEST'.
    *CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
    EXPORTING
       i_language          = v_language
       i_application        = 'SAPDEFAULT'
    IMPORTING
       e_devtype           = v_e_devtype.
    st_output_options-tdprinter = v_e_devtype.
    st_control_parameters-no_dialog = ' '.
    st_control_parameters-getotf = 'X'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZMM_402_FORM'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  =  FM_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.
    **WRITE:/ FM_NAME.
    CALL FUNCTION FM_NAME
      EXPORTING
      control_parameters            = st_control_parameters
        output_options              = st_output_options
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
        EXNUM                      = EXNUM-LOW
        EXNUM1                     = EXNUM-HIGH
        DATE                       = EXDAT
        KUNNR                      = KUNNR
        SR                         = SR_NO
        DATE1                      = DATE1
    IMPORTING
       document_output_info        = st_document_output_info
        job_output_info            = st_job_output_info
        job_output_options         = st_job_output_options
      DOCUMENT_OUTPUT_INFO       =   W_RETURN
      JOB_OUTPUT_INFO            =
      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.
    .........................CONVERT TO OTF TO PDF.......................
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
        IMPORTING
          bin_filesize                 = v_bin_filesize
        TABLES
          otf                             = st_job_output_info-otfdata
          doctab_archive         = it_docs
          lines                          = it_lines
        EXCEPTIONS
          err_conv_not_possible     = 1
          err_otf_mc_noendmarker = 2
          OTHERS                            = 3.
    ........................GET THE FILE NAME TO STORE....................
      CONCATENATE 'smrt' '.pdf' INTO v_name.
      CREATE OBJECT v_guiobj.
      CALL METHOD v_guiobj->file_save_dialog
        EXPORTING
          default_extension  = 'pdf'
          default_file_name  = v_name
          file_filter                 = v_filter
        CHANGING
          filename                 = v_name
          path                       = v_path
          fullpath                  = v_fullpath
          user_action            = v_uact.
      IF v_uact = v_guiobj->action_cancel.
        EXIT.
      ENDIF.
    ..................................DOWNLOAD AS FILE....................
      MOVE v_fullpath TO v_filename.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          bin_filesize              = v_bin_filesize
          filename                  = v_filename
          filetype                   = 'BIN'
        TABLES
          data_tab                = it_lines
        EXCEPTIONS
          file_write_error            = 1
          no_batch                      = 2
          gui_refuse_filetransfer = 3
          invalid_type                 =   4
          no_authority                =   5
          unknown_error             =   6
          header_not_allowed     =   7
          separator_not_allowed =   8
          filesize_not_allowed      =   9
          header_too_long           = 10
          dp_error_create            = 11
          dp_error_send               = 12
          dp_error_write               = 13
          unknown_dp_error         = 14
          access_denied                = 15
          dp_out_of_memory        = 16
          disk_full                           = 17
          dp_timeout                      = 18
          file_not_found                 = 19
          dataprovider_exception  = 20
          control_flush_error          = 21
          OTHERS                           = 22.
    ENDIF.
    Please Help me ..
    How can i see print preview..

    use like this:
       call function lf_fm_name
               exporting
                        archive_index        = toa_dara
                        archive_parameters   = arc_params
                        control_parameters   = ls_control_param         "Smart Forms: Control structure
                        mail_recipient       = ls_recipient
                        mail_sender          = ls_sender                "Structure for Object ID
                        output_options       = ls_composer_param        "SAP Smart Forms: Smart Composer (transfer) options
                        user_settings        = ' '
                        is_dlv_delnote       = ls_dlv_delnote           "Delivery Note Data: Transfer-Structure for Smartform
                        is_nast              = nast                     "Nast
             exceptions formatting_error     = 1
                        internal_error       = 2
                        send_error           = 3
                        user_canceled        = 4
                        others               = 5.
            if sy-subrc <> 0.
      error handling
              cf_retcode = sy-subrc.
              perform protocol_update.
        get SmartForm protocoll and store it in the NAST protocoll
              perform add_smfrm_prot.                  "INS_HP_335958
            endif.
    *To read the Spool Number generated
            read table it_job_output_info-spoolids into v_rspoid index 1.
    concatenate 'aBC.pdf' into v_file_name.
    submit rstxpdft4 and return
              with   spoolno = v_rspoid
              with   p_file  = v_file_name.
              clear: v_rspoid.

  • Having problem sending mail to yahoo using a yahoo id(SendMailException)

    Hi, I read almost all the post's related to javamail,but none of them seems to help me, and hence the reason for this post,
    i've written a simple application(with reference to the one implemented on sun's site) that sends a message to a yahoo id using a yahoo id,
    meaning
    [email protected](recepient) and [email protected](sender)
    the code is given below:
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import javax.mail.Authenticator;
    public class MailSender
         String host = "smtp.mail.yahoo.com";
         String from = "[email protected]";
         String to = "[email protected]";
         public void sendMessage()
              try
                   Properties props = System.getProperties();
                   props.put("mail.smtp.host", host);
                   props.put("mail.smtp.auth","true");
                   Authenticator auth = new MyAuthenticator();
                   Session session = Session.getInstance(props,auth);
                   session.setDebug(true);
                   MimeMessage message = new MimeMessage(session);
                   message.setFrom(new InternetAddress(from));
                   message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
                   message.setSubject("Hello JavaMail");
                   message.setText("Welcome to JavaMail");
                   message.saveChanges(); // implicit with send()
                   Transport.send(message);
              catch(Exception e)
                   System.out.println("Sorry could not complete your Request, you have an error "+ e);
                   e.printStackTrace();
         public static void main(String args[])     
              MailSender ms= new MailSender();
              ms.sendMessage();
         private class MyAuthenticator extends Authenticator
         public PasswordAuthentication getPasswordAuthentication() {
              return new PasswordAuthentication("someoneelse","password");
    It compiles but when i execute it i get a nested exception
    nested exception is:
    javax.mail.AuthenticationFailedException
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.AuthenticationFailedException
    at javax.mail.Transport.send0(Transport.java:218)
    at javax.mail.Transport.send(Transport.java:80)
    at MailSender.sendMessage(MailSender.java:32)
    at MailSender.main(MailSender.java:45)
    Does anyone know a solution to this problem?

    Sure, you can put a local mail server on ur machine to test out sending and receiving in javamail. There r several mail server implementations out there, I personally prefer James (available at http://apache.org) It is pure java based mail server providing full POP3 and SMTP functionality.
    Once u configure a local mail server, u can use emailids like xyz@localhost or acme@localhost

  • Premature end of file Problem in Mail-Adapter by using StrictXml2PlainBean

    Hello Experts,
    I tried a simple File to Mail scenario with the following test message and received the expected attachment:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_TEST_FlatMessage xmlns:ns0="urn:lynx.de:pi:test:bw_extractor">
         <elemente>
              <Kundennummer>4711</Kundennummer>
              <RechnungsNr>0001</RechnungsNr>
              <Umsatz>234,67</Umsatz>
              <Anzahl>34</Anzahl>
              <Versand>12,00</Versand>
              <PosNr>0001</PosNr>
         </elemente>
         <elemente>
              <Kundennummer>4711</Kundennummer>
              <RechnungsNr>0002</RechnungsNr>
              <Umsatz>1900,25</Umsatz>
              <Anzahl>100</Anzahl>
              <Versand>50</Versand>
              <PosNr>0002</PosNr>
         </elemente>
    </ns0:MT_TEST_FlatMessage>
    Everything is fine. Now I want to transform the message in a CSV-Attachment and joined the Module
    1     AF_Modules/StrictXml2PlainBean     Local Enterprise Bean     0
    as first entry in the sequence with the following configuration:
    Key  Parameter                          Value
    0     addHeaderLine                fromXML
    0      elemente.endSeparator      \r\n
    0     elemente.fieldSeparator        ;
    0     singleRecordType                elemente
    But now I the adapter gets the error:  Premature end of file
    What did I wrong?

    >
    Dirk Koch wrote:
    > as first entry in the sequence with the following configuration:
    >
    > Key  Parameter                          Value
    > 0     addHeaderLine                fromXML
    > 0      elemente.endSeparator      \r\n
    > 0     elemente.fieldSeparator        ;
    > 0     singleRecordType                elemente
    >
    >
    > But now I the adapter gets the error:  Premature end of file
    >
    > What did I wrong?
    try
    0      elemente.endSeparator      'nl'

  • Is anyone else having a problem in mail everytime an apostrophe is used?

    I am having a problem in Mail, everytime I use an apostrophe. It refuses to add the second l in I'll it jumps it to the next line. Anyone else have this issue?

    Quite a few people are; though, many are not.
    Two workarounds have been noted on other threads.
    Disable Smart Quotes in Edit Menu, Substitutions.
    Set spelling check to be as you type instead of when sending.
    Each workaround works for some, but not others. Some people, like me, don't have the problem at all.

  • Error "number out of range" in pdf sent through mail using smartform output

    Hi Experts,
    We have a program which sends mail using smartform output in 'PDF' format. We are able to preview smartform correctely in SAP and mail is also getting sent fine with attachment of form as PDF document. But, when we try to open the document, it gives error saying 'Number out of range'. Also, not all of the windows of smartform are appearing in document and some are coming only half.
    We are not able to find out the reason for this. Any help would be appriciated.
    Gouri.

    Hello,
    How did you solve this one? We are facing the same problem in ECC6.0.
    Thanks in advance,
    Benjamin de Rijke

  • Problems sending mail with txt attachtment using SO_DOCUMENT_SEND_API1 MF

    Hi gurus,
    I allready tried to search in the forum some threads related with my problem, but i couldnt found any with the same problem that im having.
    My problem it's when attachting an txt file, using MF SO_DOCUMENT_SEND_API1 MF, the mail attachtment it's coming with the txt file but instead of coming with the all lines in the contents_bins table the file it's coming with a few lines. I think the problem it's that the txt file should come with 80 characters per line, like it's on the contents_bin table, buu instead that the MF it's filling me each line of the file with 1024 characters.
    Does anyone has ideas what im doing wrong?
    Ps - Below goes my code.
    Thanks in Advance,
    Best Regards,
    João Martins.
      CLEAR contents_bin.
      REFRESH contents_bin.
      PERFORM get_attachment TABLES tab_movimentos contents_bin
                             USING linha_inicial
                             linha_final.
      CLEAR: document_data, tab_lines.
      MOVE 'Aviso Ficheiro Retorno' TO document_data-obj_descr.
      MOVE 'Aviso Ficheiro de Retorno TU' TO document_data-obj_name.
      DESCRIBE TABLE contents_txt LINES tab_lines.
      READ TABLE contents_txt INDEX tab_lines.
      document_data-doc_size = ( tab_lines - 1 ) * 255
                               + STRLEN( contents_txt ).
      CLEAR packing_list.
      REFRESH packing_list.
      packing_list-transf_bin = space.
      packing_list-head_start = 1.
      packing_list-head_num = 0.
      packing_list-body_start = 1.
      DESCRIBE TABLE contents_txt LINES packing_list-body_num.
      packing_list-doc_type = 'RAW'.
      APPEND packing_list.
      packing_list-transf_bin = 'X'.
      packing_list-head_start = 1.
      packing_list-head_num   = 1.
      ADD 1 TO tab_lines.
      packing_list-body_start = tab_lines.
      CLEAR: lv_filename, tab_lines.
      CONCATENATE 'Fich Retorno -' nome_ficheiro INTO lv_filename.
      DESCRIBE TABLE contents_bin LINES tab_lines.
      packing_list-doc_type   =  'TXT'.
      packing_list-obj_descr  =  'Ficheiro Retorno'.
      packing_list-obj_name   =  lv_filename.
      packing_list-doc_size   =  tab_lines * 255.
      APPEND packing_list.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = document_data
                put_in_outbox              = 'X'
                sender_address             = 'SIFJOB'
                sender_address_type        = 'B'
           IMPORTING
                sent_to_all                = sent_to_all
           TABLES
                packing_list               = packing_list
                contents_bin               = contents_bin
                contents_txt               = contents_txt
                receivers                  = tab_receiver
           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.
      SUBMIT rsconn01 WITH mode = 'INT'
                  WITH output = SPACE
                  AND RETURN.
    FORM get_attachment TABLES   p_tab_movimentos STRUCTURE
                                 zlinha_movimentos_fich_retorno
                                 p_contents_bin STRUCTURE contents_bin
                        USING    p_linha_inicial STRUCTURE
                                 zlinha_inicial_ps2
                                 p_linha_final STRUCTURE
                                 zlinha_final_ps2.
      DATA: lv_valor(14).
      DATA : line(80) TYPE x.
      CONCATENATE p_linha_inicial-referencia p_linha_inicial-tipo_registo
      p_linha_inicial-tipo_operacao p_linha_inicial-situacao_conta
      p_linha_inicial-situacao_registo p_linha_inicial-iban+4(21)
      p_linha_inicial-moeda p_linha_inicial-data_pag
      p_linha_inicial-ref_ordenante p_linha_inicial-filler
      INTO p_contents_bin-line.
      CLEAR line.
      conv_bin p_contents_bin-line line.
      MOVE line TO p_contents_bin-line.
      APPEND p_contents_bin.
      CLEAR p_contents_bin.
      LOOP AT p_tab_movimentos.
        CLEAR: lv_valor.
        WRITE p_tab_movimentos-montante TO lv_valor.
        PERFORM normalize_value USING lv_valor.
        CONCATENATE p_tab_movimentos-referencia
          p_tab_movimentos-tipo_registo p_tab_movimentos-tipo_operacao
          p_tab_movimentos-sit_conta_retor p_tab_movimentos-situacao_registo
          p_tab_movimentos-nib lv_valor
          p_tab_movimentos-ref_ordenante p_tab_movimentos-filler
          INTO p_contents_bin-line.
        CLEAR line.
        conv_bin p_contents_bin-line line.
        MOVE line TO p_contents_bin-line.
        APPEND p_contents_bin.
        CLEAR p_contents_bin.
      ENDLOOP.
      CLEAR: lv_valor.
      WRITE p_linha_final-mont_total TO lv_valor.
      PERFORM normalize_value USING lv_valor.
      CONCATENATE p_linha_final-referencia p_linha_final-tipo_registo
        p_linha_final-tipo_operacao p_linha_final-filler_1
        p_linha_final-situacao_registo p_linha_final-filler_2
        p_linha_final-total_reg lv_valor
        p_linha_final-filler INTO p_contents_bin-line.
      CLEAR line.
      conv_bin p_contents_bin-line line.
      MOVE line TO p_contents_bin-line.
      APPEND p_contents_bin.
      CLEAR p_contents_bin.
    ENDFORM.                    " get_attachment

    Hi,
    I've solved this problem. The problem was because i was using the
    * Anexo - Descrição
      packing_list-transf_bin = 'X'.
      packing_list-head_start = 1. "Here it must be 0 because i wasn't using any table header
      packing_list-head_num   = 0.
      ADD 1 TO tab_lines.
      packing_list-body_start = 1.
      CLEAR: lv_filename, tab_lines.
      CONCATENATE nome_ficheiro 'TB' INTO lv_filename.
    *  CONCATENATE 'Fich Retorno -' nome_ficheiro INTO lv_filename.
      DESCRIBE TABLE contents_bin LINES tab_lines.
      packing_list-doc_type   =  'TXT'.
      packing_list-obj_descr  =  lv_filename."'Ficheiro Retorno'.
      packing_list-obj_name   =  lv_filename.
      packing_list-body_num = tab_lines.
      packing_list-doc_size   =  tab_lines * 255.
      APPEND packing_list.
    Best Regards
    Thanks,
    João Martins

  • Smartform output to a PDF file, using it as an attachment to send the mail.

    Hi,
    I have a smartform output, which needs to be converted to PDF file and it should be mailed to a user as an attachment.
    Could anyone please tell me how this can be done.
    Thanks & Regards,
    Goutham.

    Hi ,
    Find the code below:
    Reward if helpful
    *&      Form  smart_form_process
          Make calls to required functions exporting GT_INTERFACE
    FORM smart_form_process CHANGING cf_retcode TYPE sy-subrc.
    Smart form data
    DATA:
      w_ssfname         TYPE tdsfname,             "Smart form name
      lf_fm_name        TYPE rs38l_fnam.           "Function module name
    Local data:
      DATA:
        ls_control_param  TYPE ssfctrlop,           "Control paramters
        ls_output_options TYPE ssfcompop.           "Output options
    Data for email smart form:
      DATA:
        lv_ip_mailaddr  TYPE so_name,               "Address of a Mail Recipient
        lv_ip_type_id   TYPE so_escape,             "Recipient type
        ls_recipient_id TYPE swotobjid,             "Structure for recvr obj ID
        ls_sender_id    TYPE swotobjid.             "Structure for sender obj id
    Constants:
      CONSTANTS:
        lc_ip_type_id TYPE so_escape VALUE 'U',               "For internet address.
        lc_smartform  TYPE tdsfname VALUE 'ZVSF_ASN_DELNOTE', "Smart form name
        lc_mail       TYPE tddevice VALUE 'MAIL'.             "Mail device
    Assign recipient
      lv_ip_mailaddr = gv_smtp_addr.                "CSAM email id
      lv_ip_type_id  = lc_ip_type_id.               "External address
    Create Mail title
      CONCATENATE text-001
                  nast-objky
             INTO ls_output_options-tdtitle.
    Create recipient object
      CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF'
        EXPORTING
          ip_mailaddr       = lv_ip_mailaddr
          ip_type_id        = lv_ip_type_id
        IMPORTING
          ep_recipient_id   = ls_recipient_id
        EXCEPTIONS
          invalid_recipient = 1
          OTHERS            = 2.
      IF sy-subrc <> 0.
      error handling
        cf_retcode = sy-subrc.
        PERFORM protocol_update.
      ENDIF.
    Get sender object id.
      CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF'
        EXPORTING
          ip_sender      = sy-uname
        IMPORTING
          ep_sender_id   = ls_sender_id
        EXCEPTIONS
          invalid_sender = 1
          OTHERS         = 2.
      IF sy-subrc <> 0.
      error handling
        cf_retcode = sy-subrc.
        PERFORM protocol_update.
      ENDIF.
    Assign the smart form name
      w_ssfname = lc_smartform.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = w_ssfname
        IMPORTING
          fm_name            = lf_fm_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
      error handling
        cf_retcode = sy-subrc.
        PERFORM protocol_update.
      ENDIF.
    For email output.
    Output options
      ls_output_options-BCS_COMMIT = 'X'.
        ls_control_param-device  = lc_mail.
      ENDIF.
    dynamically call Fm behind the Smart form
      CALL FUNCTION lf_fm_name
        EXPORTING
          control_parameters = ls_control_param
          mail_recipient     = ls_recipient_id
          mail_sender        = ls_sender_id
          output_options     = ls_output_options
          user_settings      = ' '
        TABLES
          delivery           = gt_delivery
        EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4
          OTHERS             = 5.
      IF sy-subrc <> 0.
    Error handling
        cf_retcode = sy-subrc.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                                        " smart_form_process

  • 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

  • Send smartform output by mail

    Hi, im tring to use the SO_DOCUMENT_SEND_API1 FM to send a smartform output by mail. Im able to convert the smartform output to pdf and save it to teh hard drive and works great but when i try to send the pdf doc by mail it comes corrupted... can anyone help me on this... heres a piece of my code
      call function 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
          max_linewidth         = 132
        IMPORTING
          bin_filesize          = v_len_in
        TABLES
          otf                   = i_otf
          lines                 = i_tline
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          others                = 4.
    * Fehlerhandling
      if sy-subrc <> 0.
      endif.
    ******* I THINK THE ERROR MAYBE ON THIS PIECE OF CODE ************
      loop at i_tline.
        translate i_tline using ' ~'.
        concatenate wa_buffer i_tline into wa_buffer.
      endloop.
      translate wa_buffer using '~ '.
      do.
        i_record = wa_buffer.
        append i_record.
        shift wa_buffer left by 255 places.
        if wa_buffer is initial.
          exit.
        endif.
      enddo.
    ***************** it message ****************************************
      refresh it_message.
      it_message = 'Em anexo vai a tabela interna de utilizadores '.
      APPEND it_message.
      it_message = 'Clique no link '.
      APPEND it_message.
    **************** Assunto do Email *****************
    * Fill the document data and get size of attachment
      CLEAR w_doc_data.
      DESCRIBE TABLE It_message LINES x.
      READ TABLE It_message INDEX x.
      w_doc_data-DOC_SIZE =
                   ( x - 1 ) * 255 + STRLEN( It_message ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = 'ASSUNTO EMAIL'.
      w_doc_data-sensitivty = 'F'.
    ************************ fim assunto email *********************
      data linha type i.
      data lv_cntl type i.
      CLEAR t_attachment.
      REFRESH t_attachment.
    ************************** Mensagem ******************
    * Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      clear t_packing_list-transf_bin.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      describe table it_message lines t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    ***************************-Filling the attch table with data  *************************
      CLEAR : L_TABLE_LINES.
    *  clear wa_objhead.
    *  loop at i_record.
      t_attachment[] = i_tline[].
    *    append t_attachment.
    *  endloop.
    * Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES L_TABLE_LINES.
      t_packing_list-body_num = L_TABLE_LINES.
      t_packing_list-obj_descr = 'output'.
      t_packing_list-doc_type   =  'BIN'.
      t_packing_list-doc_size   =  L_TABLE_LINES * 255.
      t_packing_list-obj_langu  = sy-langu.
      t_packing_list-obj_name   = 'Teste'.
      APPEND t_packing_list.
    *************** Endereços de email dos destinatários *************************
      CLEAR receivers.
      REFRESH receivers.
      receivers-receiver = '[email protected]'.
      receivers-rec_type = 'U'.
      receivers-com_type = 'INT'.
      receivers-notif_del = 'X'.
      receivers-EXPRESS = 'X'.
    *  receivers-notif_ndel = 'X'.
      APPEND receivers.
    ************************Fim de email dos Dest.  ******************************
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA                    = w_doc_data
          PUT_IN_OUTBOX                    = 'X'
    *   SENDER_ADDRESS                   =  ld_sender_address
    *   SENDER_ADDRESS_TYPE              = ld_sender_address_type
          COMMIT_WORK                      = 'X'
       IMPORTING
          SENT_TO_ALL                      = w_sent_all
    *   NEW_OBJECT_ID                    =
    *   SENDER_ID                        =
        TABLES
          PACKING_LIST                     = t_packing_list
    *      OBJECT_HEADER                    = wa_objhead
          CONTENTS_BIN                     = t_attachment
          CONTENTS_TXT                     = it_message
    *   CONTENTS_HEX                     = contents_hex
    *   OBJECT_PARA                      =
    *   OBJECT_PARB                      =
          RECEIVERS                        = receivers
       EXCEPTIONS
         TOO_MANY_RECEIVERS               = 1
         DOCUMENT_NOT_SENT                = 2
         DOCUMENT_TYPE_NOT_EXIST          = 3
         OPERATION_NO_AUTHORIZATION       = 4
         PARAMETER_ERROR                  = 5
         X_ERROR                          = 6
         ENQUEUE_ERROR                    = 7
         OTHERS                           = 8.
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      wait up to 2 seconds.
      if sy-subrc eq 0.
        submit rsconn01 "with mode = 'INT'
    *with output = 'X'
        and return.
      endif.

    Hi Joao,
    Try using this code .
    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Sending HTML Mails using SO_DOCUMENT_SEND_API1

    Dear all,
    we were using SO_DOCUMENT_SEND_API1 to send plain text e-mail replies to participants of an incentive program. Now the customer wants to send HTML mails. Customer has provided HTML templates for the mails, and the text always is the same, only slight changes in regard to the particpants number occur. Has anybody ever performed sending HTML formated mails without using SmartForms?
    Thanks for your help!
    Kind Regards
    Chris

    Sure.. here is a sample program.
    report zrich_0002.
    data: maildata   like sodocchgi1.
    data: mailtxt    like solisti1 occurs 10 with header line.
    data: mailrec    like somlrec90 occurs 0  with header line.
    start-of-selection.
      clear:    maildata, mailtxt,  mailrec.
      refresh:  mailtxt, mailrec.
      perform build_text_message.
      perform build_receivers.
      perform send_mail_nodialog..
    *      Form  BUILD_TEXT_MESSAGE
    form build_text_message.
      maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test Subject'.
      mailtxt  = '<html>'.
      append mailtxt.
      mailtxt  = '<head>'.
      append mailtxt.
      mailtxt  = '<title>Untitled Document</title>'.
      append mailtxt.
      mailtxt  = '<meta http-equiv="Content-Type" content="text/html;'.
      append mailtxt.
      mailtxt  = 'charset=iso-8859-1">'.
      append mailtxt.
      mailtxt  = '</head>'.
      append mailtxt.
      mailtxt  = '<body>'.
      append mailtxt.
      mailtxt  = '<div align="center"><em><font' .
      append mailtxt.
      mailtxt  = 'color="#0000FF" size="+7" face="Arial,'.
      append mailtxt.
      mailtxt  = 'Helvetica, sans-serif">THIS'.
      append mailtxt.
      mailtxt  = '  IS A TEST </font></em><font' .
      append mailtxt.
      mailtxt  = 'color="#0000FF" size="+7" face="Arial,'.
      append mailtxt.
      mailtxt  = 'Helvetica, sans-serif"></font>'.
      append mailtxt.
      mailtxt  = '</div>'.
      append mailtxt.
      mailtxt  = '</body>'.
      append mailtxt.
      mailtxt  = '</html>'.
      append mailtxt.
    endform.
    *      Form  BUILD_RECEIVERS
    form build_receivers.
    *  mailrec-receiver = '[email protected]'.
      mailrec-rec_type  = 'U'.
      append mailrec.
    endform.
    *      Form  SEND_MAIL_NODIALOG
    form send_mail_nodialog.
      call function 'SO_NEW_DOCUMENT_SEND_API1'
           exporting
                document_data              = maildata
                document_type              = 'HTM'
                put_in_outbox              = 'X'
           tables
                object_header              = mailtxt
                object_content             = mailtxt
                receivers                  = mailrec
           exceptions
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                others                     = 8.
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.
    Regards,
    Rich Heilman

Maybe you are looking for