Sending mail to root summarizing results of daily/weekly/monthly?

I would like to modify the daily, weekly, and monthly scripts so that I get an email notification that the jobs ran, and what they did. I added two cron jobs to my crontab file (I use cron, not launchd, should it make a difference) and they send an email to root saying that they ran and did their thing (I have postfix enabled on my Mac so I can get these emails as Postfix redirects them to the admin user's mail account).
The two added crontab entries are
54 01 * * 7 root diskutil secureErase freespace 1 /
and
48 02 * * 6 root diskutil repairPermissions /
so, apparently, diskutil can send me a summary/results email.
But daily, weekly, and monthly aren't doing that. I think it would be nice to get an email parroting all of the "echo" lines in each of the scripts to an email, or somehow summarizing the progress/results of those scripts having run into an email, and sending it to root.
Anybody out there know how to do something like that?
Thanx in advance
jv
Quicksilver G4    

This works for me when I run the periodic command from the Terminal window: create a file in "etc" called "periodic.conf". In that file put:
daily_output="email@address"
weekly_output="email@address"
monthly_output="email@address"I used a full email address, but you can try just "root" or a user name and see if it works.
This setting then overrides the default settings in "/etc/defaults/periodic.conf", BTW. Oh, and they won't be logged in "/var/log/*.out" any more either.
charlie

Similar Messages

  • How do I schedule regular daily/weekly/monthly/quarterly data uploads?

    Hello gurus!
    How do I schedule regular daily/weekly/monthly/quarterly data uploads?  How can I make it "automatic"?
    Thank you very much!
    Philips

    Hi,
    There are lots of documents available on how to design a process chain. It is basically your requirement what is needed.
    for eg.. You have  a daily masterd ata loaded into BW from R/3 and then the transaction data. So we create a chain where in we create anothe meta chain (for Master data) and drag the option of Load IP ( give variant as ur IP name you have created for that Particluar master data) , same for texts and hierarchy, for hierarchy use save option after the hierarchy process. and then use a attribute change run proces step to activate the master data. and then create another meta chain that loads transactiond data. Normally you have a IP that loads data into ODS here from source system, so Use IP process for that , next a process step to activate the ODS data and then use another IP to send the data to a cube. If you have aggregates built on that cube, use roll up process to roll up the data.
    If you can gimme your mail ID , I can send some docu's on process chains
    Regards
    Srini

  • How can i re-automate/re-enable the daily, weekly, & monthly 'tasks'

    some time ago i was having trouble burning a home video with imovie. one of the suggested remedies was to disable the overnight cleaning up tasks, which i did. however, i'd now like to reset this so that these tasks are once again automated whilst i sleep (currently using MacJanitor).
    but i cannot for the life of me work out how to do this. please help.

    Open the application TextEdit. Under the TextEdit menu open the Preferences. Under the heading New Document Atributes select the Plain text radio button. Under the heading Default Plain Text Encodings select Unicode(UTF-8) in the drop down menu by Save:. Under the heading Saving check the box Overwrite read-only files. Put TextEdit into your Dock.
    From the Finder > Go menu select Go to Folder... Type /etc in the dialog box and press return. Locate the file- crontab. Drag the file onto the TextEdit icon in your Dock. The file should open. Your crontab file probably looks like this:
    # /etc/crontab
    SHELL=/bin/sh
    PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
    HOME=/var/log
    #minute hour mday month wday who command
    #*/5 * * * * root /usr/libexec/atrun
    # Run daily/weekly/monthly jobs.
    #15 3 * * * root periodic daily
    #30 4 * * 6 root periodic weekly
    #30 5 1 * * root periodic monthly
    You need to remove the # on the following three lines.
    #15 3 * * * root periodic daily
    #30 4 * * 6 root periodic weekly
    #30 5 1 * * root periodic monthly
    Save the file and you should be good to go.

  • Daily, Weekly, Monthly, Yearly Backups & Tapes Pooling

    We are running number of servers, and have recently migrated from HP Data Protector to System Center DPM 2012 SP1. I am facing two issues here in which the potential solution is requested. I have created one Protection Group with 1 week retention for Daily
    Backup. Different selections or sources are part of this protection group from different servers.
    1. The issue # 1, is that when I wanted to create more Protection Groups for Weekly, Monthly and Yearly Tape Backups, then I could not select those volumes which are already part of Protection Group that I created for the Daily Backup (probably due to the
    reason that same data source can't be part of multiple protection groups). The data source selection will repeat in all protection groups, so please advise how can I achieve daily, weekly, monthly and yearly backups?
    2. Can I restrict some specific tapes (by allocating through bar codes) to each protection group so that only specific tapes will be used for daily, weekly, monthly and yearly backup? This way the offsite tape movement will also be achieved.
    Need solution on both issues. Please help.

    Hi,
    For item 1. use following PG settings. 
    1) In the protection group, select short term tape and long term protection.
    2) Select daily, only full backup, or Full plus incremental based on your needs.
    3) For the long term goals, select weekly, monthly, and yearly.
    For item 2. - there is no provision in DPM to specify certain tapes for each goal, but if you create a colocation PGset, you can specify how long to write to a tape and control if different goals use the same tapes or not by adjusting expiry tolerance.
    See Colocate data from different protection groups on tape
    http://technet.microsoft.com/en-us/library/jj628040.aspx
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT]
    This posting is provided "AS IS" with no warranties, and confers no rights.

  • Daily/weekly/monthly production reports

    Hi Experts,
    IMy client needs daily/weekly/monthly production reports with graphical representation. I want to know in acase there are any standard reports which will be a work around solution for the above said reports.
    Thanks

    Hi nandi6346,
    Yes, COOIS : Order informaton system, it self gives graphical representation for production reports.
    Go to COOIS - execute as per required date, to get grafical representation select the coloumns you required, e.g. Production order, target qty, Confirmed Qty, Delivered Qty, Scrap Qty, etc and the click on "Display Grafic" tab, it will show you grafical report.
    Tara

  • What do you use to manage daily\weekly\monthly tasks?

    I use Tasks (a clone of Astrid based on the source code) on Android which is synced to Google Tasks. Haven't really ever found anything that's a real replacement to Astrid since Yahoo killed it for no reason.

    Hey guys, just wanted to see what you guys use to manage your tasks on a daily\weekly\monthly\quarterly\yearly basis?We are currently using a product called VIP Task Manager Professional and we really love it. Ithttp://www.taskmanagementsoft.com/products/taskmanagerpro/It is pretty inexpensive and customizable. They offer a full-featured 30-day trial version of VIP Task Manager and there is a Standard edition as well.All the tasks have the ability to be assigned to the whole team or an individual member and can have notes, comments and even documentation attached to the task.There is a calendar feature, it has recurring tasks and you can set up different views too - daily - weekly - all tasks.BTW, our Operations team started using it 10 months ago and we have been using it for about 3 months. Operations just passed an audit with flying...
    This topic first appeared in the Spiceworks Community

  • Not Been Able To Run Daily/Weekly/,Monthly Scripts

    I was running Onyx as usual and was surprised that it would freeze whenever running the "scripts" option. I then downloaded a trial version of Cocktail after uninstalling Onyx and my macbook got stuck again at the weekly scripts. Then I installed a new version of Onyx and again the application stopped responding! I tried via Terminal too but there was no indication that something is happening. I am using the latest version of Tiger.
    I dont understand why something like this is happening. Should I be worried? Also I think my macbook has become a little slower and even Mail takes forever to open!

    Hello,
    Sometimes the weekly scripts take more than 10 minutes to run, with absolutely no feedback whatsoever. (I think weekly takes the longest time of the 3 types.) Did you get the grey screen of death, or just assume it was freezing since nothing was happening? If you force quit a weekly job, it takes slightly longer the next time you run it. My advice is to run weekly, go get lunch, and come back and see if it is done.

  • Cannot Send Mail from my iPhone 4s

    I am no longer able to send out replies or new emails from my phone, this is very recent and I have tried everything I know of.. But I am not THAT tech-savvy.
    So, anyways, when I go to send an email or reply to one, I get a pop-up box that says "Cannot Send Mail - The username or password for "said"-hotmail account is incorrect." So then I go to the settings enter my correct password for my hotmail account, it accepts it, and try again. Same pop-box appears, even though my password and username are both correct.  I know that they are correct because I am able to receive email with no problems at all.
    Is this a fixable problem or should I call Apple or take my phone in directly to them and have one of the techs look at it ?
    Thanks;
    Odyssy

    Problems with sending mail is rooted in the settings for the SMTP server. There are places in this that say the username and password are optional, but normally are required by many email providers. Go back into the SMTP server settings and check all of the areas. I also agree with Doctor9fan to check your SSL settings. If you cannot get it to work like this, then remove the account from the device and add it back. As you complete the creation, make sure the account verifies. You can also check the Microsoft site to make sure settings are correct for Hotmail.

  • Mail to root

    Hello,
    I would like send mails to root. I set up an alias for root in /etc/aliases. But if I send an email to root I get an error:
    warning: recipient rejected <root> not in Mail Service ACL
    Recipient address rejected: User unknown in local recipient table
    The alias for postmaster is in the alias table also and is working like expected.
    How do I setup postfix, aliases and/or the root user to enable root receiving mails?
    Thank you.
    P.
    P.S. I added root to the group com.apple.access_mail and it works.
    But this doesn't seem the right way.
    P.

    But is it secure or right to do this?
    I can't say that it would make any list of best practices. It would be better to change whatever is sending mail to root in the first place. That's what I do.

  • My ipad logs me out of every site if my screen turns off. It also clears all history. Even some of my email accounts won't let me send mail. Ever since the ios7 update, I am frustrated daily! How do I fix these problems?

    My ipad logs me out of every site if my screen turns off. It also clears all history. Even some of my email accounts won't let me send mail. Ever since the ios7 update, I am frustrated daily! How do I fix these problems?

    My ipad logs me out of every site if my screen turns off. It also clears all history. Even some of my email accounts won't let me send mail. Ever since the ios7 update, I am frustrated daily! How do I fix these problems?

  • Send mail daily

    pleze help can anybody help me in sending mail
    from a servlet daily and every time the order was delivered from
    a customer for my site

    extend HttpServlet
    Override doPost()
    and use java mail.
    You can find information on this by using the Search feature of java.sun.com.
    I hope this helps.
    -Richard Burton

  • How to create job to run daily based on form values entered and send mail.

    Hi,
    In DB we have 3 columns: creation_date, name, approved_or_not. Default for approved_or_not is 'No'.
    In the application form page suppose I fill in sysdate for creation_date and leave default for approved_or_not and click [create] button.
    Now a job should run everyday and check for where (approved_or_not='No' & creation_date = 'sysdate - 1') and send mail to the person in 'name' field mentioning: 'Approval pending. click on link <some_link> for details on approval'.
    Could anyone give me pointers to example on such job? (Working on APEX 3.0)
    Thanks,
    Priyanka

    create a DBMS JOB
    check out this forum link.
    dbms_job

  • Sending mail results is weird stuff happening

    I've been having heaps of problems when I send mail using the Mail programme on the mac (that never happen with exactly the same email accounts using Outlook on my other two, Windows, pc's). Sometimes parts of the message go missing. (like today - this is what one guy got when I sent him an email Hi Nomi and Jerome -- for some reason, part of Sarah's message wound up in
    the attachment called "untitled attachment 03982.txt". If that happened
    to you, you might have missed it. So...just in case.....here is the part
    that I found in "untitled attachment 03982.txt"). Other times the recipient says the message just looks like it's all Greek letters and unreadable - yet they can send the message back to me and it looks perfectly fine on my computer! WHAT ON EARTH IS HAPPENING? Can anyone help me stop? I use my mac for business and I really can't be having mis-formatted messages going to clients.

    Not going to be easy to figure out what happened with mixing message content. I don't think Mail alone could do that -- do you have any plugins or enhancement apps related to Mail?
    In general, make sure to use Plain Text only when sending to those people who report problems with displaying normal text.
    Ernie

  • How to send mail to other domains

    can any one help me?
    My requirement is i have to send mails daily to our customers according to the customers search results.
    our customers is having different mail ids(hotmail,rediffmail,yahoo,satyam,infosys...so on)
    I want to send the results according to the mail id they specified. I able to send mails with in our mail server(mail.kaakateeya.com). Please help me regarding this.

    Check with your system admin. Your e-mail server is probably setup to not allow mail relay.

  • Sending mail with multiple attachment

    hi.
    i want to send mail with multiple attachment.
    i m succeed in sending multiple attachment but the second pdf is not open.
    its given error like "This file is damaged and could not be open.
    pls check my code. and
    give the solution....
    point should be assured...........
    hope all u r understand my problem..
    & tell me where is i m missing something.
    REPORT  YSDPASALE1_MAIL LINE-SIZE 110.
    data : year_month(6) type c.
    data : from_date like sy-datum,to_date like sy-datum.
    INITIALIZATION.
    year_month = sy-datum+0(6).
    CONCATENATE year_month '01' into from_date.
    to_date = sy-datum.
    ranges : temp for mkpf-budat.
    temp-low = from_date.
    temp-high = to_date.
    append temp to temp.
    DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,
           jobname like TBTCJOB-JOBNAME,
           L_RELEASE(1) TYPE c.
    CONSTANTS : l_c_device(4)    VALUE 'LOCL'.
    DATA : t type i value 0.
    DATA : p_email1 like somlreci1-receiver,
            p_sender LIKE somlreci1-receiver.
    Data Declaration
    DATA: gd_recsize TYPE i,gd_recsize1 TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject  LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att1 LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att2 LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_desc1 TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des,
          gd_mtitle LIKE sodocchgi1-obj_descr.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    DATA: BEGIN OF mailstr OCCURS 0,
            p_email like somlreci1-receiver,
          END OF mailstr.
    DATA: mailtab like STANDARD TABLE OF mailstr WITH HEADER LINE.
    DATA: ypp18tab like STANDARD TABLE OF mailstr WITH HEADER LINE,
          ymis008tab like STANDARD TABLE OF mailstr WITH HEADER LINE,
          ysd15tab like STANDARD TABLE OF mailstr WITH HEADER LINE,
          ymis10tab like STANDARD TABLE OF mailstr WITH HEADER LINE.
    SUBMIT YSDPASALE1 with bdt in temp
                           to sap-spool
                          with line-size = '255'
                           with KEEP_IN_SPOOL = 'X'
                           with IMMEDIATELY = ' '
                           WITHOUT SPOOL DYNPRO
                           AND RETURN
       NEW-PAGE PRINT ON
       DESTINATION l_c_device
       IMMEDIATELY ' '
       KEEP IN SPOOL 'X'
       NEW LIST IDENTIFICATION 'X'
       NO DIALOG.
       new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
        PERFORM convert_spool_to_pdf.
        select yemail as p_email into CORRESPONDING FIELDS OF TABLE ymis008tab
          from ymail
          where ytcode = 'YMIS008'.
    ELSE.
       SKIP.
       WRITE:/ 'Program must be executed in background in-order for spool & mail sending',
               'request to be created.'.
      ENDIF.
    wait up to 3 seconds.
      submit YSD_MONTHLY_SALES
                                USING SELECTION-SET 'MAIL'
                                to sap-spool
                               with KEEP_IN_SPOOL = 'X'
                               with IMMEDIATELY = ' ' "SPACE
                               WITHOUT SPOOL DYNPRO
                               AND RETURN
       NEW-PAGE PRINT ON
       DESTINATION l_c_device
       IMMEDIATELY ' '
       KEEP IN SPOOL 'X'
       NEW LIST IDENTIFICATION 'X'
       NO DIALOG.
       new-page print off.
        IF sy-batch EQ 'X'.
        gd_attachment_desc1  = 'YMIS10'.
        gd_mtitle = 'Monthly Sales Report'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
        PERFORM convert_spool_to_pdf1.
       loop at it_mess_att.
        move it_mess_att1 to it_mess_att.
        APPEND it_mess_att.
       endloop.
       APPEND LINES OF it_mess_att1 to it_mess_att.
       free it_mess_att1.
        it_mess_att[] = it_mess_att1[].
        insert LINES OF it_mess_att1 into it_mess_att.
        APPEND LINES OF it_mess_att2 to it_mess_att .
         insert LINES OF it_mess_att1 into it_mess_att.
         insert LINES OF it_mess_att2 into it_mess_att.
       loop at ymis008tab into mailstr.
         p_email1 = mailstr-p_email.
          p_email1 = '[email protected]'.
           PERFORM process_email.
       endloop.
           clear mailstr.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
      ELSE.
        SKIP.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
    FORM convert_spool_to_pdf1.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att1 = gd_buffer.
        APPEND it_mess_att1.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      DESCRIBE TABLE it_mess_att1 LINES gd_recsize1.
      CHECK gd_recsize > 0 or gd_recsize1 > 0.
      PERFORM send_email." USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email." USING p_email.
    CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = gd_attachment_desc1 .
    gd_attachment_desc = 'YPP18 - Daily Highlights'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Dear Sir,'.
      APPEND it_mess_bod.
    it_mess_bod        = ' '.
    APPEND it_mess_bod.
      it_mess_bod        = ' '.
      APPEND it_mess_bod.
      it_mess_bod        = 'kindly find the attached document'.
      APPEND it_mess_bod.
    it_mess_bod        = ' '.
    APPEND it_mess_bod.
    it_mess_bod        = 'Do not reply on this mail, It is generated from SAP'.
    APPEND it_mess_bod.
    it_mess_bod        = ' '.
    APPEND it_mess_bod.
      it_mess_bod        = ' '.
      APPEND it_mess_bod.
      it_mess_bod        = 'Regards,'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Arpit Shah'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                          it_mess_att1
                                    using "p_email
                                          gd_mtitle
                                         'Testing mail generated from SAP'
                                         'Daily Highlights Abstract Report - YPP18'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                              it_attach1
                                        using "p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1,w_doc_data1 like sodocchgi1.
    ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data1-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    For 2nd Attachments
    * Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach1 INDEX w_cnt.
      w_doc_data-doc_size = w_doc_data1-doc_size +
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach1 ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
    APPEND LINES OF it_attach1 to t_attachment.
      t_attachment[] = it_attach1[].
    APPEND LINES OF it_attach1 to t_attachment.
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 0.
      t_packing_list-body_start = 1.
    DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
    DESCRIBE TABLE it_mess_att LINES t_packing_list-body_num.
      DESCRIBE TABLE it_attach LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  'YMIS008'."ld_attdescription.
      t_packing_list-obj_name   =  'YMIS008'."ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
      clear t_packing_list.
    for 2 attachments
      data : a type i,b type i.
       a = t_packing_list-body_num.
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 0.
      t_packing_list-body_start = a + 1. "1
    DESCRIBE TABLE it_mess_att1 LINES t_packing_list-body_num.
      DESCRIBE TABLE it_attach1 LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  'YMIS10'."ld_attdescription.
      t_packing_list-obj_name   =  'YMIS10'."ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    a = t_packing_list-body_num.
    clear t_packing_list.
    * Create attachment notification
    t_packing_list-transf_bin = 'X'.
    t_packing_list-head_start = 1.
    t_packing_list-head_num   = 1.
    t_packing_list-body_start = a + 1.
    t_packing_list-body_num = t_packing_list-body_num + 1.
    DESCRIBE TABLE it_mess_att1 LINES t_packing_list-body_num.
    t_packing_list-body_num = a + t_packing_list-body_num .
    t_packing_list-doc_type   =  ld_format.
    t_packing_list-obj_descr  =  'YMIS10'."ld_attdescription.
    t_packing_list-obj_name   =  'YMIS10'."ld_attfilename.
    t_packing_list-doc_size   =  t_packing_list-body_num * 255.
    APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
    loop at ymis008tab into mailstr.
      t_receivers-receiver = mailstr-p_email.  "ld_email.
      t_receivers-receiver = p_email1.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'. "X   "Read Acknoledgement
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
    endloop.
       CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    Rgds.
    Arpit

    Hi Arpit,
    Take a look at the documentation of FM 'SO_DOCUMENT_SEND_API1' for parameter PACKING_LIST. I think you should set t_packing_list-head_num to a different value than 0 for the second attachment.
    Regards,
    John.

Maybe you are looking for

  • Questions regarding itunes/ipod + found potential bug (itunes 7 + 5G ipod)

    I'd love to be proven wrong here.. but... Okay I've got an iPod 60GB video model (5G) and using itunes 7.0.2 on the imac and powerbook... now... my main storage point for music is the imac (so I automatically sync the ipod to itunes on the imac) and

  • Purchases from multiple iTunes stores (different countries)

    Do I have to have  a new/different accounts to bye from iTunes in the US? My account is Norwegian. I tired to by from the US store but it said that i only could by from the Norwegian store. When I tried to make another account for the US store it sai

  • Unable to use JRE 1.4.2 in Web Start

    LS, I have installed Java 2 RE 1.4.2-beta and Web Start lists it under Preferences | Java. But when I try to launch an application with js2e version="1.4.2" specified in the JNLP-file, Web Start tries to download this JRE from java.sun.com. I read in

  • IPod Click Wheel Question

    Can anyone tell me how long it's supposed to take to download 350 songs from the Mac to the new iPod? I'm just not sure if I'm having a problem or not - Thanks!

  • Iplanet LDAP Server 5.1

    After installing LDAP Server 5.1 on a Windows XP machine the following post installation errors are shown: -Setup is unable to store configuration data in the LDAP directory -Unable to create Administrative Server configuration -Could not authenticat