Application Development 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: 

send email if fm executes more than one minute

0 Kudos

Hi Experts,

we have z function module, have created rest api for the same. this rest api used by the non sap systems, it is working as expected.

now the requirement, if the FM is executing more than 30 seconds then we have to send fm output as email & after 31st-second need to return the flag to api saying that data is sending through email.

let me know your thoughts how can we handle this.

thanks.

4 REPLIES 4

gdey_geminius
Contributor
0 Kudos

You can get the current time stamp in the first line of the FM using GET RUN TIME field. Below is the link for the same.

https://wiki.scn.sap.com/wiki/display/Community/GET+RUN+TIME+FIELD

After each statement you can get the RUN TIME field again and can do the subtraction. If the value is more than "30" sec, you can proceed for the sending email and exit the FM.

Thanks,

Gourab

0 Kudos

Hi Gourab,

my requirement, if the fm is executing more than 30 seconds then I have to interrupt the fm execution send some flag to api then after run the fm again send the output as email.

Thanks,

Vishwa

srikanthnalluri
Active Participant
0 Kudos

You can use the timer class - CL_GUI_TIMER to trigger the email after 30 secs, check the program SAP_TIMER_DEMO

0 Kudos

Hi Nalluri,

SAP_TIMER_DEMO which is more similar to WAIT statement. It does not suites my requirement.

1. I am creating a fm with wsdl, inside fm calling one child fm

2. if child fm executes more than 30 seconds then we have to stop child fm execution forcefully.

3. send a message to wsdl saying that "output will send through email"

4. send the fm output data through email.

I hope requirement is clear now.