‎2008 Oct 22 9:04 AM
Hi all,
I need to know the difference between the two of the below statements
Tables spfli.and
data spfli type spfli with header line.As far as i know both seem same to me.
Thanks in advance,
Bala.
‎2008 Oct 22 10:12 AM
Hi,
For
" data spfli type spfli with header line. "
It defines an inetrnal table that has exactly the same structure as of the SPFLI table.
Apart from the internal table, this addition, which is not allowed in ABAP Objects,
declares another data object, the header line, which has exactly the same name as
the internal table and has the row type of the internal table as the data type.
If at an operand position of an ABAP statement,
you specify the name of internal table itab, it depends on the statement whether
the table body or the header line are used. As a rule, all table-specific statements
such as SORT or LOOP use the internal table, while all other statements use the header
line. Exceptions are the statements IMPORT and EXPORT.
For
" Tables spfli. "
declares a data object spfli as a table work area whose data type is adopted from the
identically named structured data type spfli from the ABAP Dictionary.
spfli must be defined as a flat structure in the ABAP Dictionary.
You can specify database tables or Views for spfli.
Work table areas declared with TABLES are interface work areas and should only be
declared in the global declaration section of a program for the following purpose:
The statement TABLES is required for exchanging data between screen fields
that were defined in a program screen when transferring from the ABAP Dictionary
and the ABAP program
Thanks & Regards
‎2008 Oct 22 9:09 AM
The tables statement declares a work area, but this statement is obsolete in ABAP Objects.
You have to declare the workarea via the DATA statement.
regards,
Hans
‎2008 Oct 22 9:09 AM
hi bala,
data spfli type spfli with header line.
this statement is used to create an internal table with header line.
although this statement is not recommended any more. you used create a structure first and the internal table and work areas.
Tables spfli.
this statement is used to include any perticular table in your program.
but this statement is obsolete
Edited by: arjun on Oct 22, 2008 10:14 AM
‎2008 Oct 22 9:11 AM
>
> Hi all,
>
> I need to know the difference between the two of the below statements
>
>
Tables spfli.
this will create a work area (spfli), looks like DB table spfli, but the statement is obsolate
>
data spfli type spfli with header line.
this will result in a syntax error, because this would also create a work area, but they cannot have header lines, so you should leave the WITH HEADER LINE addition.
To create work area use:
DATA : gw_spfli TYPE spfli.To create internal table:
DATA : gt_spfli TYPE TABLE OF spfli.
‎2008 Oct 22 9:12 AM
Hi
With the first statement Tables SPFLI it comes with bydefault header line but with the second one you need to explicitly declare the header line
‎2008 Oct 22 9:15 AM
Hi,
When you declare Tables: <Tablename> this statement is used to read the table and when the structure is declare for the table fields.
When you declare Data spfli type spfli with header line.
with the above statement we can send the data records one by one to the workarea through header line which mean one by one records.
Cheers!!
Balu
‎2008 Oct 22 9:21 AM
‎2008 Oct 22 9:58 AM
Thank you all for your replies.
I am still not clear.
Does these 2 statements create a
1.) internal table of structure similar to spfli
2.) Header line of structure spfli.
if so.. in what situation i have to use these two statements. Also amit was telling me about using tables in screens. I checked and both these statements work fine with screens.
I understood that tables cannot be used in classes.
So the case is that , even though both perform the same operations ,their usage is restricted in some areas of programs?
Thanks in advance,
Bala.
‎2008 Oct 22 10:02 AM
>
> Does these 2 statements create a
>
> 1.) internal table of structure similar to spfli
> 2.) Header line of structure spfli.
it will create a work area of spfli (work area = structure in this case), it is like one line of table spfli
>
if so.. in what situation i have to use these two statements. Also amit was telling me about using tables in screens. I checked and both these statements work fine with screens.
never I told already: first one is obsolate, second one will result in syntax error
>
I understood that tables cannot be used in classes.
tables with header lines cannot be used in classes
read my answer again, to get understanding (unfortunately some other answers were completely wrong)
‎2008 Oct 22 10:12 AM
Hi,
For
" data spfli type spfli with header line. "
It defines an inetrnal table that has exactly the same structure as of the SPFLI table.
Apart from the internal table, this addition, which is not allowed in ABAP Objects,
declares another data object, the header line, which has exactly the same name as
the internal table and has the row type of the internal table as the data type.
If at an operand position of an ABAP statement,
you specify the name of internal table itab, it depends on the statement whether
the table body or the header line are used. As a rule, all table-specific statements
such as SORT or LOOP use the internal table, while all other statements use the header
line. Exceptions are the statements IMPORT and EXPORT.
For
" Tables spfli. "
declares a data object spfli as a table work area whose data type is adopted from the
identically named structured data type spfli from the ABAP Dictionary.
spfli must be defined as a flat structure in the ABAP Dictionary.
You can specify database tables or Views for spfli.
Work table areas declared with TABLES are interface work areas and should only be
declared in the global declaration section of a program for the following purpose:
The statement TABLES is required for exchanging data between screen fields
that were defined in a program screen when transferring from the ABAP Dictionary
and the ABAP program
Thanks & Regards
‎2008 Oct 22 10:18 AM
>
> " data spfli type spfli with header line. "
>
> It defines an inetrnal table ...
WRONG!!!
‎2008 Oct 22 10:23 AM
Hi,
If you refer to the ABAP documentation. The first statement that they specify is that it defines an internal table.
Thanks & Regards
‎2008 Oct 22 10:26 AM
Thanks eric...
You are correct. i tried the second statement throws error.
You said know tables statement is obsolete.
So should i use
data spfli type standard table of spfli.
data spfli_wa type spfli.instaed of
tables spfli.
‎2008 Oct 22 10:27 AM
Any link? I guess you have the wrong documentation... or the wrong understanding...
DATA : spfli TYPE TABLE OF spfli WITH HEADER LINE.
this declares an internal table (pls. note the difference). The original statement will result in a syntax error (I am telling the third time). Anyway, you don't have to believe it to me, just give it a try on your own!
‎2008 Oct 22 10:29 AM
Bala: exactly! Forget the TABLES statement and declare everything with DATA...!
‎2008 Oct 22 10:32 AM
‎2008 Oct 22 10:36 AM
‎2008 Oct 22 10:36 AM
of course... check my othe replies in the thread
this was just to show the difference between DATA : spfli TYPE spfli WITH HEADER LINE and DATA : spfli TYPE TABLE OF spfli WITH HEADER LINE
‎2008 Oct 22 10:41 AM
Thanks all for spending time to help me solve my doubts.
Thank you very much eric