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

I NITIAL

Former Member
0 Likes
629

hi

can anyone tell me y and what is the use use IF NOT INITAL statement,d OCCURS statement and also WITH HEADER LINE satement very briefly in clear terms....

vijay

hi

can anyone tell me y and what is the use use IF NOT INITAL statement,d OCCURS statement and also WITH HEADER LINE satement very briefly in clear terms....

vijay

4 REPLIES 4
Read only

Former Member
0 Likes
531

1. IF NOT ITAB INITAL

It is used for checking whether Internal table has any value in it before it process the other statments after that ...

2.

Occurs statament mean the structure is a internal table:

DATA: BEGIN OF LT_ITAB,

END OF LT_ITAB.

This is a flat structure

DATA: BEGIN OF LT_ITAB OCCURS <n>,

END OF LT_ITAB.

This is an internal table

The number <N> indicate how many lines has to have the table in initialization time: i.e. when the program is loaded in memory, the space for the table depends on the initialization numbers of the records.

AT run time if the table needs more space, this'll automatically be enhanced.

But If you know your table can have a certain numbers of records, you can indicate it in the defination, what'll improve the performance:

all the space the table needs is taken at the beginin, so it doesn't need to enhance the space at run time.

3. WITH HEADER LINE

WITH HEADER LINE creates a field with the same name as the internal table and the same type as the line type of the internal table.

Meaning it creates a work area of the line type of the internal table..

Example

-


DATA: ITAB LIKE MARA WITH HEADER LINE.

**Now you can use ITAB as a structure also..

**meaning.

ITAB-MATNR = 'ABCD'.

IF ITAB-MATNR = 'ABCD'.

      • True

ENDIF.

If you don't give header line..then the workarea is not created..

Example

-


DATA: ITAB LIKE MARA OCCURS 0.

DATA: WA LIKE ITAB.

To access the data you have to create another workarea ..

READ TABLE ITAB INTO WA INDEX 1.

IF WA-MATNR = 'ABCD'.

...

ENDIF.

Message was edited by:

Santosh Kumar Patha

Read only

Former Member
0 Likes
531

hi,

declarations

***********

1.

Tables : sflight. "structure

data : itab like sflight occurs 0 with header line."itab with work area.

2.

data : begin of itab. "itab with out work area.

fields...

endof itab.

data : begin of itab occurs 0. "itab with work area.

fields...

endof itab.

If you give Occues 0 then we are giving ful space(8kb) to Internal table,

if you give occurs 5, then you are assiging less space,

this is very usefull for large amount of data,

if the total no of records in the internal table execced the 8kb,

then the system automatically assign 8kb space again,

so if you are dealing with small amount of data in the internal table,

then make use of this occurs N, so you won't get any memero related problems

IF NOT INITAL

***********

IF NOT INITAL  itab1[].

*itab1 has data.

else.

*itab1 has no data.

Endif.

Regards

Reshma

Read only

Former Member
0 Likes
531

thanks

Read only

Former Member
0 Likes
531

Hi...

IF NOT INITAL statement is is used to check the internal table is not empty.

OCCURS statement is used to create an internal table and the space allocated will be decided with OCCURES Clause.

WITH HEADER LINE is used to create an internal tanle with header line.

For further information See the following links :

http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3646358411d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3660358411d1829f0000e829fbfe/frameset.htm

Reward points if useful......

Suresh......