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]

Similar Messages

  • Send Workitem to external mail ID and Execute?

    Hi all,
    I have requirement to send a WorkItem to Approvers External Mail ID and executes there.I have tried to send text mail to Approver's external mail id using Fm SO_NEW_DOCUMENT_SEND_API1.
    It is working fine but how to send WI to external mail id?
    Is there any way?
    Regards,
    Arpita

    Hi AC,
    there is a way out for the problem which you have where the user doesnt want to put his SAP userid and pwd and wants him to take directly to the SAP screen.
    For this you need to create a shortcut in your SAP logon pad for the transaction.
    and since you want him/her to go directly to the tcode, you need to put an entry in your sapshortcut.ini
    -pw "password"
    So what this entry does is the moment user clicks the workitem in Outlook, it would directly take him to the t-code for which you have created the shortcut, without asking him/her credentials.
    For your second issue, yes if 2 users get workitem, if any one reserves or executes the workitem, it automatically deletes from the other users SAP inbox.
    Hope it helps.
    Aditya

  • How to send "SPOOL" on SAP MAil or external mail in background???

    I tried using 'SO_DOCUMENT_REPOSITORY_MANAGER' function but it failed when I run it in background. I learned that it calls a screen at the middle of the process which needs user input to go on with the process.
    Is there other way that I could send spool on SAPMail or external Mail in background??? Any suggesstions will be greatly appreciated.. thanx...

    see below sample function module, you can use in backgroud also
    FUNCTION Z_SEND_MAIL_FOR_SPOOLLIST.
    ""Local interface:
    *"       IMPORTING
    *"             VALUE(SPOOLNUMBER) LIKE  SY-SPONO DEFAULT SY-SPONO
    *"             VALUE(MAILNAME) LIKE  SOOD1-OBJNAM DEFAULT 'NOTE'
    *"             VALUE(SUBJECT) LIKE  SOOD1-OBJDES
    *"             VALUE(RECEPIENT) LIKE  SY-UNAME OPTIONAL
    *"             VALUE(DLI) LIKE  SOOS1-DLINAM OPTIONAL
    *"       TABLES
    *"              TEXT STRUCTURE  SOLI OPTIONAL
    *"       EXCEPTIONS
    *"              ERROR
    DATA: OBJECT_HD_CHANGE LIKE SOOD1 OCCURS 0 WITH HEADER LINE,
          OBJPARA          LIKE SELC  OCCURS 0 WITH HEADER LINE,
          RECEIVERS        LIKE SOOS1 OCCURS 0 WITH HEADER LINE.
    OBJECT_HD_CHANGE-OBJLA  = SY-LANGU.
    OBJECT_HD_CHANGE-OBJNAM = MAILNAME.
    OBJECT_HD_CHANGE-OBJDES = SUBJECT.
    OBJECT_HD_CHANGE-OBJSNS = 'F'.
    OBJECT_HD_CHANGE-VMTYP  = 'T'.
    OBJECT_HD_CHANGE-SKIPS  = 'X'.
    OBJECT_HD_CHANGE-ACNAM  = 'SP01'.
    OBJECT_HD_CHANGE-OBJCP  = 'X'.
    RECEIVERS-RCDAT  = SY-DATUM.
    RECEIVERS-RCTIM  = SY-UZEIT.
    IF DLI IS INITIAL.
        RECEIVERS-RECNAM = RECEPIENT.
        RECEIVERS-RTUNAM = RECEPIENT.
    ELSE.
        RECEIVERS-RECNAM = DLI.
        RECEIVERS-ADR_NAME = DLI.
        RECEIVERS-RECESC = 'C'.
    ENDIF.
    RECEIVERS-SNDEX  = 'X'.     " Express-Mail
    APPEND RECEIVERS.
    OBJPARA-NAME = 'SPI'.
    OBJPARA-LOW  = SPOOLNUMBER.
    APPEND OBJPARA.
    CALL FUNCTION 'SO_OBJECT_SEND'
          EXPORTING
               OBJECT_HD_CHANGE           = OBJECT_HD_CHANGE
               OBJECT_TYPE                = 'RAW'
               OWNER                      = SY-UNAME
          TABLES
               OBJCONT                    = TEXT
               OBJPARA                    = OBJPARA
               RECEIVERS                  = RECEIVERS
          EXCEPTIONS
               OTHERS                     = 01.
    IF SY-SUBRC NE 0.
       RAISE ERROR.
    ENDIF.
    ENDFUNCTION.

  • 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 send a work item ( Mail ) as open tasks in WEB UI

    Hi,
      I have a requirement as to send a WF work item of mail text to WEB UI as open tasks.  Upon click of te link; the mail txts comes there with the link detials to the service contract number and service contract quotation. Upon click of the links it need to redirect to the respective documents.
    The requirement is as such that 60 days prior to the contract end date we need to trigger a mail that 'the contract expires in 60 days,do you  need to renewal it'. This text need to go to the WEB UI respective agent of this mail as tasks. Upon click of the task description link need to navigate to the mail text with the details of the contract and quotation numbers in link. upon click of the lnk it needs to navigate such that they can change accordingly and the contractrenewal process is completed.
    How to acheive this one.
    Thanks and Regards,
    Satish Akkina

    Hi,
    Sending Mail to Outlook : U need the Following things done for this:-
    1> Use the Mail Step in the WF and Choose the Receipient as the E-Mail Address and Give the E-Mail Address there.
    2> Check the Configurations that need to be done in Transaction SCOT. SMTP Server Settings are done to get the Desired Results.
    From the external mail, they should have the flexibility to approve or reject PO.
    To get Workitems in Outlook..!!
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/workflow%252bscenario
    Problem in transferring the workitems into OUTLOOK
    /people/saujanya.gn/blog/2006/12/19/how-to-get-work-items-your-outlook-inbox
    Workflow Items in Outlook
    Let me know if u still face any issues.
    Regards,
    Kanika

  • How to send an attachment thru mail in SAP?

    Hi all,
    I have an file which has been sent by the customer. The file type may vary each & every week (sometimes XLS, sometimes CSV & sometimes notepad). This file has to be sent to another person thru mail as an attachment.
    Is it possible to send thru the fun mod 'SO_SEND_NEW_*'.
    If so how to send as attachment. If not thru this fun mod, how to send?
    Thanks,
    Vijay.

    I am enclosing the sample code to trigger an email, The logic for this is in comments, check this I am shure yuor problem will be solved.
    *& Report ZGBL_SLA_PER
    REPORT zgbl_sla_per NO STANDARD PAGE HEADING LINE-COUNT 26(3) MESSAGE-ID
    zmsg2.
    DECLARATION OF DB TABLES
    TABLES: zncrfid, zrule_id.
    DECLARATION OF INTERNAL TABLES
    DATA: BEGIN OF ncrf OCCURS 0,
    zncrf_id(15) TYPE c,
    zncrf_l4_name(60) TYPE c,
    z9gl_sla_flag(1) TYPE c,
    zowners(30) TYPE c,
    zowners_value(30) TYPE c,
    zdate_changed(8) TYPE n,
    ztime_changed(6) TYPE n,
    END OF ncrf.
    *DATA: NCRF LIKE ZNCRFID OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF it_ruleid OCCURS 0,
    zrule_id(10) TYPE c,
    zowners(30) TYPE c,
    zowners_value(30) TYPE c,
    END OF it_ruleid.
    *data: wa like ncrf occurs 0 with header line.
    DATA: BEGIN OF itab OCCURS 0,
    zncrf_id(15) TYPE c,
    zncrf_l4_name(60) TYPE c,
    z9gl_sla_flag(1) TYPE c,
    zowners(30) TYPE c,
    zowners_value(30) TYPE c,
    zdate_changed(8) TYPE n,
    ztime_changed(6) TYPE n,
    END OF itab.
    data: file(10) type c,
    dates type date.
    EMAIL DECLARATION
    *CONSTANTS: c_subject LIKE sodocchgi1-obj_descr VALUE 'Subject',
    *c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
    *DATA: g_time TYPE char8,
    *g_email(40) TYPE c,
    *g_sent_all(1) TYPE c,
    *g_doc_data LIKE sodocchgi1,
    *g_error TYPE sy-subrc.
    *DATA: i_message LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    *i_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
    *i_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
    *DATA: BEGIN OF mailid OCCURS 0,
    zemail_id TYPE zrule_id-zemail_id,
    END OF mailid.
    *data: mailid like zrule_id occurs 0 with header line.
    UPLOADING FLAT FILE TO INTERNAL TABLE NCRF
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'C:\VAMSY\file.txt'
    filetype = 'ASC'
    has_field_separator = 'X'
    HEADER_LENGTH = 0
    READ_BY_LINE = 'X'
    DAT_MODE = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    CHECK_BOM = ' '
    IMPORTING
    FILELENGTH =
    HEADER =
    TABLES
    data_tab = ncrf[]
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_READ_ERROR = 2
    NO_BATCH = 3
    GUI_REFUSE_FILETRANSFER = 4
    INVALID_TYPE = 5
    NO_AUTHORITY = 6
    UNKNOWN_ERROR = 7
    BAD_DATA_FORMAT = 8
    HEADER_NOT_ALLOWED = 9
    SEPARATOR_NOT_ALLOWED = 10
    HEADER_TOO_LONG = 11
    UNKNOWN_DP_ERROR = 12
    ACCESS_DENIED = 13
    DP_OUT_OF_MEMORY = 14
    DISK_FULL = 15
    DP_TIMEOUT = 16
    OTHERS = 17
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ELSE.
    IF sy-subrc EQ 0.
    Checking internal table ncrf is empty then
    *delete records from TABLE ZNCRF_ID ******************************
    IF ncrf[] IS INITIAL.
    MESSAGE i003(ZMSG2).
    ELSE.
    DELETE FROM zncrfid.
    ENDIF.
    *****Values are read from rule table and checking owner and owner_value
    *from zrule_id table and inserted into ZNCRFID **************
    SELECT * FROM zrule_id INTO CORRESPONDING FIELDS OF TABLE it_ruleid
    WHERE zrule_id IN ('OWNER1', 'OWNER2').
    append IT_RULEID.
    LOOP AT ncrf WHERE z9gl_sla_flag EQ 'Y'.
    READ TABLE it_ruleid WITH KEY zowners = ncrf-zowners
    zowners_value = ncrf-zowners_value.
    IF ncrf-zowners = it_ruleid-zowners AND ncrf-zowners_value =
    it_ruleid-zowners_value AND ncrf-z9gl_sla_flag ='Y'.
    itab-zncrf_id = ncrf-zncrf_id.
    itab-zncrf_l4_name = ncrf-zncrf_l4_name.
    itab-z9gl_sla_flag = ncrf-z9gl_sla_flag.
    itab-zdate_changed = sy-datum.
    itab-ztime_changed = sy-uzeit.
    itab-zowners = it_ruleid-zowners.
    itab-zowners_value = it_ruleid-zowners_value.
    APPEND itab.
    ENDIF.
    ENDLOOP.
    modify database table zncrfid FROM ITAB
    LOOP AT itab.
    WRITE:/ itab-zncrf_id, itab-zncrf_l4_name, itab-z9gl_sla_flag,
    itab-zowners, itab-zowners_value, itab-zdate_changed,
    itab-ztime_changed.
    zncrfid-zncrf_id = itab-zncrf_id.
    zncrfid-zncrf_l4_name = itab-zncrf_l4_name.
    zncrfid-z9gl_sla_flag = itab-z9gl_sla_flag.
    zncrfid-zowners = itab-zowners.
    zncrfid-zowners_value = itab-zowners_value.
    zncrfid-zdate_changed = itab-zdate_changed.
    zncrfid-ztime_changed = itab-ztime_changed.
    INSERT INTO zncrfid VALUES zncrfid.
    ENDLOOP.
    ENDIF.
    ENDIF.
    *CALL FUNCTION 'DATE_TO_DAY'
    EXPORTING
    DATE = sy-datum
    IMPORTING
    WEEKDAY = file.
    **CHECKING FOR THE FIRST MONDAY OF THE MONTH.
    dates = sy-datum.
    shift dates by 6 places left.
    if file CO 'monday' and dates < 7 and dates >= 1.
    else.
    message e004(zmsg2).
    endif.
    EMAIL SEND TO OWNERS LIST
    **Fill the mail body in i_message.
    get email id's from database into internal table et_mailid
    Fill the document data.
    *g_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
    *g_doc_data-obj_langu = sy-langu.
    *g_doc_data-obj_name = 'SAPRPT'.
    *g_doc_data-obj_descr = c_subject .
    *g_doc_data-sensitivty = 'F'.
    Describe the body of the message
    Information about structure of data tables
    *CLEAR i_packing_list.
    *REFRESH i_packing_list.
    *i_packing_list-transf_bin = space.
    *i_packing_list-head_start = 1.
    *i_packing_list-head_num = 0.
    *i_packing_list-body_start = 1.
    *DESCRIBE TABLE i_message LINES i_packing_list-body_num.
    *i_packing_list-doc_type = 'RAW'.
    *APPEND i_packing_list.
    Add the recipients email address
    *LOOP AT mailid.
    *CLEAR i_receivers.
    *i_receivers-receiver = mailid-zemail_id.
    *i_receivers-rec_type = 'U'.
    *i_receivers-com_type = 'INT'.
    *i_receivers-notif_del = 'X'.
    *i_receivers-notif_ndel = 'X'.
    *APPEND i_receivers.
    *ENDLOOP.
    Call the FM to post the message to SAPMAIL
    *CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    *EXPORTING
    *document_data = g_doc_data
    *put_in_outbox = 'X'
    *commit_work = 'X'
    *IMPORTING
    *sent_to_all = g_sent_all
    *TABLES
    *packing_list = i_packing_list
    *contents_txt = i_message
    *receivers = i_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.
    Store function module return code
    *g_error = sy-subrc.
    Get i_receivers return code
    *LOOP AT i_receivers.
    *ENDLOOP.
    **Instructs mail send program for SAPCONNECT to send email(rsconn01)
    *WAIT UP TO 2 SECONDS.
    *IF g_error EQ 0.
    *SUBMIT zgbl_sla_per WITH mode = 'INT'
    *WITH output = 'X'
    *AND RETURN.
    REWARD IF FOUND USEFULL,
    Cheers,

  • How to send table contents as mail attachment.

    Hi,
       I am showing data into webdynpro table by accessing database. Now i have to send these data through mail to different persons. How can i do it. I tried it by sending the table elements into excel files but i am facing some problems. can it be done through HTML files??
          Please give a solution to it.
          Thanks and Regards..
          Pankaj Kumar.

    Pankaj
    I am giving sample code here.
    Put this code in an action behind Send Mail button on your iview as an example.
    Also add external jar file mail.jar to your web dynpro project to achieve your objective.
         if(wdContext.currentContextElement().getTest()== null)
              IWDWindowInfo windowInfo1 = wdComponentAPI.getComponentInfo().findInWindows("EnterText");
              IWDWindow window1 =wdComponentAPI.getWindowManager().createWindow(windowInfo1,true);
              window1.open();
              window1.setWindowPosition(300,300);
              wdContext.currentContextElement().setEmptyText(window1);
         } else
              Properties props = new Properties();
              String host = "XXX.XXX.X.X"; /*ip address of mail server */
              props.put("mail.smtp.host", host);
              props.put("mail.smtp.port", "25");
              props.put("mail.smtp.auth","false");
         //     auth = new AuthenticationBean();
              Session session = Session.getInstance(props, null);
               MimeMessage  message = new MimeMessage (
              Session.getInstance ( props, null ) );
             Address toAddress = new InternetAddress();
              Address fromAddress = new InternetAddress();
              Address ccAddress = new InternetAddress();
              Address bccAddress = new InternetAddress();
                     //new window code
                   IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("SuccessWindow");
                   IWDWindow window =wdComponentAPI.getWindowManager().createWindow(windowInfo,true);
                   window.open();
                   window.setWindowPosition(300,300);
                   wdContext.currentContextElement().setSuccess(window);
            try
                   MimeMultipart multipart = new MimeMultipart();
                   BodyPart messageBodyPart = new MimeBodyPart();
                     fromAddress = new InternetAddress(wdContext.currentContextElement().getFromEmail());
                   message.setFrom(fromAddress);
                   toAddress = new InternetAddress(wdContext.currentContextElement().getRfcEmail());
                   wdContext.currentContextElement().setErr(wdContext.currentContextElement().getRfcEmail());
                   message.setRecipient(Message.RecipientType.TO, toAddress);
                   message.setSubject(wdContext.currentContextElement().getMycontactDD());
                   messageBodyPart.setText("Message From :"" " wdThis.wdGetMailAppController().wdGetContext().currentContextElement().getName()"\r\n""\r\n"+wdContext.currentContextElement().getTest());
                   multipart.addBodyPart(messageBodyPart);
                   message.setContent(multipart);
                   Transport.send(message);
                 catch (AddressException e)
                             wdComponentAPI.getMessageManager().reportWarning(e. getLocalizedMessage());
                              e.printStackTrace();
                 catch (SendFailedException e)
                        wdComponentAPI.getMessageManager().reportWarning(e. getLocalizedMessage());
                         e.printStackTrace();
                 catch (MessagingException e)
                         wdComponentAPI.getMessageManager().reportWarning( e.getLocalizedMessage());
                         e.printStackTrace();
    Please award points if this helps as this will give you a hint for sending mails.

  • Can't send smartform to external mail address

    Hi, everyone.
    Now, after creating some self-defined smartforms, we want to send its
    PDF copy to
    our external mail address. From this point, I had some try.
    Reference to SAP Library, I make a testing program named 'YPDF_TEST'.
    However, one exception always exists when running and error message id
    is 'XS806' - means
    "No delivery to &, invalid recipient address"
    I filled the address with following fields.
    [ dev_mail_recipient-logsys = 'CLNT600'.
    dev_mail_recipient-objtype = 'RECIPIENT'.
    dev_mail_recipient-objkey = '[email protected]'. ]
    I just can't understand the real reason why it doesn't work.
    Through debugging, I found the error occurs when handling the following
    codes
    in function "SX_ADDRESS_TO_DEVTYPE".
    [ swc_create_object o_recipient 'RECIPIENT' recipient_id-objkey.
    swc_get_property o_recipient 'CommunicationType' m_recipient-type.
    get_property_longvalue o_recipient m_recipient-address. ]
    On the current situation, if can't come over this problem,
    we may not build the connection and don't provide information in time.
    Failed to send, I yet try another function - added the tail but on earthdidn't get it ~~~
    Would you give me some hints or advice ?
    Any help is appreciated.
    ====================
    <i>REPORT ypdf_test .
    DATA: fm_name TYPE rs38l_fnam.
    DATA: my_control_pars TYPE ssfctrlop. "for CONTROL_PARAMETERS
    DATA: my_output_info TYPE ssfcrescl. "for JOB_OUTPUT_INFO
    DATA: output_options TYPE ssfcompop.
    DATA: e_devtype TYPE rspoptype.
    DATA: gw_lcprint TYPE ziebsflc001.
    DATA: bin_file TYPE xstring,
    bin_filesize TYPE i,
    ndiv TYPE i, offset TYPE i,
    nmod TYPE i.
    DATA: BEGIN OF bin_table OCCURS 0,
    x TYPE xstring,
    END OF bin_table.
    DATA: lines LIKE tline OCCURS 0.
    DATA: dev_mail_sender LIKE swotobjid, "B20K061818
    dev_mail_recipient LIKE swotobjid.
    DATA: dev_mail_applobj_tab LIKE swotobjid OCCURS 10 WITH HEADER LINE.
    DATA: param LIKE itcpp.
    my_control_pars-no_dialog = 'X'.
    my_control_pars-getotf = 'X'.
    Get genereated function name of Smartform
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'ZDEMO_SMART_FORM_PPF'
    IMPORTING
    fm_name = fm_name
    EXCEPTIONS
    no_form = 1
    no_function_module = 2
    OTHERS = 3.
    IF sy-subrc <> 0.
    ENDIF.
    Get Device type
    CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
    EXPORTING
    i_language = sy-langu
    I_APPLICATION = 'SAPDEFAULT'
    IMPORTING
    e_devtype = e_devtype
    EXCEPTIONS
    no_language = 1
    language_not_installed = 2
    no_devtype_found = 3
    system_error = 4
    OTHERS = 5 .
    IF sy-subrc <> 0.
    ENDIF.
    output_options-tdprinter = e_devtype.
    set needed mail option
    my_control_pars-device = 'MAIL'.
    dev_mail_sender-logsys = 'CLNT600'.
    dev_mail_sender-objtype = 'RECIPIENT'.
    dev_mail_sender-objkey = 'CHI_DEV03'.
    dev_mail_recipient-logsys = 'CLNT600'.
    dev_mail_recipient-objtype = 'RECIPIENT'.
    dev_mail_recipient-objkey = '[email protected]'.
    CALL FUNCTION fm_name
    EXPORTING
    control_parameters = my_control_pars
    mail_recipient = dev_mail_recipient
    mail_sender = dev_mail_sender
    output_options = output_options
    ip_carrid = 'ID'
    ip_connid = '8290'
    ip_fldate = sy-datum
    ip_bookid = '12345678'
    ip_customid = '09876521'
    ip_luggweight = 90
    ip_wunit = 'KG'
    ip_smoker = 'X'
    IMPORTING
    job_output_info = my_output_info
    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.
    Another try ***
    *DATA: param LIKE itcpp.
    *DATA: BEGIN OF off_obj.
    INCLUDE STRUCTURE soodk.
    *DATA: END OF off_obj,
    ok TYPE c,
    msgid TYPE symsgid,
    msgno TYPE symsgno,
    msgv1 TYPE symsgv,
    msgv2 TYPE symsgv,
    msgv3 TYPE symsgv,
    msgv4 TYPE symsgv.
    *DATA: dev_mail_applobj_tab LIKE swotobjid OCCURS 10 WITH HEADER LINE.
    *CALL FUNCTION 'CONVERT_OTF_AND_MAIL'
    EXPORTING
    mailoptions = param
    mail_sender = dev_mail_sender
    mail_recipient = dev_mail_recipient
    IMPORTING
    office_objid = off_obj
    mail_ok = ok
    msgno = msgno
    msgid = msgid
    msgv1 = msgv1
    msgv2 = msgv2
    msgv3 = msgv3
    msgv4 = msgv4
    TABLES
    mail_application_object_ids = dev_mail_applobj_tab
    otf = my_output_info-otfdata.</i>

    Hi,
    You can follow a different approach. Send the output of the Smartform to the spool.
    You have a Function Module to read the spool and convert it to PDF . Then there is one more function module to attach the PDF and send it as a mail.
    You need to configure SMTP in Tcode : SCOT.
    Search the forum with emailpdfattachment
    You have umpteen postings available.
    Pls reward if useful.
    Regards,
    Laxman Nayak

  • 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

  • Send notification to external mail id when work item reach users inbox

    hi all ,
              i would like to know wat are all the settings required for sending an external mail when a user recieves a work item. i think it can be done by running the program rswuwfml .but wat are all the settings required to be done before running the program .....
    Useful answers will be rewarded.......

    What the??!!!! I totally missed this before and actually found it quite acidentally....
    >Yep true! Totally agree with Kjtetil, it adds to an already noisy forum and I am >afraid if others start aping it will be brought down on level with the XYZ forum. >And we don't want that!
    >Anyone volunteering to have the 'M' flag?
    Though I cannot comprehend what you are trying to get at or say I will, attempt to set the record straight.
    Yes I have said that on another thread. I am not asking for points anywhere, I am happy to receive and happier to solve someone's problem.
    The issue with this thread is the author obviously has not bothered to do any investigation. I am not for spoon feeding just for the sake of some points, I am willing to help those who do some bit from their end as well who encounter a genuine stumbling block.
    My reference to "reward" was with a bit of sarcasm, if you know what that means.

  • How to send Mp4 file on Mail

    Please could some friendly person tell me how to send a recorded Mp4 track by email? I can drag it off the desktop (from iTunes) into a new message, but cannot play it back.

    Greetings,
    Why do you need to play it back? You already know what it is, so you just need to send it. Mail can't play these files; it has to use QuickTime to play them, so it's not unusual or unexpected that you can't play it in Mail.

  • How to send doc files from one system to another using XI

    Hi All,
    I have a requirement to pick the word doc files from one file system and send these word document files to ECC system place in ECC application server.Can we achieve this requirement using XI. If so how we can do this. also let me know can we convert these doc files into proxy and send to ECC?. Please let me know. Thanks.
    Regards,
    Rajesh

    Yes You Can
    XI Converts Unstructured data(That is non -XML)Type- in your case word doc and maps it to Target structure.
    You can either use content conversion
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
    /people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
    /people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns
    /people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
    You can either built a adaptermodule for the same(U nedd to have Some Java knowledge)
    You can also convert without creating any objects in integration directory link for the same is
    /people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository
    ***********Please Reward Points If find Helpful*********

  • How to send JPG images in MAIL?

    I'm having a problem in sending JPG files in MAIL. Nobody can open de files i send. Need Help.
    Tanks.

    Makes sure extensions are fully apparent, checks the form of preview that may have been created on the Mac for its use. Two support documents are linked below, and the one for earlier version of Mail is still useful:
    http://docs.info.apple.com/article.html?path=Mail/4.0/en/9965.html
    and
    http://docs.info.apple.com/article.html?path=Mail/3.0/en/9965.html
    If you were sending to someone using a really old version Mac OS, it might be a hinderance, btw.
    The issues that can arise from use of Rich Text Format are separate issues, and relate to MS and AOL not processing RTF from other systems.
    Ernie
    Message was edited by: Ernie Stamper

  • How to send html newsletter via Mail app

    I want crystal and clear instruction as all the ones I have found either old fashioned and not relevant or skip that interesting part.
    I have already done html page (newsletter). Now I want to transform it somehow and send via Mail app so my contacts could receive it as html newsletter. If I need to attach txt message please add it to the instruction. I need complete how to send html newsletter.

    alabanco wrote:
    thanks. Now we've got to the most interesting part and intriguing one. Why should I upload html page to the server. I do understand uploading the images to server which will be used as links in my html mail. But why and how should I store that page in my server if I have CMS post instead from which I used pictures as links. SHould I create yet another type of post in CMS that is my html newsletter? That's not cool. What is the industry standard approach for that?
    By the way Mail.app uses that baby design templates for your messages. Why don't we have an option to delete all these creepy childish templates and store solid bold corporate style templates for newsletters and send it somehow? Or will it just attach the images to the message then? If so then it is not what I want and it is really depressing.
    The industry convention/"standard" is not to use html in email. Wheteher or not your html newsletter displays as you intended is at the mercy of the recipient and their email client settings.
    If you want to preserve your html layout and styles, save your newsletter as a pdf document and attach the pdf document to your email. Or, as already suggested, use a web server to serve your html newsletter.

Maybe you are looking for