2005 Aug 31 6:43 AM
Hello,
If I want to add a few rows to a hashed internal table, is it not possible at all?
INSERT and APPEND are not allowed on hashed internal tables.
Has anybody faced a similar problem?
What I want to do is..
LOOP AT hashed_inttable into wa where a = b.
APPEND wa TO another_hashed_inttable."[APPEND not allowed]
ENDLOOP.
Cheers
Anoop.
2005 Aug 31 9:00 AM
Hi Anoop,
Append definitely cant be used with hashed tables.
You need to use "insert" statement to insert records into ur hashed internal table.
For insert you need to use the following syntax..
INSERT <WA> INTO <b>TABLE</b> <ITAB>, as somebody pointed out.. The table keyword is important here. I think u wud have forgotten the Table keyword in your syntax.
Kinldy reward points to the reply that answered ur question, and close the thread if u have no other issues.
Prabhu.
2005 Aug 31 6:58 AM
Hi Anoop,
I think u can use INSERT command.Just try it.
TYPES: BEGIN OF LINE,
COL1,
COL2,
END OF LINE.
DATA: WA TYPE LINE,
ITAB TYPE HASHED TABLE OF LINE WITH UNIQUE KEY COL1,
KEY(4) VALUE 'COL1'.
WA-COL1 = 'X'. INSERT WA INTO TABLE ITAB.
WA-COL1 = 'Y'. INSERT WA INTO TABLE ITAB.
Hope this helps u.
Thanks&Regards,
Ruthra.R
Message was edited by: Ruthra
2005 Aug 31 7:03 AM
Hello Ruthra,
I've tried INSERT, INSERT with INDEX , APPEND.
None of them are allowed.
Thanks & Regards,
Anoop.
2005 Aug 31 7:33 AM
Hi Anoop,
U can't do index operation in Hashed Internal table.U can insert the values with out index.
With Regards,
Ranganathan
2005 Aug 31 9:36 AM
Hi ,
Insert command will work on HASHED tables on Key access.
Try with below code...
REPORT zhashtable_test .
TYPES :
BEGIN OF t_city,
city TYPE sgeocity-city,
country TYPE sgeocity-country ,
latitude TYPE sgeocity-latitude,
END OF t_city,
t_city_list TYPE HASHED TABLE OF t_city WITH UNIQUE KEY city country.
DATA : wa_itab TYPE t_city,
city_list TYPE t_city_list.
wa_itab-city = 'Coimbatore'.
wa_itab-country = 'INDIA'.
wa_itab-latitude = '150'.
INSERT wa_itab INTO TABLE city_list .
2005 Aug 31 9:46 AM
Hi, As far as I know you cannot add rows to a hashed table from within a loop structure. This is because the hash has to be calculated and with that the order of the rows can change which gives you an unreliable loop result.
Sometimes you can make a copy of the table which you use for looping while adding records to the "desired table".
Message was edited by: Bas Jansen
2005 Aug 31 7:41 AM
Hi Anoop,
You cannot use index operation in HASHED table.
Use INSERT <WA> INTO TABLE <HAS_ITAB>.
Hashed tables
This is the most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index. The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for processing large amounts of data.
Hope it helps u.
Thanks & Regards,
Ruthra.R
2005 Aug 31 7:48 AM
may be post your code then we can check where the issue is
Regards
Raja
2005 Aug 31 9:00 AM
Hi Anoop,
Append definitely cant be used with hashed tables.
You need to use "insert" statement to insert records into ur hashed internal table.
For insert you need to use the following syntax..
INSERT <WA> INTO <b>TABLE</b> <ITAB>, as somebody pointed out.. The table keyword is important here. I think u wud have forgotten the Table keyword in your syntax.
Kinldy reward points to the reply that answered ur question, and close the thread if u have no other issues.
Prabhu.
2005 Sep 02 10:58 AM
Anoop,
More than just this, there r a lot of dos and dont's with a hashed table... u need to be extremely careful when using a hashed table. read the sap docu on this to understand thsi clearly.
Reward suitable points if thsi post answered ur question.
Rgds,
Prabhu.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |