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: 

Function module In Update Task is called more than once

Former Member
0 Kudos

Hi experts!!

I had a requirement to Create a Customer ( i will call it B) when another Customer (A) is created (ON SAVE).

I used a Badi to implement the requirement, and inside my Badi i have 2 Function Calls in Update Task.

The first one to create Customer B and the second one to send Customer's B data to another System.

Even though the second function call is inside an IF-ENDIF condition ( so that only Customer's B data are sent) the function is called twice sending the same data. My guess is that since the First Function saves the Customer to the database, that is the reason why the second Function is called twice.

Is there any way i can control how many times a Function In Update Task is called????

Please help!!

Thank you in advance!!

2 REPLIES 2

Former Member
0 Kudos

sure, declare variable you can use as a switch. Upon entry it will be initial, after first execution set to ON, and always check for initial before call the FMs. If that doesn't work, export the value to memory id, import upon each entry to your code and check for whether already executed or not.

Former Member
0 Kudos

Hi BreakPoint & thank you for your reply!!

I tried your suggestion but even if i fill the flag during the first call the function is called twice. Looks like during the second database commit the function is called with the correct conditions met but twice.

Also while debugging it looks like it is only called once. It s very strange!

Any other ideas???