How to send smart form as mail?

Hello everybody,
I have used the following code to send a smartform in PDF format through email.
I m able to view the contents of the mail in SAP Bussiness Workplace but UNABLE TO TRANSFER THE MAIL to an INTERNET ID (like gmail id or yahoo id).
Can anybody suggest me about what might have gone wrong?
Helpful answers will surely be rewarded.
code
  DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
  i_tline TYPE TABLE OF tline WITH HEADER LINE,
  i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
  i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
  i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
  i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
  i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
  i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
  wa_objhead TYPE soli_tab,
  w_ctrlop TYPE ssfctrlop,
  w_compop TYPE ssfcompop,
  w_return TYPE ssfcrescl,
  wa_doc_chng TYPE sodocchgi1,
  w_data TYPE sodocchgi1,
  wa_buffer TYPE string,"To convert from 132 to 255
Variables declarations
*v_form_name TYPE rs38l_fnam, " L_FM_NAME
  v_len_in LIKE sood-objlen,
  v_len_out LIKE sood-objlen,
  v_len_outn TYPE i,
  v_lines_txt TYPE i,
  v_lines_bin TYPE i.
  DATA: l_fm_name TYPE rs38l_fnam.
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname                 = p_l_formname
  VARIANT                  = ' '
  DIRECT_CALL              = ' '
   IMPORTING
     fm_name                   = l_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.
  IF g_it3 = 'M'.
    g_it3 = 'Mr'.
  ENDIF.
  IF g_it3 = 'F'.
    g_it3 = 'Ms'.
  ENDIF.
  CALL FUNCTION l_fm_name
    EXPORTING
  ARCHIVE_INDEX              =
  ARCHIVE_INDEX_TAB          =
  ARCHIVE_PARAMETERS         =
  CONTROL_PARAMETERS         =
  MAIL_APPL_OBJ              =
  MAIL_RECIPIENT             =
  MAIL_SENDER                =
  OUTPUT_OPTIONS             =
  USER_SETTINGS              = 'X'
      it                         =     g_it
      it1                        =     g_it1
      it3                        =     g_it3
      it4                        =     g_it4
      it5                        =     g_it5
      it6                        =     g_it6
      it7                        =     g_it7
      it8                        =     g_it8
      it10                       =     g_it10
      it14                       =     g_it14
      it15                       =     g_it15
      it36                       =     g_it36
      it18                       =     g_it18
      it37                       =     g_it37
      it19                       =     g_it19
      it9                        =     g_it9
      it11                       =     g_it11
      it13                       =     g_it13
      it39                       =     g_it39
      it40                       =     g_it40
      it20                       =      g_it20
      it21                       =      g_it21
      it22                       =      g_it22
      it23                       =      g_it23
      it25                       =      g_it25
      it26                       =      g_it26
      it27                       =      g_it27
      it28                       =      g_it28
      it29                       =      g_it29
      it30                       =      g_it30
      it31                       =      g_it31
      it32                       =      g_it32
      it33                       =      g_it33
      total                      =      g_total
      it34                       =      g_it34
      it35                       =      g_it35
      it2                        =     pa0006-begda
      it12                       =     pa0001-begda
      it16                       =     pa0015-begda
      it17                       =     pa0001-endda
      it24                       =      pa0002-endda
      it38                       =     pa0002-begda
IMPORTING
  DOCUMENT_OUTPUT_INFO       =
  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.
g_semail = 'X'.
IF g_semail = 'X'.
    w_ctrlop-getotf = 'X'.
    w_ctrlop-no_dialog = 'X'.
    w_compop-tdnoprev = 'X'.
    CALL FUNCTION l_fm_name
      EXPORTING
        control_parameters = w_ctrlop
        output_options     = w_compop
        user_settings      = 'X'
      IMPORTING
        job_output_info    = w_return
      EXCEPTIONS
        formatting_error   = 1
        internal_error     = 2
        send_error         = 3
        user_canceled      = 4
        OTHERS             = 5.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    i_otf[] = w_return-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        format                = 'PDF'
        max_linewidth         = 132
      IMPORTING
        bin_filesize          = v_len_in
      TABLES
       otf                   = i_otf
        otf                   = i_otf
       lines                 = i_tline
        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.
*convert PDF from 132 to 255
    LOOP AT i_tline.
*Replacing space by '~'.
      TRANSLATE i_tline USING '~'.
      CONCATENATE wa_buffer i_tline INTO wa_buffer.
    ENDLOOP.
*Repalacing '~' by space.
    TRANSLATE wa_buffer USING '~'.
    DO.
      i_record = wa_buffer.
*Appending 255 characters as a record.
      APPEND i_record.
      SHIFT wa_buffer LEFT BY 255 PLACES.
      IF wa_buffer IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
Attachment
    REFRESH:
    i_reclist,
    i_objtxt,
    i_objbin,
    i_objpack.
    CLEAR wa_objhead.
*Object with PDF.
    i_objbin[] = i_record[].
    DESCRIBE TABLE i_objbin LINES v_lines_bin.
Create Message Body
Title and Description
*Object with main text of the mail.
    i_objtxt = 'Find attached the output of the smartform'.
    APPEND i_objtxt.
    i_objtxt = 'Regards'.
    APPEND i_objtxt.
    i_objtxt = 'Lokesh'.
    APPEND i_objtxt.
    DESCRIBE TABLE i_objtxt LINES v_lines_txt.
   READ TABLE i_objtxt INDEX v_lines_txt.
*Document information.
    wa_doc_chng-obj_name = 'Offer Letter'.
    wa_doc_chng-expiry_dat = sy-datum + 10.
    wa_doc_chng-obj_descr = 'Offer Letter'.
    wa_doc_chng-sensitivty = 'F'.
    wa_doc_chng-doc_size = v_lines_txt * 255.
Main Text
*Pack to main body as RAW.
*Object to be transported not in binary form.
   wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + STRLEN( i_objtxt ).
    CLEAR i_objpack-transf_bin.
    i_objpack-head_start = 1.
    i_objpack-head_num = 0.
    i_objpack-body_start = 1.
    i_objpack-body_num = v_lines_txt.
    i_objpack-doc_type = 'RAW'.
    APPEND i_objpack.
Attachment
(pdf-Attachment)
*Packing as PDF
    i_objpack-transf_bin = 'X'.
    i_objpack-head_start = 1.
    i_objpack-head_num = 1.
    i_objpack-body_start = 1.
Länge des Attachment ermitteln
   DESCRIBE TABLE i_objbin LINES v_lines_bin.
   READ TABLE i_objbin INDEX v_lines_bin.
    i_objpack-doc_size = v_lines_bin * 255 .
    i_objpack-body_num = v_lines_bin.
    i_objpack-doc_type = 'PDF'.
    i_objpack-obj_name = 'smart'.
    i_objpack-obj_descr = 'test'.
    APPEND i_objpack.
    CLEAR i_reclist.
    i_reclist-receiver = '[email protected]'.
    i_reclist-express = 'X'.
    i_reclist-rec_type = 'U'.
    APPEND i_reclist.
*CALL FUNCTION 'LXE_SEND_MAIL_ATTMNT'
EXPORTING
   description                =
  SENSITIVITY                = 'O'
  IN_OUTBOX                  = ' '
tables
   receivers                  =
   document_text              =
  DOCUMENT_ATTMNT            =
  DOCUMENT_ATTMNT_ATTR       =
EXCEPTIONS
  TOO_MANY_RECEIVERS         = 1
  DOCUMENT_NOT_SENT          = 2
  NO_AUTHORIZATION           = 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.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = wa_doc_chng
        put_in_outbox              = 'X'
      TABLES
        packing_list               = i_objpack
        object_header              = wa_objhead
        contents_bin               = i_objbin
        contents_txt               = i_objtxt
        receivers                  = i_reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        document_type_not_exist    = 3
        operation_no_authorization = 4
        parameter_error            = 5
        x_error                    = 6
        enqueue_error              = 7
        OTHERS                     = 8.
    IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ELSE.
      MESSAGE 'success' TYPE 'I'.
    ENDIF.
ENDIF.
ENDFORM.                    " GET_OFFER_LETTER

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

Similar Messages

  • Adobe PDF-based print forms - how to send pdf-form by mail?

    Hello All.
    I have created a PDF-form and now I want to send the form by mail without
    seeing it on my screen first. I want it to be done in the backround.
    I'm not using java/abap web dynpro.
    Can somebody help me with this?
    Thanks, Barak.

    hi
    good
    go through this link hope this would help you solve your problem
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8cd6adbb-0301-0010-39ba-938c601d5db9
    reward point if helpful.
    thanks
    mrutyun^

  • Default settings for sending smart forms via mail saving it in pdf

    do we have to do any default settings in any trasaction code like scot for solving the above problem

    hi  thanku very much durga prasad
    my mail id is [email protected]

  • For this program i could send the smart form thru mail but in the inbox ..

    *& Report  ZSFOO
    REPORT  ZSFOO.
    *& Report  ZSFINV
    TABLES : KNA1,         " General Data In Customer Master
             KNB1,         " Customer Master(Company Code)
             BSID,         " Accounting: Secondary Index for Customers
             ZSMARTFORM,   " Custom table for Storing Bank Details
             zsf_exp_inv,  " Structure that stores required fields from all tables used
             KNVK.         " Customer Master Contact Partner
    data : Begin of it_struct occurs 0.
            include structure zsf_exp_inv01.
    data : End of it_struct.
    types : begin of ty_bsid,
            kunnr like bsid-kunnr,
            WAERS like bsid-WAERS,
            XBLNR LIKE BSID-XBLNR,
            BUDAT LIKE BSID-BUDAT,
            WRBTR LIKE BSID-WRBTR,
            BUKRS LIKE BSID-BUKRS,
            end of ty_bsid.
    types : begin of ty_kna1,
            kunnr like kna1-kunnr,
            NAME1 LIKE KNA1-NAME1,
            STRAS LIKE KNA1-STRAS,
            MCOD3 LIKE KNA1-MCOD3,
            LAND1 LIKE KNA1-LAND1,
            SORTL LIKE KNA1-SORTL,
            end of ty_kna1.
    types : begin of ty_knb1,
            kunnr like knb1-kunnr,
            ZTERM LIKE KNB1-ZTERM,
            end of ty_knb1.
    types : begin of ty_knVK,
            kunnr like kNVK-kunnr,
            NAME1 LIKE KNVK-NAME1,
            end of ty_knVK.
    types : begin of ty_ZSMARTFORM,
            SNO      LIKE ZSMARTFORM-SNO,
            CURRENCY LIKE zsmartform-currency,
            BANKNAME LIKE zsmartform-bankname,
            ADDRESS1 LIKE ZSMARTFORM-ADDRESS1,
            ADDRESS2 LIKE ZSMARTFORM-ADDRESS2,
            ADDRESS3 LIKE ZSMARTFORM-ADDRESS3,
            ADDRESS4 LIKE ZSMARTFORM-ADDRESS4,
            ADDRESS5 LIKE ZSMARTFORM-ADDRESS5,
            ADDRESS6 LIKE ZSMARTFORM-ADDRESS6,
            VALIDFROM LIKE ZSMARTFORM-VALIDFROM,
            VALIDTO   LIKE ZSMARTFORM-VALIDTO,
            end of ty_ZSMARTFORM.
    data : it_bsid type table of ty_bsid,
           it_kna1 type table of ty_kna1,
           it_knb1 type table of ty_knb1,
           it_zsmartform type table of ty_zsmartform,
           it_knVK type table of ty_kNVK.
    data : wa_bsid like line of it_bsid,
           wa_kna1 like line of it_kna1,
           wa_knb1 like line of it_knb1,
           wa_zsmartform like line of it_zsmartform,
           wa_knVK like line of it_knVK.
    *****************Selection Screen**********************************
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
    SELECT-OPTIONS : S_KUNNR FOR KNA1-KUNNR,
                     S_belnr FOR BSID-belnr,
                     S_BUKRS FOR BSID-BUKRS,
                     S_CURR FOR ZSMARTFORM-CURRENCY.
    SELECTION-SCREEN END OF BLOCK B1.
    DATA : BEGIN OF IT_PARAM OCCURS 0.
            INCLUDE STRUCTURE ZPARAMETERS.
    DATA :  END OF IT_PARAM.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
    SKIP 1.
    Parameters : OPTION1 AS CHECKBOX,
                 P_POINF(300) type c,
                 OPTION2 AS CHECKBOX,
                 P_DESC(300) TYPE C,
                 OPTION3 AS CHECKBOX,
                 P_MONTH(200) TYPE C,
                 OPTION4 AS CHECKBOX,
                 P_RATE(100)  TYPE C.
    SELECTION-SCREEN END OF BLOCK B2.
    **********************PARAMETERS***********************************
    data :  l type i,
            Y(300) type c,
            j type i,
            k type i value 1,
            s type i,
            m(300) type c,
            p type i,
            z type i.
    data :  l1 type i,
            Y1(300) type c,
            j1 type i,
            k1 type i value 1,
            s1 type i,
            m1(300) type c,
            p1 type i,
            z1 type i.
    data :  l2 type i,
            Y2(300) type c,
            j2 type i,
            k2 type i value 1,
            s2 type i,
            m2(300) type c,
            p2 type i,
            z2 type i.
    data :  l3 type i,
            Y3(300) type c,
            j3 type i,
            k3 type i value 1,
            s3 type i,
            m3(300) type c,
            p3 type i,
            z3 type i.
    IF OPTION1 = 'X'.
      concatenate  P_POINF  ',' into P_POINF.
      l = strlen( P_POINF ).
      do l times.
        Y = P_POINF+j(k).
        case Y.
          when ','.
            m = P_POINF+s(z).
            s = j + 1.
            z = -1.
            p = p + 1.
            if p = 1.
              IT_PARAM-LINE1 = m.
            endif.
            if p = 2.
              IT_PARAM-LINE2 = m.
            endif.
            if p = 3.
              IT_PARAM-LINE3 = m.
            endif.
         when '.'.
            if p = 4.
              IT_PARAM-LINE4 = m.
            endif.
        endcase.
        j = j + 1.
        z = z + 1.
      enddo.
    ENDIF.
    IF OPTION2 = 'X'.
      concatenate  P_DESC  ',' into P_DESC.
      l1 = strlen( P_DESC ).
      do l1 times.
        Y1 = P_DESC+j1(k1).
        case Y1.
          when ','.
            m1 = P_DESC+s1(z1).
            s1 = j1 + 1.
            z1 = -1.
            p1 = p1 + 1.
            if p1 = 1.
              IT_PARAM-LINE5 = m1.
            endif.
            if p1 = 2.
              IT_PARAM-LINE6 = m1.
            endif.
            if p1 = 3.
              IT_PARAM-LINE7 = m1.
            endif.
         when '.'.
            if p1 = 4.
              IT_PARAM-LINE8 = m1.
            endif.
        endcase.
        j1 = j1 + 1.
        z1 = z1 + 1.
      enddo.
    ENDIF.
    IF OPTION3 = 'X'.
      concatenate  P_MONTH  ',' into P_MONTH.
      l2 = strlen( P_MONTH ).
      do l2 times.
        Y2 = P_MONTH+j2(k2).
        case Y2.
          when ','.
            m2 = P_MONTH+s2(z2).
            s2 = j2 + 1.
            z2 = -1.
            p2 = p2 + 1.
            if p2 = 1.
              IT_PARAM-LINE9 = m2.
            endif.
            if p2 = 2.
              IT_PARAM-LINE10 = m2.
            endif.
            if p2 = 3.
              IT_PARAM-LINE11 = m2.
            endif.
         when '.'.
            if p2 = 4.
              IT_PARAM-LINe12 = m2.
            endif.
        endcase.
        j2 = j2 + 1.
        z2 = z2 + 1.
      enddo.
    ENDIF.
    IF OPTION4 = 'X'.
      concatenate  P_RATE  ',' into P_RATE.
      l3 = strlen( P_RATE ).
      do l3 times.
        Y3 = P_RATE+j3(k3).
        case Y3.
          when ','.
            m3 = P_RATE+s3(z3).
            s3 = j3 + 1.
            z3 = -1.
            p3 = p3 + 1.
            if p3 = 1.
              IT_PARAM-LINE13 = m3.
            endif.
            if p3 = 2.
              IT_PARAM-LINE14 = m3.
            endif.
            if p3 = 3.
              IT_PARAM-LINE15 = m3.
            endif.
            if p3 = 4.
              IT_PARAM-LINe16 = m3.
            endif.
        endcase.
        j3 = j3 + 1.
        z3 = z3 + 1.
      enddo.
    ENDIF.
    APPEND IT_PARAM.
    select * from kna1 into corresponding fields of table it_kna1 where kunnr in s_kunnr.
    select * from knb1 into corresponding fields of table it_knb1 for all entries in it_kna1 where kunnr = it_kna1-kunnr.
    select * from bsid into corresponding fields of table it_bsid for all entries in it_kna1 where kunnr = it_kna1-kunnr and belnr in s_belnr and bukrs in s_bukrs..
    SELECT * FROM KNVK INTO CORRESPONDING FIELDS OF TABLE IT_KNVK FOR ALL ENTRIES IN IT_KNA1 WHERE KUNNR = IT_KNA1-KUNNR.
    select * from zsmartform into corresponding fields of table it_zsmartform .
    DATA :  AMT LIKE SPELL.
    loop at it_bsid into wa_bsid.
      read table it_kna1 into wa_kna1 with key kunnr = wa_bsid-kunnr.
      read table it_knb1 into wa_knb1 with key kunnr = wa_bsid-kunnr.
      read table it_zsmartform into wa_zsmartform with key  CURRENCY =  wa_bsid-WAERS.
      READ TABLE IT_KNVK INTO WA_KNVK WITH KEY KUNNR = WA_BSID-KUNNR.
      it_struct-name1 = wa_kna1-name1.
      it_struct-stras = wa_kna1-stras.
      it_struct-mcod3 = wa_kna1-mcod3.
      it_struct-land1 = wa_kna1-land1.
      it_struct-sortl = wa_kna1-sortl.
      it_struct-zterm = wa_knb1-zterm.
      it_struct-xblnr = wa_bsid-xblnr.
    it_struct-currency = wa_zsmartform-currency.
      it_struct-currency = wa_bsid-waers.
      it_struct-budat = wa_bsid-budat.
      it_struct-BANKNAME = wa_zsmartform-BANKNAME.
      it_struct-ADDRESS1 = wa_zsmartform-ADDRESS1.
      it_struct-ADDRESS2 = wa_zsmartform-ADDRESS2.
      it_struct-ADDRESS3 = wa_zsmartform-ADDRESS3.
      it_struct-ADDRESS4 = wa_zsmartform-ADDRESS4.
      it_struct-ADDRESS5 = wa_zsmartform-ADDRESS5.
      it_struct-ADDRESS6 = wa_zsmartform-ADDRESS6.
      it_struct-CURR = WA_BSID-WRBTR.
      IT_STRUCT-NAME = WA_KNVK-NAME1.
    IT_STRUCT-AMOUNT = IT_SPELL-AMT.
      append it_struct.
    endloop.
    data : x type i,
           x1 type i,
           a type string.
    loop at it_struct.
      x = strlen( it_struct-curr ).
      x1 = x - 3.
      a = it_struct-curr+0(x1).
      CALL FUNCTION 'SPELL_AMOUNT'
          EXPORTING
            AMOUNT          = a
      CURRENCY        = ' '
      FILLER          = ' '
      LANGUAGE        = SY-LANGU
          IMPORTING
            IN_WORDS        = AMT.
    EXCEPTIONS
      NOT_FOUND       = 1
      TOO_LARGE       = 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.
    endloop.
    DATA: ws_ucomm LIKE sy-ucomm.
    DATA: form_name TYPE rs38l_fnam.
    DATA: wa_ctrlop TYPE ssfctrlop,
    wa_outopt TYPE ssfcompop.
    data : i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
          i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE.
    DATA: t_otfdata TYPE ssfcrescl,
    t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
    i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
          i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
      data : wa_objhead TYPE soli_tab,
      wa_doc_chng typE sodocchgi1,
          w_data TYPE sodocchgi1,
          wa_buffer TYPE string,
          v_len_in LIKE sood-objlen,
          v_len_out LIKE sood-objlen,
          v_len_outn TYPE i,
          v_lines_txt TYPE i,
          v_lines_bin TYPE i.
    DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE string.
    DATA: w_bin_filesize TYPE i.
    wa_ctrlop-getotf = 'X'.
    CALL FUNCTION '/1BCDWB/SF00000001'
    EXPORTING
    control_parameters = wa_ctrlop
    output_options = wa_outopt
    user_settings = 'X'
    IN_WORDS = amt
    importing
    job_output_info = t_otfdata
    TABLES
    I_ZSF_EXP_INV = it_struct
    I_ZPARAMETERS = it_param.
    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
    IMPORTING
    bin_filesize = w_bin_filesize
    TABLES
    otf = t_otf
    lines = t_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.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    bin_filesize = w_bin_filesize
    CODEPAGE = ' '
    filename = 'c:     est59.PDF'
    filetype = 'BIN'
    IMPORTING
    filelength = w_filesize
    TABLES
    data_tab = t_pdf_tab
    EXCEPTIONS
    file_open_error = 1
    file_write_error = 2
    invalid_filesize = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    OTHERS = 10
    IF sy-subrc <> 0.
    *You should include message-id in the report heading
    WRITE : sy-subrc.
    ELSE.
    WRITE : 'File Test.pdf downloaded succesfully'.
    ENDIF.
    loop at t_pdf_tab.
        translate t_pdf_tab using '~'.
        concatenate wa_buffer t_pdf_tab into wa_buffer.
      endloop.
      translate wa_buffer using '~'.
      do.
        i_record = wa_buffer.
        append i_record.
        shift wa_buffer left by 255 places.
        if wa_buffer is initial.
          exit.
        endif.
      enddo.
    Attachment
      refresh:
        i_reclist,
        i_objtxt,
        i_objbin,
        i_objpack.
      clear wa_objhead.
      i_objbin[] = i_record[].
    Create Message Body
    Title and Description
      i_objtxt = 'test with pdf-Attachment!'.
      append i_objtxt.
      describe table i_objtxt lines v_lines_txt.
      read table i_objtxt index v_lines_txt.
      wa_doc_chng-obj_name = 'smartform'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr = 'smartform'.
      wa_doc_chng-sensitivty = 'O'.
      wa_doc_chng-doc_size = v_lines_txt * 255.
    Main Text
    wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt )
      clear i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      append i_objpack.
    i_objpack-transf_bin = 'X'.
    i_objpack-head_start = 1.
    i_objpack-head_num = 1.
    i_objpack-body_start = 1.
    i_objpack-body_num = v_lines_bin.
    i_objpack-doc_type = 'PDF'.
    i_objpack-obj_name = 'Smartform'.
    CONCATENATE 'Hazard report-' p_load '.pdf' INTO i_objpack-obj_descr.
    describe table i_objbin lines v_lines_bin.
    read table i_objbin index v_lines_bin.
    i_objpack-doc_size =  v_lines_bin * 255 .
    i_objpack-obj_descr = 'test'.
    i_objpack-doc_size = v_lines_bin * 255.
    APPEND i_objpack.
    Attachment
    (pdf-Attachment)
    i_objpack-transf_bin = 'X'.
    i_objpack-head_start = 1.
    i_objpack-head_num = 0.
    i_objpack-body_start = 1.
    Länge des Attachment ermitteln
    describe table i_objbin lines v_lines_bin.
    read table i_objbin index v_lines_bin.
    i_objpack-doc_size =  v_lines_bin * 255 .
    i_objpack-body_num = v_lines_bin.
    i_objpack-doc_type = 'PDF'.
    i_objpack-obj_name = 'smart'.
    i_objpack-obj_descr = 'test'.
    append i_objpack.
      clear i_reclist.
      i_reclist-receiver = '[email protected]'.
         i_reclist-express = 'X'.
      i_reclist-rec_type = 'U'.
      append i_reclist.
        call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                  document_data              = wa_doc_chng
                  COMMIT_WORK = 'X'
                  put_in_outbox              = 'X'
             TABLES
                  packing_list               = i_objpack
                  object_header              = wa_objhead
                  CONTENTS_BIN               = i_objbin
                  contents_txt               = i_objtxt
                  receivers                  = i_reclist
             EXCEPTIONS
                  too_many_receivers         = 1
                  document_not_sent          = 2
                  document_type_not_exist    = 3
                  operation_no_authorization = 4
                  parameter_error            = 5
                  x_error                    = 6
                  enqueue_error              = 7
                  others                     = 8.
    for this program i could send the smart form thru mail but in the inbox i could not
    download it it says needed to be decoded properly.file not starting with pdf....
       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 'POPUP_TO_INFORM'
           EXPORTING
             titel = 'Mail sent'(003)
             txt1  = 'The report is sent via e-mail.'(004)
             txt2  = '  '.
         LEAVE PROGRAM.
       ENDIF.

    hi krishna,
    u r right. there is no error  in sending the mail and the file but the problem is that file created and converted to pdf is not done properly.jst verify whether the file is created properly or not .thats the only problem that can occurs else ur program is absolutely right.

  • Need to send Smart form via email through Driver program

    Hi All,
    We need to send smart form via email through a new driver program (z program). Can you please guide me on this.
    I have used the following code to achieve this. We are getting message saying 'Mail request has created' when executed, but the mail is not sent.
    lvs_comm_type = 'INT'.
    lvs_comm_values-adsmtp-SMTP_ADDR = e_mail.
    lvs_comm_values-adsmtp-R3_USER = 'X'.
    lvs_comm_values-adsmtp-ENCODE = '0'.
    call function 'CONVERT_COMM_TYPE_DATA'
    exporting
    pi_comm_type = lvs_comm_type
    pi_comm_values = lvs_comm_values
    pi_screen = ' '
    pi_newid = 'X'
    importing
    pe_itcpo = lvs_itcpo
    pe_device = lvf_device
    pe_mail_recipient = p_mail_recipient
    pe_mail_sender = p_mail_sender
    exceptions
    comm_type_not_supported = 1
    recipient_creation_failed = 2
    sender_creation_failed = 3
    others = 4.
    if sy-subrc ne 0.
    raise COMMUNICATION_ERROR.
    endif.
    control_parameters-device = 'MAIL'.
    output_options-TDIMMED = 'X'.
    output_options-TDDELETE = 'X'.
    CALL FUNCTION fm_name
    exporting
    CONTROL_PARAMETERS = control_parameters
    MAIL_RECIPIENT = mail_recipient
    MAIL_SENDER = mail_sender
    OUTPUT_OPTIONS = output_options
    USER_SETTINGS = space
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    Thank you

    Hi,
    For sending smartform output into mail you first have to generate spool request and convert it into PDF and then
    only it can be sended into mail, please find the sample code in the mail below:
    http://wiki.sdn.sap.com/wiki/display/sandbox/ConversionofSpoolRequestDataintoPDFandExcelFormatandSenditintoMail
    Mansi
    Edited by: Matt on Jan 29, 2010 8:25 AM - removed code, instead point to wiki that Mansi authored.

  • How to send sapmails to external mail systems

    Hi,
    how to send sapmails to external mail systems....
    like if we want to mail a purchase order from SAP System to *@yahaoo.com or @.com.
    TY.

    hi manish,
    u can do it.
    chk this .
    chk this code
    DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
    DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
    DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
    DATA: doc_chng LIKE sodocchgi1.
    *& Form f_send_mail
    text
    --> p1 text
    <-- p2 text
    FORM f_send_mail .
    *store the vendor name, vendor email id , employee name and employee
    *email id in the internal table int_crb
    Creation of the document to be sent
    CLEAR doc_chng.
    REFRESH objpack.
    REFRESH objhead.
    REFRESH reclist.
    REFRESH objtxt.
    File Name
    doc_chng-obj_name = 'SHIPMENT'.
    Mail Subject
    CONCATENATE 'Shipment Document No.' int_crb_mail-shipdocnum
    'Cleared.'
    INTO doc_chng-obj_descr SEPARATED BY ' '.
    Mail Contents
    objtxt-line = 'Hi,'.
    APPEND objtxt.
    objtxt-line = ' '.
    APPEND objtxt.
    CONCATENATE 'Shipment Document Number ' int_crb_mail-shipdocnum
    ' cleared for move.' INTO objtxt-line SEPARATED BY ' '.
    APPEND objtxt.
    objtxt-line = ' '.
    APPEND objtxt.
    CLEAR objtxt.
    objtxt-line = 'Regards '.
    APPEND objtxt.
    objtxt-line = ' '.
    APPEND objtxt.
    objtxt-line = 'SAP '.
    APPEND objtxt.
    CLEAR objtxt.
    APPEND objtxt.
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ TABLE objtxt INDEX tab_lines.
    doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN(
    objtxt ).
    Creation of the entry for the compressed document
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'RAW'.
    APPEND objpack.
    Completing the recipient list
    target recipent
    CLEAR reclist.
    reclist-receiver = int_crb_mail-empperid. "employee email ID
    "wf_empperid.
    reclist-express = 'X'.
    reclist-rec_type = 'U'.
    APPEND reclist.
    copy recipents
    CLEAR reclist.
    reclist-receiver = int_crb_mail-smtp_addr."vendor email id
    reclist-express = 'X'.
    reclist-rec_type = 'U'.
    reclist-copy = 'X'.
    APPEND reclist.
    Sending the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = doc_chng
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    receivers = reclist
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    operation_no_authorization = 4
    OTHERS = 99.
    COMMIT WORK.
    SUBMIT rsconn01
    WITH mode = 'INT'
    WITH output = ' '
    AND RETURN.
    ENDFORM. " f_send_mail
    for any clarifiaction pls mail me.
    pls reward points, if this helped u.
    regards,
    anversha.
    [email protected]

  • How to send image file through mail without   any attachment

    Plz tell  me how to send image file through mail without any attachment  ( i mean not converting  that image into pdf or any format )  i want to send that text or image  through mail .

    Hi Sandeep,
    I think you can setup the type of email in Shared office Settings in transaction S016.
    There is an option called <Preset document classes>
    You choose this pushbutton to branch to the maintenance screen for the document classes that are directly displayed to users in the Business Workplace for selection when they use the Create function. The name under which the documents are displayed can also be maintained.
    http://help.sap.com/saphelp_nw70/helpdata/en/6c/69c30f418d11d1896e0000e8322d00/content.htm
    Haven't tried it though.
    Regards,
    Siddhesh

  • Very urjent how to send report output in mail

    hi experts,
    how to send report output in mail which function module should i use wht parameters should i pass.
    thanks in addavnce,
    points to be awarded.

      CALL FUNCTION 'GET_PRINT_PARAMETERS'
           EXPORTING
                destination    = '026c'
                copies         = count
                list_name      = 'VATS_ASBUILT'
                list_text      = v_list
                immediately    = 'X'
                release        = 'X'
                new_list_id    = 'X'
                expiration     = days
                line_size      = 132
                line_count     = 65
                layout         = 'X_65_132'
    *            sap_cover_page = 'X'
    *            cover_page     = 'X'
                receiver       = 'SAP*'
                department     = 'VATS'
                no_dialog      = 'X'
           IMPORTING
                out_parameters = params
                valid          = valid.
      SUBMIT zppr_vats_asbuilt  WITH p_aufnr EQ v_aufnr
                   TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                      SPOOL PARAMETERS params
                         AND RETURN.
      SELECT SINGLE rqident FROM tsp01 INTO l_spoolno
                         WHERE rqtitle = v_list .
    * convert report to PDF format
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = l_spoolno
                no_dialog                = 'X'
           TABLES
                pdf                      = l_ipdf
           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.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        EXIT .
      ENDIF.
    Now comes the part to send the mail
      try.
    * -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
          clear document.
    * -------- create and set document with attachment ---------------
    * create document from internal table with text
          document = cl_document_bcs=>create_document(
          i_type = 'RAW'
          i_text = text
          i_length = '12'
          i_subject = '' ).
    *changing the content of the attachment
          binary_content[] = l_iobjbin[].
    *change the name of the PDF attachment
          concatenate 'Build ID' s_buildid_i 'Rev' v_buildid_rev
                              into i_att_sub separated by space.
    * add attachment to document
          call method document->add_attachment
            exporting
              i_attachment_type    = 'PDF'
              i_attachment_subject = i_att_sub
              i_att_content_hex    = binary_content.
    *setting the option to send an e-mail more than 50 characters
          call method send_request->set_message_subject
            exporting
              ip_subject = t_sub.
    * add document to send request
          call method send_request->set_document
            exporting
              i_document = document.
    * --------- set sender -------------------------------------------
    * note: this is necessary only if you want to set the sender
    * different from actual user (SY-UNAME). Otherwise sender is
    * set automatically with actual user.
          sender = cl_sapuser_bcs=>create( 'VATSUPPORT' ).
          call method send_request->set_sender
            exporting
              i_sender = sender.
    *Send the list based on receivers list obtained
          loop at l_ireclist.
            AD_SMTPADR = l_ireclist-receiver.
    * --------- add recipient (e-mail address) -----------------------
    * create recipient - please replace e-mail address !!!
          recipient = cl_cam_address_bcs=>create_internet_address(
          AD_SMTPADR ).
    * add recipient with its respective attributes to send request
          call method send_request->add_recipient
            exporting
              i_recipient = recipient
              i_express   = 'X'.
          ENDLOOP.
          call method send_request->set_status_attributes
            exporting
              i_requested_status = 'E'
              i_status_mail      = 'E'.
    * To send the mail immediately
          call method send_request->set_send_immediately( 'X' ).
    * ---------- send document ---------------------------------------
          call method send_request->send( ).
          commit work.

  • How to populate smart form with new values

    Hi!
    I am new to smart form . Can anybody help me in how to populate smart form with some new fileds. Actually i have to populate credit memo form with some customized values..

    Hello,
    Please elaborate your query more in order to be comprehendable.
    Regards,
    Shehryar

  • How to send the form data through mail with pdf format?

    forms 6i
    Hi to all,
    i am developed one master detail form.example is based on the dept number emp details will be displayed.here my requirment is whatever displayed on the form
    the data ,these data send to mail with any format.is it possible? if is possible any one give a proper solution.
    Regards,
    Stevie
    Edited by: 994418 on 6 May, 2013 11:15 PM

    Hello,
    you can create a Report that accepts the search parameters from the Forms mask and generates a PDF. You also have the option to send the report via mail.
    Personally I would generate the report with a tool like as_pdf
    http://technology.amis.nl/2012/04/11/generating-a-pdf-document-with-some-plsql-as_pdf_mini-as_pdf3/
    Then you can send the mail using utl_mail or utl_smtp.
    www.google.com/search?q=site:forums.oracle.com+utl_mail+utl_smtp
    Regards
    Marcus

  • How to user Smart form for the BID in SRM 4.0

    Hello,
    We have SRM 4.0 and we need to send the BID information to the vendor. This is because we have vendors that are not able to get in to our system and we have to send them a print out of the bid information so that they give us back the information. Then our users will insert it in the system.
    It could be as an attach to the email or it could be printable in the program SPPS - Selecting and Processing Outputs.
    SAP says that there is a smart form BBP_BIDINV_BID and BBP_BID_NOTIFICATION but I am not managing to make them work.
    I found some messages to help solving specific problems so I assume it is possible to do this...
    Is there someone that can help me?
    Thanks very much.
    My best regards,
    Catarina Campos

    Hi
    <u><b>Here is the standard solution to use your own forms:-></b></u>
    <u>- copy the smartform BBP_BIDINV_BID to ZBBP_BIDINV_BID (transaction SMARTFORMS) and apply your changes
    - use BADI to call your custom form ZBBP_BIDINV_BID</u>
    <b>For PDF output form change use BADI BBP_OUTPUT_CHANGE_SF.</b>
    <b>For email notification change use BADI BBP_CHANGE_SF_BID instead.</b>
    <u>You will find all relevant documentation in SPRO --> Supplier Relationship Management --></u>
    SRM Server --> Business Add-Ins (BAdIs) --> Document Output -->
    - Change Forms for Document Output
    - Change Smart Form for E-Mails Relating to Bids
    <u><b>Please go through the links below for more details -></b></u>
    Re: how to use cutom smartform instead standard?
    Re: Email message customization ?
    Re: Bid Invitation Email Subject
    Re: Email notification to bidder should reflect start/end date and time
    Re: RFQ Smartform in SRM
    Re: Standard Text
    Do let me know.
    Regards
    - Atul

  • PO smart form e-mail attachments - both PO and PO line 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 Ravi
    You can send the Smart form as an attachment to an e-mail using the Function module:<b>SO_NEW_DOCUMENT_ATT_SEND_API1</b>
    For your complete reference, please see the code posted in the following link:
    Smart Forms by e-mail
    Hope this helps you.
    Reward points if useful
    Regards
    Message was edited by:
            Blue moon
    Message was edited by:
            Blue moon

  • How to send a form in DW 7?

    Hi! I'm from Spain and I'd like to be understanded if possible. I've got Dreamweaver MX 7. I'd like to know how to send directly the form:
    I design a form, I put a text box with "name", "e-mail" and "comment" for example and the button "send". If I test it, when I press send, the Outlook (I've got windows XP) is opened with the information.written in the form.
    Can I send the form without opening the Outlook?
    It is possible to do it with HTML language?
    Where do I have to write the script?
    If it isn't possible in HTML, how do I do it in PHP?

    http://www.cmiwebstudio.com/adobe_extensions/dreamweaver_easy_php_mailer.php
    http://www.cmiwebstudio.com/adobe_extensions/dreamweaver_easy_php_mailer_pear.php
    these extensions make it incredibly easy to do this very task.  determine first how your server email is being handled... through phps built in mail function, or does it require smtp authentication to relay mail.

  • How to convert Smart Form into PDF format and return the result in BAPI?

    I want to convert a Smart Form into PDF format and return the result in BAPI.
    can anyone tell me how it can be done with related example
    regards
    pranay

    hi,
    smart form to pdf--
    All you have to do is call your SF to get OTF and then concert it to PDF. Works like charm:
    DATA: p_output_options TYPE ssfcompop,
    p_control_parameters TYPE ssfctrlop.
    p_control_parameters-no_dialog = 'X'.
    p_control_parameters-getotf = 'X'.
    CALL FUNCTION v_func_name "call your smartform
    EXPORTING
    output_options = p_output_options
    control_parameters = p_control_parameters
    IMPORTING
    job_output_info = s_job_output_info.
    call function 'CONVERT_OTF_2_PDF'
    tables
    otf = s_job_output_info-otfdata
    lines = t_pdf
    and if u need more u can check below links also
    Check the below links..
    Re: Smartforms to PDF
    Re: smartform (otf) as pdf and sending as email-attachment
    VISIT THIS LINK
    Re: Smartforms to PDF
    PLZ REWARD POINTS IF IT HELPS YOU
    rgds
    anver

  • Sending Smart form to Printer  in SRM

    Hi All,
    I am trying to send a smartform to Printer in SRM ITS. I gave output options and control parameters . When i see the Print dialog box i dont see the Front end printers in that. Normally when we pass  LOCL we should see default printer in Print dialog.
    When i do print, spool is creating but its not printing at local printer .
    I am doing this in SRM ITS ... could you kindly any one tell me what steps need to take to print a smart form at local printer when we call form ?
    Thanks

    Hi
    Please elaborat, when you need this SMARTFORM to get triggered.
    By the way, Have you tried implementaing the following BADIs ?
    BBP_CHANGE_SF_BID                                             Smartform for E-Mails to Bidder           
    BBP_CHANGE_SF_CTR                                             Change Smart Form for Contract Output     
    BBP_CHANGE_SF_ERS                                             Change Smart Form                         
    BBP_CHANGE_SF_SC                                              Smart Form Shopping Cart Print            
    BBP_CHANGE_SF_VERS                                            Change Smart Form for Version Comparison  
    BBP_PROCESS_AUC                                               Process Smart Form with Changed Interface 
    BBP_PROCESS_BID                                               Process Smart Form with Changed Interface 
    BBP_PROCESS_CTR                                               Process Smart Form with Changed Interface 
    BBP_PROCESS_PO                                                Process Smart Form with Changed Interface 
    BBP_PROCESS_QUOT                                              Process Smart Form with Changed Interface
    Hope this will help.
    Please rewards suitable points.
    Regards
    - Atul

Maybe you are looking for

  • Save as a PDF in Flash

    Hello All, I have been searching for a tutorial with no luck on saving a movieclip as a PDF (or jpg, png, tiff, etc). I am using AS2/CS3... I am pretty sure I have seen this done and just really want to figure out how to do it. Thanks in advance!

  • How do I find out if the pressed key is printable?

    I have made a game and now I'm working on a hiscore table for it. But with my function the program doesn't know if the pressed key is printable or if it's shift, ctrl or something like that. And I made it possible to enter maximum 40 letters as name,

  • Making and sharing user accounts

    Okay-I have spent five hours trying to find a solution in Manuals, Support and similar questions but didn't find anything similar. Maybe I was searching in the wrong places but now I need direct help. This is my question : I need to duplicate my admi

  • IPhoto wont open and this is the message....

    "iPhoto is missing system files and cannot open. Please reinstall iPhoto from your iLife CD." I reinstalled from the iLife DVD/CD. The same message pops up. This is all after I installed a RADEON Video card. HUH? Is there a problem between video card

  • CUCM 10.5 Local Route Group

    When utilizing the local route group for a device pool, when a change is made for that device pool, does a reset of the devices have to occur for the changes to go into affect?  The reason I ask is if you are simply making the change to the Route Lis