06-03-2008 8:32 AM
hi,
i have a doubt,please clarify.
data:itab like <databse table> occurs 0 with header line.
or
data:itab like <databse table>occurs 0,
wa like line type of itab.
in above two cases , in my view no difference.
in first case there will be one workarea will be created with same name itab,
in second case we are explicitly creating work area.
ok.
here my doubt is in what cases it is madatory to create internal table with explicitly work area?
thank in advance.
venu
06-03-2008 8:39 AM
In object oriented programing , you can't use the table with header line.
06-03-2008 9:17 AM
Hi,
It is a good practice to define a structure for your internal table. Then declare an internal table with the defined structure. Using a workarea to access to the internal table.
TYPES : BEGIN OF struc_tab,
rec1(10) TYPE c,
END OF struc_tab.
DATA : itab TYPE TABLE OF struc_tab,
wa_itab LIKE LINE OF itab.
There is no differences, just that we're avoiding declaring using 'With Occurs 0' or 'With Header Line' and in some cases in oo programming, headerline are not allowed.
Regards,
Loo
06-03-2008 9:18 AM
HEADERLINE is obsolote, and OCCURS is also obsolete.
use this syntax instead:
DATA: itab TYPE STANDARD TABLE OF <dbtab>,
wa_itab TYPE <dbtab>.
the reason why you should not use headerline is simple - its confusing because "itab" refers to both a structure and an internal table.
For more info, use the Extended Program Check or the Code Inspector tool. In fact, you should always run one of these tools before handing your development over for tests..