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

Can we call a Function Module with in a loop

Former Member
0 Likes
4,137

Hi,

Can we call a Function Module within a loop . Does it reduces the performance.

Can you please guide regarding this.

With Best Regards

Mamatha.

8 REPLIES 8
Read only

gopi_narendra
Active Contributor
0 Likes
1,630

Yes we can call. But it depends on the requirement.Performance is not a major compared to the requirement needed.

loop at it_tab into wa_tab.

call function 'CONVERSION_EXIT_PDATE_OUTPUT'

exporting

INPUT = wa_tab-date

IMPORTING

OUTPUT = wa_tab-date.

modify table it_tab from wa_tab transporting date.

clear wa_tab.

endloop.

Regards

- Gopi

Read only

Former Member
0 Likes
1,630

Hi,

If you can avoid it that's good,

but it doesn't affect the performance very badly as it creates it's own LUW.

Regards,

Raghavendra

Read only

Former Member
0 Likes
1,630

you can call the fuction module in the loop.

it depends totally what fuction module you are calling, if it is making lot ot iteration then performance may decrease,

so its totally depends upon the condtion where you are calling

but in most of the cases its not good to do so

Regards,

Naveen

Read only

Former Member
0 Likes
1,630

hi Mamatha,

You can call .. but it is better to avoid calling it within a loop...


Loop at it_tab.

   call function 'CONVERSION_EXIT_ALPHA_INPUT'
    exporting
      input  = it_tab-vbeln.
    importing
      output = it_tab-vbeln.

endloop.

Regards,

Santosh

Message was edited by:

Santosh Kumar Patha

Read only

Former Member
0 Likes
1,630

You can call the function module in loop.

Read only

Former Member
0 Likes
1,630

Hi

I have the input to a function module in an internal table and i need read record by record. For Each record we have to fetch the Net Due Date by calling a FM.

How can i avoid calling a Function Module with a loop. Any alternatives available.

With Best Regards

Mamatha.B

Read only

0 Likes
1,630

yes u can call the FM its not a big performance issue. unless and untill it triggers the <b>MODIFICATIONS</b> on standard SAP tables.

Regards

- Gopi

Message was edited by:

Gopi Narendra

Read only

0 Likes
1,630

Hi Mamatha.

If you can edit the function module, you can pass the internal table or the column of the table (import) to the function module and return the due date column (as a table of due date) (export).

Loop on the imported table and write your due date calculation code in that loop filling the export table at the end.

Regards

Kaushal N. Shah.