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

How to pass a value to the export parameter for a method (public instance)?

Former Member
0 Likes
1,698

Hello,

I am trying ABAP OO newly. How to pass a value to the export parameter for a method (public instance) called in a report? This *export parameter has a reference type of structure.

Thanks in advance,

Ranjini

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
1,139

Hi,

"class definition


class lcl... definition.
  public section.
    method m1 imporitng par type ref to data.  "now you can pass any reference to the method, but this way you have to maintain this reference dynamically inside the method (you can't be sure what that reference is really "pointing" at)
endclass.

"in program


data: r_lcl type ref to lcl...

create object r_lcl.
call method r_lcl 
  exporting 
     par    =  "pass any reference variable here

Regards

Marcin

Hello,

I am trying ABAP OO newly. How to pass a value to the export parameter for a method (public instance) called in a report? This *export parameter has a reference type of structure.

Thanks in advance,

Ranjini

3 REPLIES 3
Read only

MarcinPciak
Active Contributor
0 Likes
1,140

Hi,

"class definition


class lcl... definition.
  public section.
    method m1 imporitng par type ref to data.  "now you can pass any reference to the method, but this way you have to maintain this reference dynamically inside the method (you can't be sure what that reference is really "pointing" at)
endclass.

"in program


data: r_lcl type ref to lcl...

create object r_lcl.
call method r_lcl 
  exporting 
     par    =  "pass any reference variable here

Regards

Marcin

Read only

rb
Contributor
0 Likes
1,139

Dont forget what you see as import parameter in SE80 are export parameters in your report.

A good tipp is to use the "Patterns" button in SE80, there you can choose your class and method name and get the syntax for calling that method.

Edited by: Richard Brünning on Jan 18, 2010 3:23 PM

Read only

Clemenss
Active Contributor
0 Likes
1,139

...

if the method exists, then choose the class in the object tree in se80, drag and drop the method into the editor window with your report. This is much easier than the pattern method.

The object tree works independently from what is open in the object maintenance window. So you can choose report in the tree first, edit your report. Then choose class, the class of the chosen method, expand the tree and drag the method.

One of the few not perfect but extremely useful drag&drop functions in SAP.

Regards,

Clemens