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

Create object in OOP

Former Member
0 Likes
3,472

Hi guys,

What is the purpose or how does CREATE OBJECT works?

Thanks a lot!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,104

hi

let take an example

DATA r_vehicle1 TYPE REF TO lcl_vehicle

lcl_vehicle is used to define

a reference variable, which is thereby typed as a pointer to objects of type

lcl_vehicle. The null reference is the technical initial value of a reference variable. ( r_vehicle1 ).

now

when i do this

create object r_vehicle1

The statement CREATE OBJECT creates an object in the memory. Its attribute values are then either initial or assigned according to the VALUE specification.

Cheers

Snehi

7 REPLIES 7
Read only

Former Member
0 Likes
2,104

Hi,

Create Object is used to create the Instance of the Class i.e Object of the Class.

Check these links-

http://www.slideshare.net/srinatha/oo-abap-sap/

Regards,

Sujit

Read only

Former Member
0 Likes
2,104

Hi,

actualy in OOABAP , the objet is created in two steps.

Step1 : in statement

DATA (object_name) type ref to (class name). , we create instance of a class i.e. a null object pointer. To be more specific , a pointer of class type , but not assigned to the class.

Step 2:

CREATE OBJECT (objectname)

Here we create the link of the object to the class

regards,

anirban

Read only

Former Member
0 Likes
2,104

hi,

We write CREATE OBJECT inside START-OF-SELECTION Event.

CREATE OBJECT is used to assign the Memory to the Ref. VAriable. It Creates the Actual Object.

Regards

Sumit Agarwal

Read only

Former Member
0 Likes
2,105

hi

let take an example

DATA r_vehicle1 TYPE REF TO lcl_vehicle

lcl_vehicle is used to define

a reference variable, which is thereby typed as a pointer to objects of type

lcl_vehicle. The null reference is the technical initial value of a reference variable. ( r_vehicle1 ).

now

when i do this

create object r_vehicle1

The statement CREATE OBJECT creates an object in the memory. Its attribute values are then either initial or assigned according to the VALUE specification.

Cheers

Snehi

Read only

Former Member
0 Likes
2,104

Hi,

CREATE OBJECT is used in ABAP OBJECTS to create a runtime object(instance of your class)

This statement creates an object in the memory.

Regards

Abhijeet

Read only

former_member787646
Contributor
0 Likes
2,104

Hi

The statement CREATE OBJECT creates an instance of a class.

The methods (Instance Constructor or Static Constructor ) and events will be triggered implicitly when an object is created.

Hope it helps.

Murthy

Read only

Former Member
0 Likes
2,104

CREATE OBJECT

Create object is used to Create the Object, and set the Default value to Attributes or initialize the attributes.

When you use Create Object , the Instance Constructor will be called internally (if there is a constructor available in the class ).