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: 

Wat is d Difference between NOT INITIAL and NOT SPACE

Former Member
0 Kudos

HI,

Wat is d Difference between NOT INITIAL and NOT SPACE.

Ex

<b>IF NOT t_Itab IS INITIAL.</b>

<b>IF t_Itab is eq Space</b>.

And in which case do we use this scenario.

Please rewertBack with Ur ans ASAP.

6 REPLIES 6

Former Member
0 Kudos

Hi ,

Not initial - Checks for default values based on the data type of the variable you r using for comparision.

Not space is a always used with char. data type variable.

you can use space with integer,,floatin......and otherthan char

0 Kudos

You cannot use space with data type other than char....it may create problem

0 Kudos

could u please tell in detail

0 Kudos

Hi Ravi..

NOT Initial : To compare whether a Variable has initial Value (Spaces or Zero based on the Data type). It supports all data types.

Eg:

DATA : VAR TYPE I VALUE 2.

if VAR is initial.

Write:/ 'Initial'.

Else.

Write:/ 'Not Initial'.

Endif.

Here the output will be <b>Not Initial</b>.

Note: We can also use IS INITIAL for internal tables to know whether the Body is empty.

NOT SPACE: It can be only used with Character based data types. Bcoz their Default value will be SPACE. So it is better to use IS INITIAL always.

<b>reward if Helpful.</b>

former_member189631
Active Contributor
0 Kudos

Some datatypes has zero (0) as initial value. eg: ( D , T , I etc.)

and some datatypes has SPACE as initial values. (C etc.)

Its better to use NOT INITIAL,

Eg:

Data: Int type i ,

If Int is space -


>which may give wrong result

endif.

regards,

Ram.

Former Member
0 Kudos

SPACE is a value.....however for character types, it is same as the initial value.

INITIAL means the default value that a data variable takes depending on its data type..for example, numeric types have initial value as 0 while character types have initial value as '' (blank).

the following code snippet will show you that for char types, the space and initial are the same.

data str type string.

str = ' '.

if str eq SPACE .

write 😕 'space'.

endif.

if str is initial.

write 😕 'initial'.

endif.