Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ABAP Objects Design/Organization Issues

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.

Tags:
Not what you were looking for? View more on this topic or Ask a question