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

Difference between receiving, changing inporting, exporting and returning

Former Member
0 Likes
11,633

Hi OO ABAP Gurus

Please clear me the Difference between receiving, changing inporting, exporting and returning parameters of a method?

Many thanks in advance

Sandeep Sharma..

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
4,526

Forget what Prasad said - he's not talking about classes, or objects.

It depends on context. For CALLING a method.

Receiving - typed value returned by the method - maximum one of these

Importing - value returned by the method - many possible, all optional

Exporting - value sent to the method - many possible, some optional

Changing - value sent to the method , changed within the method, sent back from method - many possible some optional

For DEFINING a method

Returning - typed value returned to the caller- maximum one of these

Exporting - value sent to the caller - many possible, all optional

Importing - value sent by the caller - many possible, some optional

Changing - value sent by the caller, changed within the method, sent back to caller - many possible some optional

Note - only for returning/receiving must the parameter have a specific type.

See ABAP help for more details.

matt

9 REPLIES 9
Read only

Former Member
0 Likes
4,526

Hai sandeep,

we are using changing and using when working with subroutines.

Using and changing : Both are same except, the order how they are taking the order of parameters in called subroutine.

In general,

Using: is used in subroutines when input parameter value doesn't change in the called program.

Changing: is used in subroutines when input parameter value does change in the called program and need to update its value in calling programming.

Importing, Exporting,Changing: These are used when working with function modules only.

Importing: To receive the parameter values from driver program

to function module

Exporting: To send the calculated parameter values to driver

program from function module.

Changing: It is used to send the updated parameter values

(Intially receiving from driver program)

from function module to driver program.

If useful, reward points

by

G.V.K.Prasad

Edited by: PRASAD GVK on Apr 9, 2008 8:57 AM

Read only

0 Likes
4,526

test

Read only

matt
Active Contributor
4,527

Forget what Prasad said - he's not talking about classes, or objects.

It depends on context. For CALLING a method.

Receiving - typed value returned by the method - maximum one of these

Importing - value returned by the method - many possible, all optional

Exporting - value sent to the method - many possible, some optional

Changing - value sent to the method , changed within the method, sent back from method - many possible some optional

For DEFINING a method

Returning - typed value returned to the caller- maximum one of these

Exporting - value sent to the caller - many possible, all optional

Importing - value sent by the caller - many possible, some optional

Changing - value sent by the caller, changed within the method, sent back to caller - many possible some optional

Note - only for returning/receiving must the parameter have a specific type.

See ABAP help for more details.

matt

Read only

Former Member
0 Likes
4,526

Hi Matt

Thanks for the answer..

But still i have one doubt..

As you define

For receiving and returning typed value

for opthers value

Can you please clear me betwee typed value and value

Please provide me a example if possible for you..

Many thanks in advance

Read only

matt
Active Contributor
4,526

For receiving/returning you can't use a generic type, such as: ANY, ANY TABLE, STANDARD TABLE, CLIKE, NUMERIC.

You have to use a specific type:

  • an ABAP type (e.g. I, C, string),

  • a type defined in the data dictionary (a view, a database table, a data type ) e.g. T100, S38E

  • a type REF TO DATA

  • type REF TO some other class or interface

  • another class's public type, e.g. ZCL_MYCLASS=>PUBLIC_TYPE

  • a type defined with the type section of the class itself.

The point is that the type of the receiving/returning parameter must be known at compile time. For the other parameter types, it can be determined at runtime as well.

matt

Read only

Former Member
4,526

Hi,

When we define a Method, we can use following for Formal Parameters-

1- IMPORTING-for Input Formal Parameter

2-EXPORTING-for output Formal Parameter

3-CHANGING-for Input/outputt Formal Parameter

4-RETURNING-for outputt Parameter, passed by value only, and used with a Functional Method

When we call a Method, RECEIVING is used for Actual Parameter to receive the return value of Method in data object.

Thanks,

CP

Read only

Clemenss
Active Contributor
4,526

Hi sandeep,

you should post a question after reading the [documentation|http://help.sap.com/abapdocu_702/en/abapcall_method_parameters.htm].

Regards,

Clemens

Read only

Former Member
0 Likes
4,526

As per i have seen:

Importing parameters can be optional or non-optional.

Exporting parameters can be optional or non-optional.

Changing parameters can be optional or non-optional.

But,

Returning Parameter is always optional by default.

Regards,

Pranoy

Edited by: Pranoy on Feb 2, 2012 6:57 AM

Read only

Former Member
0 Likes
4,526

Hi Experts,

Can i use changing parameter (in ooabap) to pass and receive the values at the same time for a mathod?

Moderator message: Please don't post a question on an old thread.

Edited by: Neil Gardiner on Feb 20, 2012 4:18 PM