Creating a multi-dimensional set in GS01

Hello experts,
I am trying to create what I hope is a simple multi-dimension set using GS01.
The help on SAP is limited.
I am attenpting to create a set which will be across a range of G/L accounts (say 10000 to 59999) and have included in this set a number of discrete profit centres...so that I have a mix of G/L accounts and profit centres that will become a set.
I wish to use this as a set to choose in transaction FAGLGP52 Copy Plan Model..
Many thanks in advance

In creating multi-dimension sets for T-code FAGLGP52 - "Copy Model Plan", perform the following steps:
Step 1:
Create basic sets/groups for the various characteristics, e.g.
ZRBUKRS - via GS01 on FAGLFLEXT-RBUKRS (Set class 0000)
ZPRCTR - via KCH1 Create PCtr Group (Set class 0106)
ZPPRCTR - via KCH1 Create Partner PCtr Group (Set class 0106)
ZHKONT - via KDH1 Create Account Group (Set class 0109)
ZFAREA - via FM_SETS_FUNCTION1 Create Functional Area Group (Set class 0112)
etc.   ...for every characteristic required to be copied.  Do NOT create sets for chars you want excluded.
Note -  My preference is to create the sets in their respective classification.  However,you do have the option to create the above sets using GS01.  The sets will then be created under the "0000" general set class.  You may create them all againt table FAGLFLEXT. 
Step 2:
Create Multi Set via t-code GS01, e.g.
Create ZGL_PLAN_MODEL_CHARS
Table - FAGLFLEXT, and select Option "Multi Set"
Click on "Values" , or Goto>Values or F(7)
Enter the sets from Step 1, then Save.
Done - Now you have your Multi Set for FI Plan copying t-code FAGLGP52.

Similar Messages

  • Multi-Dimensional Sets in a hierarchy

    Hi
    I'm trying to create a set hierarchy which contains multi-dimensional sets.  When adding the multi-dimensional set as a sub-ordinate in the hierarchy I receive the error <Set Name> invalid characteristic  for Input Field HKONT.
    The requirement is that on a report in BI we need to limit rows on a report to specific GL accounts and then specific transaction types (BEWAR) within those GL accounts.  We have around 20 reports that have the same format but the GL accounts and Transaction Types on each row are different - hence we wanted to use sets to maintain the GL accounts and transaction types for each row.
    So I've created several sets which are single sets and it all works fine.  But when I create a multidimensional set (with Account and Transaction Type) it works fine.  But when I attempt to add that as a subordinate set (ie to create the row in the report hierarchy) I get this message. 
    The Set that contains the rows can't be a multidimensional set as I can't add multi-dimensional sets to multi-dimensional sets.  
    Anyone come across this or know of a way around it ?  or perhaps a different approach.
    Thanks

    Hi
    I guess the problem is because, in a multi dimensional set, you have more than one char i.e. HKONT and BEWAR... In your report row, have you included both of these chars or just one?
    Try to include both the chars and then use a multi dimensional set in the row...
    The idea of multi dimensional set is that no char in it should repeat... When you are adding this multi set to a BASIC SET or SINGLE SET, you are bound to get this error in GS01
    Br, Ajay M

  • Multi-dimensional arrays with non-specified dimension

    Hi all,
    I'm trying to write a method to create a multi-dimensional array of
    Integer, based on another one, taken as parameter. I would like the
    method to work for an array of a non-specified dimension, that is,
    it could take as parameter a Integer[], or a Integer[][], or a
    Integer[][][] and so on.
    The idea is to have as a result an array with the original elements
    doubled.
    Here is my recursive function:
        public static Object[] f(Object[] a) {
             // the array to be returned is created with the
             // same size as the original
            Object[] r = new Object[a.length];
            for (int i=0; i<a.length; i++) {
                Object elem = a;
    Object newElem = null;
    if (elem instanceof Object[]) {
    // Recursive case
    newElem = f((Object[]) elem);
    } else if (elem instanceof Integer) {
    // Base case
    newElem = new Integer(((Integer)elem).intValue() * 2);
    r[i] = newElem;
    return r;
    This method returns an array with the same structure (that is, same
    dimensions) of the array taken in the constructor. In the recursive
    case, it just calls the function to the inner arrays. In the base
    case, where I have an Integer, it creates a new Integer, whose
    value is the old multiplied by 2.
    Then I initialize an array:
        public static void main(String args[]) throws Exception {
            Integer[][] a = new Integer[][] {
                new Integer[] {
                    new Integer(0), new Integer(2)
                new Integer[] {
                    new Integer(1), new Integer(4), new Integer(3)
      // And try to call the function like this:
            Integer [][] b = (Integer [][]) f(a);
        }   And I get a java.lang.ClassCastException: [Ljava.lang.Object;
    I don't understand the reason of this exception, because the
    object returned is a Integer[][]. Isn't it?
    And since I don't have a compiler error in the cast, that means
    that Object[] and Integer[][] are not inconvertible. Right?
    Could anyone explain me why this is wrong and/or give me some
    ideas to do what I'm trying to do?
    Thanks a lot,
    Angela

    I retract my previous statement about using
    reflection. Use "Object[] r =(Object[])a.clone()"
    to create a new array of the same type.You don't need temporary array variable here.
    You could simply use argument a instead of r.
    (But this my gotcha is derived from your clever rep.)Well, this isn't a temporary variable, its the return variable, which is different. If you don't want the original matrix changed, you have to clone the argument.

  • Error trying to create a Power View report against a Multi Dimensional SSAS cube

    Hi all,
    We have installed the Power View For Multidimensional Models CTP, released last November 27 on our Analysis Server instances.  I am now trying to create a Power View report in SharePoint that is connected to a Multi-Dimensional cube.
    I have followed the instructions diligently:
    1. Install the CTP
    2. Created a data connection of type "Microsoft BI Semantic Model for Power View" (see attachment #1)
    3. Tested that the connection was valid (all is good here!)
    I then select the "Create Power View Report" option from the data connection that I created above.
    The Power View GUI appears, and then throws an error:
    Error text:
    "An error occurred while loading the model for the item or data source 'http://server/site/SalesVarianceAnalysis_MDX.rsds'. Verify that the connection information is correct and that you have permissions to access the data source."
    The details of the error are:
    <detail><ErrorCode xmlns="rsCannotRetrieveModel</ErrorCode><HttpStatus">http://www.microsoft.com/sql/reportingservices">rsCannotRetrieveModel</ErrorCode><HttpStatus
    xmlns="400</HttpStatus><Message">http://www.microsoft.com/sql/reportingservices">400</HttpStatus><Message xmlns="An">http://www.microsoft.com/sql/reportingservices">An
    error occurred while loading the model for the item or data source 'http://hubtest/sites/broadcasting/thewowzone/Data Connections/SalesVarianceAnalysis_MDX.rsds'. Verify that the connection information is correct and that you have permissions to access the
    data source.</Message><HelpLink xmlns="http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsCannotRetrieveModel&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=11.0.3000.0</HelpLink><ProductName">http://www.microsoft.com/sql/reportingservices">http://go.microsoft.com/fwlink/?LinkId=20476&amp;EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&amp;EvtID=rsCannotRetrieveModel&amp;ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&amp;ProdVer=11.0.3000.0</HelpLink><ProductName
    xmlns="Microsoft">http://www.microsoft.com/sql/reportingservices">Microsoft SQL Server Reporting Services</ProductName><ProductVersion xmlns="11.0.3000.0</ProductVersion><ProductLocaleId">http://www.microsoft.com/sql/reportingservices">11.0.3000.0</ProductVersion><ProductLocaleId
    xmlns="127</ProductLocaleId><OperatingSystem">http://www.microsoft.com/sql/reportingservices">127</ProductLocaleId><OperatingSystem xmlns="OsIndependent</OperatingSystem><CountryLocaleId">http://www.microsoft.com/sql/reportingservices">OsIndependent</OperatingSystem><CountryLocaleId
    xmlns="1033</CountryLocaleId><MoreInformation">http://www.microsoft.com/sql/reportingservices">1033</CountryLocaleId><MoreInformation xmlns="<Source>ReportingServicesLibrary</Source><Message">http://www.microsoft.com/sql/reportingservices"><Source>ReportingServicesLibrary</Source><Message
    msrs:ErrorCode="rsCannotRetrieveModel" msrs:HelpLink="http://go.microsoft.com/fwlink/?LinkId=20476&amp;EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&amp;EvtID=rsCannotRetrieveModel&amp;ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&amp;ProdVer=11.0.3000.0"
    xmlns:msrs="An">http://www.microsoft.com/sql/reportingservices">An error occurred while loading the model for the item or data source '<omitted for security purposes>.
    Verify that the connection information is correct and that you have permissions to access the data source.</Message><MoreInformation><Source></Source><Message>For more information about this error navigate to the report server
    on the local server machine, or enable remote errors</Message></MoreInformation></MoreInformation><Warnings xmlns="http://www.microsoft.com/sql/reportingservices" /></detail>
    So, I can connect with the connection, but I get an error when connecting with Power View. 
    Any suggestions are appreciated.
    Thanks...
    /Peter
    Peter

    Hi Peter - are you specifying the cube name in the connection string?
    Data Source=[server];Initial Catalog=AdventureWorksDW-MD;Cube='Adventure Works'
    Check out
    http://blogs.msdn.com/b/analysisservices/archive/2012/12/09/power-view-for-multidimensional-models-feature-drill-down.aspx

  • Setting up a multi dimensional array of objects

    Hey ya'll. How would i setup a multi dimensional array with this structure?
    TypeSave(Title, material(name, quantity))
    TypeSave[1](Lego Shop, material[1](Lego Blocks, 100))
                   material[2](Roof, 1))
    TypeSave[2](Lego Car, material[1](Door, 2))
              material[2](Gravy, 3, ounces))
    TypeSave will be saved as a serialised object to a file so i can load everything within it and keep the structures integrity.
    I'll have an add button that will add the name and quantity to the next empty position of "material" array. This will then be listed in a list box and allow me to save all the materials with a title to the TypeSave list in the next empty position.
    I'm getting mightily confused how to set up the classes and the array structure :(
    Any help would be greatly appreciated!

    private TypeSave t = new TypeSave();
    private void btnSaveItemActionPerformed(java.awt.event.ActionEvent evt) {                                             
            t.addItem(txtItemTitle.getText(), new Material(txtMaterialName.getText(),txtQuantity.getText()));
            t.saveToFile();
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new MainForm().setVisible(true);
        class Material implements Serializable {
         String name = null;
         String quantity = null;
         //To restrict default constructor
         private Material() {
         public Material(String name, String quantity) {
              this.name = name;
              this.quantity = quantity;
         public String getName() {
              return this.name;
         public String getQuantity() {
              return this.quantity;
         public String toString() {
              return "Name : " + this.name + "Quantity : " + this.quantity;
    class TypeSave implements Serializable {
         private Hashtable items = null;
         public TypeSave() {
              items = new Hashtable();
         public void addItem(String title,Material material) {
              ArrayList materials = (ArrayList) items.get(title);
              if(materials == null) {
                   materials = new ArrayList();
                   items.put(title,materials);
              materials.add(material);
         public Hashtable getItems() {
              return this.items;
         public ArrayList getItem(String title) {
              return (ArrayList)this.items.get(title);
            void saveToFile() {
        ObjectOutputStream oos = null;
            try
            oos = new ObjectOutputStream(new FileOutputStream("item.ser"));
            catch (IOException i)
              System.out.println( "Error opening file");
          try
            oos.writeObject(items);
            catch (IOException o)
                System.out.println("Error writing file");
          try
              if(oos != null)
              oos.close();
            catch (IOException x)
                System.out.println("Error closing file");
    }My save class was working, but i tried to merge it to test this code structure and now it's failing with excepion:
    "Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException"
    any ideas?

  • How to create SET in gs01 ?

    Hi friends...
    I  created one FI report, in which i have hard coded some G/Ls. But users saying that i have to create a SET to maintain  that G/Ls. How to Create a set in GS01 & How to
    refer it in my coding ?
    Plz help me. It is very Urgent.

    Ram,
    Follow the link given below to create a SET.
    [Create SET|http://www.purdue.edu/onepurduehelp/content/fi_gl_gs01_create_sets/wi/html/index.htm]
    And now the Link on How to Use the SET
    [How to Use|http://help.sap.com/saphelp_erp2005/helpdata/EN/5b/d2297e43c611d182b30000e829fbfe/frameset.htm]
    Hope this helps.
    Vinodh Balakrishnan

  • Populating ADF Table from Multi-Dimensional Array

    Hello!
    I'm trying to populate an ADF table from a multi-dimensional array.
    Let's say that my array is
    String [] [] myArr = new String [3][5].
    On my page backing bean, I have a private attribute called tmpArr like this...
    String [] [] tmpArr;
    ...which I will initialize later after I know the proper dimensions. The dimensions will come from a multimap that contains a key and and another array (for the key's value) containing values for the key. So once I know the dimensions I initialize my array with...
    tmpArr = new String [x][y] where x and y are the dimensions (counters).
    Now I have my multidimension array. On an jsp page I have an ADF table, and I'm setting the value for the table to the array (the table's value property is bound to the backing bean's tmpArr attribure).
    Like so:
    <af:panelForm id="availableOptions"
    binding="#{myBackingBean.availableOptionsValues}">
    <af:table emptyText="No items were found" rows="10"
    value="#{myBackingBean.tmpArr}" var='myArr'>
    Now I need to know how to do the following:
    1) Set the table's columns based on the number of attributes on the array.
    2) Set the table's rows based on the array's length.
    3) Set each table cell value to values on the array's 2nd dimension. I'm assuming that ADF takes care iterating through the array, and that I should do something like...
    <af:outputText value="#{myArr[][0]}"/>
    <af:outputText value="#{myArr[][1]}"/>
    etc...
    However, this isn't working...
    javax.faces.el.ReferenceSyntaxException: myArr[][0]
    ...bla bla bla...
    Was expecting one of:
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <STRING_LITERAL> ...
    "true" ...
    "false" ...
    "null" ...
    "not" ...
    "empty" ...
    <IDENTIFIER> ...
    Is there a blog or resource (article, book, etc) that shows how this is done? Anyone has done this and would like to share how?
    Thank you.

    This is in fact possible. I'm not sure about the "best practice" around doing this but there is a couple of ways to do this.
    You can either create a managed bean then right click on it and use the wizard to create a data control or you can do it as per below
    The a table will convert an array into a collection.
    Once you have created an array and generated the accessors in a bean you can then reference the mutli-dimensional array from a table as per below.
    <af:table value="#{pageFlowScope.PageBean.sessionArr}" var="row" rowBandingInterval="0" id="t1" varStatus="status">
    <af:column sortable="false" headerText="col1" id="c1">
    <af:outputText value="#{pageFlowScope.PageBean.sessionArr[status.index][0]}" id="ot1"/>
    </af:column>
    </af:table>
    String [][] sessionArr = new String[5][2];
    public void setSessionArr(String[][] sessionArr) {
    this.sessionArr = sessionArr;
    public String[][] getSessionArr() {
    sessionArr[0][0]="rice";
    sessionArr[1][0]="water";
    return sessionArr;
    EDIT: For either of the above methods the managed bean must have a scope of pageFlow or longer.
    Cheers,
    Aaron
    Edited by: Aaron Rapp on Oct 6, 2011 3:28 PM

  • Best practice in JSTL with multi-dimensional arrays

    Hi,
    I'm working in a project and I'm trying to convert some code into JSTL way, I have a first.jsp that calls addField(String, String) from fieldControl.jsp:
    (first.jsp)
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ include file="fieldControl.jsp" %>
    <html>
    <head><title>JSP Page</title></head>
    <body>
    <%! String[][] list1;
    %>
    <%
    list1 = new String[2][2];
    list1[0][0]="first_1";
    list1[0][1]="first_2";
    list1[1][0]="second_1";
    list1[1][1]="second_2";
    for (int i=0;i<list1.length;i++){
    String html;
    html = addField (list1[0], list1[i][1]);
    out.println(html);
    %>
    </body>
    </html>
    (fieldControl.jsp)
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page language="java" %>
    <%! public void addField(String name,String label)
    return ...
    Now for JSTL I've this example from "JSTL pratical guide for JSP programmers" Sue Spielman:
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <html>
    <head>
    <title>
    Display Results
    </title>
    </head>
    <body>
    <%-- Create a HashMap so we can add some values to it --%>
    <jsp:useBean id="hash" class="java.util.HashMap" />
    <%-- Add some values, so that we can loop over them --%>
    <%
         hash.put("apples","pie");
         hash.put("oranges","juice");
         hash.put("plums","pudding");
         hash.put("peaches","jam");
    %>
    <br>
    <c:forEach var="item" items="${hash}">
    I like to use <c:out value="${item.key}" /> to make <c:out value="${hash[item.key]}" />
    <br>
    <br>
    </c:forEach>
    </body>
    </html>
    and my problem is :
    1st - how to use the multi-dimensional array in this way (<jsp:useBean id="hash" class="java.util.HashMap" />) ? because if I use it like this
    <% String[][] list1;
    list1 = new String[2][2];
    list1[0][0]="first_1";
    list1[0][1]="first_1";
    list1[1][0]="second_1";
    list1[1][1]="second_2";%>
    <c:out value="${list1}" />
    <c:out value="${list1.lenght}" />
    I get nothing,
    also tryed <c:set var="test" value="<%=list1.length%>" /> and got "According to TLD or attribute directive in tag file, attribute value does not accept any expressions"
    2nd hot to make the call to the method addField?
    Thanks for any help, I really want to make this project using JSTL, PV

    When you are using JSTL, it is best to not put data inside the JSP. Put it inside JavaBeans. Then make calles to the methods in those JavaBeans.
    So you should get used to JavaBeans and their requirenments.
    Access JavaBeans only through 2 types of methods: getters and setters.
    Getters are used to "get" values (properties) from the bean, and always have the form
    public Type getPropertyName(void)
    That is, they are public, return some value, start with the exact string "get" end with the name of the property (first letter of the property name capitalized) and have a void (empty) argument list.
    For example, this is a good signature to get HTML from a bean:
    public String getHtml()
    Setters are used to assign values to a bean. They always have the form
    public void setPropertyName(Type value)
    That is, they are public, do not return anything, start with the string "set", end with the name of the property (first letter capitalized), and take a SINGLE parameter.
    public void setHtml(String value)
    Also, JavaBeans must have a no argument constructor and need to be Serializable.
    The way I would approach this would be to create a JavaBean that holds the two dim array for you, and has a getter that returns a list of all the formatted html.
    package mypack;
    import java.util.List;
    import java.util.ArrayList;
    public class DataFormatterBean implement java.io.Serializable {
      private String[][] list;
      public DataFormatterBean() {
        list = new String[2][2];
        list[0][0]="first_1";
        list[0][1]="first_2";
        list[1][0]="second_1";
        list[1][1]="second_2";
      public List getHtml() {
        List outputHtml = new ArrayList(list.length);
        for (int i = 0; i < list.length; i++) {
          String html = addField(list[0], list[i][1]);
    outputHtml.add(html);
    return outputHtml;
    private addField(String a, String b) { .. do work .. }
    Then, the JSP would look like this:
    <jsp:useBean id="dataFormatter" class="mypack.DataFormatterBean"/>
    <c:forEach var="htmlString" items="${dataFormatter.html}">
      <c:out value="${htmlString}"/>
    </c:forEach>Once you start thinking in terms of having JavaBeans do your work for you JSTL is so much easier... and it gets even easier when you start to delve into custom tags.

  • Create a two dimensional table in Acess

    Hi,
    I am working with a database and the toolkit "the database connectivity tooset". I know how to create a new table from labview, but is it possible to create a "two dimensional" table from labview, i.e, where one table in Microsoft Access is linked to another one. I know how to do it in access, but it should be possible in program to crate a new table and this one has to be linked to another one then, just like the others. Does someone know how to do it??
    Thank you!

    Hi
    I assume you are not so familiar with databases, are you?
    First I want to comment your previous post:
    well I have a table for a product that contains, say different data for the product, i.e. the date of the test, who is responsible for the test, where it was performed. Also, linked to the date (I guess it is the primary key), there are also some data related. so in my table in the database, next to the date, there is a "+"-sign, so I can open up the page of all the data related to the date.
    Well, did you create this database on your own? So you must have created two tables (table one with fields Datum, Responsible & Cost and table two with fields Place1, Place2, Place3 & Place4). Then you must have dragged on field from one table to another field in the other table in the "Relations" view of access. Doing so, you created a relation. Due to this, access now knows how this date is related and displays the "+"-sign. You can not assume that the date is the primary key.
    In fact you do not have a "2D" table, but just different datasets from two tables connected to each other. This connection is created by relations.
    So, if I know would like to create a new table in my program (each product has its own table, so a new product=a new table), I would also like to create this "data" sheet that is connected to the data. Bu how do I do that?
    I can easily just create a new table (i.e. a new product), just using the "DB Tools Create Table.vi". But I guess it is when I actually want to add the data to the database, where I create the "data" sheet? Using the "DB Tools Execute Query" and a SQL statement with INSERT INTO, is that the way to go?
    As mentioned before, this "datasheet" is just a dataset from a second table which is made displayable by the relation. So if you're question is "how to create a relation using LV", you are quite on the right way. First create two tables one of which has to contain a field where the primary key from the other table is linked to. Then you have to set a PK in one table (using SQL statements) and then build the relation (also using SQL statements). I can't tell you, if you have to define the foreign key in the second table too.
    Have a look at the MS-Access help on how to assign relations and how to define primary keys. There may be something to take care off. Basically standard SQL should do - but using MS you never know .
    As this is somehow complicated, I always create the database structure in MS Access and that's it - afterwards all is done programatically (write and read data). Usually I don't open the database again with Access unless there is a special task.
    Hope this helps you a little bit otherwise come and ask again.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...

  • Binding arraylist, list, or multi-dimensional array to table in web dynpro

    Greetings,
    I like to ask if anyone knows how to bind data from an arraylist, list, or multi-dimensional array list to a table in web dynpro, your help is much appreciated.
    Thanks in advance.
    Cory

    Is there a way to create or cast a multi-dimensional
    array from a Collection or Vector ?
    ArrayList list = new ArrayList();
    list.add( new Object[4] );
    Object[] array2 = list.toArray(); // is only
    single dimension !
    Of course it is a single dimension array.
    Check the definition of the toArray() function, and the specification of arrays in general.
    toArray() returns a one dimensional array.
    In your case it will return an array of arrays. So array2[0] will be an array of 4 objects.
    That just happens to be a 2 dimensional array though you may (I haven't checked it) need some parentheses to call the elements.
    Try Object o = array2[0][1]; and if that doesn't work Object o = (array2[0])[1];

  • Stored Procedure in Universe - Multi-result set

    I have been trying to get more information on stored procedures as a source for universes. Business Objects designer 3.1 documentation says the following
    Stored procedures with multi-result set
    Example: A stored procedure that returns more than one result set. At design
    time, several tables are created in the universe structure based on the same
    stored procedure.
    Does this mean?
    1. These result sets are shown as multiple tables in designer?
    2. if so, can these result sets be used as regular tables in designer to build joins and contexts.
    I searched the forum for relevant threads before posting but could not find any. I tried posting this thread earlier - internet connection timed out. Please forgive me if this is a duplicate post.
    Thanks

    DROP TABLE #DescendantsMS SQL Server - right?
    Then don't drop the table.
    From the MS docs for "create table"
    Local temporary tables are visible only in the current session;
    A local temporary table created in a stored procedure is dropped automatically when the stored procedure completes. The table can be referenced by any nested stored procedures executed by the stored procedure that created the table. The table cannot be referenced by the process which called the stored procedure that created the table.

  • JNI: Multi-dimensional (3-D) Array [][][]

    Hi,
    Am having trouble with passing multi-dimensional arrays from C++ to Java.
    The Java method receives an object but it's contents are null.
    The received (in Java) object's length is correct.
    If I only have a 2d array, I do not encounter a problem.
    // Create the class
    jclass intClass = env->FindClass("[I");
    // Create 1st and 2nd array
    jobjectArray array1 = env-> NewObjectArray(30, intClass, NULL)
    jobjectArray array2 = env-> NewObjectArray(2, intClass, NULL)
    // Create 3rd Array
    jintArray array3 = env->NewIntArray(100);
    // Put some data into array3
    env-> SetIntArrayRegion(array3 , 0, 1, myBuffer);
    // Add array 3 to array 2 and array 2 to array 1
    env->SetObjectArrayElement(array2 , 0, array3);
    env->SetObjectArrayElement(array1 , 0, array2 );
    // Call the Java method
    env->CallVoidMethod(obj, mid, array1 )I have checked before calling the Java method that all 3 arrays are created and have the correct sizes.
    The example in Sheng Liang's book is only for 2d Arrays.
    Any ideas ?
    Many thanks.
    Andy

    Hi,
    I'm not very aware of arrays under JNI but I thought the number of [ were the number of dimension :
    // Create the class
    jclass intClass = env->FindClass("[[[I");--Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Multi-dimensional Array Question

    Hi all,
    I am trying to build a Multi-dimensional Object Array from several One Dimensional Object Arrays. I am looping through a .properties file to determine how many individual Object Arrays will be added to the Multi-dimensional Array. The part that I am having trouble with is in adding each Array to the Multi-dimensional Array in the loop.
    For example:
      public Object[] getRowData(String row_str)
        StringTokenizer st = new StringTokenizer(row_str,"|");
        Object[] row_data = new Object[st.countTokens()];
        for(int i = st.countTokens();i > 0;--i)
          Arrays.fill(row_data,st.nextToken());
        return row_data;
      public Object[][] getTableData()
        int rows = new Integer(resources.getString("Rows")).intValue();
        Object[][] data = null;
        for(int j = 0;j < rows;j++)
          String row_str = resources.getString("row_"+j);
          Object[] row_data = getRowData(row_str);
    // Here is the prolbem.  I need to add each individual row_data Array to the Multi-dimensional Array(data) .
    //      data = row_data;  This does not work.
        return data;
      }Thanks in Advance.

    Set the 2darray size ...then do some casting ...don't forget the index [j]:
        Object[][] data = new Object[rows][0];
        for(int j = 0;j < rows;j++)    {
          data[j] = (Object[]) row_data;
        }

  • Cloning multi-dimensional arrays

    I am working on this program of mine and really need some help since I am completely stuck, the thing is that I am trying to clone a multi-dimensional array, I have tried with a simple array and that worked fine, but not with the multi-dimensional. Like this:
    int[] initialSquareValues3 = {1,2,3};
    int[] squareValues3 = initialSquareValues3.clone();
    System.out.println(initialSquareValues3[0]);
    System.out.println(squareValues3[0]);
    squareValues3[0] = 3;
    System.out.println(initialSquareValues3[0]);
    System.out.println(squareValues3[0]);
    Will give the output "1 1 1 3", just what i want. While this:
    int[][] initialSquareValues2 = {{1,2,3}, {4,5,6}, {7,8,9}};
    int[][] squareValues2 = initialSquareValues2.clone();
    System.out.println(initialSquareValues2[0][0]);
    System.out.println(squareValues2[0][0]);
    squareValues2[0][0] = 3;
    System.out.println(initialSquareValues2[0][0]);
    System.out.println(squareValues2[0][0]);
    Will give the output "1 1 3 3" where "squareValues2" only seems to be a reference to the same data as the original "initialSquareValues2"
    So the question is simply: How do i clone a multi-dimensional array?
    I'm running Java SE 5.0 (1.5.0) and the code is run inside the contructor in a class extending JPanel.

    No need to explicitly do any copying of elements except as part of deepening the clone.
        public int[][] cloneIntArrays(int[][] array)
            // Create shallow clone
            int[][] clonedArray = array.clone();
            // Deepen the shallow clone
            for (int index = 0; index < clonedArray.length; index++)
                clonedArray[index] = clonedArray[index].clone();
            return clonedArray;
        }

  • Multi-Dimensional Arrays

    Greetings everyone,
    Currently I am working on a project for school, this is my first term in Java and a project we have been assigned to do is pretty much create a application (using the SDK for use on the computer only) and create a application where a new user can modify a new computer from a base system via combo boxes, check boxes, radio buttons and what not. Here is me question. I was going to try and get tricky and create a three dimensional array to link the combo box with a label so the end user could choose an up grade, see what the upgrade did and see what the cost was say for instance:
    Athlon 64X2 4200+(combo) amd athlon 64 X2 4200+ 2.2GHz 1MB Cache Add $300.00
    Each one of those i was thinking i could place in a seperate column and each have a variable already assigned such as array[0][0] = Athlon64X2 4200+ array[0][1]="AMD Athalon 64.." array[0][2]="Add $300.00". I thought that, maybe it is, and i did something wrong and missed something. Anyhow, now i have broke it down to trying to do it with a reg array feeding the combo and the two dimensional array doing teh cost upgrade and the description, i guess my question is, why is it when i seem to try everything to grab the information i set in the array it does not seem to want to pull it. And if and when i do get it to work, how can i link the two dim with the combo. I am rather confused, maybe i am looking more into it then there really is, which i have done in other languages.
    If someone could give me a moch code using what i had there so i might clear the fog in me head, it would be greatly appreciated. If i have confused others with my confusion, just ask and i will try to clear it up. Thanks for all and any help.
    Whitz3nd

    The course i am taking is a rather basic Java programming class. We are using arrays instead of databases to get use to working with handling data. That is why the arrays. If that clears anything up. I know it seems kind of crude, like i said it is a basic Java class.
    Here is an easier question, that i would like to know:
    in a two dimensional array,
    if i had this info:
    AMD Athlon64 3100+
    AMD Athlon64 3300+
    AMD Athlon64 3800+
    and
    Add $100.00
    Add $200.00
    Add $200.00
    How would i place this data into an array. Would it be this way:
    String [][] test = { {"AMD Athlon64 3100+,Add $100.00"}, {"AMD Athlon64 3300+,Add $200.00"},{"AMD Athlon64 3800+,Add $200.00"} };
    As i said, i am a new person to the programmaing world, so please excuse my shortcomings!

Maybe you are looking for