‎2008 Feb 27 10:07 AM
hi,
any one can provide sample programs on pass by value, pass by reference using function modules.
‎2008 Feb 27 10:11 AM
Hi,
By Value
Data : a type I value 20.
Perform sub1 using a.
Write a.
FORM sub1 using value (p_a)
P a = 15
ENDORM.
In this case during subroutine call, the formal parameter are created as copies of actual parameter.
The formal parameters have the memory of their own. Changes made to formal parameter have no effect on the actual parameter.
Like in this case, though value of p_a is changed to 15, it has no effect on a which remains as 20.
By Reference
Data: a type I value 20.
Perform sub1 using a.
Write a.
FORM sub1 using value (p_a)
P a = 15.
ENDORM.
By default system calls all the forms by reference.
In this case, only the address of the actual parameter is transferred to the formal parameters. The formal parameter has no memory of its own. If you change the formal parameter, change is visible in actual parameter also.
Regards,
Priyanka.
‎2008 Feb 27 10:11 AM
Hi,
All you need to do is check/uncheck the check box present in the import parameter. you will understand the flow
‎2008 Feb 27 10:11 AM
Hi,
By Value
Data : a type I value 20.
Perform sub1 using a.
Write a.
FORM sub1 using value (p_a)
P a = 15
ENDORM.
In this case during subroutine call, the formal parameter are created as copies of actual parameter.
The formal parameters have the memory of their own. Changes made to formal parameter have no effect on the actual parameter.
Like in this case, though value of p_a is changed to 15, it has no effect on a which remains as 20.
By Reference
Data: a type I value 20.
Perform sub1 using a.
Write a.
FORM sub1 using value (p_a)
P a = 15.
ENDORM.
By default system calls all the forms by reference.
In this case, only the address of the actual parameter is transferred to the formal parameters. The formal parameter has no memory of its own. If you change the formal parameter, change is visible in actual parameter also.
Regards,
Priyanka.
‎2008 Feb 27 10:39 AM
Hi ,
go to import or changin or tables parameter , near to optional parametr you will find one more check box for pass value.
if you check that it will be pass by value. for more details just press f1 on the same you will get more documantation on the same.
‎2008 Feb 27 11:08 AM
hi,
r u having any simple programs on function module.
pls send to me.