Skip to Content
0
Former Member
Apr 23, 2008 at 06:47 AM

Doubt is uning and changing parameters

21 Views

Hi all

I get to know that if we pass a actual parameter with using value addition to a formal parameter , even if the values got changed inside the subroutine ,it will lost its changed value and turns to original value when its out of the subroutine. (Correct me if i am wrong).

If the case is like this if v pass a actual parameter with the changing value addition what will happen..i got an example with the answer here it is

REPORT demo_mod_tech_example_3.

DATA: op1 TYPE i,

op2 TYPE i,

res TYPE i.

op1 = 3.

op2 = 4.

PERFORM multip

USING op1 op2

CHANGING res.

WRITE: / 'After subroutine:',

/ 'RES=' UNDER 'RES=', res.

FORM multip

USING value(o1) TYPE any

value(o2) TYPE any

CHANGING value(r) TYPE any.

r = o1 * o2.

WRITE: / 'Inside subroutine:',

/ 'R=', r, 'RES=', res.

ENDFORM.

This produces the following output:

Inside subroutine:

R= 12 RES= 0

After subroutine:

RES= 12

Can anyone help me how it arrived the result ???

Thanks in Advance

Arun Joseph