Problem with local class, static private attribute and public method

Hello SDN,
Consider the following situation:
1) I have defined a LOCAL class airplane.
2) This class has a private static attribute "type table of ref to" airplane (array of airplanes)
3) A public method should return the private static table attribute
Problems:
a) The table cannot be given as an EXPORTING parameter in the method because TYPE TABLE OF... is not supported and I get syntax errors. I also cannot define a dictionary table type because it is a local class.
b) The table cannot be given as a TABLES parameter in the method because TABLES is not supported in the OO context.
c) The table cannot be given as an EXPORTING parameter in the method defined as LIKE myStaticAttribute because my method is PUBLIC and my attribute is PRIVATE. ABAP syntax requires that all PUBLIC statements are defined before PRIVATE ones, therefore it cannot find the attribute to reference to with LIKE.
I see only 2 solutions:
a) Never ever use local classes and always use global classes so that I might define a dictionary table type of my class which I can then use in my class.
b) Make the attribute public, but this goes against OO principles, and isn't really an option.
Am I missing anything here, or is this simply overlooked so far?

Hello Niels
Since your class is local and, thus, only know to the "surrounding" application is does not really make sense to make it public to any other application.
However, if you require to store instances of your local classes in internal tables simply use the most generic reference type possible, i.e. <b>OBJECT</b>.
The following sample report shows how to do that. Furthermore, I believe it also shows that there are <u><b>no </b></u>serious inconsistency in the ABAP language.
*& Report  ZUS_SDN_LOCAL_CLASS
REPORT  zus_sdn_local_class.
" NOTE: SWF_UTL_OBJECT_TAB is a table type having reference type OBJECT
*       CLASS lcl_airplane DEFINITION
CLASS lcl_airplane DEFINITION.
  PUBLIC SECTION.
    DATA:    md_counter(3)             TYPE n.
    METHODS: constructor,
             get_instances
               RETURNING
                 value(rt_instances)   TYPE swf_utl_object_tab.
  PRIVATE SECTION.
    CLASS-DATA: mt_instances    TYPE swf_utl_object_tab.
ENDCLASS.                    "lcl_airplane DEFINITION
*       CLASS lcl_airplane IMPLEMENTATION
CLASS lcl_airplane IMPLEMENTATION.
  METHOD constructor.
    APPEND me TO mt_instances.
    DESCRIBE TABLE mt_instances.
    md_counter = syst-tfill.
  ENDMETHOD.                    "constructor
  METHOD get_instances.
    rt_instances = mt_instances.
  ENDMETHOD.                    "get_instance
ENDCLASS.                    "lcl_airplane IMPLEMENTATION
DATA:
  gt_instances      TYPE swf_utl_object_tab,
  go_object         TYPE REF TO object,
  go_airplane       TYPE REF TO lcl_airplane.
START-OF-SELECTION.
  " Create a few airplane instance
  DO 5 TIMES.
    CREATE OBJECT go_airplane.
  ENDDO.
  gt_instances = go_airplane->get_instances( ).
  CLEAR: go_airplane.
  LOOP AT gt_instances INTO go_object.
    go_airplane ?= go_object.
    WRITE: / 'Airplane =', go_airplane->md_counter.
  ENDLOOP.
END-OF-SELECTION.
Regards
  Uwe<u></u>

Similar Messages

  • *Very challenging problem with Firefox involving 'table-layout' attribute and cell padding

    I've been trying to figure this out for days and I just feel
    like my head is going to explode. I don't even think words could
    describe the relief if someone could solve this problem for me.
    I described the problem here to make things easier:
    http://morthian.googlepages.com/Untitled-2.html

    .oO(AngryCloud)
    >I came up with a solution. If I use a div inside of the
    cells instead of
    >assigning them a class, the problem goes away.
    This doesn't sound right. You should put the page up again,
    describe
    what you're trying to do and what the problem is in more
    detail.
    >This is going to take me hours
    >to monotonous work, but I will do what I have to do.
    Search & replace comes to mind, but this shouldn't be
    necessary at all.
    A 'div' inside a table cell just for the sake of "fixing"
    some obscure
    problem is not really a solution, as it doesn't really fix
    anything.
    Micha

  • Configuration of Cisco WLC 2504 with Local LAN static IP and DHCP

    I want to configure Cisco WLC 2504 with Local LAN static IP and WLC 2504 with DHCP so that APs can be connect with controller.
    Currently i am using WLC 2504 with DHCP so can anyone suggest how to do that..

    Hi Sandeep
    The info is correct, if we're using code below 7.3.101.0.
    This issue is fixed via the below bug id.
    CSCto01390 Unable to ping AP's directly connected to a 2500 controller
    check the fix that is updated on 7.4, 7.5 RNE.
    http://www.cisco.com/en/US/docs/wireless/controller/release/notes/crn75.html
    Note
    Directly connected APs are supported only in Local mode.
    http://www.cisco.com/en/US/prod/collateral/wireless/ps6302/ps8322/ps11630/data_sheet_c78-645111.html
    For quick and easy deployment Access Points can be connected directly to 2504 Wireless LAN Controller via two PoE (Power over Ethernet) ports
    Thanks
    Saravanan

  • Problems with inner classes in JasminXT

    I hava problems with inner classes in JasminXT.
    I wrote:
    ;This is outer class
    .source Outer.j
    .class Outer
    .super SomeSuperClass
    .method public createrInnerClass()V
         .limit stack 10
         .limit locals 10
         ;create a Inner object
         new Outer$Inner
         dup
         invokenonvirtual Outer$Inner/<init>(LOuter;)V
         ;test function must print a Outer class name
         invokevirtual Outer$Inner/testFunction ()V
    .end method
    ;This is inner class
    .source Outer$Inner.j
    .class Outer$Inner
    .super java/lang/Object
    .field final this$0 LOuter;
    ;contructor
    .method pubilc <init>(LOuter;)V
         .limit stack 10
         .limit locals 10
         aload_0
         invokenonvirtual Object/<init>()V
         aload_0
         aload_1
         putfield Inner$Outer/this$0 LOuter;
         return
    .end method
    ;test
    .method public testFunction ()V
         .limit stack 10
         .limit locals 10
         ;get out object
         getstatic java/io/PrintStream/out  java/io/PrintStream;
         aload_0
         invokevirtual java/lang/Object/getClass()java/lang/Class;
         ;now in stack Outer$Inner class
         invokevirtual java/Class/getDeclaringClass()java/lang/Class;
         ;but now in stack null
         invokevirtual java/io/PrintStream/print (Ljava/lang/Object;)V
    .end methodI used dejasmin. Code was equal.
    What I have to do? Why getDeclatingClass () returns null, but in dejasmin code
    it returns Outer class?

    Outer$Inner naming convention is not used by JVM to get declaring class.
    You need to have proper InnerClasses attribute (refer to http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#79996)
    in the generated classes. Did you check using jclasslib or another class file viewer and verified that your .class files have proper InnerClasses attribute?

  • Button in Bex Analyser 7.0 - problem with setting up Static Parameters

    Hello,
    I know a similar problem has been discussed here already, but I am still having problems with setting up Static Parameters of my Button in BEx Analyser 7.0, so that I can pass Variable values from that button to my query.
    This is what I do - in Static Parameters of my Button I set the following values:
    Name                          Index          Value
    DATA_PROVIDER        0               DP_1
    CMD                             0               PROCESS_VARIABLES
    SUBCMD                      0               VAR_SUBMIT
    VAR_NAME                 0               0RMA_FIP
    VAR_VALUE               0               004/2010
    As a result, I would like the value 004/2010 to be passed to variable 0RMA_FIP (which is mandatory) and the query to be executed with that value. For some reason, however, the value is not passed correctly, and instead the variable is filled with a blank or not filled at all, and I am getting a message "Specifiy value for variable Fiscal year/period". What do I do wrong?
    Just to give you a broader picture - I would like to later use this logic to pass more than one variables into a query, including a hierarchy node, and read the values from an Excel worksheet - however, after many attempts to do so, I started playing with just one variable to figure out what the problem was.
    I have already seen the following two threads and SAP notes on passing variable values from the button:
    Re: Button in BEx Analyzer 7.0
    Re: How to set variables values via VBA.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be?quicklink=index&overridelayout=true
    Can anyone please advise?
    Cheers,
    AL

    I managed to figure it out myself!
    Instead of VAR_VALUE I need to enter VAR_VALUE_EXT, and it works fine.
    I will mark this thread as "answered".

  • Problem with local editing after update to SP13

    Hallo,
    we have updated our Enterprise Portla 7.00 to SP13. Now many user have Problem with local editing. The error message is "The download of the document fail".
    I know that every PC needs the "Docservice" Active X component installed. The "Docservice" is also installed.
    At my PC theres only this problem with "html" documents.
    What could be the problem. ?
    Please help.
    Many thanks
    Ronald

    We found that there is a problem with the Docservice Active X Component.
    If we work in a deeper folder there is a problem with the length of the url. I changed the TEMP Setting
    "Setting a different TEMP directory:                                     
    In cases that it is problematic to use the standard %TEMP% directory,   
    setting the environment variable SAPKM_USER_TEMP pinpointing to a       
    corresponding directory path (e.g.                                      
    X:\SHARES\USERS\xxx\CheckedOutDocuments) will be also supported. If the 
    access to that directory fails the standard %TEMP% directory will be    
    used as fallback."
    I used "C:\TEMP" and now it works.......  but this cant be the solution....
    thans Ronald

  • Problem with Local DCs View in NWDS 7.0

    Hi!
    I' ve got a problem with Local DCs view in NWDS: None of the standard-DCs (BI_MMR, BI_UDI, CAF a.s.o.) can be expanded and show their content. I already reinstalled IDE, but without success.
    Has anybody got an idea?
    Thanks a lot in advance!
    Regards,
    Thomas

    Hi,
    This is due to some files missed in Local development.
    Let me know Are you able to see <b>.confdef, .syncdb</b> and <b>buildvariant.config </b> files under Local Developement.
    If you are not able to see, UnInstall your NWDS, Remove Local developement under .dtc folder, then Re-Install NWDS.
    Hope this will help you.
    Thanks & Regards
    Vasundhara

  • Problem with Local DCs View in NWDS

    Hi!
    I' ve got a problem with Local DCs view in NWDS: None of the standard-DCs (BI_MMR, BI_UDI, CAF a.s.o.) can be expanded and show their content. I already reinstalled IDE, but without success.
    Has anybody got an idea?
    Thanks a lot in advance!
    Regards,
    Thomas

    Your setup might be incomplete: The SAR file extraction creates very long paths on your filesystem. If you do not extract to the rootfolder of disk, chances are the paths become too long and the installation exits, without any warning.
    If this is not the cause of your problem, check if the .dcdef files for the local DCs (plugin com.sap.tc.ap if I'm correct) were copied during installation.

  • Getting problem with DOMImplementation classes method getFeature() method

    hi
    getting problem with DOMImplementation classes method getFeature() method
    Error is cannot find symbol getFeature()
    code snippet is like...
    private void saveXml(Document document, String path) throws IOException {
    DOMImplementation implementation = document.getImplementation();
    DOMImplementationLS implementationLS = (DOMImplementationLS) (implementation.getFeature("LS", "3.0"));
    LSSerializer serializer = implementationLS.createLSSerializer();
    LSOutput output = implementationLS.createLSOutput();
    FileOutputStream stream = new FileOutputStream(path);
    output.setByteStream(stream);
    serializer.write(document, output);
    stream.close();
    problem with getFeature() method

    You are probably using an implementation of DOM which does not implement DOM level-3.

  • Private attributes and Inheritance.

    I have a question regarding 'private attributes and inheritance'.
    If I have a class that will be extended by other classes,(basically
    this will act as a BASE class ),then why do I need to define
    any attribute private to this base class.?
    If I define an attribute as private in the base class,then the subclass cannot access
    this attribute.Right?
    1) Why define a private attribute in the base class ?
    2) When can a situation arise whereby the base class attribute is defined
    as 'private' and the base class is also extensible?

    If I define an attribute as private in the base
    class,then the subclass cannot access
    this attribute.Right?Right. A simple example would tell you this.
    >
    1) Why define a private attribute in the base class?Because information hiding and encapsulation are always good things, even between super and sub classes.
    >
    2) When can a situation arise whereby the base class attribute is defined
    as 'private' and the base class is also extensible?This question makes no sense whatsoever. A base class is extensible, unless it is marked as final, whether or not it's got private data members.
    Objects usually have private state and public interfaces. The idea is that clients of a class, even subclasses, should only access the private state thorugh the public interface. So if you've designed your classes properly you shouldn't need to access that private state.
    If you do, you can always provide get/set methods.
    OR declare the data members as protected. That way they're package visible and available to subclasses.
    But private members do not make a class inextensible.
    %

  • Hey Guys i have a problem with my mac since last month and it wont boot up it freezes in a grey apple logo and and spinning gear any body know how to fix this?

    Hey Guys i have a problem with my mac since last month and it wont boot up it freezes in a grey apple logo and and spinning gear any body know how to fix this?

    Take each of these steps that you haven't already tried. Stop when the problem is resolved.
    Step 1
    The first step in dealing with a boot failure is to secure your data. If you want to preserve the contents of the startup drive, and you don't already have at least one current backup, you must try to back up now, before you do anything else. It may or may not be possible. If you don't care about the data that has changed since your last backup, you can skip this step.
    There are several ways to back up a Mac that is unable to boot. You need an external hard drive to hold the backup data.
    a. Boot into Recovery by holding down the key combination command-R at the startup chime, or from a local Time Machine backup volume (option key at startup.) Release the keys when you see a gray screen with a spinning dial. When the OS X Utilities screen appears, launch Disk Utility and follow the instructions in the support article linked below, under “Instructions for backing up to an external hard disk via Disk Utility.”
    How to back up and restore your files
    b. If you have access to a working Mac, and both it and the non-working Mac have FireWire or Thunderbolt ports, boot the non-working Mac in target disk mode by holding down the key combination command-T at the startup chime. Connect the two Macs with a FireWire or Thunderbolt cable. The internal drive of the machine running in target mode will mount as an external drive on the other machine. Copy the data to another drive. This technique won't work with USB, Ethernet, Wi-Fi, or Bluetooth.
    How to use and troubleshoot FireWire target disk mode
    c. If the internal drive of the non-working Mac is user-replaceable, remove it and mount it in an external enclosure or drive dock. Use another Mac to copy the data.
    Step 2
    Press and hold the power button until the power shuts off. Disconnect all wired peripherals except those needed to boot, and remove all aftermarket expansion cards. Use a different keyboard and/or mouse, if those devices are wired. If you can boot now, one of the devices you disconnected, or a combination of them, is causing the problem. Finding out which one is a process of elimination.
    Before reconnecting an external storage device, make sure that your internal boot volume is selected in the Startup Disk pane of System Preferences.
    Step 3
    Boot in safe mode.* The instructions provided by Apple are as follows:
    Shut down your computer, wait 30 seconds, and then hold down the shift key while pressing the power button.
    When you see the gray Apple logo, release the shift key.
    If you are prompted to log in, type your password, and then hold down the shift key again as you click Log in.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    *Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t boot in safe mode. Post for further instructions.
    When you boot in safe mode, it's normal to see a dark gray progress bar on a light gray background. If the progress bar gets stuck for more than a few minutes, or if the system shuts down automatically while the progress bar is displayed, your boot volume is damaged and the drive is probably malfunctioning. In that case, go to step 5.
    If you can boot and log in now, empty the Trash, and then open the Finder Info window on your boot volume ("Macintosh HD," unless you gave it a different name.) Check that you have at least 9 GB of available space, as shown in the window. If you don't, copy as many files as necessary to another volume (not another folder on the same volume) and delete the originals. Deletion isn't complete until you empty the Trash again. Do this until the available space is more than 9 GB. Then reboot as usual (i.e., not in safe mode.)
    If the boot process hangs again, the problem is likely caused by a third-party system modification that you installed. Post for further instructions.
    Step 4
    Sometimes a boot failure can be resolved by resetting the NVRAM.
    Step 5
    Launch Disk Utility in Recovery mode (see above for instructions.) Select your startup volume, then run Repair Disk. If any problems are found, repeat until clear. If Disk Utility reports that the volume can't be repaired, the drive has malfunctioned and should be replaced. You might choose to tolerate one such malfunction in the life of the drive. In that case, erase the volume and restore from a backup. If the same thing ever happens again, replace the drive immediately.
    This is one of the rare situations in which you should also run Repair Permissions, ignoring the false warnings it produces. Look for the line "Permissions repaired successfully" at the end of the output. Then reboot as usual.
    Step 6
    Boot into Recovery again. When the OS X Utilities screen appears, follow the prompts to reinstall the OS. If your Mac was upgraded from an older version of OS X, you’ll need the Apple ID and password you used to upgrade.
    Note: You need an always-on Ethernet or Wi-Fi connection to the Internet to use Recovery. It won’t work with USB or PPPoE modems, or with proxy servers, or with networks that require a certificate for authentication.
    Step 7
    Repeat step 6, but this time erase the boot volume in Disk Utility before installing. The system should automatically reboot into the Setup Assistant. Follow the prompts to transfer your data from a backup.
    Step 8
    If you get this far, you're probably dealing with a hardware fault. Make a "Genius" appointment at an Apple Store to have the machine tested.

  • Problems with Mac OSX 10.5.2 and installing my pro tools le 7.1.1

    Problems with Mac OSX 10.5.2 and installing my pro tools le 7.1.1.
    My garage band & reason software don´t open anymore giving me a error messasge regarding the midi drivers in the operating system.
    Please help!!!
    Thanks,
    Paolo

    Somewhere at either Macworld or here I learned that DVDSP 2, DVDSP 3 and now DVDSP 4 "internally" are major re-writes.
    Support for HD among a few other items along with QT 7 which comes with Tiger means sincerely that one set of applications/OS is not going to be stable.
    Personally I think of all the issues possible its DVDSP vs QT.
    Unless you move to DVDSP v4 the alternative is to wipe the disk and go back to Jaguar (10.2) or perhaps Panther but avoid upgrading QT beyond 6. I advocate wiping the disk because I'n not sure an archive and install to down shift to an earlier version of the OS is possible. If it is I'd still worry about mis-matched files in all sorts of locations.

  • TS3694 good evening i have an problem with my iphone 4 the wif and network cant on now if i tray is showing iTunes i tray to reload the ios is showing an error -1 can you help me

    good evening i have an problem with my iphone 4 the wif and network cant on now if i tray is showing iTunes i tray to reload the ios is showing an error -1 can you help me

    No problem, glad to help!
    Update: my PC USB hub was connected to a USB 3 port, I connected the 30 pin cable directly to my PC, And the restore worked just fine. Restored phone from iCloud backup and seems to be working fine.

  • Can't download anything from app store or itunes. everytime i try to install an app i get "there is abilling problem with a previous purchase. please update ur payment method". i have recently changed my address and visa debit card. please help

    can't download anything from app store or itunes. everytime i try to install an app i get this error "there is a billing problem with a previous purchase. please update ur payment method". i have recently changed my visa debit card and home adress and when i make these changes i still get the same error.
    will u please help me out?

    Are you listing the billing address for the card correctly? The address in the iTunes/MAS account must match the address on your bill exactly.

  • Hi I've a big problem with adobe acrobat reader XI pro and I hope you can help me. The problem is; when I past copied text from some pdf books (not all of them) it past symbols only! wherever I past it! and even if I coped that text from another pdf reade

    Hi
    I've a big problem with adobe acrobat reader XI pro and I hope you can help me.
    The problem is; when I past copied text from some pdf books (not all of them) it past symbols only! wherever I past it! and even if I coped that text from another pdf reader (adobe pdf reader, internet browsers, ...etc.).
    This problem started to happen since yesterday when I installed adobe acrobat reader XI pro to try it before I buy it, and before that when I was using the free adobe pdf reader I was totally able to copy any text from any pdf and past it anywhere with nothing wrong.
    What can I do?
    thank you a lot.

    There is no product called Adobe Acrobat Reader Pro. There is
    - Adobe Acrobat Pro ($$)
    - Adobe Reader (free)
    Which do you have? And are you a programmer?

Maybe you are looking for

  • This html code only plays midi file in IE, not Safari - why?

    <html> <title>New York</title> <bgsound src="http://home.earthlink.net/~maugustine2/daydream/bachair.mid" loop="0"> <body bgcolor="#CCCC98"> </html> With this code, the midi file: bachair.mid will only play with IE 5.2/mac, not Safari 2.0.1 / 10.4.2

  • How can I add new sites to the "Most Visited"-Latest Headlines baqr?

    In Windows XP I had a bar in Firefox where I could add frequently accessed sites such as news websites and brokerages. == I got a new computer with Windows 7.

  • Bind and form reset

    I've got a set of radio buttons bound to a cfdiv. None of them are initially selected. As expected, once you click one, the cfdiv shows the value of the radio button that was selected. The problem is if I reset the form that contains the radio button

  • Missing CONFIG_B43_BCMA_EXTRA option in kernel config

    I am running a BCM43224 wireless card on and need to recompile the kernel to make use of the card.  According to the wiki, I need to ' recompile the kernel with the CONFIG_B43_BCMA_EXTRA option set to use b43.'  However, after following the wiki inst

  • Purchasing Aperture 2 Question

    Hi, my 30 day free trial for Aperture 2 has run out and I would like to purchase the full version. When I go to Apple.com and order Aperture 2 will I receive a serial number right away or will they ship me out a boxed version which will then have to