All active OLE controls containing collections within an SAP system are implemented according to common conventions. As long as a collection is not explicitly declared as a non-standard collection, the following description applies to the collection. However, not all properties and methods mentioned below are available with every collection.
The lower bound index for all collections is 1.
For hints on using collection objects, see
Using Collection Objects.Standard Collection Properties
Name |
Parameter |
Type |
Description |
Count |
void |
Long |
Returns the number of objects stored in the collection. |
Item |
Variant vaIndex |
Object |
Returns an object according to vaIndex. Item is always the default property. |
Standard Collection Methods
Name |
Parameter |
Return Type |
Description |
Add |
Object dependent |
Object |
Adds a new object and returns the new object. |
Insert |
Variant vaIndex Object dependent |
Object |
Inserts a new object at position vaIndex and returns the new object. |
Remove |
Variant vaIndex |
Boolean |
Removes the object at position vaIndex. |
RemoveAll |
void |
Boolean |
Removes all objects from the collection. |
UnLoad |
Variant vaIndex |
Object |
Unloads the object at position vaIndex. |
Detailed Description
Object Item(Variant vaIndex)
The item method returns an object from the collection. The parameter vaIndex identifies the position of the object to be returned. The type of this parameter depends on the object. It may describe the position where the object can be found, either as a simple integer value, or as a string value (as described in
Named Collections), or in any object-dependent variant data type. In the following sections, the valid types are described for each collection.Object Add (…)
The parameters for the Add method depend on the object. These parameters are used to initialize the new object. Add always returns the new object.
Object Insert(Variant vaIndex,…)
The parameters for the Insert method depend on the object. These parameters are used to initialize the new object. Insert always returns the new object. The first parameter of the Insert methods always describes the position where to insert the new object (the new object is always inserted in front of the position described by vaIndex). The type of this parameter is object-dependent. It may describe the position where to insert the new object, either as a simple integer value, or as a string value (as described in
Named Collections), or as an Object which is already part of the collection. Nevertheless, the indexing parameter always has the same meaning as the indexing parameter of the default property Item.Boolean Remove(Variant vaIndex)
This method removes an object from its collection. The parameter vaIndex identifies the position of the object to be returned. The type of this parameter depends on the object. It may describe the position where to insert the new object, either as a simple integer value, or as a string value (as described in
Named Collections). Nevertheless, the indexing parameter always has the same meaning as the indexing parameter of the default property Item.
When removing an object from the collection, the object becomes invalid. Any further attempts to work on the object return an Invalid Object Exception. Use UnLoad if the object should be removed from the collection for further use.
Object UnLoad(Variant
vaIndex )This method unloads an object from its collection. The parameter vaIndex identifies the position of the object to be returned. The type of this parameter depends on the object. It may describe the position where to unload the object, either as a simple integer value, or as a string value (as described in
Named Collections). Nevertheless, the indexing parameter always has the same meaning as the indexing parameter of the default property Item.