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

FUNCTION MODULE

Former Member
0 Likes
507

hi,

any one can provide sample programs on pass by value, pass by reference using function modules.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
493

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.

4 REPLIES 4
Read only

Former Member
0 Likes
493

Hi,

All you need to do is check/uncheck the check box present in the import parameter. you will understand the flow

Read only

Former Member
0 Likes
494

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.

Read only

Former Member
0 Likes
493

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.

Read only

0 Likes
493

hi,

r u having any simple programs on function module.

pls send to me.