cancel
Showing results for 
Search instead for 
Did you mean: 

Email Trigger after error

Former Member
0 Kudos

Hi,

I created an abap program to calculate the size of a file and raise an error if it was not within a certain threshold size. I use the program in a process chain and upon an error, I have it send an email. The problem is, that the email is only sent when I check the log to see how the process chain ended, it comes out with the dialog, "Status Change of Process ABAP1 ZD_FILE_SIZE_CHK, Save Status and Trigger Events if Appropriate". Only if I say Yes to that message, does it send the email. I want it to automatically send it without me having to check the log.

Is that possible? By the way, I had to create my own Process Chain type for an ABAP program because the original ABAP Program process chain did not have a success or fail completion statuses, it only had a completion status.

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Angel,

try to have a look 176492 oss note.

It could be useful for this issue. I didn't applied it yet but I will as soon as possible because the only way to send mail automatically is via the CCMS.

I'll let you know.

Regards

Matteo

Former Member
0 Kudos

Hmm, I sent an OSS Note to SAP and they suggested to not have the ABAP program raise an exception, because it makes the program dump in turn not allowing the process chain to call the trigger after events, instead, have it just set a variable unsuccessful without dumping. How do you stop a program without having it dump? Im fairly new to ABAP programming so I am not sure of a way to tell the process chain to categorize this program as a failed program if something happens...

Former Member
0 Kudos

We had this same issue for a long time until someone finally figured it out.

You need to add the process chain to "Monitor Daily Process Chains" after it has run successfully on Production. (trancode RSPCM) To add a process chain to this transaction, use the "Create Button".

Then you need to schedule this transaction to run regularly, say every half hour. I don't know how to do the scheduling part; someone else did it, and he's not here now.

Former Member
0 Kudos

THANKS ALOT KURT,

It worked like a charm. Good stuff.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi!

The message "Status Change of Process ABAP1 ZD_FILE_SIZE_CHK, Save Status and Trigger Events if Appropriate" only occurs if the process had aborted.

Please make sure that your custom abap program works fine

in isolation with the chain. I hope you have implemented the method ' ~get_status ' which returns the current status of the process back to the chain.

Best Regards,

Poornima

Former Member
0 Kudos

I have executed the report on its own and it does execute correctly. What about this get_status method... can you show me an example of how to use it?

Thanks,

Former Member
0 Kudos

Hi ,

I am also working on this stuff a bit in RSPCM

Can you briefly tell me how to send a message when a process fails??

Many Thanks,

Reddy

Former Member
0 Kudos

In the process chain (in RSPC), right-click on a process, select Create Message... and fill in the necessary fields.

Former Member
0 Kudos

Ok, this is what I did:

1. Create your process chain.

2. Right-click the process in the chain you want to have en email message sent for, and select Create Message.

3. A pop-up will appear asking you to create a message for either errors, successes, or always (This depends on the process type, if you want an ABAP program to send messages on errors, you need to create a new process type which mimics the standard ABAP process type)

- To create a new process type, go to Settings->Maintain Process Types.

- This screen looks similar to the Variables maintenance in 2.X versions. You can click on New Entries to create a new one, OR copy an existing one and modify it. If you're creating an ABAP process type for errors and successes, please use copy.

- Once on the process type information screen, go to possible events, and change it to: Process ends "successful" or "incorrect".

- Save it.

- You can now see the new process type on your left side in your process type tab.

4. Once you select either success, error, or always, it will bring you to the documents screen.

5. Fill in the name and description fields.

6. You can tell it to who this message will go to by clicking on manage recipients list.

7. You can edit the message going to these recipients by clicking on edit document.

8. After you have done all you needed, save it.

9. Now you have to go into RSPCM so that a job is scheduled to check the logs of this process chain and will automatically let it know to continue with the after-events when your program dumps (THIS IS ONLY NECESSARY IF YOU HAVE AN ABAP PROGRAM WHICH RAISES AN EXCEPTION, CAUSING AN ABAP DUMP). The other process chain types should be able to send an email message even upon error, but this is only my guess, I have only tried it with ABAP program errors/dumps.

- Once you go to RSPCM, You need to add your process chain to it's log monitoring list. Click on the blank page icon.

- Select your process chain.

- Click on the Job Icon in green to schedule this job.

- Set it run every 5-10 minutes, or at whatever schedule you wish, depending on when you are expecting your process chain to dump. So that it checks the logs and continues to process the chain and the email.

This is what I did on my side, if you have anything to add, or maybe an easier way to do this, please post it here. Thanks,

Former Member
0 Kudos

Thanks Angel and Kurt for your valuable Inputs.

Angel - Thanks for your patience and detail!

Regards,

Reddy

Former Member
0 Kudos

Hi Angel,

Then there might be a problem where your Basis Admin needs to change the settings in SOST for "internet" mails. For now you can try whether the mails get triggered for SAP inbox.

Former Member
0 Kudos

Hmm, I believe the problem is more on the Process Chain side, because if the process fails, and I go into the log and select yes when it asks the question, "Status Change of Process ABAP1 ZD_FILE_SIZE_CHK, Save Status and Trigger Events if Appropriate", it does send the email. It's just that I don't want to have to check the logs when it fails to send an email, I want it to send an email upon failure, without me having to click yes to the Trigger Events if Appropriate.

The email doesn't even get to be placed on the queue, since the trigger never executes it. And SOST doesn't even recognize it.

Former Member
0 Kudos

Hi all,

I have built a process chain which, after loading, should sent a mail message if the loading was correct or not.

After the process loading I have built two messages for both cases.

If the process loading is correct the mail is sent but I have some problem when the process is not correct.

If there is some problem and the loading program gives an error the mail is not sent (for example I tried to deactivate the update rules, to change data source without replicate, to stop the process from SM50).

In all these cases the mail has been sent ONLY if I entered in RSPC,check the process chain and the system asked me if I wanted to trigger the event after the error. Otherwise the mail was not sent.

The only case I found the system automatically sends an email has been when I insert in the start routine of the update rules the field "ABORT = 8".

I tried, also, to go to the CCMS Agent and complete the

alerts of process chain but the mail wasn't be sent. I tried moreover to run the SAP_CCMS_MONI_BATCH_DP job as described in the 708480 note but unsuccessfully. The only way to send the mail is by

refreshing the PC manually. Have you any idea to do this automatically?

Thanks in advance

Matteo Ferrari

Former Member
0 Kudos

This is the same problem I am having, if it goes through successfully, it emails, but when it is not correct, it doesn't email because it is waiting for you to check the logs so that it could trigger the after events. Must be a glitch in the trigger processing for failing processes.

Former Member
0 Kudos

Hi Angel,

You can create a "success" or "failure" message for each process in the Process Chain. Right click on the process and select "Create message" option. Hope it works.

Former Member
0 Kudos

Hi Dinesh, I already created the message, it just doesn't trigger after the process fails.