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

returning addition

Former Member
0 Likes
925

hi,

may i know what does the syntax mean here.

1) is returning same as exporting?

2) why we must have a ( ) in vessel_id = vessel1->get_id( )?

3) if i use exporting, how should i change this statement

"vessel_id = vessel1->get_id( )"?

methods get_id RETURNING value(id) TYPE i.

vessel_id = vessel1->get_id( ).

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
906

Hi,

The point wise answers of your qs as per my knowledge are:

1. Returning and Exporting are different. Return parameter can be used to pass value or to return value from a method. While Export parameter can only return values from the method. For a method we can have multiple Export parameters but can have only one Return Parameter.

2. In the example you have given, if the method GET_ID do not have any mandatory parameter (IMPORT, EXPORT, RETURN...) you can call the method without using any parameter as vessel_id = vessel1->get_id( ).

3. To you EXPORT parameters write code as below:

vessel_id = vessel1->get_id( exporting <e_par1> = <val> ).

Thanks

11 REPLIES 11
Read only

Former Member
0 Likes
906

hi all,

any help.

thanks

Read only

Former Member
0 Likes
907

Hi,

The point wise answers of your qs as per my knowledge are:

1. Returning and Exporting are different. Return parameter can be used to pass value or to return value from a method. While Export parameter can only return values from the method. For a method we can have multiple Export parameters but can have only one Return Parameter.

2. In the example you have given, if the method GET_ID do not have any mandatory parameter (IMPORT, EXPORT, RETURN...) you can call the method without using any parameter as vessel_id = vessel1->get_id( ).

3. To you EXPORT parameters write code as below:

vessel_id = vessel1->get_id( exporting <e_par1> = <val> ).

Thanks

Read only

0 Likes
906

hi,

1) for point 2, when you said do not have any mandatory parameter, you mean parameter interface? so returning also 1 of the mandatory parameter?

2) if mandatory parameter is parameter interface then,

methods accelerate.

call method ov->accelerate

i do not need to put the bracket, ( ) for call method ov->accelerate( ). so i wonder why there is a bracket for vessel_id = vessel1->get_id( ).

3)

i actually still do not get the syntax right.

for example:

methods dirve importing speed_up type i.

when call, call method vessel->drive( 50) or call method vessel->drive exporting speed_up = 50.

but why when methods get_id returning value(id) type i,

i need to put vessel_id = vessel1->get_id( ).

thanks

Read only

0 Likes
906

hi,

methods get_id returning value(id) type i.

can

vessel_id = vessel1->get_id( ).

write as

CALL METHOD vessel1->get_id

RECEIVING id = vessel_id.

i still do not know why need to put a bracket ( ) for "vessel_id = vessel1->get_id( )."

Read only

Former Member
0 Likes
906

<Duplicate>

Read only

Former Member
0 Likes
906

Hi e l,

The difference is that you cannot assign the value that is exported from a method using direct assignment operator.

like this:

vessel_id = vessel1->get_id( ) "If you declare an exporting parameter, you cannot assign the value directly to a variable called vessel_id.

2) we must give a () after the method name to tell the system that get_id is a method and not an ATTRIBUTE.

3) call method vessel1->get_id

exporting vessel_id = vessel_id . "But the get_id method should have an exporting parameter with the name vessel_id

Regards,

Ravi

Read only

0 Likes
906

hi,

now i got it.

1)

if not assignment like "vessel_id = vessel1->get_id( ) " we do not need to have bracket to signify that it is a method, correct?

2) only returning addition can use assignment? why? what else addtion can use assignment

3) why other like import/export cannot have direct assignment whereas returning can?

4) i can either use receiving addition or assignment for returning, correct?

thanks

Read only

0 Likes
906

1) Yes.

2) You can directly also assign the attributes of a object using assignment.

(If var is an attribute, then you can say)

val = vessel1->var

if var is a method with a returning addition,

val = vessel->var( ).

3) Import will take the values from the calling object to the called object. So there is no point in assigning.(Assigning means RHS value is transferred to LHS).

Exporting may have multiple parameters, which cannot be returned to a single variable.

4) Correct.

Regards,

Ravi

Read only

0 Likes
906

hi,

i got the helpful reply but would like to clarify.

(If var is an attribute, then you can say)

val = vessel1->var

if var is a method with a returning addition,

val = vessel->var( ).

1) why the bracket is empty also can assignment value to val?

vessel_id = vessel2->get_id( )

2) if i leave call method vessel1->drive( ), i will have compile error. so at least i must put 0.

call method vessel1->drive exporting speed_up = 50

call method vessel1->drive( 50 )

3) why point 1 can leave empty in ( ) whereas point 2 must have at least 0? get_id and drive both are method and not attribute.

4) if var is a method with a RETURNING addition then only can have assignment?

val = vessel->var( ).

which means other addition cannot have such assignment rite?

thanks

Read only

0 Likes
906

hi,

any help.

thanks

Read only

0 Likes
906

sorry,

any help?

thanks