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

Reg : Delay mail timing through ABAP programming

Former Member
0 Likes
1,324

Hi all,

        I am doing a development where I need to send mails to customers from SAP. The concept is that i need to send a mail at the time when a program( ZAUTH_CHK ) is executed fully. Then another mail in the delay of 5mins through the same program(ZAUTH_CHK) but with different message. This program will be executed only once. I should modify the code such that this mail should be sent only after 5MINS from the time of 1st mail sent. Please give your suggestions.

10 REPLIES 10
Read only

kakshat
Product and Topic Expert
Product and Topic Expert
0 Likes
1,261

You can put a WAIT statement at the end of your program and send the second mail after that.

Read only

Former Member
0 Likes
1,261

Hi akshat,

          I want the program output to be displayed before sending the second mail. so i conclude that the second mail should trigger only after entire process is over. WAIT usage making the program to wait till that time without displaying the output.which i don't need.

Read only

kakshat
Product and Topic Expert
Product and Topic Expert
0 Likes
1,261

In that case, you can probably use a background job and event approach. You can create an event in transaction SM62 and raise that event in your report. Then, create a background job (SM36) which you can configure to be triggered on the created event. You can attach another Z program which will take care of sending the second mail. You can check if the job configuration allows you to add a delay of 5 minutes (I don't remember clearly), else you can add the wait at the beginning of the Z program.

Read only

Former Member
0 Likes
1,261

Thanks for your response akshat. But can you make the same still simpler? because I am waiting to do with coding or with any change in SOST. I done need to run background job with creating new program, events etc. waiting for your response

Read only

kakshat
Product and Topic Expert
Product and Topic Expert
0 Likes
1,261

You can do another thing. You can create an FM, put a wait statement at its beginning and write coding inside it to send the second email. Then, at the end of your first program, you can call the FM in background task.

Read only

Former Member
0 Likes
1,261

hi akshat,

        we dint have authorization for Background triggering  in our server, so that i am approaching you for another solution. thanks in advance

Read only

kakshat
Product and Topic Expert
Product and Topic Expert
0 Likes
1,261

Maybe you can try CALL FUNCTION STARTING NEW TASK.

Read only

Former Member
0 Likes
1,261

You could also create a workflow and wait for events. Trigger events from your programs. Pretty straight forward.

Read only

Former Member
0 Likes
1,261

Use WAIT for 300 SECONDS and then trigger the second mail in the program.

Read only

0 Likes
1,261

Thanks Johnson, but using wait does not meet my requirement. Please see my 1st reply to

Kumar Akshat.