How to trigger a mail when a job gets cancelled

Hi experts,
                 I have a requirement to trigger a mail to the user when a job fails or gets cancelled.I need to add this part in the program for which the job is running.
Kindly help,any sample code will be very helpful.
thanks in advance,
regards,
Ashwin

check this thread out. Hope this might help you
how can i insure that job finished and good  and send mail to the user  ?
Regards,
Santosh

Similar Messages

  • How to trigger an event when a job is cancelled

    Hi,
    Can anyone help me out wid a transaction that will trigger an event when a job is
    cancelled....??
    My scenario is :
    When a job is cancelled (SM37) or in cancelled status  i want notify to certain ppl thru emails.
    How do i go abt doing the same??
    Its Urgent...
    Answers will be rewarded.
    regards,
    Rohan

    Hi,
    please check out the link below it might help you
    http://help.sap.com/saphelp_nw2004s/helpdata/en/71/a8a77955bc11d194aa0000e8353423/content.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/97d2e8b3-0b01-0010-b787-b8ce558a51c2
    for table name and list of function please check out the links below it will help you
    http://www.erpgenie.com/sap/abap/tables_system.htm
    http://www.sap-img.com/abap/function-list.htm
    **************please reward points if the information is helpful to you**********

  • How to send a mail to the user when a job gets canceled?

    Hi experts,
                      I need to send a mail when a job gets canceled to the user.I know the FM for sending mail and i can find if a job is canceled from tbtco,but i want to know how to send the mail from the same program ,once it got canceled ?
    thanks in advance,
    helpful answers will be awarded with points
    regards,
    ashwin

    Hi Ashwin
    Use the below peace of code:
    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,
    Sree

  • How to trigger a mail once BG job finished.

    Hi,
    Could anyone please let me know how to trigger a mail once Background job finished. I let you give one scenario where exactly I require this concept. Say, I execute t.code MB52 with particular variants in background to find stuck qty(s) of material(s) in given site(s).Now I want that system will trigger a mail to concern team once job finished.
    Thanks,
    AK

    You can try using workflow transaction SBWP.
    you need to create a distibution list in the above transaction and add the requested mail ids to it.
    then when you create a jon using transaction SM37 you have the option SPOOL LIST RECIPIENT where you can add the created distibution list
    so when ever the job has run sucessfully then a mail is sent to all the mail id's in the list.
    hope this helps.
    cheers
    sundeep

  • Trigger mail when backgroung job is cancel

    Hi,
    I want to trigger a mail to outlook when background job in sap gets cancel
    Regards
    Gopal

    Hi Gopal
    Have u read through [This|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/97d2e8b3-0b01-0010-b787-b8ce558a51c2] document?

  • Trigger a Mail when no file is placed

    Hi Everyone,
    How can we trigger a mail when no source file is placed for the file adapter to pick in a given time?
    Regards,
    Raghu

    Hi
    I m not sure wheter this will work or efficient.
    Cant you use operating system command option ?
    Like,,,, checking whether the particular file exists, if not create a blank file or new file with a different predefined content using Operating System Command option (using scripts or soemthing). and creating a separate file-mail scenario for this new file

  • How to trigger a mail through ALERT CONFIGURATION??

    Hi Folks,
    I want to know how to trigger a mail through Alert Configuration?
    I've read Help.SAP.com,  but i am not clear where exactly the sender Email address to be given for sending a mail??
    Pls reply..
    Thanks in advance..
    cheers
    ram.

    Hi,
    You need to maintain the email address in SU01 for the particular user Id. Also you need to configure transaction SCOT for this.
    Regards,
    Jai Shankar

  • How to trigger a workflow when data inside a table changes

    Hi
    How to trigger a workflow when data inside a table changes ??
    We need to trigger a workflow when STAT2 field value in PA0000 table changes.
    rgds
    Chemmanz

    Make use of Business Object BUS1065. In this business Object you have an attribute Status which you can use. There are a number of events that will get triggered when the status is changed.
    Thanks
    Arghadip

  • How do you quit mail when the  'quit mail' is not illuminated

    how do you quit mail when the 'quit mail' is not illuminated

    Command ⌘ + Q, or if that doesn't work, force quit by pressing Command ⌘ + option + esc, selecting Mail, and then Force Quit.

  • HT2500 how do I use Mail when I have a second e-mail address?

    How do I use Mail when I have a second e-mail address?

    If you are running Snow Leopard:
    Go under the Mail menu and choose Preferences, then choose the Accounts tab.  Under the box on the left you will see a + , click on it.  This will add a new account.  Now you must put in all the information needed to access that account. 

  • How to trigger email notification when users fail to reset your password in fim 2010 r2.

    Hi,
    how to trigger email notification when users fail to reset  your password in fim 2010 r2
    Regards
    Anil Kumar

    Hi Sylvain,
    I did all thing as you told me.First i created Criteria based Set after this we created a Workflow type Action and Actvities Type Notifcation Email template and finally i called this Workflow in MPR as Set Transition and call Set that i was created below.and
    check Advance View of Set this gives
    <Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Dialect="http://schemas.microsoft.com/2006/11/XPathFilterDialect"
    xmlns="/Request[(Creator">http://schemas.xmlsoap.org/ws/2004/09/enumeration">/Request[(Creator = 'b0b36673-d43b-4cfa-a7a2-aff14fd90522') and (RequestStatus = 'Denied or PostProcessingError')]</Filter>
    But this is not working for me so please tell me where i am wrong.
    Regards
    Anil Kumar

  • How to trigger email notification when users fail to give correct answers to reset your password in fim 2010 r2

    Hi,
    How to trigger email notification when users fail to give correct answers to reset your password in fim 2010 r2
    Senario:I want put wrong answering to the Questions that i was during registration if i give wrong answers to the questions then a Email Notification should be trigger to Users.
    Regards
    Anil Kumar

    Hi Sylvain,
    I did all thing as you told me.First i created Criteria based Set after this we created a Workflow type Action and Actvities Type Notifcation Email template and finally i called this Workflow in MPR as Set Transition and call Set that i was created below.and
    check Advance View of Set this gives
    <Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Dialect="http://schemas.microsoft.com/2006/11/XPathFilterDialect"
    xmlns="/Request[(Creator">http://schemas.xmlsoap.org/ws/2004/09/enumeration">/Request[(Creator = 'b0b36673-d43b-4cfa-a7a2-aff14fd90522') and (RequestStatus = 'Denied or PostProcessingError')]</Filter>
    But this is not working for me so please tell me where i am wrong.
    Regards
    Anil Kumar

  • Background Job get Cancelled when executing the report. Reason?

    Hi All,
    I have scheduled a Back ground Job and executed Immediately.
    when checking transacion SM37 the job get canceled.
    How to find out the problem for the Job Cancellation.
    Regards,
    Viji

    hi
    After scheduling back ground job ( give a time laps of 2 min )
    then go to sm37 ( at this moment , the job is not yet started) .
    select ur job in sm 37 and when job starts processing , type JDBG as the command and press enter.
    Now it will go to the debugging screen, where u will find system program . Now set a break point at the stements used in ur program from the debugging screen itself.( menu - breakpoint- breakpoint at - statement ) and press F8 .
    Now you can start debug ur code.
    Revrt back if any issues.
    Regards,
    Naveen

  • Triggering  a job when the first job gets cancelled...

    From BMV0, we can trigger a job once the first job is completed using the 'After Job' option. Can u tell me if its also possible to start another job when the first job gets cancelled ?
    Message was edited by: Sushma Anuprava
    Message was edited by: Sushma Anuprava

    Hi,
    Go to the database view V_OP and check for the column 'STATUS' which gives the background job status , based on value from this column (cancelled status ) , start the new job with FM : 'JOB_START' .
    Regards
    Appana

  • Information message when the job gets completed

    Hi,
      In foreground if i click a button a background job is scheduled.Now my need is when the job gets completed i need to inform the user that the job got completed.How to get that information message once it gets completed.Plz help

    check sy-subrc value after completion of the job.....
    if sy-subrc = 0.
        message i398(00) with 'You have succeeded'.
    endif.

Maybe you are looking for

  • I purchased iwork (pages/numbers) on my mac.....how do I get these apps now onto both my iphone and ipad

    I purchased iwork (pages/numbers) on my mac......how do I now get these apps onto my iphone and ipad? When I go to the 'purchased' section in my app store these are not listed. Thank you for your help. Mick.

  • Using Actions in batch editing??

    Is there any way to use Actions in Batch Editing in Photoshop Elements 10 or any Elements??  Thanks!

  • Performance Management - Transporting "Define Tabs and Process config"

    Good Morning Experts, We are moving from Development into our PPT (pre-production test) environment and have successfully transported the Performance management category settings/values, as well as the Template itself. Upon executing the Performance

  • Binding in Table

    Hi, The requirement is that there is a table and there is a column named 'status' in the table. If the value of the staus is 'PASS' then Pass should be highlighted in that row and if the value of the staus is 'FAIL' then Fail should not be highlighte

  • SCJP 1.5.0

    Hi All, I am a JAVA programmer, i am planning for SCJP 1.5.0, i have considerable knowledge in java, but i do not know about how to prepare for this exam and which is the best study guide. please, any one kindly guide me how to prepare and what to pr