cancel
Showing results for 
Search instead for 
Did you mean: 

pass a structure to a method

Former Member
0 Kudos

Hi to all, I want to pass a structure in input to method.

Please help me

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi

good

Declaring Methods

You can declare methods in the declaration part of a class or in an interface. To declare instance methods, use the following statement:

METHODS meth IMPORTING [VALUE(]i1 i2 ... [)] TYPE type [OPTIONAL]...

EXPORTING [VALUE(]e1 e2 ... [)] TYPE type ...

CHANGING [VALUE(]c1 c2 ... [)] TYPE type [OPTIONAL]...

RETURNING VALUE(r)

EXCEPTIONS exc1 exc2 ... .

and the appropriate additions.

To declare static methods, use the following statement:

CLASS-METHODS meth...

Both statements have the same syntax.

When you declare a method, you also define its parameter interface using the additions IMPORTING, EXPORTING, CHANGING, and RETURNING. The additions define the input, output, and input/output parameters, and the return code. They also define the attributes of the interface parameters, namely whether a parameter is to be passed by reference or value (VALUE), its type (TYPE), and whether it is optional (OPTIONAL, DEFAULT). Unlike in function modules, the default way of passing a parameter in a method is by reference. To pass a parameter by value, you must do so explicitly using the VALUE addition. The return value (RETURNING parameter) must always be passed explicitly as a value. This is suitable for methods that return a single output value. If you use it, you cannot use EXPORTING or CHANGING parameters.

As in function modules, you can use exception parameters (EXCEPTIONS) to allow the user to react to error situations when the method is executed.

http://help.sap.com/saphelp_nw2004s/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm

thanks

mrutyun^

sridhar_k2
Active Contributor
0 Kudos

Hi,

You can send objects to method directly, if that method accept that structure. You can find many Structures in java.util package like ArrayList,HashMap...

Go thru this link, here it was discussed.

Regards,

Sridhar

roberto_tagliento
Active Contributor
0 Kudos

The structure is a type of NODE ELEMENT.

At your context you can create a NODE like that structure with a cardinality "1..1".

And after can pass the NODE or ELEMENT.

You have to pass the instance of structure, and a NODE or ELEMENT is an instance.