2009 Jul 30 4:45 AM
Hi Folks,
I was wondering if there's ABAP collection object similar to java collection (arraylist, hashmap, etc) that I can I use as storage of objects so I can just iterate them once needed.
Thanks,
Robert
Hi Folks,
I was wondering if there's ABAP collection object similar to java collection (arraylist, hashmap, etc) that I can I use as storage of objects so I can just iterate them once needed.
Thanks,
Robert
2009 Jul 30 6:54 AM
I'm not familiar with Java collections, but for storing multiple line of data in ABAP, we used internal tables which you can iterate with:
LOOP AT internal_table INTO
ENDLOOP.
Look at F1 help on LOOP statement and how to declare these internal tables.
2009 Jul 30 6:59 AM
Can I use this internal table as return type of method? Thanks.
2009 Jul 31 12:13 PM
sure, just look at method signature and define a return parameter with the type of internal_table.
2009 Aug 04 1:15 PM
Hi ,
You can find internal tables as arraylist in Abap.Below link will help u in understanding Internal tables in detail.
http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb35de358411d1829f0000e829fbfe/content.htm
Thanks,
Ramakrishna.
2009 Aug 12 1:09 PM
Was recently wondering myself...also needed to have a "collection" of objects as a return value.
so found solution like this. The rest is like working with tables...
types:
my_object_collection TYPE STANDARD TABLE OF REF TO if_my_object with DEFAULT KEY.
methods GET_MY_OBJECTS
returning
value(MY_OBJECTS) type MY_OBJECT_COLLECTION.
Edited by: Konstantin Tarmyshov on Aug 12, 2009 2:10 PM
2009 Dec 17 3:29 PM
Hi,
there are Classes in ABAP:
CL_OBJECT_COLLECTION which is a collection
and
CL_OBJECT_COLLECTION_ITERATOR that can be used to Iterate over a collection.
You can put every Object into such a collection.