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

Recursive Function Module

Former Member
0 Likes
1,427

Hi Experts!!

I have two tables A and B.

A has two value 10

20.

B is empty here.

{Loop at A.

Call Fuction ' Find_Value'

Export

em_a = A

Import

im_b = B.

Endloop.}

here b has 3 records

75

25

39

case-2: I want to call same function module.

I want pass B value here till following condition satisfy. Let Say 10times.

Problem is I dont want to call same function module again and again.

{loop at B.

Call Fuction ' Find_Value'

Export

em_a = B

Import

im_b = B.

Table B,Field A = Table A Field C.

if B-A = A-C

Exit.

endif.

Endloop. }

Please suggest how to call above Fuction Module recursively for all value...in B.

Any clarification appreciated.

Please suggest.

Anee.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
785

use a local variable to assign the value of B.

and after calling the FM, update B.

keep calling the FM in a loop until and unless until the value of prev B = the local variable.

3 REPLIES 3
Read only

Former Member
0 Likes
786

use a local variable to assign the value of B.

and after calling the FM, update B.

keep calling the FM in a loop until and unless until the value of prev B = the local variable.

Read only

0 Likes
785

Hi,

Thanks for your quick reply.

But how to do that.

if B has 3 values, again each record giving me multiple import value. I have to again pass the same function module to find their subtransaction values.

when condition not satisfied , then quit.

Please give me example if any u have.

Read only

0 Likes
785

Hi anee,

use do...while loop.

declare a flag

Data flag type c.

do

if sy-index eq 10.

flag = 'X'.

endif.

call function

Export

tab = B

IMPORT

tab = B.

while flag <> 'X'.

it will call the same function 10 times.

Reward if helps.

Edited by: Hemant on Apr 16, 2008 6:21 PM