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

Re: How to create More two class with one object

Former Member
0 Likes
599

haii,

i have small information How to create More two class with one object,

bye

bye

babu

haii,

i have small information How to create More two class with one object,

bye

bye

babu

4 REPLIES 4
Read only

Sm1tje
Active Contributor
0 Likes
580

Could you please explain in more detail, what your requirement (question) is? Create more than two CLASSES with one OBJECT?

What do you mean with object in this case?

Read only

uwe_schieferstein
Active Contributor
0 Likes
580

Hello

I assume you want to create multiple instance of your class.

Assuming that you class is NOT a singleton then simply repeat the CREATE OBJECT statement as many times as you need.


TYPES: begin of ty_s_class.
TYPES: instance   TYPE REF TO zcl_myclass.
TYPES: end of ty_s_class.
DATA:
  lt_itab      TYPE STANDARD TABLE OF ty_s_class
                 WITH DEFAULT KEY,
  ls_record  TYPE ty_s_class.


  DO 10 TIMES.
    CLEAR: ls_record-instance.

    CREATE OBJECT ls_record-instance.
    APPEND ls_record TO lt_itab.
  ENDDO.

Regards

Uwe

Read only

Former Member
0 Likes
580

HI,

An object is an instance of a Class..Can you please be clear..what exactly are you looking for..

Regards

Vasavi

Read only

Former Member
0 Likes
580

HI,

An object is an instance of a Class..Can you please be clear..what exactly are you looking for..

Regards

Vasavi