‎2008 Jul 03 4:54 AM
Hi experts,
I'm very new to ABAP.
could u please clarify the following.
1.In how many ways can we declare an internal table (wa,body,header line,structure like...)?
2.How to choose suitable decleration?
Plz give one example for each type.
helpful answers will be rewarded.
Thanks & Regards.
Radhika.
‎2008 Jul 03 5:49 AM
Hi
You can define Internal tables in 2 ways
1. with header line
2. with out headerline
When u choose with headerline option, there is no need to create workarea, as it itself creates 1.
So u should be very careful in refreshing the internal table, because the name of the internal table and work area would be same, but the only differene is ,
u can refer internal table body as, 'itabname[]'
and header(work area) as ' itabname'.
coming to internal table without headerline,
u have to creatr workarea explicitly, as
1. like lint type of internal table
2. type structure type.
ex for internal table without header line:
*declaration of structure:
types: befin of ty_example,
v_no type i,
v_age type i,
end of ty_example.
*declaration of internal table:
data: i_example type standard table of ty_example.
*declaration of work area:
data: wa_example like line of i_example (or)
data: wa_example type ty_example.
It is a good practice to use internal table without headerline.
‎2008 Jul 03 4:57 AM
‎2008 Jul 03 4:57 AM
‎2008 Jul 03 4:59 AM
Hi .
There are 2 ways by which u can declare internal table,
with header line / without header line.
1.with header line
Data : itab like <table-name> occurs 0 with header line.
2. without header line
Data : itab type table of <table-name>
data : wa like line of itab.
if u want to go with Sap standards then choose 2nd option but sometimes it will become lengthy so we take internal table with header lines.
‎2008 Jul 03 5:00 AM
Hi Radhika,
Welcome to SAP world. You can check the below SAP help link, you can get complete information about internal tables, how many types, how to declare and how to process etc.....
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/frameset.htm
Regards,
Naveen Veshala
‎2008 Jul 03 5:06 AM
Hi,
1.In how many ways can we declare an internal table (wa,body,header line,structure like...)?
A : Please search in SDN forum.
2.How to choose suitable decleration?
A : Please search in SDN forum.
Thanks,
Sriram Ponna.
‎2008 Jul 03 5:35 AM
hi
By using the Data statement
-1 By referring to another table
- 2 By referring to a structure
- 3 With a new structure
In the (1 and 2) first two cases Header line is optional. In the third (3) case Header line is created by default.
1. Example:
DATA t_line TYPE line OCCURS 10 with header line.
2 Example:
DATA flight_tab LIKE sflight OCCURS 10.
3 Syntax
Data : Begin of <f> occurs <n>,
<component declaration>,
u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026,
End of <f>.
Work area (Header) is created by default.
Amit
‎2008 Jul 03 5:49 AM
Hi
You can define Internal tables in 2 ways
1. with header line
2. with out headerline
When u choose with headerline option, there is no need to create workarea, as it itself creates 1.
So u should be very careful in refreshing the internal table, because the name of the internal table and work area would be same, but the only differene is ,
u can refer internal table body as, 'itabname[]'
and header(work area) as ' itabname'.
coming to internal table without headerline,
u have to creatr workarea explicitly, as
1. like lint type of internal table
2. type structure type.
ex for internal table without header line:
*declaration of structure:
types: befin of ty_example,
v_no type i,
v_age type i,
end of ty_example.
*declaration of internal table:
data: i_example type standard table of ty_example.
*declaration of work area:
data: wa_example like line of i_example (or)
data: wa_example type ty_example.
It is a good practice to use internal table without headerline.