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

Initial & Not initial

Former Member
82,114

Hi Experts ,

Im having one doubt in Internal tables .

i.e. 1. what is the diff between inital & not initial ..

2. wat are all the advantages ?

3. need an example ?

Regards ,

Narayana Murthy

1 ACCEPTED SOLUTION
Read only

Former Member
30,351

Hi,

initial means no records in the internal table

not initial

means atleast one record is there

use...

if not initial

then display the records

else.

give a message ' no data found'.

endif.

reward points if helpful

regards

venkatesh

5 REPLIES 5
Read only

Former Member
30,352

Hi,

initial means no records in the internal table

not initial

means atleast one record is there

use...

if not initial

then display the records

else.

give a message ' no data found'.

endif.

reward points if helpful

regards

venkatesh

Read only

alex_m
Active Contributor
0 Likes
30,351

Initial means the table doesnt have any recrods, if not initial the table have some records.

Read only

former_member582701
Contributor
0 Likes
30,351

Internal table is initial when there are not entries in the table.

IF NOT i_tab[] IS INITIAL.

SELECT a b c

FROM X

FOR ALL ENTRIES IN i_tab.

ENDIF.

In this example you check internal table. You only do the select if exists any entry.

Read only

Former Member
30,351

Hi,

I am selecting entreis from table

for ex:

SELECT EMPNO EMPNAME from ZEMP into table t_EMP

Where DEPT = ''SAP'.

In this casethe selected entries will be there in T_EMP.

If t_EMP[] is initial.

Write 'No entreids found'.

endif.

if not t_emp[] is initial.

Select * from DEPT into table t_dept

for all entreis in t_emp

where empno = t_empno..

endif.

In this case if no entreis in t_emp uit will not process this select statement.

To avoid performance issues and dump we have to check this.

Read only

Former Member
30,351

Hi,

Initial value is the value any variable takes based on the type.

If u declare a char variable of type c the initial value is ' ' (space)

So if u check if the variable is initial u can check if the value of the variable is space. Thus u ll know if it has been changed after it has been declared.

Similarly var NOT INITIAL will check if the variable has been assigned any value after it has been declared or not.

For example see help.sap link below:

http://help.sap.com/saphelp_webas620/helpdata/en/fc/eb353d358411d1829f0000e829fbfe/frameset.htm

Regards,

Aparna