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

Object's lifetime in a program

Former Member
0 Likes
823

Hi all,

What is the Object's lifetime in a program? How long does an object exists in a program?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
754

Lifetime of an object is limited only till the execution of the program.

<b>Local objects</b> - Scope & lifetime limited within the subroutine.

<b>Global Objects</b> - Scope limited within the program or across programs, if imported/exported. Lifetime is till program termination.

5 REPLIES 5
Read only

Former Member
0 Likes
755

Lifetime of an object is limited only till the execution of the program.

<b>Local objects</b> - Scope & lifetime limited within the subroutine.

<b>Global Objects</b> - Scope limited within the program or across programs, if imported/exported. Lifetime is till program termination.

Read only

Former Member
0 Likes
754

Is there any way avilable to initialize an object before the termination of a program?

Read only

Former Member
0 Likes
754

You can initialize object at any point in the program.

Depending on the location of decalration... Say Subroutine, FM, Top Include, the scope & lifetime would be decided.

But eventually the object wont be available after program termination.

Read only

Former Member
0 Likes
754

uSE FREE MEMORY TO INITIALIZE THE OBJECT, OR CLEAR, REFRESH, DELETE.

Read only

Former Member
0 Likes
754

If you IMPORT or EXPORT the variable from the program, the lifetime of that object will be till SAP Session is terminated.