Using RTTI to identify subclasses

Hello, here is my dilemma:
Class B inherits from Class A.  Classes C and D inherit from Class B.
I need to test if object O is an instance of Class A or any of its subclasses (ie Class A, B, C or D).  Using the method GET_RELATIVE_NAME is not suitable because then I must know the actual name of the subclass, which I will not.  The methods APPLIES_TO and APPLIES_TO_CLASS do not seem to account for inheritance (ie Class D APPLIES_TO Class A is false, even though Class A is a superclass of Class D).
Any feedback would be very nice.  I'd like to accomplish this, if possible, using RTTI since it is more elegant than simply casting the object into a reference of type Class A and seeing if an error is thrown.
I'm on 4.7, WebAS 6.30.
Cheers,
Mike

I know this is NOT a RTTI way of doing this task and I can tell you from looking for hours at RTTI that it does not look at the information in this "bottom-up" manner.  Although, this would be totally unsupported you can recursivley read the VSEOEXTEND table.  That table keeps the relations of all classes and sub-classes.  Sadly, CL_ABAP_CLASSDESCR is marked as final so you can't even subclass it to add this functionality.
hope this helps.
-d

Similar Messages

  • My iPhone 4 Bluetooth, using ios7, cannot identify any other bluetooth device (even other apple products). Says device not supported. How to solve this problem?

    My iPhone 4 Bluetooth, using ios7, cannot identify any other bluetooth device (even other apple products). Says device not supported. How to solve this problem?

    Supported Bluetooth Profiles
    It is not supposed to detect other Apple products via Bluetooth.

  • Release 1.5, 'enum' is a keyword, and may not be used as an identifier.help

    hello
    i am working for a MNC and i am trying to build my prduct in JDK1.5 and i am getting this error...
    ...release 1.5, 'enum' is a keyword, and may not be used as an identifier...
    the probelm is that i cant go to 1.4 as my product suports only 1.5 and above ..
    give me asolutin as fast as possible...

    hello
    i am working for a MNC and i am trying to build my
    prduct in JDK1.5 and i am getting this error...
    ...release 1.5, 'enum' is a keyword, and may not be
    used as an identifier...
    What am I missing? Don't use the 'enum' as a variable name!

  • Using PHP to identify the current page - by David Powers

    Hi There,
    I'm trying to write a script so I can identify the sub-pages under "Gallery" in my website
    Under Gallery I have more than hundred pages describing the photos but I want to identify them as the "Gallery" page.
    How do I achieve that?
    It would be tedious to write the "PHP if" statement for each photo link.
    I trust there is a simpler solution.
    In PHP solutions by David Powers, Ch.4 "Using PHP to identify the current page"
    The script is:
    <?php $currentPage = basename($_SERVER['SCRIPT_NAME']); ?>
    <ul id="nav">
      <li><a href="index.php" <?php if ($currentPage == 'index02.php') {echo 'id="here"';} ?>>Home</a></li>
      <li><a href="journal.php" <?php if ($currentPage == 'journal.php') {echo 'id="here"';} ?>>Journal</a></li>
      <li><a href="gallery.php" <?php if ($currentPage == 'gallery.php') {echo 'id="here"';} ?>>Gallery</a></li>
      <li><a href="contact.php" <?php if ($currentPage == 'contact.php') {echo 'id="here"';} ?>>Contact</a></li>
    </ul>
    Let's say that the gallery pages contains hundreds of links gallery like gallery/photos1.php, gallery/photos2.php, gallery/photos3.php, gallery/photos4.php, gallery/photos5.php, gallery/photos6.php, gallery/photos7.php etc...
    How would I identify the sub-pages so when we are there Gallery is highlighted?
    Thank you!
    Best,

    Hello Siddhardha,
    To get the details of a process you need to use Locator class from BPEL api. You can locate your process by listInstances method which accepts WhereCondition parameter used to build a query on process instances. Once you've found the process you were looking for you can use getAuditTrail method to retrieve audit trail of a given instance. You can also use setStatus() method from a BPELX java exec tag within your process and later retrieve it from instance handle by getStatus method.
    A sample snippet to retrieve instance handles to all child processes of a given process:
    StringBuffer sb = new StringBuffer();
    Locator locator = new Locator(domain,domainpassword);
    WhereCondition wc = new WhereCondition();
    String query = sb.append(SQLDefs.AL_ci_root_id).append(" = ? ").toString();
    wc.append(query);
    wc.setLong(1,parentInstance);
    IInstanceHandle[] ih = locator.listInstances(wc);
    You can read more about querying processes on http://blogs.oracle.com/matt/2006/06/27?print-friendly=true
    Radoslaw

  • Download multiple table data using RTTI

    Hi,
    Using RTTI, I am trying to download database table data dynamically. I have code that works fine for one table at a time. If I need to download data from multiple tables in one go. How can I  do this using RTTI?
    Thanks in advance,
    VG
    My code is...
    DATA: go_struct TYPE REF TO cl_abap_structdescr,
                go_table TYPE REF TO cl_abap_tabledescr,
                gi_data type ref to data.
          FIELD-SYMBOLS: <gi_data> TYPE STANDARD TABLE.
    * Dynamically getting the line type of the specified table
          go_struct ?= cl_abap_typedescr=>describe_by_name( v_tabname ) .
          TRY.
              CALL METHOD cl_abap_tabledescr=>create
                EXPORTING
                  p_line_type  = go_struct
                  p_table_kind = 'S'
                RECEIVING
                  p_result     = go_table.
            CATCH cx_sy_table_creation .
    *MESSAGE e000 WITH text-004.
          ENDTRY.
    * creating internal table of table type just created
          CREATE DATA gi_data TYPE HANDLE go_table.
    * Assigning the internal table to field symbol
          ASSIGN gi_data->* TO <gi_data>.
    ** get the data into the internal table from db table
          SELECT * INTO TABLE <gi_data> FROM (v_tabname).
    download....
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
    *      filename                = 'C:\test.txt'
          filename                = p_file1
          write_field_separator   = 'X'
        TABLES
            data_tab               = <gi_data>
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.
      IF sy-subrc = 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Edited by: Thomas Zloch on Nov 5, 2010 9:42 AM - please use code tags

    Hi,
    DATA: go_struct TYPE REF TO cl_abap_structdescr,
    go_table TYPE REF TO cl_abap_tabledescr,
    gi_data type ref to data.
    FIELD-SYMBOLS: <gi_data> TYPE STANDARD TABLE.
    LOOP AT GT_TAB_LIST INTO GS_TAB_LIST.
    * Dynamically getting the line type of the specified table
    go_struct ?= cl_abap_typedescr=>describe_by_name( GS_TAB_LIST-tabname ) .
    TRY.
    CALL METHOD cl_abap_tabledescr=>create
    EXPORTING
    p_line_type = go_struct
    p_table_kind = 'S'
    RECEIVING
    p_result = go_table.
    CATCH cx_sy_table_creation .
    *MESSAGE e000 WITH text-004.
    ENDTRY.
    * creating internal table of table type just created
    CREATE DATA gi_data TYPE HANDLE go_table.
    * Assigning the internal table to field symbol
    ASSIGN gi_data->* TO <gi_data>.
    ** get the data into the internal table from db table
    SELECT * INTO TABLE <gi_data> FROM ( GS_TAB_LIST-tabname ).
    download....
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    * filename = 'C:\test.txt'
    filename = p_file1
    write_field_separator = 'X'
    TABLES
    data_tab = <gi_data>
    EXCEPTIONS
    file_write_error = 1
    no_batch = 2
    gui_refuse_filetransfer = 3
    invalid_type = 4
    no_authority = 5
    unknown_error = 6
    header_not_allowed = 7
    separator_not_allowed = 8
    filesize_not_allowed = 9
    header_too_long = 10
    dp_error_create = 11
    dp_error_send = 12
    dp_error_write = 13
    unknown_dp_error = 14
    access_denied = 15
    dp_out_of_memory = 16
    disk_full = 17
    dp_timeout = 18
    file_not_found = 19
    dataprovider_exception = 20
    control_flush_error = 21
    OTHERS = 22.
    IF sy-subrc = 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    endloop.

  • Is it possible to use markers/special identifiers in CF.

    Is it possible to use markers/special identifiers in Cold Fusion? If possible how do I test for markers at the end of say a zip code. E.x. 11691XX( XX is the special Marker).

    IES48069774 wrote:
    Is it possible to use markers/special identifiers in Cold Fusion?
    Sure thing. You could, for example, use string functions.
    If possible how do I test for markers at the end of say a zip code. E.x. 11691XX( XX is the special Marker).
    It depends. What you want to test for: existence of the markers, the number of characters, the character values?

  • What is the use of Payroll Identifier

    Dear Freinds,
                 I would like to know what is the use of payroll Identified in infotype 0267. When i read in the documentationt the the payroll identier  "distinguish between different off-cycle payroll runs created on the same day". so I have to tried created two different off-cycle payroll records in the infoytpe 0267 through PA30 on the payment date 01012009  with amount 200 INR , so i have created first record with payroll indicator as 1, but again with the same payment date 01012009 when iam trying to create on more record with amount 300 INR with payroll indicator as 2,  found that first record getting overwritten the second record.. There byonly one record exists in overview.
    Could any one please let me know how can i have two records . So i would like to know what is the significance of the payroll identifier.
    regards
    divya

    Hi,
    " found that first record getting overwritten the second record"
    I guess your problem is caused by incorrect manipulation.
    When you run payroll driver for off-cycle payroll run, there are 3 blanks after < Off-cycle payroll > line.,the 2nd blank is for payroll ID. Specify it with payroll ID that you entered in IT0267. Thus, you will find there is no overwritten any more.
    Br,Kee

  • Use string as identifier in array?

    hi, is it possible to use String as identifier in arrays instead of numbers? if so, how do you do it?

    lol.. mmm.. well, i just discovered hashtables :D mmm.. i find hashname.put(object, object); to be too much.. so i wrote a adhoc method for walking through two arrays and putting them into hastables :D though, i had some errors:
    public Hashtable makeHash(int cap, String allString[], int allInt[])
         Hashtable hash = new Hashtable(cap);
         int i = 0;
         while(i < allString.length && i < allInt.length)
              hash.put(allString, new Integer(allInt[i]));
              i++;
         return hash;
    then i ran this method:
    String days[]=
              "Sun",
              "Mon",
              "Tue",
              "Wed",
              "Thu",
              "Fri",
              "Sat"
    int offset[] = {0, 1, 2, 3, 4, 5, 6};
    makeHash(7, days[], offset[]);in eclipse, there is a red mark under the comma right after days[] in the makeHash parameter... when i mouse over it, it gave me an "Syntax error on token ",","." expected".. anyone know what i'm doing wrong?

  • Problem using var1 to identify a name of two files.

    Hi people,
    In my configuration part I use the %Var1% statement to assing the name of diferents files, but when I open the file in a editor text inside of it I see the name of the file to.
    I only need the file name to identify it but I don't need it into the file.
    How can I fix that?
    P.D. I use this link to make that: /people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii
    Thanks for the help.

    HI,
    you can delete the file name from the payload with the help of Cut parameter in the File Receiver Content Conversion.
    For this , you need to have , your file name as a separate node with your other data.
    For e.g
    <COmplete Data Str>
         <Data >
         </Data>
       <File Name>
          <filename>field </filename>
       </File Name >
    </COmplete Data Str>
    now you can use CUT parametert in the content conversion and you can avoid file name coming into the target file.
    For more-
    /people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12
    Hope this helps,
    Thanks,
    Moorthy

  • Little tip to get the nr of elements in a local structure using RTTI

    sometimes you need to know the number of elements in a structure for manpulating data
    for example you might need to convert the elements in an internal table to a special file format such as "field","field",......"field".
    instead of something like this where  you have counted the number of elements in your structure
    you can obtain the number of elements dynamically. This saves changing the code each time you change the structure and can avoid errors.
    data: zstring type string
    data: zstring1 type string.
    lv_index = 1.
        WHILE lv_index LE 47. 
          .CLEAR zstring.
          ASSIGN COMPONENT lv_index OF STRUCTURE  your_ structure  TO  <fsa>.
          CONCATENATE '"' <fsa> '"' INTO zstring.
          CONCATENATE zstring1 zstring INTO zstring1.
          CONCATENATE  zstring1 ',' INTO zstring1.
          lv_index = lv_index + 1.
          CLEAR zstring.
        endwhile
    lv_index = 48.
        ASSIGN COMPONENT lv_index OF STRUCTURE wa_interface_contracts TO  <fsa>.
        CONCATENATE '"' <fsa> '"' INTO zstring.
        CONCATENATE zstring1 zstring INTO zstring1.
        CONDENSE zstring1.    "Left align all data fields within the string
        APPEND zstring1 TO ta_string1.
        CLEAR zstring.
        CLEAR zstring1.
        lv_index = 1.
    Using the RTTI
    DATA lr_rtti_struc TYPE REF TO cl_abap_structdescr .
    DATA: zog    LIKE LINE OF lr_rtti_struc->components .
    DATA:  zogt                    LIKE TABLE OF zog,
      CREATE DATA dref TYPE your_structure
      ASSIGN dref->* TO <fs>.
      lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( <fs> ).
    * get the structure details into a table.
    * table zogt[] contains the structure details
      zogt[]  = lr_rtti_struc->components. 
    now the nr of rows in this table contains the number of elements in your structure.
    cheers
    jimbo

    hi Jimbo,
    why don't you start blogging?
    ec

  • I am facing the difficulty for  "enum" was using  as an identifier.

    Hi i am facing a difficulty for Axis dev team are using "enum" as an
    identifier.Actually "enum" as reserved key word.But axis dev team are
    using this as a identifier for packages.
    ie..
    org.apache.axis.enum.Style.RPC ---- here i am getting a compilation error
    under org.apache.axis.enum package you are written 3 classes
    Enum,Scope,Style and Use. I am using these any of the classes i am
    getting compilation syntax error .
    Can you tell me how to resolve these compilation errors ASAP.
    Please help me any one.
    Regards,
    Sankar.
    Edited by: sankaraiah_j2ee on Jan 17, 2008 1:35 AM

    Hi,
    I think this issue is due to the java system environment could not find your fileupload.jar file.This is not an issue of version 1.1 or other?
    I have done this fileupload ,here i can upload file via LAN but i have failed to upload via mobile.
    You copy and paste your two jar files in the required folder then try this jsp code:
    <%@ page import="org.apache.commons.fileupload.*, java.io.*" %>
    <%out.println("success");%>
    If it shows "success" then u get success.
    I think this will help u.
    All the best.
    by
    Sathiya

  • Thoughts on using iTunes to identify voicemail messages?

    iTunes is designated as the default player for MP3 files on my PC, where each of my business line voicemail messages arrives as an attachment to an email.  As a result, whenever I click on such an attachment to listen to it, iTunes "sees" that voicemail messages and lists it in My Music," where it is identified only by the cryptic filename assigned to that MP3 file by the voicemail system's numerical naming convention. For example, one such voicemail has a filename of "77124.mp3", which shows up in "My Music" as "77124". 
    I really needed a way to organize, find, and easily retrieve these voicemail messages anyway, so I'm considering using iTunes to help with this.  I'm thinking I could download a copy of each voicemail attachment after I've listened to it, then use iTunes' existing fields to identify the message as follows:
    song name = actual file name (already populated)
    artist = Name of caller
    album = date of call (yyyymmdd format)
    composer = Name of business matter (could be company name)
    genre = 1voicemail (I created this genre to makes it easier to get to this choice)
    Any thoughts about problems I might run into by pursuing this?
    Any thoughts about different field assignments I might consider that could provide better sorting options?
    Any different suggestions?

    iTunes recognizes Voice Memos as a separate file type. If yours arrive as simple MP3 files you can change that in iTunes.
    Select one or more of these files, right-click, then select Get Info. Select the Options tab, then click on the Media Kind pull down menu and select Voice Memo. The advantage of this is that now you can create a Smart Playlist based on this file format.
    How you use the various tags is entirely up to you. There are many more fields than the once you listed. I would suggest using fields that are not normally used for Music or Videos, just to keep them separate.

  • How to retrieve the Id I used to create the Icloud environment. Each time I use an Apple identifier, I receive a message like it not the one you used at Icloud creation time

    Hi,
    I defined my Icloud environment some time ago. Unfortunatly, I forgot wich Id I used for it. Now I receive a message like "This is a valid Apple Id, but it is not the Id you used to create your Icloud environment.
    So, my question is: where and how can I either replace my Icloud Id or retrieve it ?
    Thank you for your help ...
    Regards
    By the way, you will probably consider that my English is as bad as a computer translation from French. I would thank you for this evaluation !

    Hi Michael,
    Follow the instructions on this link. Be sure to sign out of your old iCloud account on your computer and your devices before setting up you new one. Then sign on the new iCloud account on your PC and your devices once you have set it up using your new AppleID as the iCloud account:
    http://www.apple.com/icloud/setup/pc.html
    Cheers,
    GB

  • Using ioreg to identify a specific CPU

    Hi all,
    I'm trying to repair a PowerMac G5 I got off of eBay. It's a dual 2.0GHz model, I believe 1st generation (PowerPC 970 v2.2 chips). I believe I've narrowed down the problem to a single bad, slowly failing CPU.
    I get the machine to boot up w/two CPUs active only for between a few mins. to an hour or two. Then it freezes up and I have to press the "on" button for the usual 5secs. or so to get it to shutdown.
    When I get the machine back up (sometimes immediately, sometimes after repeated pressing the power button), it generally comes up with only 1 CPU running. with only 1 CPU running, the machine stays up and stable for days at a time.
    I generally have had the machine boot-up maybe 1/3 of the time w/2 CPUs active. The rest of the time only 1 CPU comes up.
    I've confirmed the two different states several ways: (a) looking in Apple System Profiler, (b) System Preferences/Processor (after installing the CHUD tools), and (c) running sysctl -a from the command line and diff-ing the results from each boot-up. All show either 2 CPUs running, or only 1 CPU active.
    Looking in ioreg , specifically the class IOPlatformDevice, in Tiger (10.4.11) I see the property AAPL,phandle which seems to have a value of an address.
    Which property in which class in ioreg contains the actual "location" of each active CPU?
    In the PowerMac G5s (dual models) the CPUs are arranged vertically on the motherboard (when the tower is in the usual upright position). In the PM G4s (dual models) the CPUs are arranged horizontally.
    I'd like to just identify (and replace) the one defective CPU in the G5 rather than both.
    Any tips or links to documentation on ioreg, would be greatly appreciated!
    Ed

    In reading the ADC documentation, I ran across a nice GUI into the ioreg data, IORegistryExplorer in /Developer/Applications (in 10.2.8 Server), or /Developer/Applications/Utilities (in 10.4.11).
    When I follow the chain: Service Plane = IODeviceTree/root/device-tree/cpus
    I see a single entry "PowerPC,G5@0 on the PM G5 and two entries on my dual CPU G4s (PowerPC,G4@0 and PowerPC,G4@1).
    Hence, my question is narrowed to is the "0" CPU the lower or the upper CPU in the PM G5 dual models?
    Ed

  • Trying to Use GREP To Identify Beginning of a Paragraph

    I want to apply a character style to the first sentence in a paragraph. The challenge is these are not always traditional sentences. They can begin with a decimal point or a number. Here are a few examples.
    7.25” diamond accent bracelet. In sterling silver. Reg. $340
    Would want the character style only applied to "7.25” diamond accent bracelet."
    .04 ct. tw. diamond bangle bracelet by Brilliance. In sterling silver. Reg. $720
    Would want the character style only applied to "04 ct. tw. diamond bangle bracelet by Brilliance."
    Diamond accent earrings. In sterling silver. Reg. $120
    Would want the character style only applied to "Diamond accent earrings."
    I've used [\l\u\d\.], but that applies the character style to too much of the text. I've added the ^ to the beginning of the code, but that did not accomplish what I am trying to do, either.
    Thanks in advance for any ideas on this.

    actualy it means find any sequence of characters (.), repeated as many times as posible, but at least one (+?),  that starts at the begining of the paragraph (^), folowed by a dot (\.). the second part is called a positive lookahead, and it means that the expresion you are looking for (^.+?\u) is valid only if the conditon in the lookahead is true: (?= means 'begin positive lookahead', \s\u is the expression to validate (any whitespace followed by a capital letter), and the end of the lookahed )
    Sometimes, to understand regular expressions it is easyer to read them from right to left.
    Some very common and usefull expresion 'parts':
    .+? or .*? -> find the longest seqence of characters;
    .+ or .* -> find the shortest one;
    this is the tutorial i'we used to learn regular expresions:
    http://www.regular-expressions.info/tutorial.html

Maybe you are looking for

  • How do I stop contacts updating across two phones?

    Hi This is my first post, so please treat me gently My partner and me have both just got 3g iphones, we love them but have one slight prob with them. When we connect our phones to our itunes account, contact details from both phones are replaced with

  • ADE 4.0.1 and Windows 8.1

    Is Adobe 4.0.1 compatible with Windows 8.1? The highest Windows-version on the Adobe-website, that I have found for ADE 4.0.1 is: 7. Can't find anything about ADE 4 and W8.1. thx Willem

  • Creation of Chart failed for the Query

    I am trying to run a report in SAP CLM in Reports Section and it shows the following error message as attached. The same query is working fine in Query Definition level. Another report which is a duplicate of the previous report (different Filter) is

  • Pass Input Values to BI Publisher Report Layout from BI Answers Dashboard

    Has anyone been able successfully pass user input values from a BI Answers dashboard prompt into a BI Publisher report? I'm trying add user inputted text (notes, comments) into a report he/she runs. I've been trying with no success. I've matched the

  • What is the problem when the nano changes channels when your on a station or a song

    I can be on a channel and it will change to another channel or even a venue. It stays on one for about 15 seconds then goes wherever it wants???????????????