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

Diff between the following declarations

Former Member
0 Likes
836

Diff b/n the fllowing declarations

*data: begin of ITAB1 occurs 0.

  • include structure /nam/abc_dates.

*data: end of ITAB1.

and

data : ITAB2 TYPE TABLE OF ITAB2 WITH HEADER LINE.

and please let me know

how to declare and use interanl table in two diff function modules in the same function group

Message was edited by: Pavankumar P

9 REPLIES 9
Read only

Former Member
0 Likes
800

hi,

when u use begin of for defining internal table then the header line will be included automatically in other cases we need to specify the Header line explicitly or we woke with work area.

cheers,

sasi

Read only

alex_m
Active Contributor
0 Likes
800

I think there is no difference between this 2 decleration.

Alex

Read only

Former Member
0 Likes
800

So if I'm right you want to use the same table globally within one function group - right?

To do so, add a top include to your group and declare your table there. It will be available and changable in any of your function modules.

Concerning your two table declarations:

the first of the declarations defines a table without a header line. You have to use the table in loops and read table declarations always transferring a table line to a workarea. E.g.:

LOOP AT itab INTO workarea.

[...work with "workarea"]

ENDLOOP.

The second declaration (which is obsolete) defines a table with header line, which can be used in loops as follows:

LOOP AT itab.

[... work with "itab"]

ENDLOOP.

use the declaration

DATA itab TYPE TABLE OF struc_type [OCCURS 0]

to declare an internal table without header line.

Best regards

Wolfgang

Read only

0 Likes
800

its wrong Ralf,

The decleration of internal table starts (Begin of), its automatically have the header line.

Alex

Read only

Former Member
0 Likes
800

no difference, both the tables have header line, first declaration create internal table with header line where in second declaration you have to explicitely add WITH HEADER LINE otherwise it will create internal table without header line.

Read only

0 Likes
800

No Difference. The only thing is that you need to specify the OCCURS 0 addition in the first declaration.

Amit

Read only

Former Member
0 Likes
800

Hi,

The two declaration are same.

Sriram.

Read only

Former Member
0 Likes
800

Hello Pavan,

Welcome to SDN.

While declaring internal table you can basically use occurs 0 addition or

DATA itab {TYPE TABLE OF linetype|LIKE TABLE OF lineobj}.

Effect

This is a shortened form of the definition of a standard table. It corresponds to

DATA itab {TYPE STANDARD TABLE OF linetype|

LIKE STANDARD TABLE OF lineobj} WITH DEFAULT KEY.

or the old definition (compare variant 4)

DATA itab {TYPE linetype|LIKE lineobj} OCCURS 0.

If you add WITH HEADER LINE, then it creates a work area or header.

Coming to other point of declating internal tables in two different function in the same Func Grp

Use the following path GOTO --> Global data and then declare your internal tables there.

These tables can be used globally in all function modules assigned to that func grp.

Thanks,

Read only

0 Likes
800

Short answer......

No difference.

The OCCURS statement is "obselete".

You can not use the OCCURS syntax in ABAP Objects. You must use TYPE TABLE OF

Please remember to award points to all your fellow SDNers whose posts have helped you. Thanks.

Regards,

Rich Heilman