Application Development 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: 

What is the difference between initial and bound ?

Former Member
0 Kudos

Some time we use

if .. is initial ....

some time we use

if ... is not bound .

Can anyone tell me the difference of the 2 operator ?

Best regards ,

3 REPLIES 3

Former Member
0 Kudos

IF .. is initial .... checks if a variable is initial or not ...

For Bound

f IS [NOT] BOUND determines if the reference variable f contains a valid reference. f must be a data or an object reference variable. If you specify a function method call instead of f, the method must have a return value that is typed accordingly.

The logical expression is true for a data reference if the reference can be dereferenced. The logical expression is true for an object reference if the reference points to an objct.

The logical expression is always false if f contains the zero reference. However, there might be data references where f indeed does not contain the zero reference but where the reference contained is invalid because the object no longer exists. For example, a global data reference may point to a local data object of a procedure which is deleted after the procedure is exited. In this case, the reference is no longer bound to the destination, and the logical expression is also false.

Former Member
0 Kudos

Hi,

If not itab [ ] is initial.

By using above you will come to know whether itab is filled with the values or not, if it is initial then itab doesnot contain any values in it, or if it is not initial then itab is filled with some values.

f IS [NOT] BOUND determines if the reference variable f contains a valid reference. f must be a data or an object reference variable. If you specify a function method call instead of f, the method must have a return value that is typed accordingly.

The logical expression is true for a data reference if the reference can be dereferenced. The logical expression is true for an object reference if the reference points to an objct.

The logical expression is always false if f contains the zero reference. However, there might be data references where f indeed does not contain the zero reference but where the reference contained is invalid because the object no longer exists. For example, a global data reference may point to a local data object of a procedure which is deleted after the procedure is exited. In this case, the reference is no longer bound to the destination, and the logical expression is also false.

Example

data DREF type ref to DATA.

start-of-selection.

perform: TEST,

CREATE,

TEST.

form CREATE.

data INT type I.

get reference of INT into DREF.

perform TEST.

endform.

form TEST.

if DREF is bound.

write / 'Bound'.

else.

write / 'Unbound'.

endif.

endform.

The logical expression is only true in the subroutine CREATE.

Thanks,

Sriram Ponna.

0 Kudos

Hi , Ponna ,

I see , so in most cases , we should use bound to see if the reference to the data or object is legal , am I right ?