Add element to vector

class Helloworld{
public static void main(String args[]){
B t1 = new B();
B t2 = new B();
B t3 = new B();
t1.start();
t2.start();
t3.start();
class A extends Thread{
     static Vector v;
     v = new Vector(0,1);
public void packMes(int d, int[] sData, int so, int[] dData, int doa, int size){
         Message m = new Message(d, sData, so, dData, doa, size)   //Message is a data class
         addMessage(m);
     public static synchronized void addMessage(Message pm){
          v.addElement(pm);
class B extends A{
       int[] intArray1 = {1,2,3,4};
       int[] intArray2 = {11,12,13,14};
  public void run(){      
  if (id==0) {     // let id be the name of the current thread i.e "0" means thread-0
     packMes(3, intArray1, 0, intArray2, 0, 4);
     System.out.println("I'm thread "+id+" size: " + v.capacity());
     Message test = (Message) v.elementAt(0);
}I tried to repeat running the program several times. The capacity of the vector in thread-0 is 1 all the time. Unfortunately sometimes it says
I'm thread 0 size: 1
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.v.elementAt(Unknown Source)
at helloWorld.run(B.java:21)
[i]
Please help. Thanks in advance.

here the exact code.
type
java Helloworld 4 B
after compiled.
The same problem still exists although it doesn't happen all the time.
import java.io.*;
import java.util.*;
public class Helloworld{
     static int processor;          // total number of processors
     static String fileName;
     static int counter;          // counter for processors
public static void main(String args[]){
       // interface with users
                processor = Integer.parseInt(args[0]);  
                fileName = args[1];      
     try{     
           Class c = Class.forName(fileName);                
               Thread procs[] = new Thread[processor];             // declare an array for threads
               for (int i=0; i<processor; i++){     
                    System.out.println(i);       // create threads           
          procs[i] = (Thread) c.newInstance();  
               procs.start();                     
     } catch (ClassCastException ex)
          { System.out.println("The file you provided is not a thread"); }
catch (ClassNotFoundException ex)
          { System.out.println("That class doesn't exist");  }
     catch (Exception ex)
          { System.out.println("File error!");             }
class A extends Thread{     
     static Vector v;
     public void createVector(){
          v = new Vector(0,1);
     public void packMes(int desId, int[] sourData, int sourOffset, int[] destData, int destOffset, int size) {
               Message m = new Message(desId, sourData, sourOffset, destData, destOffset, size);
               addMessage(m);
     public int id(){          
          String procsName = getName();
          int procsID=Integer.parseInt(procsName.substring(7));
          return procsID;
     public static void addMessage(Message pm){
          v.addElement(pm);
class B extends A{
     int[] intArray1 = {1,2,3,4};
     int[] intArray2 = {11,12,13,14};
     public void run(){      
          createVector();
          if (id()==0) {     
               packMes(3, intArray1, 0, intArray2, 0, 4);
               System.out.println("I'm thread "+id()+" size: " + v.size());
               Message test = (Message) v.elementAt(0);           
class Message {
     int destID;
     int size;
     public Message(int destID, long[] sourData, int sourOffset, long[] destData, int destOffset, int size) {
          this.destID = destID;
               long[] sData = sourData;
               int sOffset = sourOffset;
               long[] dData = destData;
               int dOffset = destOffset;
               this.size = size;               
     public Message(int destID, int[] sourData, int sourOffset, int[] destData, int destOffset, int size) {
          this.destID = destID;
               int[] sData = sourData;
               int sOffset = sourOffset;
               int[] dData = destData;
               int dOffset = destOffset;
               this.size = size;               

Similar Messages

  • How to add byte[] to Vector/ArryList

    Hi
    my intention is like add the byte[] to Vector/ArryList .. and each element in byte array will be appper as vector elements.
    i mean Each byte[i] element will be as i th element in vector/ArryList
    byte [] b=myString.getBytes();
    Vector v=new Vector();
    v.add(b); // add each element of byte array to vector.....
    Wat i have to do?
    plz give me solution

    And see it my first code
    import java.io.*;
    import java.util.Scanner;
    //import herong.CipherDES;
    class Test
         private byte[] theKey;
         private byte[] theMsg;
            private StringBuffer DecMesg;
         private StringBuffer PlainMesg;     
         private StringBuffer s1;     
         private StringBuffer s2;
         public Test()
                   theKey = null;
                      theMsg = null;
         public void initialize(String str1,String str2)
                   s1=new StringBuffer(str1);
                   s2=new StringBuffer(str2);
                   while((s1.length()%8)!=0)
                             s1.append(" ");
                   if(s1.length()<s2.length())
                             while(s2.length()%8!=0)
                                       s2.append(" ");     
                   else
                             while(s2.length()<s1.length())
                                       if(s2.length()%s1.length()<8)
                                            s2.append(str2);
                                       else
                                            s2.append(" ");                              
         public String encryptDES(String str1,String str2)
                   DecMesg=new StringBuffer();
                   try
                   initialize(str1,str2);
                   for(int i=0;i<s1.length();i=i+8)
                             String Mesg=s1.substring(i,i+8);
                             String Key=s2.substring(i,i+8);
                             theMsg = Mesg.getBytes();
                             theKey = Key.getBytes();
                                 byte[][] subKeys = CipherDES.getSubkeys(theKey);
                             byte[] theCph = CipherDES.cipher(theMsg,subKeys,"encrypt");//cipherDESis a method in my class
                              String Cipher = new String(theCph);                    
                             DecMesg=DecMesg.append(Cipher);
                   catch(Exception e)
                   e.printStackTrace();
              return DecMesg.toString();
         public String decryptDES(String str1,String str2)
                   PlainMesg=new StringBuffer();
                   initialize(str1,str2);
                   try
                   for(int i=0;i<s1.length();i=i+8)
                             String Mesg=s1.substring(i,i+8);
                             String Key=s2.substring(i,i+8);
                             theMsg = Mesg.getBytes();
                             theKey = Key.getBytes();
                                 byte[][] subKeys = CipherDES.getSubkeys(theKey);
                             byte[] thePlain = CipherDES.cipher(theMsg,subKeys,"decrypt");
                              String Plain = new String(thePlain);
                             PlainMesg=PlainMesg.append(Plain);
                   catch(Exception e)
                   e.printStackTrace();
              return PlainMesg.toString();
    class kk
          public static void main(String[] a)
                    Test obj=new Test();     
              String s1="chinturao";          
              String s2="bavaanil";
              String s3="Hello  to all from krish and from idnia how r u i am fine";
              String encMesg=obj.encryptDES(s3,s1);          
              String decMesg=obj.decryptDES(encMesg,s1);
              System.out.println(decMesg);
    }wheni execute it it gives worng out put like below
    Hello  to all from krish and fro.}§&#9794;I&#9794;¶&#8805;how r u i am fineso i think its the problem with srings when Mesg are ciphers so i wish to make use if bytes.

  • Add element in dropdown list dynamically

    Hi All,
    I am facing a problem in adding item in a dropdown list dynamically.
    When i get dropdown list through IgetElementById get null.
    var list = document.getElementById("targetgroupname");
    here list comes as null. Now I've to fill this list. I am using below code -
    for(var j=0;j< com.length;j++){
    iist.options[j]= new Option(com[j],com[j]);
    But it is not working. My list is not getting filled with these values.
    I doubt due to var list -> null it does not allow to add element.
    But I am not getting any clue, how to initialize it.
    Please suggest, I am new to javascript.
    Thanks & Regards,
    Sneha.

    Hi,
    Thanks for the reply, yes the select box has that id - targetgroupname.
    actually there are 2 dropdown lists, Based on the selection of first dropdown list another list shd be filled.
    So I've written a script at "onchange" of first dropdown list. It works fine when a value gets changed at first dropdown list.
    In some cases I've to display a preselected value at first list ( which comes from previous page as parameter), in that cases there will be no onchange on first list, so I've called the script function manually after creating the first list,like below :
    <SCRIPT> checkSource();</SCRIPT>
    and in this case it does not work & I get a null when i try to read the 2nd list.
    But I am not sure why it is happening.. may be it is not loaded /created on page when i am calling it.
    If yes, what shd I do ?
    Thanks for your time.
    Regards,
    Sneha

  • Is there a way you can add elements dynamically to an existing array??

    hey guys... i need to add elements to an array dynamically... how do i do that?
    for example... in one of my functions i do..
         for each(var item:Object in fileList){
              fileListArr.push(item);
    and in a later function i need to add one more element to my fileListArr...
    so i tried doing
    fileListArr[indexNum].push({
         key:videoKey
    so i need to have an array which resembles something like this...
    Before adding elements...
    fileListArr:
         [0]:  name:test1
                Size:12K
                caption:testing caption
                number:1
         [1]:  name:test2
                Size:12K
                caption:testing caption
                number:2
    after adding key to array
    fileListArr:
         [0]:  name:test1
                Size:12K
                caption:testing caption
                number:1
                key:xyxyyy11y1yy1y1y2y2u33n
         [1]:  name:test2
                Size:12K
                caption:testing caption
                number:2
                key:iiduudjmenri112jj2n4n3m2j1j21
    any ideas?

    hmm interesting... so i made the changes... i changed the array to arraylist and the code i have is as follows... but i still get an error... the error says ... "ReferenceError: Error #1056: Cannot create property key on flash.net.FileReference."
    public var videoReference:VideoHandler;
    public var fileRef:FileReferenceList = new FileReferenceList();
    [Bindable] public var fileListArr:ArrayList = new ArrayList();
    [Bindable] public var fileNames:ArrayCollection = new ArrayCollection();
    public function selectionHandler(event:Event):void{
         fileRef.removeEventListener(Event.SELECT, selectionHandler);
         var numSelected:int = event.target.fileList.length;
         var fileList:Array = event.target.fileList;
         for each(var item:Object in fileList){
              fileListArr.addItem(item);
              fileNames.addItem({
                   num: fileNames.length + 1,
                   name: item.name,
                   size: formatFileSize(item.size),
                   status: ""
         var newListLength:Number = fileListArr.length;
         if(fileCounter > 0){
              loopList(fileCounter);
         else
              loopList(0);
    public function loopList(value:int):void{
         //trace("looplist -->");
         if(value < fileListArr.length){
              _numCurrentUpload = value;
              file = new FileReference();
              file = FileReference(fileListArr.getItemAt(value));
              file.addEventListener(Event.COMPLETE, loadVideo);
              file.addEventListener(ProgressEvent.PROGRESS, fileProgress);
              file.load();
    public function setUploadKey(event:ResultEvent):void{
         if(event.result.ThereWasAnError){
              Alert.show(event.result.ErrorMessages[0]);
         }else{
              videoKey = event.result.UploadKey;
              if(fileCounter >= fileListArr.length){
                   trace("in if");
                   fileCounter = 0;
                   uploadLoopList(fileCounter);
              }else{
                   trace("in else");
                   //fileListArr[fileCounter - 1]['videoKey'] = videoKey;
    -----> get an error here --->fileListArr.getItemAt(fileCounter - 1).key = videoKey;
                   //fileListArr[fileCounter - 1] = [{key: videoKey}];
                   loopList(fileCounter);

  • How to add elements into Object[][] type of list, in runtime?

    I have Object list, ie.
        final Object[][] data = {
            {"January",   new Integer(150) },
            {"February",  new Integer(500) },
            {"March",     new Integer(54)  },
            {"April",     new Integer(-50) }
        };How can I dynamicly add new elements in it, at the runtime?
    Thank you in advance!

    Do I have to remove 'final' for that, and then add
    elements?
    No. you can't change an array's size.
    You can do this
    Object[][] arr = new Object[numRows][numCols];But once you've created it, its size can't change.*
    I don't know what you're doing, though, and what actual data you're putting in, but Object[][] holding rows of [String, Integer] is almost certainly a poor data structure. Think about creating a class the represents one "row" here and then create a 1D array of that class.
    * Okay, you can kinda sorta effectively "change" the size of second and subsequent dimensions, since a multidimensional array is an array of arrays. I wouldn't recommend it though: int[][] arr = new int[3][2]; // a 3 x 2 rectangular array of int--it's  an array of array of int, with 3 "rows", each of which is an array of int with 2 elements.
    arr[0] = new int[10]; // now it's a jagged array whose first row has 10 elments instead of 2Here we haven't changed an array's size, just replaced one of its elements, which is also an array, with a new, larger array.

  • Records Management - automaticaly add element to record

    Hello,
    I try to add an element to a record using the bapi "bapi_record_addelement", but I get an error-message that the number of poid-parameters is not equal to those in the registry information.
    My ABAP-Code is the following:
    *& Report  Z_RECORD_ADDELEMENT
    REPORT  Z_RECORD_ADDELEMENT.
    *{   INSERT         I50K900139                                        1
    data:
    wa_ELEMENT_SP_POID     type      BAPIPROPTB,
    wa_ELEMENT_PROPERTIES  type      BAPIPROPTB,
    wa_ELEMENT_VISIBILITY  type      BAPIPROPTB,
    element_sp_poid type standard table of BAPIPROPTB,
    element_properties type standard table of BAPIPROPTB,
    wa_insertion_by_modelid type BAPISRMREC_MODELIDINS,
    return like BAPIRET2.
    * Fill SP POID table
    start-of-selection.
    CLEAR element_sp_poid.
    wa_element_sp_poid-NAME  = 'DOC_ID'.
    wa_element_sp_poid-VALUE = '03F65C4630552864E1000000AC15C293'.
    APPEND wa_element_sp_poid TO element_sp_poid.
    wa_element_sp_poid-NAME  = 'VARIANT'.
    wa_element_sp_poid-VALUE = '0'.
    APPEND wa_element_sp_poid TO element_sp_poid.
    wa_element_sp_poid-NAME  = 'VERSION'.
    wa_element_sp_poid-VALUE = '2'.
    APPEND wa_element_sp_poid TO element_sp_poid.
    wa_insertion_by_modelid-MODEL_ID = 'D7F85C462E55770CE1000000AC15C293'.
    wa_insertion_by_modelid-PARENT_NODE_ID = '3'.
    ** add element
    CALL FUNCTION 'BAPI_RECORD_ADDELEMENT'
            EXPORTING
              objectid = 'E1A55C462F0C790CE1000000AC15C293'
              DocumentClass = 'ZRMSR04'
              sps_id = 'Z_RM_MIETAKT'
              anchor = 'Schriftverkehr'
              description = 'Testdokument eingefügt mit ABAP'
             IMPORTING
              return        = return.
    write: return-message,
           return-type.
    *}   INSERT
    I hope someone can help me because I am trying for one week.
    hootzter

    Hey...
    Good information.
    I get an error in trying to add element to record, van you help me out.
    The error reads the following:
    Source: CL_SRM_GENERIC_SP0============CP , CL_SRM_GENERIC_SP0============CM002 ,       102
    General error: Could not connect to repository.
    This is the code Iam using
    *& Report  ZTESTPRG
    REPORT  ZTESTPRG.
    Definition of local data types for DOC_ID
      types: begin of ty_doc_id,
                docclass type bapisrmdoc-docclass,
                objectid type bapisrmdoc-guid,
             end of ty_doc_id.
    Structure of the correct Document-ID
      data: ls_doc_id type ty_doc_id,
            lt_sp_poid type standard table of bapiproptb,
            ls_sp_poid type bapiproptb,
            ls_return like bapiret2,
            ls_insertion_by_anchor type bapisrmrec_anchorins.
        clear: lt_sp_poid, ls_doc_id, ls_doc_id.
        ls_doc_id-docclass = 'ZSNG09'.                    
      Document Class des einzufügenden Dokumentes
        ls_doc_id-objectid = '466E6A24DED600A100000000AC10A015'.     
       Objektid des einzufügenden Dokumentes
        clear: ls_sp_poid. " clear weg und ls_sp_poid clearen
        ls_sp_poid-name  = 'DOC_ID'.
        ls_sp_poid-value = ls_doc_id.                    
       Document Class und Objektid als Struktur des Dokumentes
        append ls_sp_poid to lt_sp_poid.
        clear: ls_doc_id.
        ls_sp_poid-name  = 'VARIANT'.
        ls_sp_poid-value = '0'.
        append ls_sp_poid to lt_sp_poid.
        clear: ls_doc_id.
        ls_sp_poid-name  = 'VERSION'.
        ls_sp_poid-value = '0'.
        append ls_sp_poid to lt_sp_poid.
        clear: ls_insertion_by_anchor.
        ls_insertion_by_anchor-parent_node_id = '5'.
        call function 'BAPI_RECORD_ADDELEMENT'
          exporting
            objectid        = '466E9223F887013A00000000AC10A015'     
           Objectid der Akte
            documentclass   = 'ZSNG08'                    
           Document Class der Akte
            sps_id          = 'ZSCMG_SPS_NUCLEAR_PROCEDURE'               
           Einzufügende Elementart
            anchor          = 'NP02'                    
           Im Aktenmodell hinterlegt beim Modellknoten
            description     = 'Test Document'     
           Beschreibung des Dokumentes in der Akte
            element_type    = 'I'                         
           Instanz
          importing
            return          = ls_return
          tables
            element_sp_poid = lt_sp_poid.
            write: ls_return-message,
                   ls_return-type.

  • In .java add elements to .jsp

    Hello!
    I'm just beginning and can't understand one thing:
    When I create JSPDynPage, system create JSP and JAVA file - it's clear. Then I add elements to form in JSP, for example, Layout.
    Can I add, for example, row into that Layout in .java file?
        .JSP:
    <hbj:form>
             <hbj:formLayout
                 id="myLayout"
                 width="100%">
                 <hbj:formLayoutRow
                         id="Row1">
                         <hbj:formLayoutCell
                                 id="Cell11"
                                 align="LEFT"
                                 width="100%">                
                                 <hbj:textView
                                     id="welcome_message"
                                     text="May the force be with you unknown user"
                                     design="HEADER1" />
                           </hbj:formLayoutCell>
                   </hbj:formLayoutRow>                      
               </hbj:formLayout>            
        </hbj:form>
    .JAVA:
    public void doProcessBeforeOutput() throws PageException {
             this.setJspName("myjsp.jsp");
          Form Reg_Form = null;
          FormLayout RF_All  = new FormLayout();
          Tray Left_Tray1 = new Tray("TrayRules1");
           Reg_Form = (Form)this.getForm();
           RF_All = (FormLayout) this.getComponentByName("myLayout");
           for (int i = 1; i <= 3; i++ ) {     RF_All.addRow(); }
           Left_Tray1.setTitle("Sample Title");
           Left_Tray1.setWidth("100%");
           TextView Left_Tray1_text = new TextView("Left_Tray1_text");
           Left_Tray1_text.setText("Sample Text");
           Left_Tray1_text.setEncode(false);
           Left_Tray1_text.setWrapping(true);
           Left_Tray1.addComponent(Left_Tray1_text);
           RF_All.addComponent(2,1, Left_Tray1);
           Reg_Form.addComponent(RF_All);
    That code don't display Tray in page...

    Paul,
    I suggest you  not to add the your business logic in that auto generated file.
    Instead you can have seperate java file or any Bean.
    Since you are writing the logic for layout you can add the code in the jsp file
    itself.
    If you are using HTMLB Then keep the auto generated code in the jsp otherwise remove the code and keep the file as jsp meaning you use the html, javascript,
    jsp code in the .jsp file itself.
    you can add the java code in the jsp
    <% String strName = "SAP"; %>
    <sc ript>
    al ert("<%=strName%>");
    </sc ript>
    Ram

  • Dynamicall add element in Drop Down

    There is one for in which drop down list is present. I want to add element dynamicall into drop down list when certain event is occur

    trigger a Java script function at the end of the event which will
    add date into the combobox.

  • Adding elements to a node: cannot bind or add element

    Hallo,
    I want add emenents of my phases and subphases to a table, but I get this exception:
    ContextException: Node(RoadMapVIew.phase_subphase_table): cannot bind or add element, because it is already bound to a node
    The code is the following:
    int phaseSize = processT.getSequenceGroup1().getPhaseList().getSequenceGroup1().getPhase().length;
                     String currentStatus = "";
                     String currentPhaseId = "";
                     String currentSubphaseId = "";
                     String currentNotifyId = "";
                     String lastStatus = "";
                     for (int i = 0; i < phaseSize; i++)
    PhaseT phaseT = processT.getSequenceGroup1().getPhaseList().getSequenceGroup1().getPhase();
                         IPrivateRoadMapVIew.IPhase_subphase_tableElement tableElement = wdContext.nodePhase_subphase_table().createPhase_subphase_tableElement();
                          tableElement.setPhase_desc(phaseT.getSequenceGroup1().getPhaseDesc());
                          tableElement.setPhase_id(phaseT.getSequenceGroup1().getPhaseId());
                          int subPhaseSize = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase().length;
                          for(int j = 0; j< subPhaseSize; j++)
                               SubPhaseT subPhaseT = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase()[j];
                               tableElement.setSubphase_desc(subPhaseT.getSequenceGroup1().getSubPhaseDesc());
                               tableElement.setSubphase_id(subPhaseT.getSequenceGroup1().getSubPhaseId());
                               String status = subPhaseT.getSequenceGroup1().getStatus();
                               wdContext.nodePhase_subphase_table().addElement(tableElement);
                               lastStatus = status;
                               //le fasi/sotofasi sono ordinate perciò la corrente è l'ultima con uno status valido
                               if (status != null && !status.equals(""))
                                    currentStatus = status;
                                    currentPhaseId = phaseT.getSequenceGroup1().getPhaseId();
                                    currentSubphaseId = subPhaseT.getSequenceGroup1().getSubPhaseId();
                                    if (status.equals(DAConst.STATUS_NOTIFY))
                                         //currentNotifyId = "notifyId"; //subPhaseT.getSequenceGroup1().getNotifyId();
                                         currentNotifyId = subPhaseT.getSequenceGroup1().getNotifyId();
    Can anybody help me please?
    Thanks,
    regards,
    Andrea

    I have solved moving the creation of the reference of the node element and the setting of elements inside the second for loop:
    for (int i = 0; i < phaseSize; i++)
                          PhaseT phaseT = processT.getSequenceGroup1().getPhaseList().getSequenceGroup1().getPhase()<i>;
                          String phaseDesc=phaseT.getSequenceGroup1().getPhaseDesc();
                          String phaseId=phaseT.getSequenceGroup1().getPhaseId();
                          int subPhaseSize = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase().length;
                          for(int j = 0; j< subPhaseSize; j++)
                               SubPhaseT subPhaseT = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase()[j];
                               IPrivateRoadMapVIew.IPhase_subphase_tableElement tableElement = wdContext.nodePhase_subphase_table().createPhase_subphase_tableElement();
                               tableElement.setSubphase_desc(subPhaseT.getSequenceGroup1().getSubPhaseDesc());
                               tableElement.setSubphase_id(subPhaseT.getSequenceGroup1().getSubPhaseId());
                               tableElement.setPhase_desc(phaseDesc);
                               tableElement.setPhase_id(phaseId);
                               String status = subPhaseT.getSequenceGroup1().getStatus();
                               wdContext.nodePhase_subphase_table().addElement(tableElement);
                               lastStatus = status;
    Thanks everybody for helps,
    Andrea

  • GeneralException Node(( Context path of node ): cannot bind or add element,

    Hello all,
    Stack trace :
    GeneralException Node((<Context path of node>): cannot bind or add element, because it is already bound to a node
    I am trying to upload data from excel file in web dynpro context.In the process,  when I create and add  an element to the node which I want to populate with excel data, it throws the above mentioned exception.
    Any idea as to wht is causing the problem ?

    Hi,
    GeneralException Node((<Context path of node>): cannot bind or add element, because it is already bound to a node
    It seems that its a mapped node, try to bind or addelements at the source.
    Ex: If this node is mapped from controller to view try to add elements in contoller instead of doing in view.
    Regards
    Ayyapparaj

  • ContextException : cannot bind or add element

    Hi all,
    I can't find an answer to my problem.
    Hope you'll be able to
    Here are the facts :
    Context :
    I'm currently creating a TeamViewer for Managers to be able to select the employees they manage.
    For that, I have a table which lists them all, displaying their infos in specific columns.
    Both columns and data are dynamic and are specified in the SAP back end.
    I use the following bapis to get these informations :
    - HRWPC_RFC_GET_COL_INFO (returns columns informations)
    - HRWPC_RFC_GET_OBJECTS (returns employees personal numbers -> pernr)
    Fact is the second one doesn't return as much informations as needed.
    So I have then to call a third bapi :
    - MYBAPI_USER_INFOS (return informations about an employee)
    which, from an employee pernr, returns a lot more informations about him.
    Fact is I manage to use efficiently both first bapis, so I get columns and pernr data.
    Then I would like to get in a context node the list of enhanced informations of the employees, which is mapped to my view context and applied to a dynamic table.
    My problem :
    While adding programmaticaly the columns to my context node, I get the following exception : "com.sap.tc.webdynpro.progmodel.context.ContextException: Node(TeamViewerApp.MainViewColumns): cannot bind or add element, because it is already bound to a node" error.
    Error summary :
    - com.sap.tc.webdynpro.progmodel.context.ContextException: Node(TeamViewerApp.MainViewColumns): cannot bind or add element, because it is already bound to a node
    -- at com.sap.tc.webdynpro.progmodel.context.Node.prepareAddElement(Node.java:649)
    -- at com.sap.tc.webdynpro.progmodel.context.Node.addElement(Node.java:635)
    -- at com.airfrance.tv1.teamviewer.components.TeamViewerApp.updateMainView(*TeamViewerApp.java:560*)
    -- at com.airfrance.tv1.teamviewer.components.wdp.InternalTeamViewerApp.updateMainView(InternalTeamViewerApp.java:534)
    -- at com.airfrance.tv1.teamviewer.components.views.TeamViewerView.onActionChangeView(TeamViewerView.java:197)
    TeamViewerComp code :
         wdThis.getColumnsMainView(viewId, userLanguage, userId); // get the columns infos
         IGetColumns_ResultNode columns = wdContext.nodeGetColumns_Result();
         for(int i=0; i<columns.size(); i++) {
              IWDNodeElement column = columns.getElementAt(i); // get the #i column
              wdContext.nodeMainViewColumns().addElement(column);  +//add this column to my other context +
    My context :
    Component
    - GetColumns (Model)
    -- GetColumns_Output
    --- GetColumns_Result
    Colname
    Heading
    -- Langu
    -- Uname
    -- Viewid
    - MainViewColumns (Value)
    -- lot of infos
    - SubViewColumns (Value)
    -- lot of infos
    My environment :
    - os : Windows XP SP2
    - procesor : 3GHz
    - memory : 3Gb
    - ide : SAP NWDS 7.0.12
    - server JEE : 7.00 SP12
    - server VM : Java Sun 1.4.2_12
    Any help will be really appreciated
    Thank you for your time!
    Alphonse

    HI,
    com.sap.tc.webdynpro.progmodel.context.ContextException: Node(HrChiefRedressalView.Ctx_FilteredOutput): cannot bind or add element, because it is already bound to a node
    Try to bind or add element from the source of the node instead of mapped one.
    Ex:
    Controller->View
    If your node is mapped from controller to view. bind/add element should be done at controller level not at view level.
    Regards
    Ayyapparaj

  • Add element in to bundle/unbundle Functions

    In the Bundle/Unbundle functions, Add Element is adding the same element.no use of adding same (again need to Select Item).based on the Cluster order if labVIEW adds next element it is usefull.

     I typically just resize the bundle node.

  • Randomising order of elements in vectors

    hi
    i have a vector containing vectors containing Doubles (nightmare, i know!). Just wondering if there's an easy way of randomising the order or the elements in the main vector.
    thanks,
    al

    This can be improved.
    public class ARandouPermutation{
    public static void main(String[] args) throws Exception{
    java.util.Vector vec = new java.util.Vector();
    for(int i=0;i<64;i++){// 64 is an example
        vec.add(new Double(i*1.0));
    Object[] tmp0 = vec.toArray();
    int originalSize = vec.size();// obtaining the original size of the Vector
    vec.clear();  // setting to size zero
    Object[] tmp1 = new Object[originalSize];
    int[] indexarr = randPermute(originalSize);// this method is defined below
    for(int j=0;j<indexarr.length;j++){
        tmp1[j] = tmp0[indexarr[j]];
    tmp0=null;
    arr=null;
    for(int j=0;j<originalSize;j++){// this can be replaced by java.util.Arrays.asList(Object[])
      vec.add(tmp1[j]);
      System.out.println(((Double)vec.get(j)).toString());//test output
    public static int[] randPermute(int L){// length L of the array returned is passed as an argument
       if(L<0) throw new IllegalArgumentException();
       int[] arr = new int[L];
       java.util.Random rand = new java.util.Random();
       for(int j=0;j<L;j++) arr[j]=j;
       int tmp, index=0;
    Label:   while(index<L){
           tmp = rand.nextInt(L);
           for(int j=0;j<index;j++) {
                if(tmp==arr[j]) continue Label;
            arr[index]=tmp;
            index++;
       return arr;
    }

  • Add element in Report Painter

    Hi All,
    I am trying a add an element (to the individual/lowest level) in my existing report in 'GRR2'.
    If I do not explode, element is created as below image,
    If I explode, element is shifted to final level as below image,
    But I want the element to be present at the lowest level as below,
    * 1990
    Note: The test '1990' will be replaced with the actual account name...
    Expert advice is appreciated...
    Thanks
    Rajesh P

    hi
    Report painter
    the below Pdf should help you
    http://www.virtuosollc.com/PDF/Get_Reporter.pdf
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/66/bc7d2543c211d182b30000e829fbfe/frameset.htm
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/eb/1377e443c411d1896f0000e8322d00/frameset.htm
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/5b/d22cee43c611d182b30000e829fbfe/frameset.htm
    nagesh

  • How can we add elements to component at run time  through java

    Hi,
    In my project ,I am using JArrayList to collect urls and I need to add those to JScrollPane(JTextArea) and this to frame. This works fine but I need the process of how the elements added to ArrayList simultaneusly added to JTextArea.
    pls suggest the way

    arrayList.add( someObject );
    textArea.append( someObject.toString() );

Maybe you are looking for

  • Regarding  to enable transfered option for enhanced field  in BI 7.0

    Hi Experts,     I am working on a requirement for which  i have enhanced fields  at RSA 6  extractor level and then  I removed hide options from those enhanced fields and then I had replicate it at BI system but  then what happen na for those fields

  • Photoshop CS4 will not launch after installing Yosemite.

    Photoshop CS4 will not launch after installing Yosemite. All the other CS4 apps open. I upgraded Java. Genius Bar could not get it to launch.

  • Automation of printing of FI documents

    Hi Masters, Please guide me on the following points. 1. We can trigger a correspondence for an FI document individually & 2. Print it through F.61 or, we can automate T code F.61 through batch job Is it possible to automate the printing of FI invoice

  • IPad frame shattered only six days old

    My ipad2 is only six days old, I keep the smart cover on it, and have the wrapsol screen protector on it. I noticed today that other frame area around the screen is shattered on each side of the home button, which is where I hold it when reading book

  • How to invoke web service in web Dynpro for java in CE environment.

    Hi all, Currently, I would like to invoke web service to retrieve data and display to the web dynpro. Do you have any sample code which I can reference? I am currently using CE7.1 SP3. Thank you.