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

array

Former Member
0 Likes
1,725

is there any concept of array in abap. if it is there pls tell me the usage

e.g.

var1 = 10

var2 = 20

var3 = 30

can we store above data as

var1[1] = 10

var1[2] = 20

var1[3] = 30

and also pls tell me how to use this in loop.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,205

Hi Santosh B,

There is no arry concept in ABAP like C language but there is a concept INTERNAL TABLE it is like arrays in C language

See the following link

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/frameset.htm

Reward if it is useful,

Mahi.

6 REPLIES 6
Read only

Former Member
0 Likes
1,206

Hi Santosh B,

There is no arry concept in ABAP like C language but there is a concept INTERNAL TABLE it is like arrays in C language

See the following link

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/frameset.htm

Reward if it is useful,

Mahi.

Read only

Former Member
0 Likes
1,205

Hi,

There is no concept of arrays in ABAP, we use internal tables to hold application data. U can use access internal tables with index.

Read table itab index l_index this is same as u do in case of arrrays a(l_index)

Regards,

Chandru

Read only

Former Member
0 Likes
1,205

There is no concept of array .. Instead use an Internal table to

populate the values and read them ..

say your Internal table has a field F1 ..

itab-f1 = 10.

append itab.

clear itab.

itab-f1 = 20.

append itab.

clear itab.

itab-f1 = 30.

append itab.

clear itab.

Now internal table has 3 values ...

use loop ... endloop to get the values ..

loop at itab.

write 😕 itab-f1.

endloop.

Read only

Former Member
0 Likes
1,205

Hi,

There is no concept of array in abap .

But it is possible to store all the values in a single variable if it is declared of type string.

Ex.

Data: var type string.

append 30 20 10 to var seperated by space.

Now the variable will have the data seperated by space.

Reward if helpful.

Regards.

Read only

Former Member
0 Likes
1,205

S IT IS POSSIBLE TO DECLARE THE ONE -DIMENSIONAL ARRAY IN ABAP BY USING INTERNAL TABLES.

EX.)

DATA: BEGIN OF IT1 OCCURS 10,

VAR1 TYPE I,

END OF IT1.

IT1-VAR1 = 10.

APPEND IT1.

IT1-VAR1 = 20.

APPEND IT1.

IT1-VAR1 = 30.

APPEND IT1.

LOOP AT IT1.

WRITE:/ IT1-VAR1 COLOR 5.

END LOOP.

Read only

Former Member
0 Likes
1,205

hi

Santosh

in ABAP to hold one record we are using Work area where as

to hold array of records we are using Internal Tables

Internal Table is nothing but temporary memory to hold the data while

uploading / downloading from DB.

plz reward points if useful

regards

Hemasekhara Reddy