Is it possible to pass a "reference to a method" as an argument to a method

Hi all.
I really am looking for a way to do this.
(I may justify my need, but if the answer is "no", I may have to rethink my strategy ..)
Hope to get a boolean answer to my question soon .. :-)
Regards
Ajay Garg

Java is pass by value, ALWAYS.
In languages that do support function pointers (a.k.a. "closures" to use the object oriented euphemism) the mechanism leads to no end of trouble as it's constantly and massively abused.
What you want instead is something like a Strategy or Template Method pattern.

Similar Messages

  • Passing self reference to a method call.

    I have classes 'A' & 'B'.
    A's method 'M1' calls a B's method 'M2'which takes object of type 'A' as an argument.
    Is it possible to use 'this' keyword or do I need to use Class.forName('A')
    If not, is there a better way to accomplish the same.
    Ex:
    public class A
    public M1()
    //calls a method M2 on B that takes object of type 'A' as argument
    B b = new B().M2(this);
    }//end of class
    public class B
    public Object M2(A a)
    }//end of class B
    Thanks in advance.

    Class.forName("A") returns an object of type Class, not an object of type A. So it won't work. this would work.

  • Pass by reference and String

    public class Test {
        static void method(String str) {
            str = "String Changed";
        public static void main(String[] args) {
            String str = new String("My String");
            System.out.println(str);
            method(str);
            System.out.println(str);
    }The output is
    My String
    My String
    How this is possible when objects are passed by reference ?

    > How this is possible when objects are passed by reference ?
    All parameters to methods are passed "by value." In other words, values of parameter variables in a method are copies of the values the invoker specified as arguments. If you pass a double to a method, its parameter is a copy of whatever value was being passed as an argument, and the method can change its parameter's value without affecting values in the code that invoked the method. For example:
    class PassByValue {
        public static void main(String[] args) {
            double one = 1.0;
            System.out.println("before: one = " + one);
            halveIt(one);
            System.out.println("after: one = " + one);
        public static void halveIt(double arg) {
            arg /= 2.0;     // divide arg by two
            System.out.println("halved: arg = " + arg);
    }The following output illustrates that the value of arg inside halveIt is divided by two without affecting the value of the variable one in main:before: one = 1.0
    halved: arg = 0.5
    after: one = 1.0You should note that when the parameter is an object reference, the object reference -- not the object itself -- is what is passed "by value." Thus, you can change which object a parameter refers to inside the method without affecting the reference that was passed. But if you change any fields of the object or invoke methods that change the object's state, the object is changed for every part of the program that holds a reference to it. Here is an example to show the distinction:
    class PassRef {
        public static void main(String[] args) {
            Body sirius = new Body("Sirius", null);
            System.out.println("before: " + sirius);
            commonName(sirius);
            System.out.println("after:  " + sirius);
        public static void commonName(Body bodyRef) {
            bodyRef.name = "Dog Star";
            bodyRef = null;
    }This program produces the following output: before: 0 (Sirius)
    after:  0 (Dog Star)Notice that the contents of the object have been modified with a name change, while the variable sirius still refers to the Body object even though the method commonName changed the value of its bodyRef parameter variable to null. This requires some explanation.
    The following diagram shows the state of the variables just after main invokes commonName:
    main()            |              |
        sirius------->| idNum: 0     |
                      | name --------+------>"Sirius"       
    commonName()----->| orbits: null |
        bodyRef       |______________|At this point, the two variables sirius (in main) and bodyRef (in commonName) both refer to the same underlying object. When commonName changes the field bodyRef.name, the name is changed in the underlying object that the two variables share. When commonName changes the value of bodyRef to null, only the value of the bodyRef variable is changed; the value of sirius remains unchanged because the parameter bodyRef is a pass-by-value copy of sirius. Inside the method commonName, all you are changing is the value in the parameter variable bodyRef, just as all you changed in halveIt was the value in the parameter variable arg. If changing bodyRef affected the value of sirius in main, the "after" line would say "null". However, the variable bodyRef in commonName and the variable sirius in main both refer to the same underlying object, so the change made inside commonName is visible through the reference sirius.
    Some people will say incorrectly that objects are passed "by reference." In programming language design, the term pass by reference properly means that when an argument is passed to a function, the invoked function gets a reference to the original value, not a copy of its value. If the function modifies its parameter, the value in the calling code will be changed because the argument and parameter use the same slot in memory. If the Java programming language actually had pass-by-reference parameters, there would be a way to declare halveIt so that the preceding code would modify the value of one, or so that commonName could change the variable sirius to null. This is not possible. The Java programming language does not pass objects by reference; it passes object references by value. Because two copies of the same reference refer to the same actual object, changes made through one reference variable are visible through the other. There is exactly one parameter passing mode -- pass by value -- and that helps keep things simple.
    -- Arnold, K., Gosling J., Holmes D. (2006). The Java� Programming Language Fourth Edition. Boston: Addison-Wesley.
    ~

  • Calrification on Pass by reference

    Hi All,
    In java, if we are passing an object to a function actually we are passing the reference. So, if the function is doing any manipulation on the Object reference, it will affect the passing object.
    For example,
    class Ob1
         int i=0;
    public class Ref
         public static void main(String a[])
              Ob1 o=new Ob1();
              System.out.println("Before calling :"+o.i);
              call(o);
              System.out.println("After calling :"+o.i);
         static void call(Ob1 o)
              o.i++;
    Is it possible to get the original value of i(object Ob1) after calling call()?
    Thanks in advance
    +Sha                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    > In java, if we are passing an object to a function
    actually we are[b] passing the reference.
    By value.
    Is it possible to get the original value of i(object
    Ob1) after calling call()?
    Store the original value in a local variable.
    And please note the following:
    All parameters to methods are passed "by value." In other words, values of parameter variables in a method are copies of the values the invoker specified as arguments. If you pass a double to a method, its parameter is a copy of whatever value was being passed as an argument, and the method can change its parameter's value without affecting values in the code that invoked the method. For example:
    class PassByValue {
        public static void main(String[] args) {
            double one = 1.0;
            System.out.println("before: one = " + one);
            halveIt(one);
            System.out.println("after: one = " + one);
        public static void halveIt(double arg) {
            arg /= 2.0;     // divide arg by two
            System.out.println("halved: arg = " + arg);
    }The following output illustrates that the value of arg inside halveIt is divided by two without affecting the value of the variable one in main:before: one = 1.0
    halved: arg = 0.5
    after: one = 1.0You should note that when the parameter is an object reference, the object reference -- not the object itself -- is what is passed "by value." Thus, you can change which object a parameter refers to inside the method without affecting the reference that was passed. But if you change any fields of the object or invoke methods that change the object's state, the object is changed for every part of the program that holds a reference to it. Here is an example to show the distinction:
    class PassRef {
        public static void main(String[] args) {
            Body sirius = new Body("Sirius", null);
            System.out.println("before: " + sirius);
            commonName(sirius);
            System.out.println("after:  " + sirius);
        public static void commonName(Body bodyRef) {
            bodyRef.name = "Dog Star";
            bodyRef = null;
    }This program produces the following output: before: 0 (Sirius)
    after:  0 (Dog Star)Notice that the contents of the object have been modified with a name change, while the variable sirius still refers to the Body object even though the method commonName changed the value of its bodyRef parameter variable to null. This requires some explanation.
    The following diagram shows the state of the variables just after main invokes commonName:
    main()            |              |
        sirius------->| idNum: 0     |
                      | name --------+------>"Sirius"       
    commonName()----->| orbits: null |
        bodyRef       |______________|At this point, the two variables sirius (in main) and bodyRef (in commonName) both refer to the same underlying object. When commonName changes the field bodyRef.name, the name is changed in the underlying object that the two variables share. When commonName changes the value of bodyRef to null, only the value of the bodyRef variable is changed; the value of sirius remains unchanged because the parameter bodyRef is a pass-by-value copy of sirius. Inside the method commonName, all you are changing is the value in the parameter variable bodyRef, just as all you changed in halveIt was the value in the parameter variable arg. If changing bodyRef affected the value of sirius in main, the "after" line would say "null". However, the variable bodyRef in commonName and the variable sirius in main both refer to the same underlying object, so the change made inside commonName is visible through the reference sirius.
    Some people will say incorrectly that objects are passed "by reference." In programming language design, the term pass by reference properly means that when an argument is passed to a function, the invoked function gets a reference to the original value, not a copy of its value. If the function modifies its parameter, the value in the calling code will be changed because the argument and parameter use the same slot in memory. If the Java programming language actually had pass-by-reference parameters, there would be a way to declare halveIt so that the preceding code would modify the value of one, or so that commonName could change the variable sirius to null. This is not possible. The Java programming language does not pass objects by reference; it passes object references by value. Because two copies of the same reference refer to the same actual object, changes made through one reference variable are visible through the other. There is exactly one parameter passing mode -- pass by value -- and that helps keep things simple.
    -- Arnold, K., Gosling J., Holmes D. (2006). The Java� Programming Language Fourth Edition. Boston: Addison-Wesley.

  • How to pass Method Inner Class reference to other method?

    Hi All,
    I am trying to pass the reference of "method inner class".
    Can any one explain me how to pass the reference and where other method will sit in the class, I mean either in Outer Class or in Inner Class ?
    Thanks in advance for ur reply :)
    package methosInnerClass;
    public class MethodLocalInnerClass {
         private String outerName;
         private static String statOuterName;
         public MethodLocalInnerClass(String name, String statName) {
              outerName = name;
              statOuterName = statName;
         public void methodWithLocallClass() {
              class MethodInnerClass {
                   String innerName;
                   MethodInnerClass(String name) {
                        innerName = name;
                   public void displayOuterInner() {
                        System.out.println("Outer Name: " + outerName + "\nOuter StatName: " + MethodLocalInnerClass.statOuterName + "\nInner Name: " + innerName);
              MethodInnerClass methodInner = new MethodInnerClass("Harish");
              methodInner.displayOuterInner();
                    *Pass above reference to other method*
         public static void staticMethodWithLocallClass() {
              class MethodInnerClass {
                   String innerName;
                   MethodInnerClass(String name) {
                        innerName = name;
                   public void displayOuterInner() {
                        // We can not access the non-static instance variable since this method is a static method
                        //System.out.println("Outer Name: " + outerName + "\nOuter StatName: " + MethodLocalInnerClass.statOuterName + "\nInner Name: " + innerName);
                        System.out.println("Outer StatName: " + MethodLocalInnerClass.statOuterName + "\nInner Name: " + innerName);
              new MethodInnerClass("Shakshi").displayOuterInner();
         public static void main(String[] args) {
              new MethodLocalInnerClass("Abhishek","Neeshu").methodWithLocallClass();
              System.out.println("Calling innerClass within static method !!!");
              staticMethodWithLocallClass();
    }

    package donald.test.inner_class;
    public class OutterClass {
         private String outerName;
         private final OutterClass outterClass;
         public OutterClass() {
              outterClass = this;
         public void methodWithInnerClass(final String strValueToPassToInnerClass) {
              class InnerClass {
                   private InnerClass innerClass;
                   private String innerName;
                   InnerClass(String name) {
                        innerName = name;
                   public void displayOuterInner() {
                        System.out.println("Non-Static:\tOuter Name: " + outerName + "\tInner Name: " + innerName);
                        System.out.println("");
                        System.out.println("final String strValueToPassToInnerClass = " + strValueToPassToInnerClass);
                    * @return the innerClass
                   public InnerClass getInnerClass() {
                        return innerClass;
                    * @param innerClass the innerClass to set
                   public void setInnerClass(InnerClass innerClass) {
                        this.innerClass = innerClass;
                    * @return the innerName
                   public String getInnerName() {
                        return innerName;
                    * @param innerName the innerName to set
                   public void setInnerName(String innerName) {
                        this.innerName = innerName;
              InnerClass methodInner = new InnerClass("Inner.Donald");
              methodInner.displayOuterInner();
              System.out.println("My OutterClass " + outterClass.getOuterName());
        // Unknown "MethodInnerClass "
         public void passReferenceOfInnerClassToOtherMethod(     ) {
          * @param args
         public static void main(String[] args) {
              OutterClass outterClass = new OutterClass();
              outterClass.setOuterName("Outter.Donald");
              outterClass.methodWithInnerClass("This Donald is so very cool...!!!  Yeah...!!!");
          * @return the outerName
         public String getOuterName() {
              return outerName;
          * @param outerName the outerName to set
         public void setOuterName(String outerName) {
              this.outerName = outerName;
          * @return the outterClass
         public OutterClass getOutterClass() {
              return outterClass;
    }

  • Arrays are passed by reference or value ?

    Hi peoples,
    I have something interesting here which I need to know. Look into the following classes :
         public class example1 {
         int i[] = {0};
         public static void main(String args[]) {
         int i[] = {1};
         change_i(i);
         System.out.println(i[0]);
         public static void change_i(int i[]) {
         i[0] = 2;
         i[0] *= 2;
         public class example2 {
         int i[] = {0};
         public static void main(String args[]) {
         int i[] = {1};
         change_i(i);
         System.out.println(i[0]);
         public static void change_i(int i[]) {
         int j[] = {2};
         i = j;
    Among the above classes, the class named 'example1' returns the value 4 whereas, the class named 'example2' returns the value 1.
    Any explanations to this one please....
    Cheers,
    Rasmeet

    minglu, you are not doing right.
    i just don't get it why you have i[] as instance variable but never use it ( i[] is declared in every method so each i you refer to in the method is a local varable not member variable that can be shared for the object ).
    your first solution work. but that i = j line is not needed because it has no effect you still cannot change the referrence of i to other int[]. your first soultion just need to be
    public static int[] change_i(int i[]) {
    int j[] = {2};
    return j;
    }anyway, using this solution, the method name will be misleading because the method didnot change i in anyway. i is changed because you assign the return array (j) to i.
    for that second solution also, you didn't use your member variable i at all. what you change is the content of i you pass so the result is correct. but then how is this method different from the first method the original poster posted?
    moreover, java never pass argument to the method by reference it ALWAYS pass by copy.i suppose you define passing by reference in the same way C++ does. all object variable in java is a refernce to Object so passing the variable to method is surely passing the reference to the method but that's not passing by reference. it's passing by copy because what is passed is the copy of the reference to the object, not the reference to the reference to Object. if it is really passing by refernce, then you will be able to change your reference to object to point anywhere because you have the access the address of the reference. but since you don't (you only know where the passed reference is pointing to (you have the COPY of value of reference) but you don't know where the refernce store its value) you can only change the content of the pointed object but not changing the pointed object.
    let me restate this, java always pass by reference.

  • Passing Select-Option to OO method via parameter list

    Is it possible to pass a reference to a select-option through the parameter list of a method such that the parameter can be used in a "where clause" using the conventional "IN" operator?  If so, how should the parameter be typed? 
    Thanks in advance,
    Philip Smith

    Sure, here's how.
    report zrich_0002 no standard page heading.
    tables: mara.
    *       CLASS lcl_app DEFINITION
    class lcl_app definition.
      public section.
        types: t_matnr type range of mara-matnr.
        data: imara type table of mara.
        methods: constructor importing im_matnr type t_matnr.
    endclass.
    *       CLASS lcl_app IMPLEMENTATION
    class lcl_app implementation.
      method constructor.
        select * into table imara from mara up to  100 rows
                     where matnr in im_matnr.
        check sy-subrc = 0.
      endmethod.
    endclass.
    data: myapp type ref to lcl_app.
    select-options: s_matnr for mara-matnr.
    start-of-selection.
      create object myapp
            exporting
                 im_matnr = s_matnr[].
    Welcome to SDN!.  Be sure to award points for helpful answers and mark your post as solved when solved completely.  Thanks.
    REgards,
    Rich Heilman

  • Is possible pass class reference into function by reference ?

    Hello, here is one example.
    class MyClass
    public int i;
    public static void Change(MyClass param1, MyClass param2)
    MyClass temp;
    temp = param1;
    param1 = param2;
    param2 = temp;
    public static void main(String[] args)
    MyClass param1 = new Main();
    param1.i = 100;
    MyClass param2 = new Main();
    param2.i = 200;
    Change(param1,param2);
    System.out.println(param1.i);
         System.out.println(param2.i);
    Is clear the result will be :
    100
    200
    Well, is possible in java pass into function object reference by reference? (for example in C# exist keyword ref, which solve this problem.) Other question is if this is something what is really needed in daily programming life, but I'm curious.
    Thanks for response

    iaragorn wrote:
    Well, is possible in java pass into function object reference by reference? No. Java only passes by value.
    Other question is if this is something what is really needed in daily programming lifeNope. Java has done just fine without pass by reference for about 12 or 14 years now.

  • How do you pass vi references from one event to another

    I have a vi which gets vi references (thereby loading the vi's into memory) for all the vi's in a given directory when a user clicks a button on the front panel. To do this I use an event structure. My question is whether it is possible to have another event (user button on the front panel) which unloads the vi's from memory. I have tried passing the vi references that are initially generated to the close reference function but whenever I do I get a 'vi reference invalid' error. Does this have to do with trying to pass the vi references between one event and another? If I use a local variable simply pass a reference to another indicator and then probe it, the originally-generated refnum and the local vari
    able refnum match up. However once I try to wire that same indicator to the close reference function I get the 'vi reference invalid' error. Is there a different/better way to unload the vi's from memory based on a user button click? Any suggestions would be welcome.
    Jason
    Attachments:
    Load_Directory_of_vi's.vi ‏57 KB

    Several problems with your code:
    1... Bad idea to use lights as buttons. Yes it can be done, but it's not "natural".
    2... If you've gotta do that, set their mechanical action to "LATCH WHEN RELEASED"
    3... Because of #2, you are getting TWO copies of every array when you click the LOAD VIs light (er... button).
    4... No need for the conversion from path to string and back - use BUILD PATH to append each file name to he folder path.
    5... Set the BROWSE OPTIONS on your PATH control to EXISTING DIRECTORY to allow browsing of directories, not files.
    6... Your code doesn't care whether the file is a .VI file, or a .ZIP file, or a .TXT file, or what. Use the PATTERN input on the LIST function to discriminate.
    7... Your code is only storing the latest refer
    ence, not the array of references.
    8... An ERROR DIALOG on the OPEN REFERENCE function will tell you that you're getting an error. Why? You are asking to prepare a non-reentrant VI for reentrant execution (why use options = 8?)
    9... Because of #8, the latest VI reference is invalid.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Error : Access not possible using "null" objects reference

    Hello.
    i am working with a zbapi.
    i called a external email program in this bapi,everything is working fine over here.
    In webdynpro java they mapped my bapi and starting working from there.
    every functionality is working fine but regarding this email stuff it is showing an error as access not possible using null objects reference.
    where could be the possible error.
    is it in webdynpro or in abap side.

    Raghu,
    You are right. When it comes from the WD Java, may be you are not passing any value at all. You can trace it by these ways.
    1. Check it using SE37, make sure everyhting is fine.
    2. Print all the values that you are passing to the RFC in the execute RFC method().
    3. using ST05 transaction in R/3, enable RFC and SQL trace, check what is passing in between web dynpro and R/3.
    Moreover paste your error message here.
    Thanks,
    Raj.

  • Passing a reference to a type definition to a SubVI

    I have created a type definition that I would like to use across my application. This particular type definition is also the front panel control to my top level VI. I wanted to pass a reference to this control to my SubVi's so that they could dereference as needed and in very rare cases update the values on the front panel. However, as I built the application I noticed that I was breaking the control reference as I updated the type definition. This implies that they type of the reference changes as I change the type definition.
    How do I go about building the reference I need or is there some other way to do this that works just as well. Even if I can't make a reference to the control that is tied to the type definition, I'm willing to pass in a variant who can house the reference as long as I can build the data type (the reference) inside my SubVis.
    Solved!
    Go to Solution.

    Okay, so I tried all three approaches in a SubVI, here's what happened.
    My approach was simply to create a Type Def control, right-click and create a Reference. Then create a control from that reference by right-clicking the output of the reference and selecting the Create Control option. I then pasted this 'cluster' reference into my SubVi, made it an input and then wired up the reference in the parent to the control in the SubVi.
    Result: This breaks when you update the Type Definition.
    Next, Ben's approach (or my best effort at doing what he suggested). I created a control from reference to the type def. I cut it from the parent VI and pasted it into a new type def. I then put the type def in the SubVI and set it as an input.
    Result: This breaks when you update the Type Definition (but it actually takes a bit longer for the error to propogate).
    Finally, Christian's solution (or my best effort). I took the type def reference and put it through a To More Generic Class guy, casting it to a Control Refnum. I put a Control Refnum on the front panel of my SubVI and wired it to a To More Specific Class guy. I created a control of the type def in the subvi, hid it, and created a reference. I wired the reference to the more specific guy and verified I was getting the right data.
    Result: It works!
    It's possible I just didn't understand how to make the reference type def you were referring to Ben. I would prefer a method with less verbage. I pass this refnum into a class which holds it. Since I can't replicate the type exactly prior to run time (i.e. create a control that is exactly a reference to the type definition of my front panel), I have to save the reference as a Control Refnum and cast it every time I need it (i.e. create a control from the typedef, create a reference frome the type def, etc). More verbage than optimal, but still good!
    Thanks for the help.

  • Is it possible to pass a field symbol as parameter from any method of view?

    Hi
    Is it possible to pass a field symbol as an importing parameter to teh globally declared attribute??

    While it is true that you can pass field symbols, they must be fully typed at the time you pass them  and they will be passed by value, not by reference. If you want to pass generically typed variables use a data reference (TYPE REF TO) instead.

  • Is it possible to pass parameters through eventlisteners?

    Hello everyone!
    Inside a .fla file I have some buttons and each button will tween a different image to the stage. All the images are outside the stage in the same x and y position and I just need to tween the x coordinate.
    Now I'm working with an external document class where I'm trying to hold all my functions and I'm stucked with the Tweens. I'm willing to stay away from the flash tween engine and I'm trying to work with tweenLite.
    My question is: Is it possible to pass parameters through eventListeners so I can use something like this inside my docClass?
         public function animeThis (e:MouseEvent, mc:MovieClip, ep:int):void { //ep stands for endPoint.
         TweenLite.to(mc, 2, {x:ep});
    If this is possible, how am I supposed to write the listeners so it will pass the event to be listened for AND those parameters? And how to build the function so it will receive those parameters and the event?
    If this is not possible, what's the best approach to do this?
    Thanks again!

    So, I understand you need to match buttons with corresponding visuals.
    Here is a suggested approach.
    Since SimpleButton is not a dynamic class, I suggest you have an enhanced base class for these buttons that extends SimpleButton. What is enhanced is that button has reference to the target.
    I wrote code off the top of my head and it may be buggy. But concept is clear:
    This is base class for all the buttons:
    package 
         import flash.display.DisplayObject;
         import flash.display.SimpleButton;
         public class NavButton extends SimpleButton
              public var targetObject:DisplayObject
              public function NavButton()
    Now, this is your doc class that utilizes this new buttons:
    package 
         import flash.display.DisplayObject;
         import flash.display.MovieClip;
         import flash.display.Sprite;
         import flash.events.Event;
         import flash.events.MouseEvent;
         public class DocClass extends Sprite
              private var btnArray:Array;
              private var visuals:Array;
              // references to objects being swapped
              private var visualIn:MovieClip;
              private var visualOut:MovieClip;
              public function DocClass()
                   if (stage) init();
                   else addEventListener(Event.ADDED_TO_STAGE, init);
              private function init(e:Event = null):void
                   removeEventListener(Event.ADDED_TO_STAGE, init);
                   // buttons and MCs shouldn't be in the same array - otherwise it is counterintuitive
                   // assuming all the objects are on stage
                   btnArray = [price_btn, pack_btn, brand_btn, position_btn];
                   visuals = [g19_mc, g16_mc, g09_mc, g04_mc];
                   configObjects();
              private function configObjects():void
                   var currentVisual:MovieClip;
                   var currentButton:NavButton;
                   for (var i:int = 0; i < btnArray.length; i++)
                        currentVisual = visuals[i];
                        // hold original positioin
                        currentVisual.hiddenPosition = currentVisual.x;
                        currentButton = btnArray[i];
                        // set target MC
                        currentButton.targetObject = currentVisual;
                        currentVisual.addEventListener(MouseEvent.CLICK, placeObject);
                        currentButton.addEventListener(MouseEvent.CLICK, placeObject);
              private function placeObject(e:MouseEvent):void
                   // if NavButton is clicked - make new visual targeted for moving in and currently visible object subject for moving out
                   if (e.currentTarget is NavButton) {
                        visualOut = visualIn;
                        visualIn = NavButton(e.currentTarget).targetObject;
                   else {
                        // otherwise - move visual out
                        visualOut = visualIn;
                   swapVisuals();
               * Accompishes visuals swapping
              private function swapVisuals():void {
                   if (visualIn) TweenLite.to(visualIn, .3, { x:0 } );
                   if (visualOut) TweenLite.to(visualOut, .3, { x:visualOut.hiddenPosition } );

  • Using "Set Control Value" to pass a reference

    Hi,
    every time I tried to passe a Control Reference using "Set Control Value" I have the Error 1 (invalid input parameter at invoke node). Why is it not possible to pass a control reference using the invoke node??
    Thanks
    Golzio

    Hi,
    This is possible. Trick is, the type of the control reference needs to be
    the same as the input. E.g. a string control reference is a different type
    as a numeric control reference (, or a control reference).
    To avoid this conflic, make sure the input of the vi is a control reference
    (and not a e.g. string control reference). Also make sure the to convert the
    reference you pass to a control reference (using Application Control>To More
    Generic Class).
    Regards,
    Wiebe.
    "Golzio" wrote in message
    news:506500000008000000C1F00000-1079395200000@exch​ange.ni.com...
    > Hi,
    > every time I tried to passe a Control Reference using "Set Control
    > Value" I have the Error 1 (invalid input parameter at invoke node).
    > Why is it not possible to pass a control re
    ference using the invoke
    > node??
    >
    > Thanks
    > Golzio

  • How BAPI Tables parameters are passed by reference

    Hi Gurus,
                     I have a genuine doubt regarding BAPI parameters. I would like to point out the genreal rules of bapi like,
    1. BAPI parameters should be passed by value. (Because they are rfc fm's. So both systems will be in different servers. This is the normal scenario.)
    2. But the tables parameters in BAPI can't be passed by value. Instead they are passed by reference.
    3. I know they use some kind of delta mechanism to transfer tables parameters to remote servers.
    So gurus I would like to know what exactly happens when a tables parameter is passed. And also I didn't understand the delta mechanism. Kindly guide me.
    Thanks in advance,
    Jerry Jerome

    You'll see in [SAP Library - RFC - Parameter Handling in Remote Calls|http://help.sap.com/saphelp_nw04s/helpdata/en/22/042551488911d189490000e829fbbd/frameset.htm] that tables are not passed by reference when you use RFC. It also explains the delta.
    When you make a remote function call, the system handles parameter transfer differently than it does with local calls.
    TABLES parameters
    The actual table is transferred, but not the table header. If a table parameter is not specified, an empty table is used in the called function.
    The RFC uses a delta managing mechanism to minimize network load during parameter and result passing. Internal ABAP tables can be used as parameters for function module calls. When a function module is called locally, a parameter tables is transferred u201Cby reference". This means that you do not have to create a new local copy. RFC does not support transfer u201Cby referenceu201D. Therefore, the entire table must be transferred back and forth between the RFC client and the RFC server. When the RFC server receives the table entries, it creates a local copy of the internal table. Then only delta information is returned to the RFC client. This information is not returned to the RFC client every time a table operation occurs, however; instead, all collected delta information is passed on at once when the function returns to the client.
    The first time a table is passed, it is given an object-ID and registered as a "virtual global table" in the calling system. This registration is kept alive as long as call-backs are possible between calling and called systems. Thus, if multiple call-backs occur, the change-log can be passed back and forth to update the local copy, but the table itself need only be copied once (the first time).

Maybe you are looking for