Program To Send Email with attachemnts in PDF / Excel with Subject

Hi All,
I have been given an Object to Develop a report to Send Email with attachemnts in PDF / Excel with Subject.
Please provide the way to go about.
Regards,
Mohsin

REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING LINE-SIZE 200.
DATA : BEGIN OF ITAB OCCURS 0,
PERNR LIKE PA0001-PERNR,
ENAME LIKE PA0001-ENAME,
END OF ITAB.
DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 10,
compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
w_object_hd_change LIKE sood1,
compressed_size LIKE sy-index.
START-OF-SELECTION.
SELECT PERNR ENAME
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM PA0001
WHERE PERNR < 50.
LOOP AT ITAB.
WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
SY-VLINE.
ENDLOOP.
Receivers
receiver_list-recextnam = 'type your email address here'. "-->
EMAIL ADDRESS
RECEIVER_list-RECESC = 'E'. "<-
RECEIVER_list-SNDART = 'INT'."<-
RECEIVER_list-SNDPRI = '1'."<-
APPEND receiver_list.
General data
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = 'Object name'.
w_object_hd_change-objsns = 'P'.
Mail subject
w_object_hd_change-objdes = 'Message subject'.
Mail body
APPEND 'Message content' TO message_content.
Attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
compressed_size = compressed_size
TABLES
in = listobject
out = compressed_attachment.
DESCRIBE TABLE compressed_attachment.
CLEAR packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 0.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = sy-tfill.
packing_list-objtp = 'ALI'.
packing_list-objnam = 'Object name'.
packing_list-objdes = 'Attachment description'.
packing_list-objlen = compressed_size.
APPEND packing_list.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change
object_type = 'RAW'
owner = sy-uname
TABLES
objcont = message_content
receivers = receiver_list
packing_list = packing_list
att_cont = compressed_attachment.
Hope it helps,
regards,
kushagra

Similar Messages

  • How can i send Email with attacment in pdf/xls with pass word protect

    Hi
    Can i send Email with attachment in pdf/xls with password protect in oracle apps .Here we want monthly stmt to send the customer with pdf/Xls with
    password protect.Is it possible if yes how
    Thanks

    One option is to convert the report to XML Publisher (which you might have already done as you are asking PDF/XLS), then look into the links below:
    http://blogs.oracle.com/xmlpublisher/2007/09/11/
    http://blogs.oracle.com/xmlpublisher/2010/02/securing_burst_output_document.html
    http://blogs.oracle.com/xmlpublisher/2007/06/merge_and_secure_pdfs.html

  • ABAP program for sending emails

    Hello SAP developers,
    I need ABAP program for sending emails to my internet adress in background - just some simple header with no body and no attachement. Recipient should be specified due the parameter etc... Does program like this exist or i have to create it? I am not familiar with ABAP. I am basis admin so I am little bit lost in this. I have tried program code from this page ->
    http://www.sapdevelopment.co.uk/reporting/email/email_mbody.htm
    But anyway it does not work - there is an exception "no message send". SCOT is configured, mails are working fine from transaction SBWP.
    Thanks in advace
    JM

    I have already solved my issue through CCMS agents and RZ20 central autoreaction (sms) in Solution Manager.
    Regards
    JM

  • Sending email using CL_BCS in the background with subject line 255 chars

    Hello Gurus,
           Following is the sample code,. When I run in the foreground, I am getting the mail, with proper subject line. However my output medium type is '5-'External Send#. When I am trying to run this in my output program, it is resulting in dump.
           When I keep 'COMMIT WORK',  I am getting a dump saying tText * Invalid COMMIT WORK in an update function module.*
           When I remove this 'COMMIT WORK', I am still getting the error, saying Screen output without connection to user. (The current ABAP program "SAPLSTXC" statements could not be executed.)
          Hoping for a quick solution.
    Regards,
    Shaheen
    REPORT  Z_CL_BCS_TEST.
    * Trying classes
    DATA: send_request        TYPE REF TO cl_bcs.
    DATA: li_main_text        TYPE bcsy_text,
          lw_main_text        LIKE LINE OF li_main_text.
    DATA: document            TYPE REF TO cl_document_bcs.
    DATA: recipient           TYPE REF TO if_recipient_bcs.
    DATA: sender              TYPE REF TO if_sender_bcs.
    DATA: l_mtitle            LIKE sodocchgi1-obj_descr.
    DATA: sent_to_all         TYPE os_boolean.
    DATA: bcs_exception       TYPE REF TO cx_bcs.
    DATA: lv_sub TYPE string.
    TRY.
    *     -------- create persistent send request ------------------------
        send_request = cl_bcs=>create_persistent( ).
    *     -------- create and set document---------------
    *     Email title
        l_mtitle = 'attachment'.
        lv_sub = 'Email Title : I want to try for a subject which is more than 50 chars. will this work?'.
        CALL METHOD send_request->set_message_subject
          EXPORTING
            ip_subject = lv_sub.
    *     Fill the body of the mail
        REFRESH li_main_text.
        lw_main_text = 'This is test email'.
        APPEND lw_main_text TO li_main_text.
        CLEAR: lw_main_text.
        lw_main_text = 'Regards'.
        APPEND lw_main_text TO li_main_text.
        CLEAR: lw_main_text.
    *     Create Email Object
        document = cl_document_bcs=>create_document(
          i_type    = 'RAW'
          i_text    = li_main_text
          i_subject = l_mtitle ).
    *     Add document object to send request
        send_request->set_document( document ).
    *     add recipient (e-mail address)
        recipient =
            cl_cam_address_bcs=>create_internet_address(
                  'Shaheen.Taori at solvay.com' ).           " changed the email id purposefully
    *     Add recipient object to send request
        CALL METHOD send_request->add_recipient
          EXPORTING
            i_recipient = recipient
            i_express   = 'X'.
    *     ---------- send document ---------------------------------------
    *    sent_to_all = send_request->SEND_WITHOUT_DIALOG( I_WITH_ERROR_SCREEN = ' ').
        CALL METHOD send_request->SEND_WITHOUT_DIALOG.
    *      EXPORTING
    *        e_sent_to_all = 'X'.
    *    IF sent_to_all IS INITIAL.
    *      MESSAGE 'Erorr while sending email ' TYPE 'E'.
    *      EXIT.
    *    ENDIF.
          COMMIT WORK.
    *   exception handling
      CATCH cx_bcs INTO bcs_exception.
        MESSAGE i865(so) WITH bcs_exception->error_type.
    ENDTRY.

    Try using method SEND instead of SEND_WITHOUT_DIALOG.
    Also try calling method SET_SEND_IMMEDIATELY before calling method SEND.
    Use below code lines,
    send_request->set_send_immediately( i_send_immediately = 'X' ).
    sent_to_all = send_request->send( i_with_error_screen = 'X' ).   " Instead of CALL METHOD send_request->SEND_WITHOUT_DIALOG.

  • Send email through Yahoo mail or Gmail with Java

    I have a java email program that can take a mail host name , port number and then send an email, but I don't want to use the mail host at work, I wonder if I can send email through my Yahoo Mail or Gmail account with Java, do they have any Java API that my program can log me in and send emails ? Any sample code available ? Thanks.
    Frank

    Thanks for reminding me, I did some search on "Yahoo" and "Gmail". For Yahoo someone posted some code that didn't work, for gmail, there seems to be a solution for sending email from command line. I wonder if I can send full fledged email : with CC, BCC, Attachment, Html email with images inside ...
    I've done it with a local mail host, but how to do it with Yahoo or Gmail ?
    Frank
    Have you read the JavaMail FAQ? Search for "Yahoo" and "Gmail".

  • Cannot send email via Hotmail through port 587 with Secure Connection (SSL) set

    Something is blocking my attempts to send email (with Outlook Express) via my hotmail.com account. The error I receive is as follows:
    Your server has unexpectedly terminated the connection. Possible causes for this include server problems, network problems, or a long period of inactivity. Account: 'Hotmail', Server: 'smtp.live.com', Protocol: SMTP, Port: 587, Secure(SSL): Yes, Error Number: 0x800CCC0F
    When Hotmail.com first changed over to a POP3 server (Sept 2009), I could send emails through them using port 587, which they require. But then something happened, with no changes on my part, to disable my ability to send.
    I have checked and rechecked my Outlook Express account settings. I can send email through another third-party mail account (at 1&1 Internet.com) using port 587, which does not require setting SSL to yes. I can also ping the Hotmail SMTP server via port 587 and receive a response from it.
    I connect to Verizon DSL via a Westell 327W modem/router. Clearly it is not blocking port 587 without SSL. Does it have the capability to block SSL traffic? Or is the Verizon server the culprit, not allowing emails to be sent via Hotmail.com?
    Two different computers on my LAN have the same problem sending emails via Hotmail.com. I have tried everything the Hotmail people have suggested; at this point they think it is an ISP problem, hence this post. This problem doesn't make sense to me and is driving me crazy. Can anyone help me with this?
    Thanks.

    You can still have your reply address set to your hotmail address. And you don't have to really remember to do anything. Configure your client for the HOTMAIL account with Verizon's outgoing server. It will automatically send via Verizon. You don't reveal your verizon.net address, you are just using their server to transmit.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • Can I send email using my own domain address with iCloud the way I can with gmail?

    Let's say I own mydomain.com and have a [email protected] email account.  I have set that up to forward to gmail, and that would be easy to switch to iCloud.  Here's the tricky part: gmail allows me to send email as [email protected]  I've been doing this for years and it works, but I'd like to switch from gmail to iCloud.  Can I set up this same behavior with an iCloud @me.com address (which I already have but haven't been using yet)?  I know I can obviously switch the forwarding of incoming mail to my @me.com address...  but can I send [email protected] email through iCloud the way I can with gmail?  All of my devices are Apple: a Mac Mini using Apple's Mail app, and an iPhone and an iPad both using the Apple email app, so I'd rather switch everything over from gmail to iCloud.
    P.S.  Awe, c'mon Apple.  Don't turn those fake addresses into links.  I just used them for the sake of giving an example.

    Ah, I should have made that clear.  My domain didn't come from google.  It was purchased at and is hosted at dreamhost, but I haven't used their email servers in years - I just route everything through gmail.  I actually have a bunch of domains (with websites).
    Gmail has an option that lets someone with custom domains send (and receive) email through gmail using the custom domain once Google confirms proper ownership of the domain (to prevent spammers and such).  Gmail has a setting for "send email as" which allows gmail to be sent using a custom domain as the sender.  I'm pretty sure Apple's old mobileme had this feature too, but I didn't use it.

  • I recently opened an email with some sort of virus and now I cannot forward, reply, send emails or view you tubes only with firefox. Can you help?

    I recently viewed an email and received some sort of virus. Only in the email address where I view in infected email and only when using Firefox do I have a problem. When using the email address I can no longer send emails, reply to emails or forward emails. I can no longer view You Tubes when using FirefoxI. I can send emails, reply, and forward emails and view You Tubes when using internet explorer. I do not have this problem when using another computer. I only have the problem described when using Firefox with the computer which was infected. I prefer Firefox so can you please guide me in a direction to address the problem.
    Phil

    thx for your response. are saying websites such as hotmail and yahoo mail detect that they are being accessed via firefox and turn off the JavaScript that makes hot links? really? additionally, i have friends with firefox in which hyperlinks stay active when they are copied and pasted.
    was the "Make Link" add-on you posted supposed to fix the problem? i downloaded it, but i don't know where the "context menu" is that is supposed to help me. how to i view this context window now that i have downloaded the add-on?

  • HT4623 After downloading new ios 7 software to my iphone5, I am no longer able to send emails. spent 3 hours on phone with Rogers and still wont send but i can receive. they say its an apple issue. whats up?

    after downloading new ios 7.0.2 to my iphone 5, i am no longer able to send emails. i spent 3 hours on the phone today with Rogers tech support, wiped the phone clean, restored it, etc and it still wont send emails. I am able to receive though. Rogers says its an Apple problem. whats up with this?

    Contact apple support at 1-800-692-7553 for mail troubleshooting.

  • Send Email for manager of the user with Login and Password the user.

    Hello everyone,
    I need to send an email to the manager of the user with login and password when it is created in AD.
    I already have a mail server configured in the IT Resource. It has some component of the IDM that solve this issue?
    Anyone you help me with the next steps?
    Thank you.

    Thank you for your attention.
    It did not work, I did another test to send email notifying you when the User change password.
    The following error message appears in oim_server1-diagnostic.log:
    [2011-08-08T19:21:30.865-03:00] [oim_server1] [NOTIFICATION] [] [oracle.iam.passwordmgmt.impl] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 88a924181f586e03:-25ab9c82:131aa884464:-8000-0000000000008862,0] [APP: oim#11.1.1.3.0] Resetting password
    [2011-08-08T19:21:30.936-03:00] [oim_server1] [NOTIFICATION] [IAM-0080013] [oracle.iam.platform.kernel.impl] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 88a924181f586e03:-25ab9c82:131aa884464:-8000-0000000000008862,0] [APP: oim#11.1.1.3.0] Kernel executing default validation with process id, event id, entity and operation 59,612.0.User.RESET_PASSWORD
    [2011-08-08T19:21:31.155-03:00] [oim_server1] [NOTIFICATION] [IAM-3050013] [oracle.iam.identity.usermgmt.impl] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 88a924181f586e03:-25ab9c82:131aa884464:-8000-0000000000008862,0] [APP: oim#11.1.1.3.0] Searching for users with the specified criteria.
    [2011-08-08T19:21:32.018-03:00] [oim_server1] [WARNING] [] [oracle.iam.passwordmgmt.impl] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 88a924181f586e03:-25ab9c82:131aa884464:-8000-0000000000008862,0] [APP: oim#11.1.1.3.0] Sending Reset Password Notification is not successful
    [2011-08-08T19:21:32.639-03:00] [oim_server1] [NOTIFICATION] [IAM-0080046] [oracle.iam.platform.kernel.impl] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 88a924181f586e03:-25ab9c82:131aa884464:-8000-0000000000008862,0] [APP: oim#11.1.1.3.0] Completed orchestration with action result - oracle.iam.platform.kernel.vo.EventResult@4fe0d018
    [2011-08-08T19:21:32.642-03:00] [oim_server1] [NOTIFICATION] [IAM-0080011] [oracle.iam.platform.kernel.impl] [tid: [ACTIVE].ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: oiminternal] [ecid: 88a924181f586e03:-25ab9c82:131aa884464:-8000-0000000000008862,0] [APP: oim#11.1.1.3.0] Orchestration process with id 59,612 started running in a new thread.
    Edited by: Piza on 08/08/2011 15:24
    Edited by: Piza on 08/08/2011 15:26

  • Java program to send email from lotus notes

    Hello,
    Please anyone suggest me how to send email from lotus notes using java.
    Thanks.

    I don't understand the question. Are you asking:
    1. How do I send e-mail from Lotus notes manually? Press the Send button.
    2. How do I send e-mail from Java? Look into the Java Mail API. Doesn't require Lotus Notes (or any other e-mail client, for that matter).
    3. How do I send e-mail to a Lotus Notes address? Just send e-mail to the address (see # 2 above). Nothing special required just because the recipient uses Lotus Notes. FYI: I use Lotus Notes (though I hate it) because it's our company's standard & have written Java apps that send e-mails to Notes. The only time I've had to be aware the recipient was a Notes client was when I was sending HTML formatted messages; then I had to pay attention to the limitations of Notes' brain dead HTML parser.

  • When sending email PO in a PDF attachment, the attachment can not be openen

    Hi all,
    We are trying to send an email with the PO in PDF format.  We got the email but the attachment can not be opened. 
    Error reads: Adobe could not open test.pdf because  it is either  not a supported file type  or because  the file has been damaged (for example , it was send as a email attachemnet and was not  correctly decoded).
    Could any body bring some light?   We know that everything in SCOT is fine because we can email the PO through configuration to the vendor without problem. It is just these extra copies that do not work.
    a) We are modifying our custom Print program to add the code below after closing the form.
    in few words:
    a) We are getting the OTF from closing the form.
    b) Converting the OTF to PDF
    c) Sending the PDF as attachment.
    data: lt_docs      TYPE TABLE OF docs.
    data: pdf_bytecount TYPE i.
    data: begin of pdfout occurs 0,
       tline type tline,
    end of pdfout.
    Ende Formulardruck --------------------------------------------------*
      CALL FUNCTION 'CLOSE_FORM'
           IMPORTING
                result = result
           tables
                otfdata = otf.
      IF RESULT-TDSPOOLID NE SPACE.
        SPOOLID = RESULT-TDSPOOLID.
        PERFORM PROTOCOL_UPDATE USING '320' SPOOLID SPACE SPACE SPACE.
      ENDIF.
      if result-userexit eq 'C' or
          result-userexit eq 'E'.
        retco = '9'.
      endif.
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
        IMPORTING
          bin_filesize           = pdf_bytecount
        TABLES
          otf                    = otf
          doctab_archive         = lt_docs
          lines                  = pdfout
        EXCEPTIONS
          err_conv_not_possible  = 1
          err_otf_mc_noendmarker = 2
          OTHERS                 = 3.
    Creation of the document to be sent File Name
       maildata-obj_name = 'TEST'.
    Mail Subject
       maildata-obj_descr = 'Subject'.
    Mail Contents
       append mailtxt.
      describe table mailtxt lines tab_lines.
      read table mailtxt index tab_lines.
      maildata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( mailtxt ).
    Creation of the entry for the compressed document
      clear mailpack-transf_bin.
      mailpack-head_start = 1.
      mailpack-head_num = 0.
      mailpack-body_start = 1.
      mailpack-body_num = tab_lines.
      mailpack-doc_type = 'RAW'.
      append mailpack.
    Move OTF code to structure SOLI form email
    CLEAR solisti1. REFRESH solisti1.
    LOOP AT otf.
      solisti1-line = otf.
      APPEND solisti1.
    ENDLOOP.
    Move pdf code to structure soli form email
      clear solisti1. refresh solisti1.
      loop at pdfout.
        solisti1-line = pdfout.
        append solisti1.
      endloop.
      loop at solisti1.
         move-corresponding solisti1 to mailbin.
         append mailbin.
      endloop.
      describe table mailbin lines tab_lines.
    mailhead = 'TEST.OTF'.
      mailhead = 'TEST.PDF'.
      append mailhead.
    Creation of the entry for the compressed attachment
      mailpack-transf_bin = 'X'.
      mailpack-head_start = 1.
      mailpack-head_num = 1.
      mailpack-body_start = 1.
      mailpack-body_num = tab_lines.
    mailpack-doc_type = 'OTF'.
      mailpack-doc_type = 'PDF'.
      mailpack-obj_name = 'TEST'.
      mailpack-obj_descr = 'Subject'.
      mailpack-doc_size = tab_lines * 255.
      append mailpack.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type = 'U'.
      append mailrec.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type = 'U'.
      append mailrec.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
              EXPORTING
                   DOCUMENT_DATA              = maildata
              TABLES
                   PACKING_LIST               = mailpack
                   OBJECT_HEADER              = mailhead
                   CONTENTS_TXT               = mailtxt
                   RECEIVERS                  = mailrec
              EXCEPTIONS
                   TOO_MANY_RECEIVERS         = 1
                   DOCUMENT_NOT_SENT          = 2
                   DOCUMENT_TYPE_NOT_EXIST    = 3
                   OPERATION_NO_AUTHORIZATION = 4
                   PARAMETER_ERROR            = 5
                   X_ERROR                    = 6
                   ENQUEUE_ERROR              = 7
                   OTHERS                     = 8.
    ENDFORM.

    Dear Monica,
      You need to configure the system with respect to functional point of view and need to write the following code in print program. i have done this and solution is as follows.
    <b>  Reward me for this solution.</b>
    Process 11 (MM)     Sending RFQs and POs to vendors directly from the system instead of sending thru Courier or Fax     
    Existing Process (AS-IS)     Presently system is not supporting this requirement
    Business Requirements     RFQ’s to be linked with vendor master with e-mail to send enquiries directly through system instead of courier/fax. Vice versa P.O’s.  Specifications, drawings should also go to vendor along with mail.
    To-Be     
    Configuration Settings:                  
    1) Spro – Materials management – Purchasing – Messages – Output control – Message types – Define message types for RFQ/ PO
    •     Created ZEK1,ZMI and ZEK2 for RFQs
    •     Created ZIK,ZOC,ZOK,ZOM,ZSI, ZSK2 and ZSM for Pos
    •     The above New output types Included with existing Print Forms and Programs but modified with External send(5) medium, and added company’s letter head thru ABAP developments (details provided below)
    •     The above new output types also maintained for Fine- tuned control (thru same navigation) for New(1) and Change(2) operations
          2) Spro – Materials management – Purchasing – Messages – Output control – Message   determination schemas – Define message schema for RFQ/ PO
    •     Maintained the new output types in the control data
    3)     Maintain Condition records for the New out put types (copied same document types from the existing old output types)
    Easy access – Logistics – Materials management – Purchasing – Master data – Messages – MN01 (for RFQs)/ MN04 (for Pos)
    4)     Maintain Email id of Vendor in Vendor master.
    Developments (ABAP):
    1)  Copied the existing print programs and forms of the corresponding out types.
    2) Addition of header window in each corresponding form (HEADER window). Uploaded the HEADER3 graphics in the header window.
    INCLUDE HEADER3 OBJECT GRAPHICS ID BCOL LANGUAGE EN
    3) Added the the following code in TOP includes
                       TYPE-POOLs szadr.
               INCLUDE:  LMEDRUCKF09.
    data: intnast         LIKE snast,
          lvs_recipient   LIKE swotobjid,       "Internet
          lvs_sender      LIKE swotobjid,       "Internet
          lvs_comm_type   TYPE ad_comm,
          lvs_comm_values TYPE szadr_comm_values,
          p_retco         TYPE i.
    5)     Addition of the perform to SOS include for header window display
           PERFORM WRITE_FORM_HEADER.
    *&      Form  WRITE_FORM_HEADER
          text
    -->  p1        text
    <--  p2        text
    FORM WRITE_FORM_HEADER.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'HE1'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'HEADER'
    IMPORTING
       PENDING_LINES                  =
    EXCEPTIONS
       ELEMENT                        = 1
       FUNCTION                       = 2
       TYPE                           = 3
       UNOPENED                       = 4
       UNSTARTED                      = 5
       WINDOW                         = 6
       BAD_PAGEFORMAT_FOR_PRINT       = 7
       SPOOL_ERROR                    = 8
       CODEPAGE                       = 9
       OTHERS                         = 10
    ENDFORM.
    6)     In the corresponding FORM include the following code has been added.
    DATA:  lvs_comm_type     TYPE   ad_comm,
            lvs_comm_values   TYPE   szadr_comm_values,
            xprogramm         type   sy-repid.
      ... use stratagy to get communication type
          CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'
               EXPORTING
                    strategy           = nast-tcode
                    address_number     = lfa1-adrnr
               IMPORTING
                    comm_type          = lvs_comm_type
                    comm_values        = lvs_comm_values
               EXCEPTIONS
                    address_not_exist  = 1
                    person_not_exist   = 2
                    no_comm_type_found = 3
                    internal_error     = 4
                    parameter_error    = 5
                    OTHERS             = 6.
          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 communication data
          MOVE-CORRESPONDING nast TO intnast.
          MOVE sy-repid           TO xprogramm.
    7) By using the function module we can get sender and reciepient mail ids to variables lvs_recipient    lvs_sender
          CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
               EXPORTING
                    pi_comm_type              = lvs_comm_type
                    pi_comm_values            = lvs_comm_values
                    pi_country                = lfa1-land1
                    pi_repid                  = xprogramm
                    pi_snast                  = intnast
               IMPORTING
                    pe_itcpo                  = itcpo
                    pe_device                 = xdevice
                    pe_mail_recipient         = lvs_recipient
                    pe_mail_sender            = lvs_sender
               EXCEPTIONS
                    comm_type_not_supported   = 1
                    recipient_creation_failed = 2
                    sender_creation_failed    = 3
                    OTHERS                    = 4.
          IF sy-subrc <> 0.
          Avoids cancellation with message TD421
            p_retco = '1'.                                           "831984
            PERFORM protocol_update USING '740' space space space space.
          dummy message to make the message appear in the where-used list
            IF 1 = 2.
              MESSAGE S740(me).
            ENDIF.
            EXIT.
          ENDIF.
          IF xdevice = 'MAIL'.                                       "885787
        Check validity of email address to avoid cancellation with TD463
            CALL FUNCTION 'SX_ADDRESS_TO_DEVTYPE'                    "831984
              EXPORTING
                recipient_id            = lvs_recipient
                sender_id               = lvs_sender
              EXCEPTIONS
                err_invalid_route       = 1
                err_system              = 2
                OTHERS                  = 3.
            IF SY-SUBRC <> 0.
              p_retco = '1'.
              PERFORM protocol_update USING '740' space space space space.
           dummy message to make the message appear in the where-used list
              IF 1 = 2.
                MESSAGE S740(me).
              ENDIF.
              EXIT.
            ENDIF.
          ENDIF.
    8)     Attaching the new print program and form in NACE transaction.
    Steps for End user:
    1)     Creating the Purchase Order or RFQ with suitable document type through ME21N or ME41 .
    2)     Executing the transaction ME9F and in selecting the suitable output type.
    3)     Executing the transaction ZSEND_PDOC using INT as input.
    4) With above steps we can able to send purchase order or RFQ to vendor as an attachment through e-mail in PDF format.
    Regards
    Badari

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

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

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

  • Can't send email after updating to snow leopard with Mail

    I can still receive emails. SMTP settings were not changed.
    I can send with Entourage using the same settings.
    any help ?
    thanx in advance

    when I try to send I get the following message
    +Cannot send message using the server Skynet+
    +The sender address was rejected by the server relay.skynet.be.+
    +Select a different outgoing mail server from the list below or click Try Later to leave the message in your Outbox until it can be sent.+
    I have the same server settings on Entourage and it works
    none of the network settings were changed or firewall settings
    the problem started after upgrading to snow leopard
    iMac8,1, Intel Core 2 Duo, 2,8 GHz

  • Program to send email concerning table in SE16

    Hi Everyone,
    I think I have a pretty simple question to ask.  I'm looking to do a Number of Entries against a table in SE16, and I basically want to be able to send that number in an email to myself.
    Does anyone know if there's a program that already exists to do this, or if there's any other way???
    <removed_by_moderator>
    Thanks,
    John
    Edited by: Julius Bussche on Sep 8, 2008 1:31 PM

    Hi,
    Write a small program..
    data : v_tfill type sy-tfill.
    SELECT COUNT(*) FROM <dbtable> into  v_tfill.
    v_tfill will give you number of lines...
    for sending mail please refer the below link..
    http://www.sapdev.co.uk/reporting/email/email_mbody.htm
    Regards,
    nagaraj

Maybe you are looking for