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

internal tables

Former Member
0 Likes
1,034

Hi all,

i declared a internal table as hashed type,

my problem is that,how can we insert or append data into internal table through work area.

10 REPLIES 10
Read only

Former Member
0 Likes
992

If your declaration of the table includes WITH HEADER LINE, just use tablename-variablename assignments and then APPEND or MODIFY tablename.

If it doesn't, declare a variable of the same type as the table structure (this is called WorkArea) and assign values using workareaname-variablename and when you are done APPEND or MODIFY tablename , with APPEND wornareaname INTO tablename.

Read only

Former Member
0 Likes
992
Read only

Former Member
0 Likes
992

Hi, it is impossible to use append with hashed table because it is index operation. Use insert.

INSERT wa_line INTO gt_table.

Read only

0 Likes
992

hi,

Thank u for reply,

can we access hashed tables through index ?....

how can we use insert .

Read only

0 Likes
992

any one give me reply soon.............

Read only

0 Likes
992

No, as I wrote you before, you cannot access hashed tables via indexes.

Read only

0 Likes
992

thank u ,

then how to insert data into hashed table.......

Read only

0 Likes
992

INSERT wa_data INTO gt_data.

of course, you can also select data into hashed tables from DB, or you can use COLECT....

Read only

Former Member
0 Likes
992

True,my bad.

Read only

Former Member
0 Likes
992

Hi,

try this way-

DATA:Itab like sorted table of sflight.

wa like line of itab.

wa-carrid = 'AA'.

wa-connid = '017'.

Append wa to itab.

Clear wa.

wa-carrid = 'AB'.

wa-connid = '012'.

Append wa to itab.

As you have declared internal table as sorted so when you insert data you have to maintain sorting order.