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

Funtion Module inside a loop

Former Member
0 Likes
617

Hi Friends,

I have my data in internal i need to add the days to the date field depending on the term of payment. I used the function module 'DATE_IN_FUTURE' it is working fine, but I used this FM when I am moving my data from other internal table to the final internal table.

I doubt it is not good method to use FM inside a loop, Can any one pls give ur comments on this. Is there any other process to do it pls let me know.

Thanx in advance,

Regards,

Line

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
554

hi,

If the fm is complex then it takes time or u can use it.

My suggestion is if u feel the same problem then go to the source code of the function module and pick the codes of line where it is getting populated.

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
554

What is the arguement of using the function module within a loop? It depends on what the function module is doing. If it is doing some complex stuff and takes a lot of time, then doing within a loop is not optimal, but may be necessary depending on the requiement. For this function module, I don't see a problem.

Regards,

Rich HEilman

Read only

Former Member
0 Likes
555

hi,

If the fm is complex then it takes time or u can use it.

My suggestion is if u feel the same problem then go to the source code of the function module and pick the codes of line where it is getting populated.

Read only

Former Member
0 Likes
554

Hai Line Turbin,

FMs are also brought from ABAP Memory not even from SAP memory.

So There will not be much performance difference.

So you can use it .

Regds,

Rama.Pammi

Read only

former_member69765
Contributor
0 Likes
554

Hi..

Infact if your requirement is to add days into a date to get the future date .. then the FM is not required actually ...

If I have understood you correctly... you have a date say date_old and you want to know the date after 5 days (just an example)

So a simple statement date_new = date_old + 5 will give you the new date.

So you can actually avoid the call to FM.

Subtraction also works just like addition.

All you need to take care is that the date has to be of type sy-datum.

Have fun..

Reward points if this solves your problem.