09-19-2008 3:48 PM
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.
09-19-2008 3:53 PM
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.
09-19-2008 3:53 PM
refer to the link for hashed table:
http://www.sap-img.com/abap/what-is-use-of-using-hashed-table.htm
09-19-2008 4:00 PM
Hi, it is impossible to use append with hashed table because it is index operation. Use insert.
INSERT wa_line INTO gt_table.
09-19-2008 5:32 PM
hi,
Thank u for reply,
can we access hashed tables through index ?....
how can we use insert .
09-19-2008 5:55 PM
09-19-2008 6:00 PM
No, as I wrote you before, you cannot access hashed tables via indexes.
09-19-2008 6:07 PM
09-19-2008 6:10 PM
INSERT wa_data INTO gt_data.
of course, you can also select data into hashed tables from DB, or you can use COLECT....
09-19-2008 4:02 PM
09-19-2008 4:05 PM
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.