Query List of Custom Objects

I'm unable to find a concrete answer on how to query an Object when it is contained within a List. Perhaps it's in the documentation or forums, but I haven't found it. What I have is a Building Object that contains a List<Room> rooms, and each Room has its own attributes like typeCode. Our cache contains Building Objects indexed by its own key. Now I want to write a Filter to locate 1 to many Building Objects that have a Room with a specific typeCode, say "2DB".
I've tried an EqualsFilter with "2DB" and passing it a ValueExtractor that navigates the Building like: rooms.typeCode. I expect the Building getRooms() method to be called, which returns a List<Room>, and then reflection to evaluate the List contents to call getTypeCode() on each Room instance. Instead, I see errors because getTypeCode() doesn't exist on java.util.ArrayList. No kidding.
How do I get the framework to dive inside the List and evaluate the Room instances inside it? All examples I've seen are for simple collections, like List<String> or List<Integer>, whereas I have a List<FooBar>.

Hi,
you would need to write a custom extractor to achieve this as the out-of-the-box extractors don't support invocation chaining across collections (i.e. extracting a collection created by extracting attributes from collection elements).
something like this:
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
import com.tangosol.io.pof.PofReader;
import com.tangosol.io.pof.PofWriter;
import com.tangosol.io.pof.PortableObject;
import com.tangosol.util.ValueExtractor;
public class TwoLevelChainExtractor implements ValueExtractor, PortableObject {
   private ValueExtractor extractorReturningCollection;
   private ValueExtractor extractorExtractingFromCollectionElement;
    * This is for the POF deserialization.
   public TwoLevelChainExtractor() {
   public TwoLevelChainExtractor(ValueExtractor extractorReturningCollection, ValueExtractor extractorExtractingFromCollectionElement) {
      this.extractorReturningCollection = extractorReturningCollection;
      this.extractorExtractingFromCollectionElement = extractorExtractingFromCollectionElement;
   @Override
   public Object extract(Object obj) {
      Object interim = extractorReturningCollection.extract(obj);
      Collection res = new ArrayList();
      ValueExtractor innerExtractor = extractorExtractingFromCollectionElement;
      if (interim instanceof Collection) {
         for (Object element : (Collection) interim) {
            res.add(innerExtractor.extract(element));
      } else if (interim instanceof Object[]) {
         for (Object element : (Object[]) interim) {
            res.add(innerExtractor.extract(element));
      } else {
         Class<? extends Object> cls = interim.getClass();
         if (cls.isArray()) {
            // primitive array
            int count = Array.getLength(interim);
            for (int i=0; i<count; ++i) {
               Object boxedPrimitive = Array.get(interim, i);
               res.add(innerExtractor.extract(boxedPrimitive));
         } else {
            res.add(innerExtractor.extract(interim));
      return res;
   @Override
   public void readExternal(PofReader reader) throws IOException {
      extractorReturningCollection = (ValueExtractor) reader.readObject(0);
      extractorExtractingFromCollectionElement = (ValueExtractor) reader.readObject(1);
   @Override
   public void writeExternal(PofWriter writer) throws IOException {
      writer.writeObject(0, extractorReturningCollection);
      writer.writeObject(1, extractorExtractingFromCollectionElement);
   // equals() and hashCode() are required to be able to use this extractor to create indexes, where the extractor acts as a key in a hash-map
   @Override
   public int hashCode() {
      final int prime = 31;
      int result = 1;
      result = prime * result
            + ((extractorExtractingFromCollectionElement == null) ? 0 : extractorExtractingFromCollectionElement.hashCode());
      result = prime * result + ((extractorReturningCollection == null) ? 0 : extractorReturningCollection.hashCode());
      return result;
   @Override
   public boolean equals(Object obj) {
      if (this == obj)
         return true;
      if (obj == null)
         return false;
      if (getClass() != obj.getClass())
         return false;
      TwoLevelChainExtractor other = (TwoLevelChainExtractor) obj;
      if (extractorExtractingFromCollectionElement == null) {
         if (other.extractorExtractingFromCollectionElement != null)
            return false;
      } else if (!extractorExtractingFromCollectionElement.equals(other.extractorExtractingFromCollectionElement))
         return false;
      if (extractorReturningCollection == null) {
         if (other.extractorReturningCollection != null)
            return false;
      } else if (!extractorReturningCollection.equals(other.extractorReturningCollection))
         return false;
      return true;
}Afterwards you can just use this extractor to extract a collection of type codes from rooms:
ValueExtractor roomsTypeCodes = new TwoLevelChainExtractor(new ReflectionExtractor("getRooms"), new ReflectionExtractor("getTypeCode"));You can use this roomsTypeCodes and a ContainsFilter or ContainsAnyFilter to achieve what you want.
You can implementing similar stuff for POF extraction by leveraging the PofValueParser class in an EntryExtractor subclass.
Best regards,
Robert

Similar Messages

  • How to get list of custom objects used in abap report program?

    Hi friends,
    I have a requirement in which I have to scan the entire abap report and retrieve list of custom objects used in it for example custom tables, data elements, structures, table types etc,. Is there any provision in SAP like fuction modules to do this functionality?  As of now I am coding everything manually where so many possibilities are there for all kinds of objects. Provide your answers and suggestions...
    Thanks,
    Nastera

    Hi,
    The best way to do this is environment analysis. Follow the steps:
    1. Open se38, type in the program name (don't click on on display/change or create button, stay on first screen only)
    2. Click on environment analysis button (hot key SHIFT+F4)
    3. It will throw a pop-up, which will ask for type of object you want to see, which are linked /used by this program. select all (or may be if you are only interested in Tables, then select table only)
    4. Hit 'Enter'
    You will get the full list of all objects used in this report program. Just note down the one which starts with Z or Y and that's it.
    Cheers,
    Anid

  • List of customized objects

    Hi,
    I want to List all the customized objects in the system.
    Can any body tell me the way how to List the same.
    Regards,
    Sekhar.

    There was a developed code for getting the details of Customized programs/objects.....you can find this code under wiki>>code gallery
    Just search there, best of luck!
    Regards,
    Nick Loy

  • Insert/Query records of custom objects

    We are looking for a generic programmatic solution to query/insert/delete records of custom objects. Using different WSDLs for custom objects and making calls to APIs of multiple stubs is NOT a generic solution. The main purpose of generic solution is – least bother about the number of custom objects present in any OCOD instance and their WSDLs. I am a bit ready to take minor hit on performance and others.
    Any suggestion? Idea?

    We are looking for a generic programmatic solution to query/insert/delete records of custom objects. Using different WSDLs for custom objects and making calls to APIs of multiple stubs is NOT a generic solution. The main purpose of generic solution is – least bother about the number of custom objects present in any OCOD instance and their WSDLs. I am a bit ready to take minor hit on performance and others.
    Any suggestion? Idea?

  • Transcation to know the list of customized objects

    Friends,
    Need one sugestion for the upgrade projcet. Is there any transaction which can tel about the totla no of customized objects available in the system including the user exits routines and all.
    rgds,
    Albert.

    Hi,
      You can check by the development class from SE80 transaction, give the dev.class and check the custom objects assigned to this,
    Hope this helps,
    Rgds,

  • Tool to list custom objects

    Hi,
    Do you know any tool or scripts which can be used to list all custom objects and standard objects that have been customized in EBS?
    Thanks in avance for your feedback,
    Regards,
    J.

    Hi,
    I think there is no such a tool/script which can be used to tell if the object is standard or custom. If you follow the customization standards, you should be able to identify the type of objects.
    Regards,
    Hussein

  • How to identify custom object in repository

    Hi,
    I need to prepare a list of Custom objects(applets, view, screens etc.,) that are existing in a repository.
    How do i identify them?
    version - siebel 7.5.13
    thanks
    Goud

    Assuming naming convention is not strongly implemented as your site, you might want to start with searching for all the objects which are not created by 'SADMIN' (assuming developers don't create objects with SADMIN as user), you might want to use 'Flat' view for that purpose or use sql.

  • Difference in DNL (Customizing) objects in CRM 7.0 and CRM 5.0

    Hi,
    I wanted to know if any new DNL's (customizing objects) have been introduced in the CRM 7.0 version in comparison to CRM 5.0. and if yes then which ones are critical with respect to data integrity and smooth functioning of the system.
    Regards
    Kshitij Garg

    Hi Kshitij,
    I dont think there is any new customizing object for CRM7.0 other than from CRM5.0. One have to follow the same procedure to download the customizing objects.
    Please find the list of customizing objects for CRM7.0 in the following link:
    http://help.sap.com/saphelp_crm70/helpdata/EN/1d/09d1e713d711d6999e00508b6b8a93/frameset.htm
    Hope this helps!
    Regards,
    Chethan

  • How to get module wise custom objects

    Hi ,
    How to get all the list of custom objects ( Eg : zreports, ztransactions, zscripts, zsmartforms,zwebdynpro components ..... )
    and how to segregate them which module wise ( FI / MM / SD .... )
    I am using Tadir for getting the custom objects. Please suggest how to segregate module wise.
    Thanks

    Hi,
    Entities are related to components by the package they are contained in.
    Have a look at the table TDEVC.
    Kind regards,
    Valentin

  • Batch Delete Custom Objects?

    Is this possible yet? Specifically for Custom Object 2. I am an administrator and have all access/privliges, but there is not a Batch Delete option when creating a list of Custom Object 2's.

    Batch Delete is supported for Accounts, Contacts, Opportunities, Leads, Service Requests and Activities.

  • ABAP program to list Data Dictionary objects referenced in custom program

    I want an uitlity program that will list all ( Custom and standard) data dictionary objects referenced to declare variables in custom ABAP program. Is there any standard program available in SAP to meet this requirements?
    This is required to create a separate transport requests only with data dictiornay objects.
    Thanks in advance for your help
    Regards,
    Sunil

    Hi
    You can try the FM AKB_WHERE_USED_LIST.
    ~~~Ganesh Kumar K.

  • Mapping and querying Custom Objects for a Contact with REST Api

    Hello All,
    We are hoping to get some details on managing DataCard set through REST APIs. Our implementation goal is to create Contacts and add Custom object for each Contact, or to be precise, add a DataCard Set for each Contact.
    At the moment, to associate a DataCard Set (or Custom Object) to an existing contact, we are supplying following custom object fields during creation of Custom Object:
    new CustomObjectField 
                                                                    name = "MappedEntityType",
                                                                    dataType = Enum.GetName(typeof(DataType), DataType.numeric),
                                                                    type = "CustomObjectField",
                                                                    defaultValue = "0"
                                                             new CustomObjectField
                                                                    name = "MappedEntityID",
                                                                    dataType = Enum.GetName(typeof(DataType), DataType.numeric),
                                                                    type = "CustomObjectField",
                                                                    defaultValue = "<ContactId>"
    Is this the correct approach? This is Based on the information provided here: http://topliners.eloqua.com/community/code_it/blog/2012/05/31/eloqua-api-how-to-mapping-a-data-card-to-an-entity.
    Would the REST API allow us to query the CustomObjects using the MappedEntityId value for later updates? If so, any pointers on how we approach that?
    Thanks in ad.

    Either the MappedEntityID field is not available or I do it wrong, Eloqua is ignoring the field and does not map the custom record with the unique Contact ID
    {"type":"CustomObjectData","ContactID":"8829509","fieldValues":[{"id":"195","value":"[email protected]"},{"id":"220","value":"a0KJ000000387QvMAI"},{"id":"191","value":"001J000001OrL77IAF"},{"id":"193","value":"NowTV MPP"},{"id":"194","value":"8829509"},{"id":"196","value":"Andreas"},{"id":"197","value":"Wolf"},{"id":"198","value":"003J00000145lkBIAQ"},{"id":"210","value":"777666555"},{"id":"199","value":"gbp"},{"id":"200","value":"0"},{"id":"215","value":"0"},{"id":"201","value":"999111999"},{"id":"214","value":"111111"},{"id":"202","value":"222222"},{"id":"204","value":"now"},{"id":"203","value":"xmas"},{"id":"205","value":"no description"},{"id":"206","value":"test"},{"id":"218","value":"holidays"},{"id":"219","value":"PPV-0878545"},{"id":"213","value":"N"},{"id":"212","value":"myself"},{"id":"209","value":"now tv"},{"id":"192","value":"1417542120"},{"id":"207","value":"1417542120"},{"id":"216","value":"1417542240"},{"id":"217","value":"1417542240"},{"id":"211","value":"1417542240"}]},"MappedEntityID":"003J00000145lkBIAQ"}
    Response
    DEBUG|Response------{"type":"CustomObjectData","id":"81720","fieldValues":[{"id":"195","value":"[email protected]"},{"id":"220","value":"a0KJ000000387QvMAI"},{"id":"191","value":"001J000001OrL77IAF"},{"id":"193","value":"NowTV MPP"},{"id":"194","value":"8829509"},{"id":"196","value":"Andreas"},{"id":"197","value":"Wolf"},{"id":"198","value":"003J00000145lkBIAQ"},{"id":"210","value":"777666555"},{"id":"199","value":"gbp"},{"id":"200","value":"0"},{"id":"215","value":"0"},{"id":"201","value":"999111999"},{"id":"214","value":"111111"},{"id":"202","value":"222222"},{"id":"204","value":"now"},{"id":"203","value":"xmas"},{"id":"205","value":"no description"},{"id":"206","value":"test"},{"id":"218","value":"holidays"},{"id":"219","value":"PPV-0878545"},{"id":"213","value":"N"},{"id":"212","value":"myself"},{"id":"209","value":"now tv"},{"id":"192","value":"1417542120"},{"id":"207","value":"1417542120"},{"id":"216","value":"1417542240"},{"id":"217","value":"1417542240"},{"id":"211","value":"1417542240"}]}
    Eloqua:
    Name: PPV-0878545
    Unique Code: a0KJ000000387QvMAI
    Status Registered
    Created Date 12/22/2014 12:44:49 PM
    Mapped NO
    Any Idea how to map this to a contact
    Entity Type is Contacts
    Entity Field is SFDC Contact ID

  • Custom Object Test query/report

    Is there a way to run a query or get a report for the scripts containing Custom Object Tests?

    Hello Jim,
    As far as I know there is no way to do this.

  • Custom Objects List Using ABAP Program

    Hi Experts,
    We have  a requirement to collect all the custom objects(reports,smartforms,ddic objects etc)developed in ECC.
    We need list basing on condition of 'last changed by' .
    So for few objects we have 'last changed by' field and we are able to get the list but for few custom objects 'last changed by' field is not maintained.
    Example for BTE there is no 'last changed by'...
    Please suggest if any ideas.
    Regards,
    Rafi

    Hi Rafi,
    Do a source scan using RS_ABAP_SOURCE_SCAN for reports..Put Z* and give your respective conditions on last change field.
    2.Check the Transport list to production you will get other details.
    Hope it will be helpful for you.
    Regards,
    Kannan

  • Error when querying custom object 5 using contact Id

    Hi,
    I have related custom object 5 to contacts in CRM On demand. I am trying to find out the custom object 5 records related to contact based on the contact Id. I'm using the query page function in the wsdl for custom object 5 (web services 2.0) and the SOAP UI tool.
    Here is the SOAP request (I replaced the contact id in the xml below ):
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="urn:crmondemand/ws/ecbs/customobject5/10/2004" xmlns:quer="urn:/crmondemand/xml/CustomObject5/Query">
    <soapenv:Header/>
    <soapenv:Body>
    <ns:CustomObject5QueryPage_Input>
    <quer:ListOfCustomObject5 pagesize="?" startrownum="?" recordcountneeded="?">
    <!--Optional:-->
    <quer:CustomObject5 searchspec="?">
    <!--Optional:-->
    <quer:ContactId sortorder="?" sortsequence="?"><+Id from CRM on demand+></quer:ContactId>
    </quer:CustomObject5>
    </quer:ListOfCustomObject5>
    </ns:CustomObject5QueryPage_Input>
    </soapenv:Body>
    </soapenv:Envelope>
    I get the following response:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
    <faultcode>SOAP-ENV:Server</faultcode>
    <faultstring>Field 'Contact Id' in the integration component 'CustomObject5' instance contains invalid query expression: <Contact id that I entered in request>(SBL-EAI-13002)</faultstring>
    <detail>
    <siebelf:siebdetail xmlns:siebelf="http://www.siebel.com/ws/fault">
    <siebelf:logfilename>siebel.log</siebelf:logfilename>
    <siebelf:errorstack>
    <siebelf:error>
    <siebelf:errorcode>(SBL-EAI-13002)</siebelf:errorcode>
    <siebelf:errorsymbol/>
    <siebelf:errormsg>Field 'Contact Id' in the integration component 'CustomObject5' instance contains invalid query expression: <Contact id that I entered in request>(SBL-EAI-13002)</siebelf:errormsg>
    </siebelf:error>
    <siebelf:error>
    <siebelf:errorcode>(SBL-EAI-13006)</siebelf:errorcode>
    <siebelf:errorsymbol/>
    <siebelf:errormsg>Invalid operator: <Contact id that I entered in request>(SBL-EAI-13006)</siebelf:errormsg>
    </siebelf:error>
    </siebelf:errorstack>
    </siebelf:siebdetail>
    </detail>
    </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Can anyone tell me what could be the problem? or what should be the format of the input parameter in the request? I checked in On demand and there should be 1 custom object 5 row returned in the response.

    Hi,
    Thanks a lot . I will try this method too. However, this is how I resolved the problem. I changed my soap request include a search based on contact id:
    <soapenv:Body>
    <cus:CustomObject5QueryPage_Input>
    <quer:ListOfCustomObject5>
    <!--Optional:-->
    <quer:CustomObject5 searchspec="[ContactId]='CRM On Demand Contact Id'">
    <!--You may enter the following 786 items in any order-->
    <quer:Id/>
    <quer:ContactId/>
    <quer:AccountId/>
    <quer:IndexedPick0 />
    </quer:CustomObject5>
    </quer:ListOfCustomObject5>
    </cus:CustomObject5QueryPage_Input>
    </soapenv:Body>
    What I din't realize was that the column names I specified in the quer: tag would be fetched from CRM and returned in the response.
    Regards,

Maybe you are looking for