How can i insure that job finished and good  and send mail to the user  ?

how can i insure that job finished and good  ,
and how can i send mail to the user "ok"   ?

Hi Dakota.  We do something simular with our nightly MRP job.  Our MRP job runs around midnight,  then we kick off another job about 4am which checks to see if any of the jobs in question have abended, if so,  then it sends an email to the email addresses specify in the report variant.  Of course, this could be modified to check for successfully complete jobs, if that is your requirement.
REPORT ZBCJOBMONITOR .
TABLES: SOMLREC90,
        TBTCO.
DATA: MAILDATA   LIKE SODOCCHGI1.
DATA: MAILTXT    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILREC    LIKE SOMLREC90 OCCURS 0  WITH HEADER LINE.
DATA: I_TBTCO    LIKE TBTCO OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001 .
SELECT-OPTIONS: S_JOB FOR TBTCO-JOBNAME.
SELECT-OPTIONS: S_JOBC FOR TBTCO-JOBClass.
SELECT-OPTIONS: S_REC FOR SOMLREC90-RECEIVER.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
  CLEAR:    MAILDATA, MAILTXT, MAILREC, I_TBTCO.
  REFRESH:  MAILTXT, MAILREC, I_TBTCO.
  PERFORM GET_ABENDED_JOBS.
  PERFORM BUILD_RECEIVERS.
  LOOP AT I_TBTCO.
    PERFORM BUILD_TEXT_MESSAGE.
    PERFORM SEND_MAIL_NODIALOG..
  ENDLOOP.
*      Form  BUILD_TEXT_MESSAGE
FORM GET_ABENDED_JOBS.
  SELECT * FROM TBTCO
          INTO CORRESPONDING FIELDS OF TABLE I_TBTCO
                     WHERE JOBNAME IN S_JOB
                       AND STATUS = 'A'
                       AND JOBCLASS IN S_JOBC
                       AND SDLSTRTDT = SY-DATUM.
ENDFORM.
*      Form  BUILD_TEXT_MESSAGE
FORM BUILD_TEXT_MESSAGE.
  DATA: DATE(10) TYPE C.
  DATA: TIME(10) TYPE C.
  MAILDATA-OBJ_NAME = 'MONITOR'.
  MAILDATA-OBJ_DESCR = 'Batch Job Monitor'.
  MAILDATA-OBJ_LANGU = SY-LANGU.
  CONCATENATE 'Job Name:' I_TBTCO-JOBNAME
              INTO MAILTXT-LINE SEPARATED BY SPACE.
  APPEND MAILTXT.
  PERFORM FORMAT_DATE USING I_TBTCO-SDLSTRTDT
                            DATE.
  CONCATENATE I_TBTCO-SDLSTRTTM+0(2) ':'
              I_TBTCO-SDLSTRTTM+2(2) ':'
              I_TBTCO-SDLSTRTTM+4(2)
                 INTO TIME.
  CONCATENATE 'Start Date/Time:' DATE TIME
            INTO MAILTXT-LINE SEPARATED BY SPACE.
  APPEND MAILTXT.
  CONCATENATE 'Job Class:' I_TBTCO-JOBCLASS
            INTO MAILTXT-LINE SEPARATED BY SPACE.
  APPEND MAILTXT.
  MAILTXT-LINE = 'Job has terminated abnormally'.
  APPEND MAILTXT.
ENDFORM.
*      Form  BUILD_RECEIVERS
FORM BUILD_RECEIVERS.
  LOOP AT S_REC.
    CLEAR MAILREC.
    MAILREC-RECEIVER = S_REC-LOW.
    MAILREC-REC_TYPE  = 'U'.
    APPEND MAILREC.
  ENDLOOP.
ENDFORM.
*      Form  SEND_MAIL_NODIALOG
FORM SEND_MAIL_NODIALOG.
  CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
       EXPORTING
            DOCUMENT_DATA              = MAILDATA
            DOCUMENT_TYPE              = 'RAW'
            PUT_IN_OUTBOX              = 'X'
       TABLES
            OBJECT_HEADER              = MAILTXT
            OBJECT_CONTENT             = MAILTXT
            RECEIVERS                  = MAILREC
       EXCEPTIONS
            TOO_MANY_RECEIVERS         = 1
            DOCUMENT_NOT_SENT          = 2
            DOCUMENT_TYPE_NOT_EXIST    = 3
            OPERATION_NO_AUTHORIZATION = 4
            PARAMETER_ERROR            = 5
            X_ERROR                    = 6
            ENQUEUE_ERROR              = 7
            OTHERS                     = 8.
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.
*      Form FORMAT_DATE
FORM FORMAT_DATE USING IN
                       OUT.
  CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
       EXPORTING
            DATE_INTERNAL            = IN
       IMPORTING
            DATE_EXTERNAL            = OUT
       EXCEPTIONS
            DATE_INTERNAL_IS_INVALID = 1
            OTHERS                   = 2.
ENDFORM.
Regards,
Rich Heilman

Similar Messages

  • I added a photo from camera roll to a created album,how can I delete that photo from camera roll and still keep photo in album

    I added a photo from camera roll to a created album, how can I delete that photo from camera roll and still keep same photo in album?

    You can't. It doesn't work that way.
    the new album that you created doesn't contain a copy of the actual photo. It contains a pointer to that photo. If you delete it from the camera roll, you will delete it from the album that you created as well. Albums that you create on the iPad in the Photos app are for local organization only and cannot be transfer or imported to your computer, because there really are no photos in those albums

  • I want to synchronize my iPOP with my new MAC. How can i do that without lost my applications and songs???

    I want to synchronize my iPOP with my new MAC. How can i do that without lost my applications and songs???

    Backup you library and restore to the new computer.
    iTunes: Back up your iTunes library by copying to an external hard drive
    or
    iTunes: How to move your music to a new computer
    - After all the media is on the new computer connect the iPod to the computer and make a backup by right clicking one the iPod under Devices in iTunes and select Back Up
    - Restore the iPod from that backup
    Note that the iPod backup that iTunes makes does not include synced media like apps and music.

  • If I purchased a movie, from a computer a LONG time ago like 3 years but recently I changed computers how can I get that movie back? p.s. I bought the movie from iTunes

    If I purchased a movie, from a computer a LONG time ago like 3 years but recently I changed computers how can I get that movie back? p.s. I bought the movie from iTunes

    If you don't have the movie on the old computer and you don't have the movie backed up on a disc somewhere, your only choice is to purchase the movie again. Currently, movie downloads are a one time deal andit is your responsibility to have a backup copy.
    If you have the movie on the other computer still, you can burn it to a DVD and then copy it over to the new computer.
    Personally, I have two computers and when I make a purchase on one, iTunes automatically copies it to the other and I have never lost videos or music in this manner.

  • We purchased a new iPad2 and registered it using a 'new' iCloud email/ID. We are unable to send email from the iPad and iPhone. The error is: Cannot send mail. The user name or password for iCloud is incorrect.

    We purchased a new iPad2 and registered it using a 'new' iCloud email/ID. We are unable to send email from the iPad and iPhone. The error is:>> Cannot send mail. The user name or password for iCloud is incorrect.

    About ~20 hours later, this ended up solving itself. We can send email using the '.icloud' email from both the iPad and iPhone.  Advise would be 'wait' before you start seeking alteranatives like yahoo, hotmail, etc.  This definitely is a convenient way to keep all your 'cloud' information in a centralized place, including the common email...

  • I am using Mail version 7.2(1874), and I have noticed that only 1 month of messages are kept in the Inbox folder  How can I change that?    onths worth of messages are kept in the Inbox. I can't figure out how to change that

    I am using Mail version 7.2, with OS 10.9.2. Only 1 month of messages are kept in the Inbox folder. How can I change that?
    ramon 261

    No luck, unfortunetly.  I've even restarted the whole computer.  They are usually still there, and sometimes, even older messages that I deleted from the drafts folder a long time ago, reappear as well.  I've also deleted the account from Mail and set it up from scratch several times hoping that would work, but it failed as well.

  • How can i know that my FPGA VI logic is placed correctly on the FPGA???

    Helloo,
    I am very new to LABVIEW and using LV8.0 version
    I am using cRIO-9002, cRIO-9101 chassis, NI-9401 in slot1 of the chassis. I have written some simple VI which will take True or False as a input and based on that output will come as 12 or 3 respectively. I am writing this output at DIO[7:4] of NI-9401.  My VI is running successfully , generating intermediate files and BIT file also. In the Front panel i am able to see correct output also. But when i see the output at the output pins of NI-9401, nothing was coming. I am attaching my file. In this i have used FPGA I/O node to write output on that pins of NI-9401. My Q is
    1. Can i expect output pins of NI-9401??
    2 . Is there anything is to be done or write anything interface VIs..etc are to be done to get the outputs.
    3. My way of procedure is complete or not??
    Help me in this issue plz.
    Reagrds,
    Ravi Kumar.
    Attachments:
    simpleAIAO.vi ‏38 KB

    Hello Eli S,
    But still i am not getting. 
    I am seeing voltage level at DIO pins of NI9401 as 0V only.
    I observed that in MAX
    Cofiguration >> my system >>  software >>  NI-VISA version is 4.1
     and
    Cofiguration >> remote system >>  software >>  NI-VISA version is 3.4.1
    will it be a problem?? I am setting initial line direction as a output port  in the project explorer NI9401 module and also set the line direction as a output in  front panel.
    Is there any chance of problem in hardware?? like connection between the FPGA(chassis cRIO9101) and NI9401??
    how can i check that my hardware is working perfeclty??
    I am thinking that the only way is what i am doing right now...like writing digital data to lines...will be a simple experiment to check my hardware.
    Sorry, i may be wasting your time, but if I overcome this problem, i can start my application on cRIO which is bigger in logic.
    Thank you very much.
    Regards,
    Ravi Kumar.
    Attachments:
    Digital Line Output.vi ‏269 KB

  • How do I fix this error "An error occurred while sending mail. The mail server responded: Authentication is required before sending [R0107005]. Please verify

    My previous request had an incorrect email. This error began yesterday and I can't reply or send new emails from my PC, but email is working on my iphone.

    I have been doing that. Here is the complete message I get. It was cut off in my initial question. "An error occurred while sending mail. The mail server responded: Authentication is required before sending [R0107005]. Please verify that your email address is correct in your Mail preferences and try again."

  • In my old OS I could press F11 and clear all the open windows from view to see only the desktop. How can I do that now in Mavricks?

    In my old OS I could press F11 and clear all the open windows from view to see only the desktop. How can I do that now in Mavricks?

    system preference > Keyborad >  click the box thast says  use all f1,f2,f2 keys as standard functiong Key and then the f11 key should casue all window fo fly to the side and you can see your desktop

  • HT1296 I was using the iCloud for my iPod and had recorded an important Voice Memo on the device. Before I was able to store it on my computer, the device stopped working. I have the data on the Cloud, how can I get that back to my iMac?

    I was using the iCloud for my iPod and had recorded several irreplaceable Voice Memos. It went up to the Cloud, but I wasn't too savvy with the Cloud at that point, so it wasn't syncronizing to my home computer. So, the thing is that the iPod died and the backup is in the Cloud and I would like to load the backup to my iMac to recover my data. How can I do that? Thanks

    The new device I got to replace the iTouch is a iPad and I don't see the playlist I created with previous voice memos on it at all. Is there any way to access them on the iPad? If I erase the iPad and restore it with the old back up will the Voice Memos come along and get in to my home computer or will I be out of luck?

  • HT4085 I can't figure out how to turn on the rotation.  How can I do that

    I can not figure out how to turn on auto rotation.  How can I do that?

    If you see a lock icon in the upper right corner of the screen - then the screen orientation is locked.
    Try the side switch above the volume rocker first and see if that unlocks the screen. If that doesn't do it, double tap the home button and swipe to the right and look for the lock icon all the way to the left.

  • When I open a new window (Ctrl+N), I want a blank page to appear. I do not want my home pages opened. How can I do that?

    When I open a new window (Ctrl+N), I want a blank page to appear. I do not want my home pages opened. How can I do that?

    A new window opens by default with the home page(s).<br />
    If you want a blank window then you need to open an about:blank page in a new window.<br />
    You can do that with a bookmark that you open with a Shift+ left-click in a new window.<br />
    Otherwise you need to set the Home page to a blank page and use a bookmark to open the preferred Home page in a new tab.

  • The aps store has an old email address as part of my apple I'd.. How can I change that?

    I have changed my apple I'd on my desktop, but cant get it changed on my ipad2 when I'm in iTunes or the aps store.
    It shows my old email address as the first part of my apple I'd. How can I change that?

    Go to Settings>Store>Apple ID - tap the ID and sign out, then sign in with the correct account. If that doesn't work, sign out of the account, restart the iPad and then sign in again.
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.

  • I have synchronized my iPhone with my ical on my macbook, but somehow my dates on the iPhone appear twice? how can I change that?

    I have synchronized my iPhone with my ical on my macbook, but somehow my dates on the iPhone appear twice? how can I change that?

    You sign off and sign in with the correct Apple ID.
    See this tip and is still valid for IOS 6
    iOS 5 & iCloud Tips: Sharing an Apple ID With Your Family

  • There are photos that I would like to delete it on Photo Stream!?! How can I do that???

    There are photos that I would like to delete it on Photo Stream!?! How can I do that???

    You'll need to convert the original source video to MP4 format, import it into iTunes and sync it to the iPad.

Maybe you are looking for