JNI - Passing an object containing an array field

I need to pass an object to a native method. The object contains several int fields and a field that is an int array (contains 32 int).
I have no problem with the int fields, but do not know how to access the int array field in the C code. What approach should be used to get/set values in the int array field?
Any suggestions are appreciated.

I have been reading up on the subject, but I guess I'm just an idiot. If all the answers were obvious from reading the specification then there wouldn't be much point to this forum.
For int fields in the object passed to the native function I do the following to set the value:
fid = (*env)->GetFieldID(env, cls, "intFieldName", "I");
(*env)->SetIntField(env, myObj, fid, newValue);
For a field that is an array of int, it seems that I can get the field ID as follows:
fid = (*env)->GetFieldID(env, cls, "arrayFieldName", "[I");
The "Get<Type>Field" and "Set<Type>Field" methods can be used for object, boolean, byte, char, short, int, long, float, double. Nothing specific here for array. Should I use the GetObjectField method, if so can the object field then be handled as an array? This is where I am missing something. I have experimented with using the SetIntArrayRegion method but this causes an exception - obviously missing a necessary step here. I am hoping someone here can provide guidance on what I am missing, what JNI functions I should be using, or refer me to the appropriate page of the specification or other document where it is explained (for idiots like me).

Similar Messages

  • Authorization objects which contain company code field

    Hi,
    We are looking for list of Authorization objects which contain company code field for Audit. The listing should have Role, Authorization obj and the <b>company code and values</b>.
    Is there any we can query this info.
    Thanks,
    Sam
    Message was edited by: Sam

    Hi,
    You can use the follwing
    in USR12 table
    in USOBT table (but you get the details for the Auth Obj in the Tcodes and their field values.
    But as far as my knowledge goes you will get all the Auth Obj with Company code field
    Caution: If there are some objects in not check or are which are not in any tcodes then they will not be captured.
    But they are very less I guess and so i think you can capture most of the Auth Obj I guess
    Message was edited by: Manohar Kappala

  • Please tell me how I can set an array field to an object?

    Hi,
    Please tell me how I can set the plID (an array field) to an object? This result is for one Agent object. Suppose the Agent object only has these two fields.
    If a sql query result is something like this (which is one object).
    agent_last PLID
    smith      5
    smith               6
    smith               7
    Agent agent = new Agent();
    StringBuffer sql = new StringBuffer();
    int count = getPLNo(agentID);// # of the query result
    try {
    SQL tsql = new SQL();
    Connection conn = tsql.getConnection();
    sql.append("SELECT agent_last, b.PLID ");
    sql.append("FROM Agent a, PL b ");
    sql.append("where a.agent_id = b.agent_id ");
    sql.append("and a.agent_id = ? ");
    PreparedStatement st = conn.prepareStatement(sql.toString());
    st.setInt(1, agentID);
    ResultSet rs = st.executeQuery();
    while (rs.next()) {
    agent.setAgentID(agentID);
    agent.setAgentLast(rs.getString(1));
    for ( int i = 0 ; i < count; i++ ) {               //how to do it?
    agent.setPrivateLabelID(new int[] {rs.getInt(2)});//how to do it?
    st.close();
    rs.close();
    tsql.close();
    } catch (SQLException e) {
    System.out.println("SQL: " + e.getMessage());
    throw new Exception(e.getMessage());
    } catch (Exception e) {
    System.out.println("Except: " + e.getMessage());
    throw new Exception(e.getMessage());
    return agent;
    }

    If that's not what you're looking for, then you get
    what you pay for. :-)Hi fmeyer75,
    Thank you very much for your input. That's exactly what I was looking for and it works!!!!
    For anyone who has similar issue, I changed the code a little to make it work with my existing ones. I never splited queries before, so please tell me if there's a better way to handle it.
    I keep the first half part and changed a little for the second half. Below is what I use now
    sql.setLength(0);
    sql.append("SELECT PLID ");
    sql.append("FROM PL ");
    sql.append("where agent_id = ? ");
    List list = new ArrayList();
    PreparedStatement st2 = conn.prepareStatement(sql.toString());
    st2.setInt(1, agentID);
    ResultSet rs2 = st2.executeQuery();
    while (rs2.next()) {
                 list.add(new Integer(rs2.getInt(1)));
    agent.setPrivateLabelID(new int[list.size()]) ;
    for ( int i = 0 ; i < list.size(); i++ ) {
    agent.getPrivateLabelID() = ((Integer)
    list.get(i)).intValue() ;
    st.close();
    rs.close();
    st2.close();
    rs2.close();

  • How can I pass a docking container to a program in a non-simple context?

    Dear colleagues,
    I want to pass a docking container like the one in SE80 to another program.
    The following code works fine:
    REPORT z_moving_dock.
    DATA: cl_docker type REF TO cl_gui_docking_container.
    PARAMETERS: test.
    INITIALIZATION.
      CREATE OBJECT cl_docker EXPORTING no_autodef_progid_dynnr = 'X'.
    END-OF-SELECTION.
      WRITE:/ test.
    But I cannot extend this to my current program. There I sourced out anything related to the GUI into a function group to obey the MVC paradigma. (That's maybe the error in reasoning, but I'm following the book Design Patterns in Object-Oriented ABAP from SAP Press and -- of course -- good and healthy programming style.)
    So it's a function group which knows the dynpros and controls, the main program knows only the data.
    Now I have a docking container like the one in SE80. We have many working older programs and I want to switch to them carrying the docking container with me. I have searched the Demos in SAP, the Online Help, the SAP Library, Books, the Web, this Forum, but none of them goes beyond the simpler examples that always work.
    I tried the LINK method on the docking container. I tried it before calling the new program (btw. by SUBMIT). I tried it afterwards from the called program (via a function module from the aforementioned group -- but the group is tied to the old program context and therefore I am in a new "instance" of it). I tried different values for REPID and DYNNR in LINK. I debugged SE80 -- too complicated!
    If it works well I get the container back when I return to the calling program. If it works badly the container is completely lost.
    Perhaps I should export something to memory?
    But I strongly would prefer not to alter the called programs: In the future I might also want to call a SAP standard program.
    I also didn't find some documentation explaining what is going on in the background so I could figure out in which direction to "think".
    I also tested the following code on SAP R/3 4.7 and SAP ERP 2005 with the same results.
    In the meantime I also created a minimal example. First the triggering report:
    REPORT z_moving_docking_container.
    DATA: g_example TYPE REF TO zcl_moving_docking_container.
    CREATE OBJECT g_example.
    This obviously calls the main class ZCL_MOVING_DOCKING_CONTAINER which has only this constructor:
    METHOD constructor.
      CALL FUNCTION 'Z_SHOW_DYNPRO'.
    ENDMETHOD.
    Normally this class should handle the business logic. Here it only calls this function module. In the appropriate function group, say Z_MOVING_DOCKING_CONTAINER, I have these declarations in the TOP-Include:
    FUNCTION-POOL z_moving_docking_container.
    DATA:
      gv_okcode TYPE ui_func,
      go_docker TYPE REF TO cl_gui_docking_container.
    The function group also contains a dynpro 9000 with this flow logic:
    PROCESS BEFORE OUTPUT.
      MODULE status_9000.
    PROCESS AFTER INPUT.
      MODULE user_command_9000.
    The modules are straightforward:
    MODULE status_9000 OUTPUT.
      SET PF-STATUS '9000'.
      IF go_docker IS INITIAL.
        CREATE OBJECT go_docker
               EXPORTING no_autodef_progid_dynnr = 'X'.
      ENDIF.
    ENDMODULE.
    with at least the function code ONLI defined in PF-status 9000 and
    MODULE user_command_9000 INPUT.
      IF gv_okcode = 'ONLI'.
        SUBMIT z_sample_report AND RETURN.
      ELSE.
        LEAVE PROGRAM.
      ENDIF.
    ENDMODULE.
    The report Z_SAMPLE_REPORT can be any report you like.
    At last the function module contains the following code:
    FUNCTION z_show_dynpro.
    *"*"Lokale Schnittstelle:
      CALL SCREEN 9000.
    ENDFUNCTION.
    As I see this, this is a straightforward application of the working example at the top and the principles of MVC and encapsulation of the dynpro logic (to "avoid" global variables as best as possible).
    Clearly in some sense this is an academic question, but I have built a fairly big application like that up to now ...
    </edit>
    Thanks for reading and contemplating,
    Thomas
    Edited by: Thomas Geiß on Feb 4, 2009 11:03 AM
    Edited by: Thomas Geiß on Feb 4, 2009 11:59 AM
    Edited by: Thomas Geiß on Feb 4, 2009 12:01 PM

    You'll either have to pass the data in as parameters in the applet tags or create a JavaScript tag and have the JavaScript pass it in. If the array is very large then you open a connection between the Applet and a servlet and pass the data that way.

  • Re: Focus Highlight Property of an Array Field

    Hi Rhonda,
    There was a couple of discussions about this subject a while ago. I
    remember
    of having posted a code sample myself. Take a look at the searchable
    archive.
    Ajith kallambella M.
    Forte Systems Engineer,
    International Business Corporation.
    From: "Shannon, Rhonda B" <[email protected]>
    Date: Fri, 21 Aug 1998 14:34:32 -0400
    Subject: Focus Highlight Property of an Array Field
    I have an array field on a window that is composedof >4 fields. The
    array field maps to an object that contains the 4
    fields. As the user
    scrolls through the array, I would like the entire
    current row to be
    highlighted, not just the current widget.
    I have been looking in the help both online and in
    the Fort=E9 manuals.
    In the index of the Display Library manual on page
    648, I see under the
    ArrayField class, a listing for FocusHighlightStyle
    attribute for page
    32. However, when I go to page 32, it is not there!
    In the online =help
    for Array Field, there is a section that lists the
    array field
    properties. In this section, there is a property
    listed called Focus
    Highlight. However, this is not in the properties
    dialogue box and I
    have no idea how to set it. I also looked in the
    online help under
    ArrayWidget. It says it provides the method which
    highlights the
    selected record in the array. However I cannot find
    this method
    anywhere in the help!
    Has anyone worked with any of these properties or
    methods? Or has
    anyone highlighted the entire current row in anarray >in a differentmanner?
    Any help/suggestions would be greatly appreciated!
    Thanks,Rhonda Shannon>_________________________________________________________
    DO YOU YAHOO!?
    Get your free @yahoo.com address at http://mail.yahoo.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Hi Rhonda,
    There was a couple of discussions about this subject a while ago. I
    remember
    of having posted a code sample myself. Take a look at the searchable
    archive.
    Ajith kallambella M.
    Forte Systems Engineer,
    International Business Corporation.
    From: "Shannon, Rhonda B" <[email protected]>
    Date: Fri, 21 Aug 1998 14:34:32 -0400
    Subject: Focus Highlight Property of an Array Field
    I have an array field on a window that is composedof >4 fields. The
    array field maps to an object that contains the 4
    fields. As the user
    scrolls through the array, I would like the entire
    current row to be
    highlighted, not just the current widget.
    I have been looking in the help both online and in
    the Fort=E9 manuals.
    In the index of the Display Library manual on page
    648, I see under the
    ArrayField class, a listing for FocusHighlightStyle
    attribute for page
    32. However, when I go to page 32, it is not there!
    In the online =help
    for Array Field, there is a section that lists the
    array field
    properties. In this section, there is a property
    listed called Focus
    Highlight. However, this is not in the properties
    dialogue box and I
    have no idea how to set it. I also looked in the
    online help under
    ArrayWidget. It says it provides the method which
    highlights the
    selected record in the array. However I cannot find
    this method
    anywhere in the help!
    Has anyone worked with any of these properties or
    methods? Or has
    anyone highlighted the entire current row in anarray >in a differentmanner?
    Any help/suggestions would be greatly appreciated!
    Thanks,Rhonda Shannon>_________________________________________________________
    DO YOU YAHOO!?
    Get your free @yahoo.com address at http://mail.yahoo.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Re: Is it possible to change row colors on array fields ors

    HI Martin!
    Yes, it is possible to change row colors on array fields.
    I have attached a PEX (tools.pex) which has an object which changes FillColor
    and PenColor for Arrays. The PEX has it's own test window, so you can try
    various combinations. (There are a few other Objects in the Project which are
    not relevant
    I'm not sure that you can change colors on individual choices in a scroll list.
    I haven't tried playing around with it.
    The test window actually changes the color of scroll lists as well.
    The object keeps track of which rows have changed color, same with pen color, so
    that when you scroll it keeps track of which rows are a different colors.
    The pex is self-contained, just import the file and do a test run.
    Please let me know if you have any problems.
    -later
    -labeaux
    Is it possible to change row colors on array fields or scroll lists?
    I need to create a list field that will allow me to dynamically change the
    fillColor and/or penColor attributes of individual rows. (I just want to
    highlight the rows, and those seem to be the obvious attributes...) It appears
    you can't do that on scroll lists (the elements are list elements, and don't
    have those attributes) and I can't figure out how to do it on an array field
    either. Any ideas for how to accomplish this?
    -Martin ([email protected])

    FreshWebmuse,
    Version 2 of iCal has the "Group Calendar" feature. It was released as part of Mac OS X v10.4, and if you really want/need that feature you will have to upgrade to Tiger.
    ;~)

  • Focus Highlight Property of an Array Field

    I have an array field on a window that is composed of 4 fields. The
    array field maps to an object that contains the 4 fields. As the user
    scrolls through the array, I would like the entire current row to be
    highlighted, not just the current widget.
    I have been looking in the help both online and in the Fort&eacute; manuals.
    In the index of the Display Library manual on page 648, I see under the
    ArrayField class, a listing for FocusHighlightStyle attribute for page
    32. However, when I go to page 32, it is not there! In the online help
    for Array Field, there is a section that lists the array field
    properties. In this section, there is a property listed called Focus
    Highlight. However, this is not in the properties dialogue box and I
    have no idea how to set it. I also looked in the online help under
    ArrayWidget. It says it provides the method which highlights the
    selected record in the array. However I cannot find this method
    anywhere in the help!
    Has anyone worked with any of these properties or methods? Or has
    anyone highlighted the entire current row in an array in a different
    manner?
    Any help/suggestions would be greatly appreciated!
    Thanks,
    Rhonda Shannon
    e-mail: [email protected]
    phone: (908) 719-4583
    fax: (908) 719-4460
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Geoff,
    May I point out that in your function, the input Row should be converted to:
    Row - <theArrayField>.TopRow + 1;
    or before calling this function.
    Also the AfterFieldScroll event should be handled.
    (It's me, Michael)
    -----Original Message-----
    From: Geoffrey Whitington [SMTP:[email protected]]
    Sent: Friday, August 21, 1998 2:54 PM
    To: 'Shannon, Rhonda B'; '[email protected]'
    Subject: RE: Focus Highlight Property of an Array Field
    Shannon,
    As an Express developer, all of my windows get this functionality for
    free. Of course this is
    due to the fact that all ArrayFields inherit from a class that provides
    this functionality.
    The following snippet of code could be exactly what you are looking for,
    method HighlightRow(input Row : integer)
    if (Row >= 0) then
    for widget in <DisplayedResultSet>.bodygrid.children do
    if (widget.row = Row) then
    widget.fillcolor = C_PALEYELLOW;
    else
    widget.fillcolor = C_WHITE;
    end if;
    end for;
    end if;
    end method;
    I sure hope this helps you,
    Take care
    Geoff Whittington,
    VP Coop Development
    Its nice to be important,
    but its more important to be nice.
    - Blair
    -----Original Message-----
    From: Shannon, Rhonda B [mailto:[email protected]]
    Sent: Friday, August 21, 1998 2:35 PM
    To: '[email protected]'
    Subject: Focus Highlight Property of an Array Field
    I have an array field on a window that is composed of 4 fields. The
    array field maps to an object that contains the 4 fields. As the user
    scrolls through the array, I would like the entire current row to be
    highlighted, not just the current widget.
    I have been looking in the help both online and in the Fort&eacute; manuals.
    In the index of the Display Library manual on page 648, I see under the
    ArrayField class, a listing for FocusHighlightStyle attribute for page
    32. However, when I go to page 32, it is not there! In the online help
    for Array Field, there is a section that lists the array field
    properties. In this section, there is a property listed called Focus
    Highlight. However, this is not in the properties dialogue box and I
    have no idea how to set it. I also looked in the online help under
    ArrayWidget. It says it provides the method which highlights the
    selected record in the array. However I cannot find this method
    anywhere in the help!
    Has anyone worked with any of these properties or methods? Or has
    anyone highlighted the entire current row in an array in a different
    manner?
    Any help/suggestions would be greatly appreciated!
    Thanks,
    Rhonda Shannon
    e-mail: [email protected]
    phone: (908) 719-4583
    fax: (908) 719-4460
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Passing an object accross classes.

    Hi all,
    I'm trying to declare an object in one class and then pass that instance over to a second class, when I try to run my code I get "Debugger stopped on uncompileable source code" error!
    I'm working with a series of JFrames, starting with a "welcome" screen and a "next" button:
        Order[] Order = new Order[99];
        int OrderNumber = 0;
        public void actionPerformed(ActionEvent event) {
            Object source = event.getSource();
            if (source == btnNext){
                OrderNumber++;
                Order[OrderNumber] = new Order();
                Name Name = new Name(Order[OrderNumber]);
                Name.show();
                this.hide();
        }This sets up a new order and passes the object over to the next JFrame class.
    The user enters some information into some text fields which is then stored in the object instance:
        Order Order;
        Customer[] Customer = new Customer[99];
        int CustomerNumber = 0;
        Name(Order Order) {
            SetupUI();
            this.Order = Order;
        public void actionPerformed(ActionEvent event) {
            Object source = event.getSource();
            if (source == btnNext) {
                CustomerNumber++;
                Order.Customer[CustomerNumber] = new Customer();
                Order.Customer[CustomerNumber].SetName(txtName.toString());
                Order.Customer[CustomerNumber].SetTable(txtTable.toString());
                FirstCourseUI Menu = new FirstCourseUI(Order, Customer[CustomerNumber]);
                Menu.show();
                this.hide();
            }This seems to work fine, the object is passed over and I can commit the information to it. But this too uses the same method to send the objects over to the next JFrame, which should in turn begin adding some items for the customer:
        Order Order = new Order();
        Customer Customer = new Customer();
        FirstCourse FirstCourse = new FirstCourse();
        FirstCourseUI(Order Order, Customer Customer) {
            this.Order = Order;
            this.Customer = Customer;
            SetupUI();
        public void actionPerformed(ActionEvent event) {
            Object source = event.getSource();
            if(source == btnAdd) {
                String selectedItem = (String)lstMenu.getSelectedValue();
                Customer.AddItem(1, selectedItem);       // PROGRAM STOPS HERE
        }And this is where I run into problems, here is the AddItem method
        public void AddItem(int course, String item)
            int i = 0;
            switch(course)
                case 0:     // Drinks
                    break;
                case 1:     // First Course
                    while(FirstCourse[i] != null) {
                        i++;
                    FirstCourse[i] = item;
                    break;
                case 2:     // Second Course
                    break;
                case 3:     // Third Course
                    break;
                default:
                    break;
            }As far as I can tell, this should work fine. I don't think the method itself is broken, the program just never gets to that point!
    Any Ideas?
    P.S. Sorry about the lack of comments in there, bad practice I know :\

    Problem solved!
    On the second JFrame where the user enters their name and table number, I was creating an object array of Customer - but my order class already has a Customer array! I was then passing over the wrong object array when the "Next" button was pressed.
        Order Order;
        int CustomerNumber = 0;
        Name(Order Order) {
            SetupUI();
            this.Order = Order;
        public void actionPerformed(ActionEvent event) {
            Object source = event.getSource();
            if (source == btnNext) {
                CustomerNumber++;
                Order.Customer[CustomerNumber] = new Customer();
                Order.Customer[CustomerNumber].SetName(txtName.toString());
                Order.Customer[CustomerNumber].SetTable(txtTable.toString());
                CoursesUI Menu = new CoursesUI(Order, Order.Customer[CustomerNumber]);
                Menu.show();
                this.hide();
        }It seems to be functioning correctly now :) Thanks for taking the time to look over it steve.
    Regards -

  • How do I convert an Object into an Array?

    If I have an instance of type object that I know is really a DataGrid row that was cast into an object when passed to a function, how can I cast that Object to an array, such that each index of this array would correspond to the information in a given column of the row?

    @Sathyamoorthi
    Can you please explain what this function does? Essentially, what should be contained in the String?
    I printed out the string and it seems like I am getting a random row in the Object, as opposed to first or last. Why is that?
    UPDATE: I printed out the value of dataGrid0.columns[5].dataField but it just turned out to be the id of the column.

  • Trying to pass and object variable to a method

    I have yet another question. I'm trying to display my output in succession using a next button. The button works and I get what I want using test results, however what I really want to do is pass it a variable instead of using a set number.
    I want to be able to pass the object variables myProduct, myOfficeSupplies, and maxNumber to method actionPerformed so they can be in-turn passed to the displayResults method which is called in the actionPerformed method. Since there is no direct call to actionPerformed because it is called within one of the built in methods, I can't tell it to receive and pass those variables. Is there a way to do it without having to pass them through the built-in methods?
    import javax.swing.JToolBar;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JPanel;
    import java.net.URL;
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class Panel extends JPanel implements ActionListener
         protected JTextArea myTextArea;
         protected String newline = "\n";
         static final private String FIRST = "first";
         static final private String PREVIOUS = "previous";
         static final private String NEXT = "next";
         public Panel( Product myProduct, OfficeSupplies myOfficeSupplies, int maxNumber )
                 super(new BorderLayout());
              int counter = 0;
                 //Create the toolbar.
                 JToolBar myToolBar = new JToolBar( "Still draggable" );
                 addButtons( myToolBar );
                 //Create the text area used for output.
                 myTextArea = new JTextArea( 450, 190 );
                 myTextArea.setEditable( false );
                 JScrollPane scrollPane = new JScrollPane( myTextArea );
                 //Lay out the main panel.
                 setPreferredSize(new Dimension( 450, 190 ));
                 add( myToolBar, BorderLayout.PAGE_START );
                 add( scrollPane, BorderLayout.CENTER );
              myTextArea.setText( packageData( myProduct, myOfficeSupplies, counter ) );
              setCounter( counter );
         } // End Constructor
         protected void addButtons( JToolBar myToolBar )
                 JButton myButton = null;
                 //first button
                 myButton = makeNavigationButton( FIRST, "Display first record", "First" );
                 myToolBar.add(myButton);
                 //second button
                 myButton = makeNavigationButton( PREVIOUS, "Display previous record", "Previous" );
                 myToolBar.add(myButton);
                 //third button
                 myButton = makeNavigationButton( NEXT, "Display next record", "Next" );
                 myToolBar.add(myButton);
         } //End method addButtons
         protected JButton makeNavigationButton( String actionCommand, String toolTipText, String altText )
                 //Create and initialize the button.
                 JButton myButton = new JButton();
                     myButton.setActionCommand( actionCommand );
                 myButton.setToolTipText( toolTipText );
                 myButton.addActionListener( this );
                   myButton.setText( altText );
                 return myButton;
         } // End makeNavigationButton method
             public void actionPerformed( ActionEvent e )
                 String cmd = e.getActionCommand();
                 // Handle each button.
              if (FIRST.equals(cmd))
              { // first button clicked
                          int counter = 0;
                   setCounter( counter );
                 else if (PREVIOUS.equals(cmd))
              { // second button clicked
                   counter = getCounter();
                      if ( counter == 0 )
                        counter = 5;  // 5 would be replaced with variable maxNumber
                        setCounter( counter );
                   else
                        counter = getCounter() - 1;
                        setCounter( counter );
              else if (NEXT.equals(cmd))
              { // third button clicked
                   counter = getCounter();
                   if ( counter == 5 )  // 5 would be replaced with variable maxNumber
                        counter = 0;
                        setCounter( counter );
                      else
                        counter = getCounter() + 1;
                        setCounter( counter );
                 displayResult( counter );
         } // End method actionPerformed
         private int counter;
         public void setCounter( int number ) // Declare setCounter method
              counter = number; // stores the counter
         } // End setCounter method
         public int getCounter()  // Declares getCounter method
              return counter;
         } // End method getCounter
         protected void displayResult( int counter )
              //Test statement
    //                 myTextArea.setText( String.format( "%d", counter ) );
              // How can I carry the myProduct and myOfficeSupplies variables into this method?
              myTextArea.setText( packageData( product, officeSupplies, counter ) );
                 myTextArea.setCaretPosition(myTextArea.getDocument().getLength());
             } // End method displayResult
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event dispatch thread.
         public void createAndShowGUI( Product myProduct, OfficeSupplies myOfficeSupplies, int maxNumber )
                 //Create and set up the window.
                 JFrame frame = new JFrame("Products");
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                 //Add content to the window.
                 frame.add(new Panel( myProduct, myOfficeSupplies, maxNumber ));
                 //Display the window.
                 frame.pack();
                 frame.setVisible( true );
             } // End method createAndShowGUI
         public void displayData( Product myProduct, OfficeSupplies myOfficeSupplies, int maxNumber )
              JTextArea myTextArea = new JTextArea(); // textarea to display output
              JFrame JFrame = new JFrame( "Products" );
              // For loop to display data array in a single Window
              for ( int counter = 0; counter < maxNumber; counter++ )  // Loop for displaying each product
                   myTextArea.append( packageData( myProduct, myOfficeSupplies, counter ) + "\n\n" );
                   JFrame.add( myTextArea ); // add textarea to JFrame
              } // End For Loop
              JScrollPane scrollPane = new JScrollPane( myTextArea ); //Creates the JScrollPane
              JFrame.setPreferredSize(new Dimension(350, 170)); // Sets the pane size
              JFrame.add(scrollPane, BorderLayout.CENTER); // adds scrollpane to JFrame
              JFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); // Sets program to exit on close
              JFrame.setSize( 350, 170 ); // set frame size
              JFrame.setVisible( true ); // display frame
         } // End method displayData
         public String packageData( Product myProduct, OfficeSupplies myOfficeSupplies, int counter ) // Method for formatting output
              return String.format( "%s: %d\n%s: %s\n%s: %s\n%s: %s\n%s: $%.2f\n%s: $%.2f\n%s: $%.2f\n%s: $%.2f",
              "Product Number", myOfficeSupplies.getProductNumber( counter ),
              "Product Name", myOfficeSupplies.getProductName( counter ),
              "Product Brand",myProduct.getProductBrand( counter ),
              "Number of Units in stock", myOfficeSupplies.getNumberUnits( counter ),
              "Price per Unit", myOfficeSupplies.getUnitPrice( counter ),
              "Total Value of Item in Stock is", myOfficeSupplies.getProductValue( counter ),
              "Restock charge for this product is", myProduct.restockingFee( myOfficeSupplies.getProductValue( counter ) ),
              "Total Value of Inventory plus restocking fee", myOfficeSupplies.getProductValue( counter )+
                   myProduct.restockingFee( myOfficeSupplies.getProductValue( counter ) ) );
         } // end method packageData
    } //End Class Panel

    multarnc wrote:
    My instructor has not been very forthcoming with assistance to her students leaving us to figure it out on our own.Aren't they all the same! Makes one wonder why they are called instructors. <sarcasm/>
    Of course it's highly likely that enough information was imparted for any sincere, reasonably intelligent student to actually figure it out, and learn the subject in the process.
    And if everything were spoonfed, how would one grade the performance of the students? Have them recite from memory
    public class HelloWorld left-brace
    indent public static void main left-parenthesis String left-bracket right-bracket args right-parenthesis left-brace
    And everywhere that Mary went
    The lamb was sure to go
    db

  • Passing multiple values for a single field in URL to call sap Transaction

    Hi All,
    I need to pass multiple values for a single field to SAP transaction .
    means if i have say a field "Date" which can contain more than one value, <b>but its not a range which has two fields</b> . How is it possible.
    Let me know pls.
    Regards,
    Sirisha.R.S.

    Hi Satyajit,
    I need to call a transaction with multiple values which gives me the report based on those values.
    So I need to pass multiple values for a single parameter.
    I hope u got it.
    Regards,
    Sirisha.R.S.

  • How can i convert object to byte array very*100 fast?

    i need to transfer a object by datagram packet in embeded system.
    i make a code fallowing sequence.
    1) convert object to byte array ( i append object attribute to byte[] sequencailly )
    2) send the byte array by datagram packet ( by JNI )
    but, it's not satisfied my requirement.
    it must be finished in 1ms.
    but, converting is spending 2ms.
    network speed is not bottleneck. ( transfer time is 0.3ms and packet size is 4096 bytes )
    Using ObjectOutputStream is very slow, so i'm using this way.
    is there antoher way? or how can i improve?
    Edited by: JongpilKim on May 17, 2009 10:48 PM
    Edited by: JongpilKim on May 17, 2009 10:51 PM
    Edited by: JongpilKim on May 17, 2009 10:53 PM

    thanks a lot for your reply.
    now, i use udp socket for communication, but, i must use hardware pci communication later.
    so, i wrap the communication logic to use jni.
    for convert a object to byte array,
    i used ObjectInputStream before, but it was so slow.
    so, i change the implementation to use byte array directly, like ByteBuffer.
    ex)
    public class ByteArrayHelper {
    private byte[] buf = new byte[1024];
    int idx = 0;
    public void putInt(int val){
    buf[idx++] = (byte)(val & 0xff);
    buf[idx++] = (byte)((val>>8) & 0xff);
    buf[idx++] = (byte)((val>>16) & 0xff);
    buf[idx++] = (byte)((val>>24) & 0xff);
    public void putDouble(double val){ .... }
    public void putFloat(float val){ ... }
    public byte[] toByteArray(){ return this.buf; }
    public class PacketData {
    priavte int a;
    private int b;
    public byte[] getByteArray(){
    ByteArrayHelper helper = new ByteArrayHelper();
    helper.putInt(a);
    helper.putInt(b);
    return helper.toByteArray();
    but, it's not enough.
    is there another way to send a object data?
    in java language, i can't access memory directly.
    in c language, if i use struct, i can send struct data to copy memory by socket and it's very fast.
    Edited by: JongpilKim on May 18, 2009 5:26 PM

  • Passing complex object from bpel process to web service

    I have deployed my web service on apache axis.The wsdl file looks like as follows,
    <?xml version="1.0" encoding="UTF-8" ?>
    - <wsdl:definitions targetNamespace="http://bpel.jmetro.actiontech.com" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://bpel.jmetro.actiontech.com" xmlns:intf="http://bpel.jmetro.actiontech.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    - <wsdl:types>
    - <schema targetNamespace="http://bpel.jmetro.actiontech.com" xmlns="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
    - <complexType name="ADLevelBpelWS">
    - <sequence>
    <element name="adLevelStr" nillable="true" type="xsd:string" />
    <element name="id" type="xsd:int" />
    </sequence>
    </complexType>
    - <complexType name="TransResultWS">
    - <sequence>
    <element name="description" nillable="true" type="xsd:string" />
    <element name="id" type="xsd:long" />
    <element name="responseType" type="xsd:int" />
    <element name="status" type="xsd:boolean" />
    </sequence>
    </complexType>
    - <complexType name="NamespaceDataImplBpelWS">
    - <sequence>
    <element name="ADLevel" nillable="true" type="impl:ADLevelBpelWS" />
    <element name="appdataDef" nillable="true" type="apachesoap:Map" />
    <element name="description" nillable="true" type="xsd:string" />
    <element name="name" nillable="true" type="xsd:string" />
    </sequence>
    </complexType>
    - <complexType name="CreateSharedNamespaceBpelWS">
    - <sequence>
    <element name="actor" nillable="true" type="xsd:string" />
    <element name="comment" nillable="true" type="xsd:string" />
    <element name="from" nillable="true" type="xsd:string" />
    <element name="namespaceData" nillable="true" type="impl:NamespaceDataImplBpelWS" />
    <element name="priority" type="xsd:int" />
    <element name="processAtTime" nillable="true" type="xsd:dateTime" />
    <element name="replyTo" nillable="true" type="xsd:string" />
    <element name="responseRequired" type="xsd:boolean" />
    </sequence>
    </complexType>
    </schema>
    - <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
    - <complexType name="mapItem">
    - <sequence>
    <element name="key" nillable="true" type="xsd:string" />
    <element name="value" nillable="true" type="xsd:string" />
    </sequence>
    </complexType>
    - <complexType name="Map">
    - <sequence>
    <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem" />
    </sequence>
    </complexType>
    </schema>
    </wsdl:types>
    + <wsdl:message name="createNamespaceRequest">
    <wsdl:part name="createNs" type="impl:CreateSharedNamespaceBpelWS" />
    </wsdl:message>
    - <wsdl:message name="createNamespaceResponse">
    <wsdl:part name="createNamespaceReturn" type="impl:TransResultWS" />
    </wsdl:message>
    - <wsdl:portType name="JMetroWebService">
    - <wsdl:operation name="createNamespace" parameterOrder="createNs">
    <wsdl:input message="impl:createNamespaceRequest" name="createNamespaceRequest" />
    <wsdl:output message="impl:createNamespaceResponse" name="createNamespaceResponse" />
    </wsdl:operation>
    </wsdl:portType>
    - <wsdl:binding name="NAMESPACEWITHMAPSoapBinding" type="impl:JMetroWebService">
    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    - <wsdl:operation name="createNamespace">
    <wsdlsoap:operation soapAction="" />
    - <wsdl:input name="createNamespaceRequest">
    <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://bpel.jmetro.actiontech.com" use="encoded" />
    </wsdl:input>
    - <wsdl:output name="createNamespaceResponse">
    <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://bpel.jmetro.actiontech.com" use="encoded" />
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    - <wsdl:service name="JMetroWebServiceService">
    - <wsdl:port binding="impl:NAMESPACEWITHMAPSoapBinding" name="NAMESPACEWITHMAP">
    <wsdlsoap:address location="http://localhost:7001/axis/services/NAMESPACEWITHMAP" />
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>
    My NamespaceDataObjectImplBpelWS object contains element appDataDef which is of type java.util.Map.My bpel wsdl file is as below,
    <?xml version="1.0"?>
    <definitions name="NsWithMap"
    targetNamespace="http://bpel.jmetro.actiontech.com"
    xmlns:tns="http://bpel.jmetro.actiontech.com"
    xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:apachesoap="http://xml.apache.org/xml-soap"
    >
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TYPE DEFINITION - List of services participating in this BPEL process
    The default output of the BPEL designer uses strings as input and
    output to the BPEL Process. But you can define or import any XML
    Schema type and us them as part of the message types.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <types>
         <schema targetNamespace="http://bpel.jmetro.actiontech.com" xmlns="http://www.w3.org/2001/XMLSchema">
         <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
              <element name="createNamespace" type="tns:CreateSharedNamespaceBpelWS"/>
              <element name="transResult" type="tns:TransResultWS"/>
              <complexType name="TransResultWS">
                   <sequence>
                        <element name="description" type="string" />
                        <element name="id" type="long" />
                        <element name="responseType" type="int" />
                        <element name="status" type="boolean" />
              </sequence>
              </complexType>
              <complexType name="ADLevelBpelWS">
                   <sequence>
                        <element name="adLevelStr" type="string" />
                        <element name="id" type="int" />
                   </sequence>
              </complexType>
              <complexType name="NamespaceDataImplBpelWS">
                   <sequence>
                        <element name="ADLevel" type="tns:ADLevelBpelWS" />
                        <element name="description" type="string" />
                        <element name="name" type="string" />
                        <element name="appdataDef" type="apachesoap:Map" />
                   </sequence>
              </complexType>
              <complexType name="CreateSharedNamespaceBpelWS">
                   <sequence>
                        <element name="namespaceData" type="tns:NamespaceDataImplBpelWS" />
              </sequence>
              </complexType>
         <element name="desc" type="string"/>
         </schema>
         <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
                   <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
                        <complexType name="mapItem">
                             <sequence>
                                  <element name="key" type="string" />
                                  <element name="value" type="string" />
                        </sequence>
                        </complexType>
                        <complexType name="Map">
                             <sequence>
                             <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem" />
                             </sequence>
                        </complexType>
              </schema>
    </types>
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    MESSAGE TYPE DEFINITION - Definition of the message types used as
    part of the port type defintions
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <message name="NsWithMapRequestMessage">
    <part name="payload" element="tns:createNamespace"/>
    </message>
    <message name="NsWithMapResponseMessage">
    <part name="payload" element="tns:transResult"/>
    </message>
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    PORT TYPE DEFINITION - A port type groups a set of operations into
    a logical service unit.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- portType implemented by the NsWithMap BPEL process -->
    <portType name="NsWithMap">
    <operation name="initiate">
    <input message="tns:NsWithMapRequestMessage"/>
    </operation>
    </portType>
    <!-- portType implemented by the requester of NsWithMap BPEL process
    for asynchronous callback purposes
    -->
    <portType name="NsWithMapCallback">
    <operation name="onResult">
    <input message="tns:NsWithMapResponseMessage"/>
    </operation>
    </portType>
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    PARTNER LINK TYPE DEFINITION
    the NsWithMap partnerLinkType binds the provider and
    requester portType into an asynchronous conversation.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <plnk:partnerLinkType name="NsWithMap">
    <plnk:role name="NsWithMapProvider">
    <plnk:portType name="tns:NsWithMap"/>
    </plnk:role>
    <plnk:role name="NsWithMapRequester">
    <plnk:portType name="tns:NsWithMapCallback"/>
    </plnk:role>
    </plnk:partnerLinkType>
    </definitions>
    I am trying to set this map data using java code ,
         HashMap procADMap1 = new HashMap(5);
                   PropertyTypeWS pType = new PropertyTypeWS();
                   pType.setTypeIndex(2);     
              AppdataDefImplWS appData1 = new AppdataDefImplWS();
              appData1.setName("Project");
              appData1.setType(pType);
              appData1.setMaxSize(400);
              appData1.setLOB(false);
         appData1.setDefaultValue("Project Default value");
              procADMap1.put(appData1.getName(), appData1);
              setVariableData("request","createNs","/createNs/namespaceData/appdataDef",procADMap1);     
    Then I am passing request object to the method which I want to invoke from bpel process.
    I am able to deploy the application but when I do post message I am getting following exception,
    NamespaceWithMap (createNamespace) (faulted)
    [2004/09/09 18:35:54] "{http://schemas.oracle.com/bpel/extension}bindingFault" has been thrown. Less
    faultName: {{http://schemas.oracle.com/bpel/extension}bindingFault}
    messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}
    code: {Server.userException}
    summary: {org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.}
    detail: {null}
    Is there any other way to handle Map type in bpel process?
    Thanks in advance,
    Sanjay

    Thanks for the quick reply.Actually the web service is already deployed on the server.What I want to do is use existing wsdl file of the deployed web service and invoke the method of the same using oracle PM.
    If I remove element which uses apachesoap:Map type it just works fine also I am getting the complex object returned by the web service method.But when I try to set appDataDef which is of type apachesoap:Map(Axis conversion for java.util.Map and it uses namespace xmlns:apachesoap="http://xml.apache.org/xml-soap") I am getting the error.
    Can you give me some direction to use this exising wsdl file to set map object or it is not possible.

  • Converting object wrapper type array into equivalent primary type array

    Hi All!
    My question is how to convert object wrapper type array into equivalent prime type array, e.g. Integer[] -> int[] or Float[] -> float[] etc.
    Is sound like a trivial task however the problem is that I do not know the type I work with. To understand what I mean, please read the following code -
    //Method signature
    Object createArray( Class clazz, String value ) throws Exception;
    //and usage should be as follows:
    Object arr = createArray( Integer.class, "2%%3%%4" );
    //"arr" will be passed as a parameter of a method again via reflection
    public void compute( Object... args ) {
        a = (int[])args[0];
    //or
    Object arr = createArray( Double.class, "2%%3%%4" );
    public void compute( Object... args ) {
        b = (double[])args[0];
    //and the method implementation -
    Object createArray( Class clazz, String value ) throws Exception {
         String[] split = value.split( "%%" );
         //create array, e.g. Integer[] or Double[] etc.
         Object[] o = (Object[])Array.newInstance( clazz, split.length );
         //fill the array with parsed values, on parse error exception will be thrown
         for (int i = 0; i < split.length; i++) {
              Method meth = clazz.getMethod( "valueOf", new Class[]{ String.class });
              o[i] = meth.invoke( null, new Object[]{ split[i] });
         //here convert Object[] to Object of type int[] or double[] etc...
         /* and return that object*/
         //NB!!! I want to avoid the following code:
         if( o instanceof Integer[] ) {
              int[] ar = new int[o.length];
              for (int i = 0; i < o.length; i++) {
                   ar[i] = (Integer)o;
              return ar;
         } else if( o instanceof Double[] ) {
         //...repeat "else if" for all primary types... :(
         return null;
    Unfortunately I was unable to find any useful method in Java API (I work with 1.5).
    Did I make myself clear? :)
    Thanks in advance,
    Pavel Grigorenko

    I think I've found the answer myself ;-)
    Never thought I could use something like int.class or double.class,
    so the next statement holds int[] q = (int[])Array.newInstance( int.class, 2 );
    and the easy solution is the following -
    Object primeArray = Array.newInstance( token.getPrimeClass(), split.length );
    for (int j = 0; j < split.length; j++) {
         Method meth = clazz.getMethod( "valueOf", new Class[]{ String.class });
         Object val = meth.invoke( null, new Object[]{ split[j] });
         Array.set( primeArray, j, val );
    }where "token.getPrimeClass()" return appropriate Class, i.e. int.class, float.class etc.

  • How to pass an object as method parameter

    Hi Guys
    I was testing a simple program and was trying to pass an object to a method but it didnt seem to work and I couldnt find out WHY.
    I am posting the code so please let me know who can i make my method ADD_EMPLOYEE work so that when i pass an object of LCL_EMPLOYEE, it updates I_EMPLOYEE_LIST.
    *& Report:  ZOO_HR_SAMPLE_1
    *& Author:  Avinash Pandey
    *& Date:    25.03.2009
    *& Description: Concepts of OO in ABAP
    REPORT  zoo_hr_sample_1.
    *&       Class LCL_EMPLOYEE
           Local class
    CLASS lcl_employee DEFINITION.
    Public section
      PUBLIC SECTION.
    Data type
        TYPES:
          BEGIN OF t_employee,
            no  TYPE i,
            name TYPE string,
            wage TYPE i,
         END OF t_employee.
    Method
        METHODS:
          constructor
            IMPORTING im_employee_no TYPE i
                      im_employee_name TYPE string
                      im_wage TYPE i,
            add_employee
             IMPORTING im_employee TYPE REF TO lcl_employee,
           display_employee_list,
           display_employee,
           get_no EXPORTING ex_no TYPE i,
           get_name EXPORTING ex_name TYPE string,
           get_wage EXPORTING ex_wage TYPE i.
      Class methods are global for all instances
        CLASS-METHODS: display_no_of_employees.
    Protected section
      PROTECTED SECTION.
      Class data are global for all instances
        CLASS-DATA: g_no_of_employees TYPE i.
        CLASS-DATA: i_employee_list TYPE TABLE OF t_employee.
    Private section
      PRIVATE SECTION.
       CLASS-DATA: i_employee_list TYPE TABLE OF t_employee.
        DATA: g_employee TYPE t_employee.
    ENDCLASS.               "LCL_EMPLOYEE
    *&       Class (Implementation)  LCL_EMPLOYEE
           Text
    CLASS lcl_employee IMPLEMENTATION.
    Class constructor method
      METHOD constructor.
        g_employee-no = im_employee_no.
        g_employee-name = im_employee_name.
        g_employee-wage = im_wage.
        g_no_of_employees = g_no_of_employees + 1.
      ENDMETHOD.                    "constructor
    Method
      METHOD display_employee.
        WRITE:/ 'Employee', g_employee-no, g_employee-name.
      ENDMETHOD.                    "display_employee
    Method
      METHOD get_no.
        ex_no = g_employee-no.
      ENDMETHOD.                    "get_no
    Method
      METHOD get_name.
        ex_name = g_employee-name.
        WRITE: / 'Name is:' , ex_name.
      ENDMETHOD.                    "get_no
    Method
      METHOD get_wage.
        ex_wage = g_employee-wage.
      ENDMETHOD.                    "get_no
    Method
      METHOD add_employee.
      Adds a new employee to the list of employees
        DATA: l_employee TYPE t_employee.
        l_employee-no = im_employee->get_no.
        l_employee-name = im_employee->get_name.
        l_employee-wage = im_employee->get_wage.
        APPEND l_employee TO i_employee_list.
      ENDMETHOD.                    "add_employee
    Method
      METHOD display_employee_list.
      Displays all employees and there wage
        DATA: l_employee TYPE t_employee.
        WRITE: / 'List of Employees'.
        LOOP AT i_employee_list INTO l_employee.
          WRITE: / l_employee-no, l_employee-name, l_employee-wage.
        ENDLOOP.
      ENDMETHOD.                    "display_employee_list
    Class method
      METHOD display_no_of_employees.
        WRITE: / 'Number of employees is:', g_no_of_employees.
      ENDMETHOD.                    "display_no_of_employees
    ENDCLASS.               "LCL_EMPLOYEE
    REPORT
    DATA: g_employee1 TYPE REF TO lcl_employee,
          g_employee2 TYPE REF TO lcl_employee.
    START-OF-SELECTION.
    Create class instances
      CREATE OBJECT g_employee1
        EXPORTING
          im_employee_no   = 1
          im_employee_name = 'John Jones'
          im_wage          = 20000.
      CREATE OBJECT g_employee2
        EXPORTING
          im_employee_no   = 2
          im_employee_name = 'Sally Summer'
          im_wage          = 28000.
    Call methods
      CALL METHOD g_employee1->display_employee.
      CALL METHOD g_employee1->add_employee
        EXPORTING
          im_employee = g_employee1.
      CALL METHOD g_employee1->get_name.
      CALL METHOD g_employee2->display_employee.
      CALL METHOD g_employee2->display_no_of_employees.
    The error I am getting is:
    Field GET_NO/GET_NAME/GET_WAGE is unknown.
    Please help me out on this.
    Thanks a lot you people

    hi.
    The following parts of your program were changed.
    The result is OK?.
    *(1)change
    CLASS lcl_employee DEFINITION.
    Public section
    PUBLIC SECTION.
    display_employee,
    *get_no EXPORTING ex_no TYPE i,
    *get_name EXPORTING ex_name TYPE string,
    *get_wage EXPORTING ex_wage TYPE i.
    get_no returning value(ex_no) TYPE i,
    get_name returning value(ex_name) TYPE string,
    get_wage returning value(ex_wage) TYPE i.
    *(2)change
    CLASS lcl_employee IMPLEMENTATION.
    Method
    METHOD add_employee.
    Adds a new employee to the list of employees
    DATA: l_employee TYPE t_employee.
    *l_employee-no = im_employee->get_no.
    *l_employee-name = im_employee->get_name.
    *l_employee-wage = im_employee->get_wage.
    l_employee-no   = im_employee->get_no( ).
    l_employee-name = im_employee->get_name( ).
    l_employee-wage = im_employee->get_wage( ).
    APPEND l_employee TO i_employee_list.
    ENDMETHOD. "add_employee
    Result List
    Employee          1  John Jones
    Name is: John Jones
    Name is: John Jones
    Employee          2  Sally Summer
    Number of employees is:          2

Maybe you are looking for