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

Module pool programming with Abap Objects

Former Member
0 Likes
1,122

Hi masters,

Somebody tell me that you can directly call a local class in a module pool.

Is that possible?

Can anybody refer me to any kind of information?

Thanks a lot.

2 REPLIES 2
Read only

former_member205645
Participant
0 Likes
532

In a function module it`s possible. You do it like when you call the class method from a normal program/report

For example:

CALL METHOD XCLASS->main

EXPORTING PTABLE = PTABLE

Read only

Former Member
532

Well, thanks for the answer, but not was the one i was waiting for... it wasn't helpful.

But, i've continued searching for answers... and i've found that:

OO Transactions Locate the document in its SAP Library structure

In transaction maintenance (SE93), you can specify a transaction code as an OO transaction.

You either link the transaction code to the Transaction Service of the Structure link ABAP Object Services for persistent objects or to a public method of a global or local class of a program. When calling up a transaction that is linked to an instance method, the system automatically generates an instance of the class in its own internal session.

An example of a link between a transaction code and an instance method of a local class of an unspecified ABAP program:

Example

*&-----------------------------------------------------------*
*& Modulpool DEMO_OO_TRANSACTION *
*& *
*&-----------------------------------------------------------*

program DEMO_OO_TRANSACTION.

class DEMO_CLASS definition.
public section.
methods INSTANCE_METHOD.
endclass.

class DEMO_CLASS implementation.
method INSTANCE_METHOD.
message 'Instance method in local class' type 'I'.
endmethod.
endclass.

The DEMO_OO_TRANSACTION program is a module pool of type M that does not contain any screens or dialog modules. Instead, the program contains the definition of a local class DEMO_CLASS.

The DEMO_OO_METHOD transaction code is linked to this program as follows:

The start object of the transaction is Method of a class (OO transaction).

OO transaction model is not selected.

The Class Name is DEMO_CLASS.

The Method is INSTANCE_METHOD.

Local in program is selected and DEMO_OO_TRANSACTION specified.

When the transaction is called up, the program is loaded, an instance of the class is created, and the method is executed.
Leaving content frame

That's what i wanted.

I hope it would be helpful for anyone else.