Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Batch job failures-email notification

Former Member
0 Likes
3,848

Hi all,

I have to make a program that should post email to multiple recipients based on the batch job failures. i do have a routine to post emails. but can u people help me with the logic to using that with the basis of job names.

thanks,

kiran.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,616

I guess I would create a custom table for storing the job name and the email addresses that need to be notified. Job name would be the key of the table, and another field for holding the email address.

<b>Job Name      Email Address</b>

Z_YOUR_JOB    [email protected]
z_YOUR_JOB    [email protected]

Then you can retrieve the email addresses by job name and send the emails.



select * into table icusttable
     from zcusttable
            where job_name = <the_job_name>.

loop at icusttable.

mailrec-receiver = icusttable-email.
mailrec-rec_type  = 'U'.
append mailrec.

endloop.

Regards,

Rich Heilman

7 REPLIES 7
Read only

Former Member
0 Likes
1,616

The Batch names are stored in the table APQI.

You can query that table and find the status (QSTATE) and accordingly build the logic to send the email to whoever you want.

Regards,

ravi

Read only

Former Member
0 Likes
1,616

Take a look at table <b>APQI</b>

I believe that the field <b>GROUPID</b> denotes the jobname. You can also give the <b>PROGID</b> (programme name) along with it!

I think you will get the status of the job from the field <b>APQI-QSTATE</b>

Do verify these....

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,617

I guess I would create a custom table for storing the job name and the email addresses that need to be notified. Job name would be the key of the table, and another field for holding the email address.

<b>Job Name      Email Address</b>

Z_YOUR_JOB    [email protected]
z_YOUR_JOB    [email protected]

Then you can retrieve the email addresses by job name and send the emails.



select * into table icusttable
     from zcusttable
            where job_name = <the_job_name>.

loop at icusttable.

mailrec-receiver = icusttable-email.
mailrec-rec_type  = 'U'.
append mailrec.

endloop.

Regards,

Rich Heilman

Read only

0 Likes
1,616

Hi Rich Heilman,

Thanks for the info. the problem is there are batch jobs which deal with the interfaces of 5 different countries and based on those jobs i have to send the emails. can u plz help me with that logic.

thanks in advance,

kishore.

Read only

0 Likes
1,616

You already have the logic for checking the status of the jobs right? You also know how to send emails, right? What logic do you need help with.

Regards,

Rich Heilman

Read only

0 Likes
1,616

thanks mate,

got it.

Read only

Former Member
0 Likes
1,616

Hi,

In that case you need to maintain the country also along with other information in the ztable and based on the SY_LANGU you can decide which one went wrong.

Regards,

Suman