‎2006 Nov 30 9:21 PM
What statments do I need to use to create an internal table? i tried TYPE but it isn't working correctly
‎2006 Nov 30 9:22 PM
Hi,
Try this..
1)
<b>Internal table with header line.</b>
DATA: BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
END OF ITAB.
2)
<b>Internal table without header line.</b>
DATA: BEGIN OF WA,
MATNR TYPE MATNR,
END OF WA.
DATA: ITAB LIKE STANDARD TABLE OF WA.
3)
TYPES: BEGIN OF TYPE_WA,
MATNR TYPE MATNR,
END OF TYPE_WA.
DATA: ITAB TYPE STANDARD TABLE OF TYPE_WA.
Thanks,
Naren
‎2006 Nov 30 9:22 PM
Hi,
Try this..
1)
<b>Internal table with header line.</b>
DATA: BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
END OF ITAB.
2)
<b>Internal table without header line.</b>
DATA: BEGIN OF WA,
MATNR TYPE MATNR,
END OF WA.
DATA: ITAB LIKE STANDARD TABLE OF WA.
3)
TYPES: BEGIN OF TYPE_WA,
MATNR TYPE MATNR,
END OF TYPE_WA.
DATA: ITAB TYPE STANDARD TABLE OF TYPE_WA.
Thanks,
Naren
‎2006 Nov 30 9:22 PM
Hi,
Please check this links for sample codes.
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3660358411d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3646358411d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb367a358411d1829f0000e829fbfe/content.htm
Hope this will help.
Regards,
Ferry Lianto
‎2006 Nov 30 9:23 PM
Hi LMM,
Use TYPES to create an internal table.
<b>TYPES:
BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln,
vdatu TYPE vbak-vdatu,
bstnk TYPE vbak-bstnk,
END OF ty_vbak.
DATA: it_vbak TYPE STANDARD TABLE OF ty_vbak WITH HEADER LINE.</b>
Internal table can be declared in the following ways.
1)
<b>Data : Itab like sflight occurs 0 with header line</b>
Here you are declaring internal table, which is similar to sflight i.e., itab like sflight i.e., you are referring to existing table (like).
(By default internal table created with this declaration is without header line).
2)
<b>Data : Begin of itab occurs 0.
Include structure sflight
Data : End of itab</b>
(Internal Table created with this type of declaration is similar to declaration done in a type the only difference is by default internal table created by this type is with header line)
3)
<b>Data :
Begin of itab occurs 0
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-f1date
End of itab.</b>
By default internal table created by this type of declaration is with header line. In this type of declaration, you are using only those fields from database table, which you require for processing.
4)
<b>Data :
Begin of itab occurs 0
carrid like sflight-carrid,
connid like sflight-connid,
bookid like sbook-bookid
id like scustom-id,
End of itab.</b>
Here you are combining fields from three different tables in one internal table.
5)
<b>Data :
Begin of itab occurs 0
Carrid1 like sflight-carrid,
End of itab.</b>
Here you are specifying different field names.
Thanks,
Vinay
‎2006 Nov 30 9:34 PM
Hi
<b>OCCURS <n>, HEADER LINE are obsolete now. Do not use them.</b>
Try this
Dictionary objects
DATA: I_MARA TYPE TABLE OF MARA, " Internal Table
W_MARA TYPE MARA. " Work Area
Custom
TYPES: BEGIN OF T_MARA,
MATNR TYPE MARA-MATNR,
MEINS TYPE MARA-MEINS,
END OF T_MARA.
DATA: I_MARA TYPE TABLE OF T_MARA, " Internal Table
W_MARA TYPE T_MARA. " Work Area
Regards
Kathirvel