09-04-2008 12:46 PM
Hi
Can anyone explain the methods or techniques involved for data declaration in the latest ecc version.Am new to abap
Regards
Arun
09-04-2008 12:48 PM
Go into editor. Type the word "DATA". Place cursor within the word "DATA". Press F1.
Actually, before you even go near a SAP system, get a book about ABAP, or go on a training course, or at least read the help.
09-04-2008 12:50 PM
Using Predefined Types
1. DATA { {var[(len)] TYPE abap_type [DECIMALS dec]}
| {var TYPE abap_type [LENGTH len] [DECIMALS dec]} }
[VALUE val|{IS INITIAL}]
[READ-ONLY].
Reference to Existing Types
2. DATA var { {TYPE [LINE OF] type}
| {LIKE [LINE OF] dobj} }
[VALUE val|{IS INITIAL}]
[READ-ONLY].
Reference Variables
3. DATA ref { {TYPE REF TO type}
| {LIKE REF TO dobj} }
[VALUE IS INITIAL]
[READ-ONLY].
Structures
4. DATA BEGIN OF struc [READ-ONLY].
...
{DATA comp ...} | {INCLUDE {TYPE|STRUCTURE} ...}.
...
DATA END OF struc.
Internal Tables
5. DATA itab { {TYPE tabkind OF [REF TO] type}
| {LIKE tabkind OF dobj} }
[WITH key] [INITIAL SIZE n]
[WITH HEADER LINE]
[VALUE IS INITIAL]
[READ-ONLY].
Ranges Table
6. DATA rtab {TYPE RANGE OF type}|{LIKE RANGE OF dobj}
[INITIAL SIZE n]
[WITH HEADER LINE]
[VALUE IS INITIAL]
[READ-ONLY].
09-04-2008 12:52 PM
Hi,
Follow the code below.
----
data definition
----
types : begin of ty_ekko,
ebeln type ekko-ebeln,
lifnr type ekko-lifnr,
bsart type ekko-bsart,
aedat type ekko-aedat,
ernam type ekko-ernam,
end of ty_ekko.
types : begin of ty_eket,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
werks type ekpo-werks,
matnr type ekpo-matnr,
menge type eket-menge,
wamng type eket-wamng,
netpr type ekpo-netpr,
end of ty_eket.
Creating internal table using predefined structure type
data : it_ekko type standard table of ty_ekko,
it_eket type standard table of ty_eket.
Creating internal table using predefined structure type
data : wa_ekko type standard table of ty_ekko,
wa_eket type standard table of ty_eket.
Hope this helps,
Murthy
09-04-2008 12:52 PM
hi ,
In the following way u can define
1.
*types : begin of ty_itab,*
*a type i,*
*b type i,*
*end of ty_itab. "-------> this is a structure.....*
*Data : wa_itab type ty_itab, " -------> work Area ,*
*it_itab type table of ty_itab, " -------> body*
2.
* Data : begin of ty_itab occurs 0,**
**a type i,**
**b type i,**
**end of ty_itab. "-------> this is a structure with headerline/work area and body.**
Regards.....,
09-04-2008 12:53 PM
Hi,
Do F1 help on DATA keyword. you can also refer to
http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb2ff3358411d1829f0000e829fbfe/content.htm
http://abap-gallery.blogspot.com/2007/07/data-declaration.html
Regards,
Ramya