Application Development 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: 

ABAP Objects Design/Organization Issues

former_member215188
Participant
0 Kudos

Hi,

I'm trying to design and implement reusable components using ABAP Objects. I'm familliar with OO concepts and have developed a few applications using C++ and Java.

I'm trying to organize my classes into separate source files (include program in ABAP).

ie.

<b>include program a</b>

CLASS a DEFINITION.

ENDCLASS.

<b>include program b</b>

INCLUDE a.
CLASS b DEFINITION.
 data x TYPE REF TO a.
ENDCLASS.

Lets say I want to write a report that uses both objects a and b. That means I have to include both programs. but since program b includes program a. including both programs a and b in my report would produce redeclarations of class a.

<b>executable program c</b>

REPORT c.

INCLUDE a.
INCLUDE b.   " error: redeclaration of class a

DATA: x TYPE REF TO a.
      y TYPE REF TO b.

This bothers me. Although it would be possible to <b>just include program b</b>, it would be a bit awkward since, i dont care if class a was used in the implementation of class b. Implementation should be abstracted from the user. Besides, everything should be explicit.

Is there a way to organize things as such? Would importing these classes globally would solve the problem.

Thanks.

2 REPLIES 2

Former Member
0 Kudos

Emir,

The way we do OO Programming in ABAP and other languages differ.

In your case, it might be a better option to create these classes as global classes, so that you will not have this issue. You can SE24 to do the same.

Regards,

Ravi

0 Kudos

do i need to keep the source code after i import?

and can you point me to any abap-oo design/organization articles.

I'm pretty much adept with the concepts and syntaxes. My company doesnt do OO architecture to their ABAP programs so I'm trying to cram years of experience for this implementation. Thanks!