Reference array in object

Forgive me, I a new to Java. All I am trying to do is have an array dedicated to an object, that is encapsulated inside it. But now I the compiler can't recognize the 'array' array. How do I call the array from a particular object? I tried the object.variable method but it doesn't work - I think I am missing something rather obvious here.
public class testing
     public static void main (String[] args)
          testing obj = new testing();
          printArray(obj);
    public testing()
         int [] array = { 1, 2, 3, 4, 5};
    static void printArray(testing obj)
         for(int i=0; i<array.length; i++)         
                       System.out.println(obj.array);

OK, I modified it so that now it is like this. I had to change the array to be static, though, which might defeat the purpose. Now I get this:
Exception in thread "main" java.lang.NullPointerException
at testing.printArray(testing.java:18)
at testing.main(testing.java:7)
public class testing
     static int [] array;
     public static void main (String[] args)
          testing obj = new testing();
          printArray(obj);                                                 //line 7
     public testing()
          int [] array = { 1, 2, 3, 4, 5};
     static void printArray(testing obj)
          for(int i=0; i<array.length; i++)                           //line 18
          System.out.println(obj.array);

Similar Messages

  • Help making a reference array of objects?

    Problem
    I want to loop through an array of map tile coordinates, place a tile on the stage for each coordinate, and put a reference to each tile instance in a separate multidimensional array called mapRef, where the tile instances can later be referenced by their coordinates in mapRef.
    Is this line (excerpt from the code below)...
    Main.mapRef[i][j] = mapTile;
    ...the way to accomplish my goal?
    Or should I be writing it differently?
    Main.as
    package
        import flash.display.MovieClip;
        import Map;
        public class Main extends MovieClip
            public static var mapRef:Array = new Array;
            public function Main()
                var myMap:Map = new Map();
                addChild(myMap);   
    Map.as
    package
        import flash.display.MovieClip;
        public class Map extends MovieClip
            public function Map()
                var map:Array = [
                    [1,1,1,1,1,1,1,1],
                    [1,0,0,0,0,0,0,1],
                      [1,0,1,0,0,0,0,1],
                    [1,0,0,0,0,1,0,1],
                    [1,0,0,0,0,0,0,1],
                    [1,1,1,1,1,1,1,1]
                var tileW:uint = 50;
                var tileH:uint = 50;
                var mapWidth = map[0].length;
                var mapHeight = map.length;
                for (var i = 0; i < mapHeight; ++i) {
                    for (var j = 0; j < mapWidth; ++j) {
                        var mapTile:Tile = new Tile;
                        addChild(mapTile);
                        mapTile.x = (j*tileW);
                        mapTile.y = (i*tileH);
                        mapTile.gotoAndStop(map[i][j]+1);
                        Main.mapRef[i][j] = mapTile;

    var mapTileObj:Object={};
    for (var i = 0; i < mapHeight; ++i) {
                    for (var j = 0; j < mapWidth; ++j) {
                        var mapTile:Tile = new Tile();
                        addChild(mapTile);
                        mapTile.x = (j*tileW);
                        mapTile.y = (i*tileH);
                        mapTile.gotoAndStop(map[i][j]+1);
    mapTile.ivar=i;
    mapTile.jvar=j;
    mapTileObj[[i,j]]=mapTile;
    you can then retrieve the Tile instance at i,j by using:
    var mapTile:Tile = mapTileObj[[i,j]];
    and you can retrieve the i and j associated with any mapTile instance by using:
    var i:uint=mapTile.ivar;
    var j:uint=maptTile.jvar;

  • Array of Object Refs

    I am doing exercises in a book (a couple books) to learn Java. I am a procedural pgmr and want to learn Java.
    Question 3 in Chapter 4 says:
    Create an array of object references of the class you created in Exercise 2, but don't actually create objects to assign into the array. When you run the program, notice whether the initialization messages from the constructor calls are printed.
    In exercise 2, I created an created an overloaded constructor. There are two constructors one that takes an argument and one that doesn't. I think I understand that I am being asked to look to see the values of the variables before the object is actually created but after initialization.
    My question is that I am not sure I understand what is being asked in question 3. I have to create an array of object references. I understand object references to be the varable names that hole the contents of the object. I don't understand what I am supposed to put into each (the two) elements of the array.
    Here is program written for exercise 2:
    //: c04:J402.java
    /* This has overloaded constructors. However, the argument must be given. Without it, there is an exception at runtime. */
    class Bird {
    Bird() {
    System.out.println("The object is an egg");
    Bird(String age) {
    System.out.println("The object is " + age + " months old");
    public class J402 {
    public static void main(String[] args) {
    String age = args[0];
    new Bird(age);
    } ///:~
    Thank you so much for any help.

    My question is that I am not sure I understand what is
    being asked in question 3. I have to create an array
    of object references. I understand object references
    to be the varable names that hole the contents of the
    object. I don't understand what I am supposed to put
    into each (the two) elements of the array.
    You need to make three different concepts clear to yourself: objects, object references, and reference variables.
    Objects are objects are objects. They are self contained entities that live somewhere in the memory. But, as you can't manipulate the memory directly (there are many good reasons for that), you can't manipulate objects directly.
    To get to objects you need references (or pointers). A reference is like a memory address. It normally points to the memory location of an object, but if the reference can also be a special 'null' reference that doesn't point to any object (or to every possible object, depending on how you want to look at it). The JVM takes care of talking to the underlaying object through the reference.
    An object can have many references pointing to it but a reference can point to only one object (or no / any object in the case of a null reference).
    Reference variables, then, are the ones you have in source code. Here's an example of a reference variable:Bird tweety;
    tweety = new Bird("I thought I saw a pussy cat!");(given a hypotetical class that can take a String object as an argument to the constructor)
    "tweety" is a reference variable. A reference variable is a variable that can hold a reference -- surprise! :). If not set to any particular reference, it's value may be null. If you now do something likeBird bird2 = tweety;
    tweety = new Bird();you first define a new ref. variable "bird2" and set its value to tweety's ref. Then you reset the var. tweety to point to a new Bird object. What happens to bird2? Nothing!! ... but if instead of "tweety = new Bird();" you had written "tweety.setChirp("TWEET!!!");" and then called bird2.chirp(), it would have chirped with "TWEET!!!" because the references of bird2 and tweety point to the same object.
    But, you can have references outside reference variables. In reference arrays (or "object arrays", the terminology can be confusing), for instance. Then, the codeBird[] flock = new Bird[2];0) Creates, allocates and initializes a new reference array object.
    1) Creates a new reference variable called "flock" and assigns it to a reference that points to the object that was created in 0).
    2) Creates 2 more references to Bird objects, initially set to null. No further objects are created. These references can be used like reference variables through flock[0] and flock[1].
    (not necessarily in this order)
    Now this should answer the excersise 3. The references of flock[0] and flock[1] are left as null and they don't point to any objects - They will only if you do something like "flock[0] = new Bird("chirp!");" or "flock[1] = tweety;"

  • How Does On Reference An Array Of Objects?

    Howdy!
    Ive read through Flex 2's help and also through the wonderful
    book 'Developing Rich Clients With Flex' for topics relating to
    this question but very strangely with no luck (and I assume it's
    quite straight forward)! So hopefully you chaps can help...
    Now, to get a value from an object model is very straight
    forward -
    quote:
    <mx:Model id="MyModel">
    <Inbox>
    <Message>
    <Sender>[email protected]</sender>
    <Subject>Blah Blah</Subject>
    <Content>This is the content of the
    email!</Content>
    </Message>
    </Inbox>
    </mx:Model>
    To get the <Sender> value its a simple case of -
    quote:
    MyModel.Inbox.Message.Sender
    Because obviously 'Sender' is just an object. But when I have
    an array of objects like so -
    quote:
    <mx:Model id="MyModel">
    <Inbox>
    <Message>
    <Sender>[email protected]</sender>
    <Subject>Blah Blah</Subject>
    <Content>This is the content of the
    email!</Content>
    </Message>
    <Message>
    <Sender>[email protected]</sender>
    <Subject>Blah Blah</Subject>
    <Content>This is the content of the
    email!</Content>
    </Message>
    </Inbox>
    </mx:Model>
    How do I reference the individual 'Sender' objects?
    Any help would really perk up my day :-)
    Thanks

    Thank you kindly!
    Just one more question (i'd select a different forum but it's
    related to this)...
    How would I loop through e.g.
    MyModel.Inbox.Message.Sender[n], from within a dataProvidor for a
    repeator?
    I'm basically creating a UI which is based on template data
    stored in an external data model which is using nested loops -
    Data Model
    quote:
    <TemplatesConfigurator>
    <Template label="Elite II" table="tbl_Category" id="2"
    description="Elite II So Quote Template 00038_TMP_V9">
    <Category label="Heading - Base System Elite"
    table="tbl_CategorySub" id="1">
    <CategorySub label="Base System" table="tbl_CategorySub"
    id="4">
    <Parts1 label="08639" table="tbl_Template"
    id="1"></Parts1>
    </CategorySub>
    <CategorySub label="Elite II (included in base system)"
    table="tbl_CategorySub" id="5">
    <Parts1 label="05356" table="tbl_Template"
    id="2"></Parts1>
    <Parts1 label="03703" table="tbl_Template"
    id="3"></Parts1>
    <Parts1 label="05904" table="tbl_Template"
    id="4"></Parts1>
    <Parts1 label="06327" table="tbl_Template"
    id="5"></Parts1>
    <Parts1 label="06767" table="tbl_Template"
    id="6"></Parts1>
    </CategorySub>
    </Category>
    <Category label="Heading - Support Contracts &
    Warranty" table="tbl_CategorySub" id="28">
    <CategorySub label="Support Contract Options "
    table="tbl_CategorySub" id="29">
    </CategorySub>
    <CategorySub label="Warranty Options"
    table="tbl_CategorySub" id="30">
    </CategorySub>
    </Category>
    </Template>
    </TemplatesConfigurator>
    Repeaters
    quote:
    <mx:Repeater id="r1"
    dataProvider="{TemplateConfiguratorData.lastResult.TemplatesConfigurator.Template}">
    <mx:Form height="100%" width="100%"
    horizontalScrollPolicy="off" paddingBottom="0" paddingLeft="0"
    paddingRight="0" paddingTop="0" backgroundColor="#ffffff"
    verticalScrollPolicy="auto">
    <mx:Label
    text="{TemplateConfiguratorData.lastResult.TemplatesConfigurator.Template.label}"
    fontWeight="bold" fontSize="13" paddingBottom="0"/>
    <mx:Text
    text="{TemplateConfiguratorData.lastResult.TemplatesConfigurator.Template.description}"
    fontSize="10"/>
    <mx:Repeater id="r2"
    dataProvider="{TemplateConfiguratorData.lastResult.TemplatesConfigurator.Template.Categor y}">
    <mx:Label id="SubHeadings" text="{r2.currentItem.label}"
    fontWeight="bold" fontSize="12"/>
    <mx:Repeater id="r3" dataProvider="{
    TemplateConfiguratorData.lastResult.TemplatesConfigurator.Template.Category[0].CategorySub}">
    <mx:Label text="{r3.currentItem.label}" fontWeight="bold"
    fontSize="10"/>
    </mx:Repeater>
    </mx:Repeater>
    </mx:Form>
    </mx:Repeater>

  • Reference to C# objects in TestStand - how to save and retreive them

    I am new to LabView and TestStand.
    I want to use 2 .NET objects in those applications
    In Labiew, I successfully created the objects, manipulate the functions through VIs and closed the references.
    While I could use the VIs for TestStand, I would rather use the DLL directly.
    I am able to create both objects in a sequence, but I have problems with the following:
      - I don't know how to save the reference to the object after the constructor is run.
        - is the object stored in Globlal variables? I tried 'RunState.Engine' but it does not work
      - I don't know how to get the reference back in the other steps where I want to reuse the object to invoke a method on.
      - Once I can do the above, I need to get it to work in the 'batch' or 'parallel' modes.
         I am using successfully the 'RunState.TestSockets.MyIndex' to select my testing resources,
         but I am still confuse as where the array of objects would be.
         Note that I already set the number of DUT <> 1 and I can create successfully my 2 objects in X instances.
    Thanks,
    Daniel Coupal

    dcoupal,
    Getting the reference to the object involves specifying that as a return value in one of your parameters when you specify the module for that action. Inside of the parameters table you can also save that return value as a local object reference and then use it later on in the sequence.
    Regarding your second question, I'm not sure what the array of objects is that you're referring to but this KB might be of some assistance.
    Message Edited by Jon M on 11-01-2006 12:44 PM
    Test Engineer - CTA

  • Check this out: making a copy of an array of objects

    I have an array of objects called Figs of type Figure and I am making a copy of this array called OriginalFigs so later when Figs change, I can use the original values stored in OriginalFigs.
    But I found out that when values in Figs change, values in OriginalFigs also change.
    I tried to store values in Vector too but even in Vector values are changing.
    seems like they both are storing reference to Figs and when Figs change , they(Vector and OriginalFigs) chnage too.
    Is there any way to come around this problem?
    if u know then plz share with me..........

    Hi,
    how do you copy them - if you use the method from Object(? was it there, never use this), you will get a shallow copy - that is a new object with the same references in it - not a new object with new objects of the figures in it.
    How about providing a methode in your figure-objects which can do a total copy? - This must be easy as so you know how to construct such an object efficiently.
    Another way to hold a copy is to write the figures out to a stream temporarily - all objects are serializable and so they can be stored to a stream - but your figures should not have references to other parts of the program in it, because the serialisation-process tries to serialize all references the object has, that is to be serialized. If there is for exampe a link to the main JFrame in it, the serialisation process tries to store your hole program to the stream and this may be impossible - I hat this with parts of a JTree that refuse to be stored to a stream.
    Hope, this will help
    greetings Marsian

  • How to create an Array of Object

    Is this correct:
    Object[] anArray = new Object[5];
    Thanks.

    Your code will create an array of 5 null references to class Object. After that line you could code:anArray[0] = new Integer(5);- or -
    Object x = anArray[1];but if you code:anArray[3].DoSomething();and have not initialized anArray[3], you will get a NullPointerException.
    Doug

  • Help With Creating Array of Objects

    I made a little test class
    class MyClass
        public int x = 0, y = 0;
    }Then I tried to declare an array.
    MyClass testObjs = new MyClass[10];However, when I tried to assign values using
    testObjs[0].x = 3;I got an error. What's the problem?
    Thanks.

    I'm thinking that you'll get a compile time message even without assigning anything. So what is the actual code and the actual error message?
    In general terms the procedure is:
    (1) Declare a variable of the type "array of MyClass"
    (2) Create (with "new") and assign a reference to an array to the variable - possibly in the same line
    (3) Populate the array - that is create (with "new") references to MyClass objects and assign them to slots in the array
    (4) Do things with the references to MyClass objects that are in the array slots.

  • CASTING AN ARRAY OF OBJECTS

    Hi guys, How I need do to cast an array of objects to a String array??!?!
    I am using
    String array[] = (String[]) getObjects();
    //getObjects() return a Object[]Thanks.
    Giscard

    And what? You get a ClassCastException? If so, you're attempting to change the type of reference that points to the object to a type that isn't the same as the class of the object instance, or a class that the class of the object instance extends, or an interface that the class of the object instance implements.

  • Array of objects in class private data and calling overridden VIs on these objects?

    Hello
    I am developing part of an application using the actor framework and have run into problems.
    I have a several actors and will try briefly describe them and their intended functionality. All actors are started by a Controller actor and in the actor core for the controller I have the possibility to do a lot of intiliazation etc.
    Logger:
    Has a message (Send Log Message) that other actors can use to write to the log. It is supposed to take a string input and a log level (error, warning, debug etc). This message chain sends data to the actor core with a user event.
    The Actor Core of Logger is supposed to save the incoming message to a log, but should be able to do it in several different ways (file, database, email or whatever).
    Logger Output:
    Abstract class that has a dynamic dispatch vi called "Write Output" that all it's children are supposed to overwrite.
    Logger Output File
    Child of Logger Output and overwrites "Write Output" to save the string to a file on disk.
    Problem:
    I want to be able to set up the actor core for Logger once and for all but still be able to create new children of "Logger Output" and have them be handled in the Logger actor core.
    My idea was to have Logger use an array of objects as private data and initialize this array in the Controller actor core.
    In the logger actor core I could then auto index the array and use each element (each Logger Output child) and the abstract "Write Output" vi to get the correct functionality.
    HOWEVER, I cannot get this to work properly and I think I have misunderstood something or stared myself blind on this problem. I have tried 3 different methods when it comes to private data for Logger.
    1. Labview Object
    2. Array of Labview Object
    3. Array of Logger Output Object
    Of these 3 methods, I can only get the first one to work and that doesn't accomplish what I want in the end (being able to add more classes without changing private data / actor core for Logger).
    I have included 3 screenshots that show snippets of 2 of the actor cores and the private data. File names should correspond to my description above.
    The screenshot "Logger actor core.png" shows a very fast test of the 3 different methods I described above. Each of the 3 tunnel inputs to the event structure can be wired to the "Reference" input of "To More Specific Class", but only method 1 (Labview Object) works.
    If you need additional information / screenshots or whatever please ask.
    Thanks in advance
    Attachments:
    Logger ctl.PNG ‏8 KB
    Logger actor core.PNG ‏25 KB
    Controller Actor Core.PNG ‏11 KB

    Thanks for the reply and sorry for the confusing OP. It was meant as a quick test and a way to skip making 10+ screenshots .
    I updated the actor core for the Controller and Logger to be less confusing (hopefully) and attached 2 screenshots.
    I agree with you that it would be a good idea to make a message for the controller that can launch new children of the L" abstract actor, but for these tests I have just launched it the easy way (dragging it to the controller actor core).
    Both Logger Output and Logger Output File are actors and in Logger Output there is a dynamic dispatch vi called Write Output that I want to override in all its children.
    The problem is when I run the actor core of Logger (see the screenshot) only the abstract version (the one in Logger Output) of Write Output is executed, not the overridden version from Logger Output File.
    When I did the same thing with the actor cores looking like the did in my original post, then the correct overridden version got executed when I used the method with one Labview Object in private data (not any array or an array of Logger Output objects).
     EDIT: I just tried to have the Logger private data be a single Logger Output object and writing the Logger Output File to that piece of private data in the Controller and the correct Write Output override method gets called now. So apparently I have done something stupid when it comes to creating the array of Logger Output objects and writing them in the controller? The private data is in the Logger actor so I have simply right clicked and chosen "New VI for Data Member Access" and chosen "Write" for "Element of Array of Logger Output Objects".
    Attachments:
    Controller Actor core updated.PNG ‏10 KB
    Logger actor core updated.PNG ‏24 KB

  • Create static references array

    Hello,
    i have done a labview program which controls six different test machines.
    the different tests are VIs which are kept by the main program in an array of static references. this way i have to write the vi only once. afterwards i create six different references of the same vi, each of them managing one test machine.
    everything is working fine. the only drawback I have found, is how to create the six references of each VI.
    the first thing I tried, was to locate the static reference function inside a loop. I enabled indexing, and i expected to obtain an array of six different references of the same vi. unfortunately this is not working: i obtain an array with six times the same reference.
    to fix this, i located the static reference function inside a switch with six cases. all of this, inside the same loop. i have to use the static reference function six times, one for each test machine. this is working, but is more work. everytime a add a new test vi, I have to add the switch with the six cases. it is a lot of copy & paste work, and errors are likely to be done doing this.
    I would like to know if there is any other (and simpler) way of obtaining this array.
    enclosed you find an example showing this: the upper loop creates an array of six references but all of them are the same. the other one, uses a switch-case so that different references are generated.
    thank you in advance
    Attachments:
    static references array.zip ‏11 KB

    I think you missed the point of what I was getting at. If you create a template VI and programmatically open a reference to it 6 times you will get references to 6 independent instances of the template all running in memory. Nothing needs to get saved to disk. If the template changes simply close the 6 old references and open 6 new ones.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How to initialize the array with object?

    Here is type I have.
    CREATE OR REPLACE TYPE SYSADM.AP_COMMENT_TYPE AS OBJECT
    BU_AP VARCHAR2(5),
    VOUCHER VARCHAR2(10),
    V_LINE INTEGER,
    USERID VARCHAR2(20),
    COMMENT_DTTM DATE,
    COMMENT VARCHAR2(254)
    CREATE OR REPLACE TYPE SYSADM.AP_COMMENT_COLL AS VARRAY(1000) OF SYSADM.AP_COMMENT_TYPE;
    Then I created a procedure to grab some data.
    PROCEDURE get_voucher_comments (
    v_bu_in IN VARCHAR2,
    v_voucher_in IN VARCHAR2,
    v_line_in IN NUMBER,
    v_userid IN VARCHAR2,
    voucher_comment OUT      sysadm.ap_comment_coll
    IS
    i NUMBER := 1;
    v_comments VARCHAR2 (254) := ' ';
    comment_type sysadm.ap_comment_type;
    v_line_num NUMBER := 0;
    CURSOR get_all_comment
    IS
    SELECT voucher_line_num, descr254_mixed
    FROM ps_fas_ap_comment
    WHERE business_unit = voucher_comment (i).bu_ap
    AND voucher_id = voucher_comment (i).voucher;
    CURSOR get_line_comment
    IS
    SELECT descr254_mixed
    FROM ps_fas_ap_comment
    WHERE business_unit = voucher_comment (i).bu_ap
    AND voucher_id = voucher_comment (i).voucher
    AND voucher_line_num = voucher_comment (i).v_line;
    BEGIN
    voucher_comment (1) := ap_comment_type (' ', ' ', 0, ' ', '', ' ');
    --voucher_comment (1) := ap_comment_type (null, null, null, null, null,null);
    IF voucher_comment (i).v_line = 0
    THEN
    OPEN get_all_comment;
    LOOP
    FETCH get_all_comment
    INTO v_line_num, v_comments;
              voucher_comment.EXTEND;
    voucher_comment (i) :=
    ap_comment_type (v_bu_in,
    v_voucher_in,
    v_line_num,
    v_userid,
    TO_DATE (TO_CHAR (SYSDATE,
    'DD-MON-YYYY HH24:MI:SS'
    'DD-MON-YYYY HH24:MI:SS'
    v_comments
    i := i + 1;
    END LOOP;
    ELSE
    OPEN get_line_comment;
    LOOP
    FETCH get_line_comment
    INTO v_comments;
              voucher_comment.EXTEND;
    voucher_comment (i) :=
    ap_comment_type (v_bu_in,
    v_voucher_in,
    v_line_num,
    v_userid,
    TO_DATE (TO_CHAR (SYSDATE,
    'DD-MON-YYYY HH24:MI:SS'
    'DD-MON-YYYY HH24:MI:SS'
    v_comments
    i := i + 1;
    END LOOP;
    END IF;
    END get_voucher_comments;
    But when I tried to test the procedure, got error: ORA-06531: Reference to uninitialized collection. Does anyone have experience of handling array with object?
    declare
    O_voucher_comment SYSADM.AP_COMMENT_COLL;
    begin
    FAS_AP_EXCEPTIONS.GET_VOUCHER_COMMENTS('FCCAN', '20494753', 1, 'KEHE', O_voucher_comment);
    end;

    Thanks for that. I changed it a little bit, but when i ran this script, got ORA-06532: Subscript outside of limit.
    declare
    O_voucher_comment SYSADM.AP_COMMENT_COLL := sysadm.ap_comment_coll(null);
    begin
    FAS_AP_EXCEPTIONS.GET_VOUCHER_COMMENTS('FCCAN', '20494753', 0, 'KEHE', O_voucher_comment);
    end;
    PROCEDURE get_voucher_comments (
    v_bu_in IN VARCHAR2,
    v_voucher_in IN VARCHAR2,
    v_line_in IN NUMBER,
    v_userid IN VARCHAR2,
    voucher_comment OUT      sysadm.ap_comment_coll
    IS
    i NUMBER := 1;
    v_comments VARCHAR2 (254) := ' ';
    comment_type sysadm.ap_comment_type;
    v_line_num NUMBER := 0;
    CURSOR get_all_comment
    IS
    SELECT voucher_line_num, descr254_mixed FROM ps_fas_ap_comment
    WHERE business_unit = v_bu_in AND voucher_id = v_voucher_in;
    CURSOR get_line_comment
    IS
    SELECT descr254_mixed FROM ps_fas_ap_comment
    WHERE business_unit = v_bu_in AND voucher_id = v_voucher_in
    AND voucher_line_num = v_line_in;
    BEGIN
    --voucher_comment() := SYSADM.ap_comment_type (NULL, NULL, NULL, NULL, NULL, NULL);
    --' ', ' ', 0, ' ', '', ' ' sysadm.ap_comment_coll
    voucher_comment := sysadm.ap_comment_coll(null);
    IF v_line_in = 0
    THEN
    OPEN get_all_comment;
    LOOP
    FETCH get_all_comment
    INTO v_line_num, v_comments;
              if i > 1
              then
                   voucher_comment.EXTEND;
              end if;
    voucher_comment (i) := ap_comment_type (v_bu_in,
    v_voucher_in, v_line_num, v_userid,
    TO_DATE (TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS'), 'DD-MON-YYYY HH24:MI:SS'), v_comments );
    i := i + 1;
    END LOOP;
    ELSE
    OPEN get_line_comment;
    LOOP
    FETCH get_line_comment
    INTO v_comments;
              voucher_comment.extend(6);
    voucher_comment (i) := ap_comment_type (v_bu_in, v_voucher_in, v_line_num, v_userid, TO_DATE (TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS' ), 'DD-MON-YYYY HH24:MI:SS'), v_comments);
    i := i + 1;
    END LOOP;
    END IF;
    END get_voucher_comments;

  • Error while activating XI App:  references the inactive object

    Guys,
    I am getting this error when I am activating my XI application .
    <i><b>Activation of the change list canceled Check result for Message Mapping Stockquote_Request_Map_01 | http://sapteched/XI/sessionid_XI251/inb/student_01:  Object Message Mapping Stockquote_Request_Map_01 | http://sapteched/XI/sessionid_XI251/inb/student_01 references the inactive object RFC Message ZGET_STOCKQUOTE | urn:sap-com:document:sap:rfc:functions | ZGET_STOCKQUOTE Check result for Message Mapping Stockquote_Response_Map_01 | http://sapteched/XI/sessionid_XI251/inb/student_01:  Object Message Mapping Stockquote_Response_Map_01 | http://sapteched/XI/sessionid_XI251/inb/student_01 references the inactive object RFC Message ZGET_STOCKQUOTE | urn:sap-com:document:sap:rfc:functions | ZGET_STOCKQUOTE.Response</b></i>

    Hi Manish,
    Make sure you have saved and activated all your dependent objects. If you have imported RFC structure then check
    for e.g. ZGET_STOCKQUOTE is your imported RFC structure then make sure its saved and activated.
    Then try activating your message mapping.
    Regards,
    Sridhar

  • Displaying the contents of an array of objects

    Hello All,
    My Java teacher gave us a challenge and I'm stumped. The teacher wants us to display the contents of the array in the main menthod. The original code is as follows:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
    }I understand that the elements of the array are objects, and each one has a value assigned to it. The following code was my first attempt at a solution:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
                                    for ( int i = 0; i < thingArray.length; i++)
                                       System.out.println( thingArray );                         
    }To which I'm given what amounts to garbage output. I learned from reading about that output that its basically displaying the memory location of the array, and the the contents of the array. There was mention of overriding or bypassing a method in System.out.println, but I don't believe that we're that far advanced yet. Any thoughts? I know I have to get at the data fields in the objects of the array, but i'm not having an easy time figuring it out. Thanks very much in advance!

    robrom78 wrote:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
    for ( int i = 0; i < thingArray.length; i++)
    System.out.println( thingArray );                         
    Note that you're trying to print the entire array at every loop iteration. That's probably not what you meant to do.
    You probably meant to do something more like
                                 System.out.println( thingArray[i] );Also, note that the java.util.Arrays class has a toString method that might be useful.
    To which I'm given what amounts to garbage output. It's not garbage. It's the default output to toString() for arrays, which is in fact the toString() defined for java.lang.Object (and inherited by arrays).
    I learned from reading about that output that its basically displaying the memory location of the array, and the the contents of the array.It displays a default result that is vaguely related to the memory, but probably shouldn't be thought of us such. Think of it as identifying the type of object, and a value that differentiates it from other objects of the same type.
    By the way I assume you mean "+not+ the contents of the array" above. If so, that is correct.
    There was mention of overriding or bypassing a method in System.out.println, but I don't believe that we're that far advanced yet. Any thoughts? No, you don't override a method in println; actually methods don't contain other methods directly. You probably do need to override toString in Thing.
    I know I have to get at the data fields in the objects of the array, but i'm not having an easy time figuring it out. You can get to the individual objects in the array just by dereferencing it, as I showed you above.
    But I suspect that won't be sufficient. Most likely, Thing doesn't have a toString method defined. This means that you'll end up with very similar output, but it will say "Thing" instead of "[Thing" and the numbers to the right of the "@" will be different.
    You'll need to override the toString() method in Thing to get the output you want.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How can i reference a MIME object within a correspondence format through...

    how can i reference a MIME object within a correspondence format through TX oofo or se71?
    Hi, I need to put a MIME object within a correspondence's format that i've already done through Tx oofo. My problem is, that i don't know exactly how can i make the reference of that MIME object in the format? and What structure type do i have to use in order to make appear the MIME object in my correspondence's format? Does anybody can help me with this?   
    Regards    Hector

    Frank,
    I tried to find some examples/samples on how to create CollectionModel for a table component but not successful.
    Can you clarify the following ?
    1. "CollectionModel" is referenced only by af:table attributes "value", "selectedRowKeys" and "selectionListener".
    The rest of af:table attributes such as "rows", "fetchSize" used to reference the iterator binding in the binding container via the EL expression "#{bindings.VOIteratorBinding.xxx} .
    What should I replace that EL expression with?
    2. I heck out the bean method to create the CollectionModel as following, is it close to what you mean?
    public void initBusinessDataDashboardView() {
    OperationBinding operation = BeanUtils.getOperationBinding("getPanelBusinessData");
    Map params = operation.getParamsMap();
    Key panelKey = getPanelInfoView().getKey();
    params.put("panelKey", panelKey);
    params.put("maximizedView", false);
    panelView = (ViewObject)operation.execute();
    // Heck code to create CollectionModel
    RowSet rowSet = panelView.getRowSet();
    ArrayList rowList = new ArrayList();
    while (rowSet.hasNext()) {
    rowList.add(rowSet.next());
    model = new ChildPropertyTreeModel(rowList, null);
    // To be used to set up af:table value, selectRowKeys, selectionListener via EL expr #{backingBeanScope.MyBean.model.xxx}
    public CollectionModel getModel() {
    return model;
    Am I on the right track?
    Edited by: Pricilla on May 4, 2010 2:20 PM

Maybe you are looking for