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

Instance creation

Former Member
0 Likes
530

Hi,

Could anyone explain how to check whether an instance is created or not for a class.

1 ACCEPTED SOLUTION
Read only

former_member242255
Active Contributor
0 Likes
505

data: obj1 type ref to Demo_class.

create object obj1.

you can see the above way of creating an instance...

4 REPLIES 4
Read only

former_member242255
Active Contributor
0 Likes
506

data: obj1 type ref to Demo_class.

create object obj1.

you can see the above way of creating an instance...

Read only

Former Member
0 Likes
505

Hi,

you can check it this way...

DATA: OBJ1 TYPE REF TO YH1330_EXAMPLE.

CREATE OBJECT OBJ1.

IF OBJ1 IS INITIAL.
  WRITE 'NOT ASSIGNED'.
ELSE.
  WRITE 'ASSIGNED'.
ENDIF.

Regards,

Siddarth

Read only

matt
Active Contributor
0 Likes
505

>

> Hi,

>

> you can check it this way...

>

>

DATA: OBJ1 TYPE REF TO YH1330_EXAMPLE.
> 
> CREATE OBJECT OBJ1.
> 
> IF OBJ1 IS INITIAL.
>   WRITE 'NOT ASSIGNED'.
> ELSE.
>   WRITE 'ASSIGNED'.
> ENDIF.

>

> Regards,

> Siddarth

That will work, but to be absolutely clear, use the keyword "BOUND".

DATA: OBJ1 TYPE REF TO YH1330_EXAMPLE.

CREATE OBJECT OBJ1.

IF OBJ1 IS NOT BOUND.
  WRITE 'NOT ASSIGNED'.
ELSE.
  WRITE 'ASSIGNED'.
ENDIF.

matt

Read only

0 Likes
505

Thanks Matt.... actually the keyword BOUND just went out of my mind......