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?

Similar Messages

  • 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

  • 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 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**********

  • Trigger Mail on Assigned JOB in Workflow

    Hi,
    I have to send mail to specified JOB (option in drop down of Recipient Type) in Workflow, but its not working though WF is not showing any error (showing success)  but user is not getting mail. I have changed it to Hard-Code user Name then user is receiving mail.. Please assist how I can send mail to assigned JOB defined...
    I have check in Table HRP1001 - w.r.t to JOB - ID, I can see record with SUBTY - 007 & user name in field - UNAME
    Thanks & Regards,
    Rajesh

    Hi,
    I think it should work, because a job as recipient type should somewhere in the background select all of the possible agents.
    Check OSS to see if this is acknowledged by SAP.
    If it is not possible at all, I would create a simple custom method which uses a function module to retrieve the agents.
    I think RH_STRUC_GET can be used along with an appropriate evaluation path (check transaction PPSS to find usefull evalution paths or create your own in OOAW)
    Kind regards, Rob Dielemans

  • CCMS not sending e-mail when system is down

    I have installed solution manager 4.0 and configured it as a CEN to handle all CCMS alerts from our SAP systems (ECC5.0, BW, etc), these systems all have CCMS agents install and configured. The configurations work no problem. We get automatically notifications on a lots of events -- such as shortdumps, responses time, system log errors, etc. However, we never get e-mail notifications on following two situations:
    1. System down -- when one system is down, we can see it availability is going to 0% on solution manager but we did not get e-mail, I am using MTE class "Availability_SysPercent_ABAP",  it should send e-mail when it below 60%. But it never did even it's 0%. Also tried several other MTEs, but none of them work.  Is this because when system is down, CCMS not work any more or something else?
    2. Job cancel -- I am not what MTE class to use in order to send e-mail when some jobs are cancelled.
    Any help are greatly appreciated.
    Yujun Ran

    I don't know if this is correct but my Execution is "Any server" and it works.
    I assume you copied the same method for your central AR method. The person earlier who mentioned clients may have something. I don't use the CCMS_OnAlert_Email_V2 method so I'm not sure but I think the parameters need to have a user in 000 with an e-mail address in the user master in order to send. I don't think this is any different for the Central AR method which works for you so probably not the problem but double-check. I use the CCMS_Send_Alert_to_ALM_V2 method so my config will be a little different.
    Is SAP_CCMS_MONI_BATCH_DP scheduled in CEN? Mine is in the working client but again, not sure if it matters.
    Does the AR method you have assigned show up in RZ20>>Change mode>>View>>Method allocation?
    Is the send job in SAPCONNECT scheduled, I believe it behaves differently with local and central AR's.
    Message was edited by:
            David Hill

  • Trigger mail for cancelled background jobs scheduled using SM37

    Dear Experts,
    My requirement is to trigger email whenever a job gets cancelled in background.
    For this I have already tried creating a workflow using BO BPJOB for event ABORTED.
    But for some reason the event is never getting triggered.
    I tested executing the workflow from tcode SWDD, it was running successfully, which means that there is no issue with my workflow.
    Now I want to resolve the above issue   OR
    I want to raise the event manually from the program through some BADI or Exit.
    But I didn't find any BADI or Exit for tcode SM37. Can anybody let me know if any.

    Hi,
    Please refer the below links.
    Workflow- Background job fail
    Re: Send mail when job fails
    Regards
    GK.
    Moderator message: please do not post just links without any further explanations.
    Edited by: Thomas Zloch on Sep 20, 2010 11:53 AM

  • 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

  • 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

  • BW- CRM MSA: Job is cancelled when Generic variant is used

    Hi Gurus,
    We are trying to download BW Reports on Mobile Sales App. The implementation is working perfect when we create variants in BW and then fetch data in CRM.
    But now we want to restrict data according to territory of the Mobile User. This is to be done with the help of "By Terr. ID" subscription, but when we use a generic variant and request data, the job is cancelled in BW system saying "Logon for BW user failed when starting a step."
    Pls help as it very very very very very very urgent!!!

    Sim, segue o dump.
    Runtime Errors         MESSAGE_TYPE_X
    Date and Time          07.02.2011 09:20:01
    Error analysis
        Short text of error message:
        Process PSAPROCESS, variant ZBRPCHAIN_LEVEL1_2LIS_11_VASTI is not schedu
        led waiting for event RSPROCESS D6OVUGNYV55HIR2Y3JEML7XT6
        Long text of error message:
         Diagnosis
             Process PSAPROCESS (variant ZBRPCHAIN_LEVEL1_2LIS_11_VASTI) needs
             to be started. According to the process chain maintenance, it needs
             to be scheduled while waiting for event
             ZBRPCHAIN_LEVEL1_2LIS_11_VASTI D6OVUGNYV55HIR2Y3JEML7XT6. However,
             this is not the case.
         System Response
             The chain is cancelled.
         Procedure
             In order to complete the chain run, follow these steps:
             1.  Ensure that Start Using Metachain or API is selected in the
                 variant maintenance for the start process. By doing so, you
                 ensure that the chain is not restarted.
             2.  Schedule the process chain.
             3.  In the log view for the process chain maintenance, choose View
                 -> Merge Active Version, and end the incorrect process using
                 the respective context menu entry.
         Procedure for System Administration
        Technical information about the message:
        Message class....... "RSPC"
        Number.............. 006
        Variable 1.......... "PSAPROCESS"
        Variable 2.......... "ZBRPCHAIN_LEVEL1_2LIS_11_VASTI"
        Variable 3.......... "RSPROCESS"
        Variable 4.......... "D6OVUGNYV55HIR2Y3JEML7XT6"

  • 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

  • Need to send a mail when job window time is over

    Hi ,
    select * from v$version;
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE 11.2.0.2.0 Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    ========
    I have created a job using dbms_scheduler.create_job with a 1 hour window ( created using dbms_scheduler.create_window ) .
    My job triggers a stored procedure . Now I have a send_mail code at the end of the stored procedure which sends a mail with plsql log as an attachment . When my job runs more than 1 hour the stored proc is getting stopped and not triggering the mail though I put the same code in exception block ( exception when others ) .
    CREATE OR REPLACE PROCEDURE my_sp
    AS
    BEGIN
    -- some code ---
    begin
    -- send mail --
    end
    EXCEPTION
    WHEN OTHERS
    THEN
    send mail ( Can I get this piece when window time is over )
    END;
    Is there any other way I can run the last piece of the proc (send_mail) .
    Thanks ,
    Mahesh

    Mahesh wrote:
    Folllowing below note .
    http://download.oracle.com/docs/cd/E14072_01/server.112/e10595/scheduse008.htm
    but need to attach a file .
    SQL> desc utl_mail
    PROCEDURE SEND
    Argument Name               Type               In/Out Default?
    SENDER                VARCHAR2          IN
    RECIPIENTS               VARCHAR2          IN
    CC                    VARCHAR2          IN     DEFAULT
    BCC                    VARCHAR2          IN     DEFAULT
    SUBJECT               VARCHAR2          IN     DEFAULT
    MESSAGE               VARCHAR2          IN     DEFAULT
    MIME_TYPE               VARCHAR2          IN     DEFAULT
    PRIORITY               BINARY_INTEGER          IN     DEFAULT
    REPLYTO               VARCHAR2          IN     DEFAULT
    PROCEDURE SEND_ATTACH_RAW
    Argument Name               Type               In/Out Default?
    SENDER                VARCHAR2          IN
    RECIPIENTS               VARCHAR2          IN
    CC                    VARCHAR2          IN     DEFAULT
    BCC                    VARCHAR2          IN     DEFAULT
    SUBJECT               VARCHAR2          IN     DEFAULT
    MESSAGE               VARCHAR2          IN     DEFAULT
    MIME_TYPE               VARCHAR2          IN     DEFAULT
    PRIORITY               BINARY_INTEGER          IN     DEFAULT
    ATTACHMENT               RAW               IN
    ATT_INLINE               BOOLEAN           IN     DEFAULT
    ATT_MIME_TYPE               VARCHAR2          IN     DEFAULT
    ATT_FILENAME               VARCHAR2          IN     DEFAULT
    REPLYTO               VARCHAR2          IN     DEFAULT
    PROCEDURE SEND_ATTACH_VARCHAR2
    Argument Name               Type               In/Out Default?
    SENDER                VARCHAR2          IN
    RECIPIENTS               VARCHAR2          IN
    CC                    VARCHAR2          IN     DEFAULT
    BCC                    VARCHAR2          IN     DEFAULT
    SUBJECT               VARCHAR2          IN     DEFAULT
    MESSAGE               VARCHAR2          IN     DEFAULT
    MIME_TYPE               VARCHAR2          IN     DEFAULT
    PRIORITY               BINARY_INTEGER          IN     DEFAULT
    ATTACHMENT               VARCHAR2          IN
    ATT_INLINE               BOOLEAN           IN     DEFAULT
    ATT_MIME_TYPE               VARCHAR2          IN     DEFAULT
    ATT_FILENAME               VARCHAR2          IN     DEFAULT
    REPLYTO               VARCHAR2          IN     DEFAULT

  • 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 send e-mail when a trigger condition is verified?

    Hi,
    I want to implement a trigger to send an e-mail when the condition of the tigger is verified.
    Thanks in advance.
    Paulo.

    i'm using the sample code you can find at http://otn.oracle.com/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html to implement the mail function.
    Check out you gateway configuration cause i had some problems with it at the beginning
    my trigger goes like this (i use it to receive a mail everytime i have a exception in one of my processes):
    create or replace trigger TRG_error_handle
    after insert on errores
    for each row
    begin
    demo_mail.mail(sender => "sendername", recipients => "your emailadress",
    subject => 'Error en reporte ' || :new.proceso,
    message => 'Ha ingresado un error de aplicación a las ' ||
    to_char(:new.fecha, 'hh24:mi:ss') || ' del ' ||
    to_char(:new.fecha, 'dd/mm/yyyy') || chr(13) ||
    ' Proceso: ' || :new.proceso || chr(13) ||
    ' Mensaje de error: ' || :new.err_desc);
    end if;
    end TRG_error_handle;
    Good luck.-

  • Which trigger fires when i press cancel query button in oracle d2k forms.

    hi all,
    i have simply press then enter query but didn't enter anything in form and then press the cancel query. so i just want to know that what trigger will fire when i press the cancel query button in d2k form.
    Regards,
    kam.

    Why not ask into Forms<br>
    <br>
    Nicolas.

Maybe you are looking for

  • Report Layout to be changed in webi document

    Hi, I have a webi documnet on top of BW query. The data is for the employee promotion details, The data is fetched like below:- EmpID     Name       Promotion Date 01           ABC        01/01/2011 02           DEF         02/01/2011 03           GH

  • How to install the ITS server

    Hi, I am looking for the ITS server in my ECC 6.0 installation files but i could not find it. Can someone help me to identify the files? Its used to access sap server via the web browser.

  • ABAP routine error message

    Can anyone tell me how to fix the routine? Error message: E:The type of the database table and work area (or internal table) "ZCA_EUMAT_PACKAGE" are not Unicode convertible. Unicode convertible. This is how I declared: data:   ZCA_EUMAT_package type

  • Why does my messages not send?

    Can anybody tell me why my messages will not send? They star to send and then as it gets to the end just stops and doesn't send.

  • DVD no worky in standalone DVD players

    I cannot get my burned DVD to play in any players. It will play in DVD Player on my G4, but thats it. I've tried 2 different brands of disks also. What really chaps my hide is that i did the EXACT same thing this time last year and it worked. No prob