2013 Jul 15 7:46 AM
Dear experts,
Why we need to use work area to display internal table, why not with out using work area or header line?
With work are WA it works.
Data : it_sflight type TABLE OF sflight,
wa_sflight type sflight.
select * from sflight into table it_sflight up to 10 rows.
Loop at it_sflight into wa_sflight.
write 😕 wa_sflight-carrid.
endloop.
Why this code not works
Data : it_sflight type TABLE OF sflight.
select * from sflight into table it_sflight up to 10 rows.
write 😕 it_sflight-carrid.
Thanks in advance....
Moderator message - Please search the forums for available content. Thread locked.
Message was edited by: Suhas Saha
2013 Jul 15 8:03 AM
Hi Ramesh,
In all programming languages using variable only they will display the data.
Data should be stored/pointed in variable. Workarea is collection of data (i.e structure will hold the many values).
Why this code not works
Data : it_sflight type TABLE OF sflight.
select * from sflight into table it_sflight up to 10 rows.
write 😕 it_sflight-carrid.
WRITE keyword functionality will be programmed in kernel level by SAP it will display only variable/structure type value, but it_sflight is a table type.
As of now in ABAP language there is no keyword to display the all the values from internal table.
Hope this will be helpful for you
Regards,
Prasanna
2013 Jul 15 8:02 AM
If you OCCURS clause, probably you may not use the Work Area.
Example:
DATA BEGIN OF it_sfligtht OCCURS n.
... include the sflight structure here.....
DATA END OF it_sflight
2013 Jul 15 8:21 AM
Hi,
If we use begin of ...occurs... there is an implicit work area which is being created with the same name as that of the internal table.
Regards,
Philip.
2013 Jul 15 8:03 AM
Hi Ramesh,
In all programming languages using variable only they will display the data.
Data should be stored/pointed in variable. Workarea is collection of data (i.e structure will hold the many values).
Why this code not works
Data : it_sflight type TABLE OF sflight.
select * from sflight into table it_sflight up to 10 rows.
write 😕 it_sflight-carrid.
WRITE keyword functionality will be programmed in kernel level by SAP it will display only variable/structure type value, but it_sflight is a table type.
As of now in ABAP language there is no keyword to display the all the values from internal table.
Hope this will be helpful for you
Regards,
Prasanna
2013 Jul 15 8:06 AM
Hi Ramesh,
Please go throgh these links get the concepts of Internal table and work area.
http://help.sap.com/saphelp_nw2004s/helpdata/EN/fc/eb367a358411d1829f0000e829fbfe/content.htm
http://scn.sap.com/thread/501035
Thank you.
2013 Jul 15 8:07 AM
The purpose of internal table(body) is to hold the data. The writing, modifying, inserting, deleting all operations are carried out through the work area or header line.
Regards,
Philip.
2013 Jul 15 8:08 AM
Hi Ramesh,
WRITE statement writes the content of the data object dobj to the current page of the current list in the list buffer.
it_sflight-carrid does not refer to the data object, instead refers to the table's field.
In case you define the table it_sflight WITH HEADER LINE then a header it_slight is created, which if contains any value would be displayed.
But in this case, the content it_sflight is filled in the table and nothing is filled in the header area yet and hence nothing will be displayed in the WRITE statement.
Data : it_sflight type TABLE OF sflight WITH HEADER LINE.
select * from sflight into table it_sflight up to 10 rows.
READ TABLE it_sflight WITH INDEX 1.
write 😕 it_sflight-carrid.
In this case, first record of it_sflight is updated into the header which displays that records value.
Hope the explanation helps.
Regards,
Adithi
2013 Jul 15 8:21 AM
Hi Ramesh,
Any table will need to be processed from start to end to read each record at a time.
Well you can use SELECT .. ENDSELECT to write data without itab.
Like:
DATA : wa_sflight type sflight.
select * from sflight into wa_sflight up to 10 rows.
write 😕 wa_sflight-carrid.
endselect.
But this will do a LOOP ENDLOOP kind of iteration at database level.
Regards