Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

data declaration

Former Member
0 Likes
614

Hi

Can anyone explain the methods or techniques involved for data declaration in the latest ecc version.Am new to abap

Regards

Arun

5 REPLIES 5
Read only

matt
Active Contributor
0 Likes
574

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.

Read only

Former Member
0 Likes
574

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].

Read only

Former Member
0 Likes
574

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

Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
574

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.....,

Read only

Former Member