Write an object that has array

I am trying to figure out how to write a object with an array
Player[] jim = new Player[30];
for (int i=0;i<30;i++)
jim= new Player("" + i);
I am trying to figure out how to get the number of points jim scores in a month, so i need 31 days and a way to input the number of points he scored. Any help would be great

Well, i think you don't have to create a whole bunch of arrays to enter jim's scores in 31 days. I presume you already have a separate object called Player. Why not set a List attribute on that object and manipulate the scores there. You don't need to instantiate an array for that.
public class Player{
    private List scores = null;
    ....... //other attributes here
    public Player(){
        scores = new ArrayList();
    public void addScore(String score){
        scores.add(score);
    public List getScore(){
        return scores;
}well, of course to get the contained items from the List, do manipulate it using arrays. And well, just parse down the returned scores to int because they are stored as strings here.
hope that helps.

Similar Messages

  • "COM object that has been separated from its underlying RCW cannot be used.

    I am constantly getting the following error when closing my app if we viewed/printed a report.  What do I need to do to correct this error?  For the following error, I opened my app, viewed a report on the screen using the 'CrystalReportViewer', closed the report viewer window, closed my app.  When closing the app, the following error occurs.
    CR version: 11.5.3300.0
    VB.NET v2.
    System.Runtime.InteropServices.InvalidComObjectException was unhandled
      Message="COM object that has been separated from its underlying RCW cannot be used."
      Source="mscorlib"
      StackTrace:
           at System.Runtime.InteropServices.UCOMIConnectionPoint.Unadvise(Int32 dwCookie)
           at CrystalDecisions.ReportAppServer.%. {(_ISCDClientDocumentEvents_OnClosedEventHandler  u)
           at CrystalDecisions.ReportAppServer.%.remove_OnClosed(_ISCDClientDocumentEvents_OnClosedEventHandler value)
           at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.DisconnectEventRelay()
           at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.  (Boolean  \b, Boolean       )
           at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Dispose(Boolean bDisposeManaged)
           at System.ComponentModel.Component.Dispose()
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.  (Boolean      :)
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.  (Boolean      ;)
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.Close()
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.
        (Object      >, EventArgs      ?)

    Hello,
    First thing is to install Service Pack 6 which you can get from the download page by clicking on BusinessObjests tab above and then downloads on the left...
    When you close your viewer be sure to add/have Youreportobject.close and Youreportobject.Dispose. Adding a GC.Collect may help also.
    Thank you
    Don

  • "Attempted to use an object that has ceased to exist" error when opening list with grouping and item level permissions

    Hi All,
    I have a list with few items. If I break role inheritance for at least one item and try to open list view page, I receive this error:
    Attempted to use an object that has ceased to exist. (Exception from HRESULT: 0x80030102 (STG_E_REVERTED))
    This occurs only if view has GroupBy in query. If I remove grouping from view, then error disappears. But I need to have grouping in view as well as item level permissions.
    How can I achieve this? Is this some limitation?
    Any help will be appreciated.
    The full stacktrace:
    System.Runtime.InteropServices.COMException: Attempted to use an object that has ceased to exist. (Exception from HRESULT: 0x80030102 (STG_E_REVERTED))    
    at Microsoft.SharePoint.Library.SPRequestInternalClass.GetListContentTypes(String bstrUrl, String bstrListName, ISPDataCallback pXMLCallback)     
    at Microsoft.SharePoint.Library.SPRequest.GetListContentTypes(String bstrUrl, String bstrListName, ISPDataCallback pXMLCallback)
    System.Runtime.InteropServices.COMException: Attempted to use an object that has ceased to exist. (Exception from HRESULT: 0x80030102 (STG_E_REVERTED)),
    StackTrace:    
    at Microsoft.SharePoint.SPContentTypeCollection.FetchCollection(IList`1 exceptions)     
    at Microsoft.SharePoint.SPList.get_ContentTypes()     
    at Microsoft.SharePoint.SPCustomActionElement.QueryForToolbarButtons(SPWeb web, SPList list, SPListItem item, PAGETYPE pgtype)     
    at Microsoft.SharePoint.SPCustomActionElement.AddCustomToolbarButtons(SPWeb web, SPList list, SPListItem item, SPContext renderContext, PAGETYPE pgtype, ToolBar toolbarControl, WebPart webPart, Page page)     
    at Microsoft.SharePoint.WebControls.ViewToolBar.CreateChildControls()     
    at System.Web.UI.Control.EnsureChildControls()     
    at Microsoft.SharePoint.WebControls.TemplateBasedControl.OnLoad(EventArgs e)     
    at System.Web.UI.Control.LoadRecursive()     
    at System.Web.UI.Control.AddedControl(Control control, Int32 index)     
    at Microsoft.SharePoint.WebPartPages.DataFormWebPart.CreateChildControls()     
    at Microsoft.SharePoint.WebPartPages.XsltListViewWebPart.CreateChildControls()     
    at Microsoft.SharePoint.WebPartPages.WebPartMobileAdapter.CreateChildControls()     
    at System.Web.UI.Control.EnsureChildControls()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     
    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     
    at System.Web.UI.Page.ProcessRequest()     
    at System.Web.UI.Page.ProcessRequest(HttpContext context)     
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     
    at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     
    at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)     
    at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     
    at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     
    at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

    Does the site use any custom code? Not necessarily the task list but can be anywhere. If yes, ensure that current context SPWeb/SPSite objects are not being disposed off.
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • Jndi lookup of of object that has been bound remotely

    I want to register in weblogic server jndi tree some remote objects. A one standalone
    application binds these object in server jndi. Another standalone app try to lookup
    and executes some methods - everything works ok.
    The problem is : applications which works internally on server can't lookup these
    object. It's initial context doesn't contains such bindings. What's the difference
    between naming contexts
    inside and outside the server?
    Thank in advance,
    Vladimir.

    Hi JP3O,
    >> But that doesn't help because CurrentExcelWorksheetEventsInstance is not nothing even after all properties give errors. What is a better test or approach I can use?
    In my option, if you refer to the property of the Worksheet object which has been deleted, the error would be raised as expected. I think you could use the try catch statement to deal with this situation. Some key code like below:
    Dim oxl As Excel.Application
    Dim owb As Excel.Workbook
    Dim osheet As Excel.Worksheet
    Dim owbname As String
    oxl = New Excel.Application
    owb = oxl.Workbooks.Open("D:\Test\VSC#\03\Winform\VBWinform\Test.xlsx")
    osheet = owb.Worksheets("sheet1")
    Try
    osheet = owb.Worksheets.Add()
    owb.Close(False)
    owbname = owb.Name
    Catch comex As System.Runtime.InteropServices.COMException
    If comex.ErrorCode = -214682246 Or comex.Message.Contains("Object has been deleted") Then
    ' handle deleted object
    Else
    Throw comex
    End If
    End Try
    Best Regards,
    Edward
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

  • COM object that has been seperated from its uderlying RCW cannot be used

    What exactly does this error mean?
    I receive this error when I perform "Unload All Modules" from the sequence editor using TestStand 4.2.1.83 development system, which is part of NI Developer Suite 2010 DS1.
    It causes TestStand to crash citing that error, and then a secondary error cites corrupted memory.

    ATE_Dude_22 wrote:
    Here is a capture of my sequence editor, where I have a alert from TestStand telling me the parameter specified doesn't match the sequence parameters (specified in the vi prototype as a string not a number), but this version of TestStand allows it to execute without needing to clear the error.
    Do you think this may have anything to do with the error I am seeing?
    Probably not. Sequence calls support mismatched parameters, what happens is that the callee gets whatever is passed to it, if that's not what it's expecting, then you might get a type mismatch error if type checking is enabled, if not then it's up to the sequence what it tries to do with the parameter for what happens next.
    Most likely the bug is in one of the code modules you are calling, probably a vi or dll is not properly maintaining a reference count somewhere or is corrupting memory and only indirectly causing the error. If most of your code is in labview, one thing to look out for is incorrectly specified calls to dlls from LabVIEW. If a call to a dll is incorrectly specified, either from LabVIEW or TestStand that can very easily lead to memory corruption and random errors later on in the code.
    I'd recommend trying to either debug and see where it's failing, if it's always failing in the same place. Or try to eliminate possibilities and reduce the called code to the minimum code required to reproduce the problem and then look for bugs in that code (paying special attention to the possibility of incorrectly specified dll calls and/or perhaps incorrectly maintained reference counts on COM objects).
    Another idea, to see if the problem is memory corruption caused by a vi, is to run all of your labview vis using the development environment (labview adapter setting), if so, any memory corruption would be in the labview process and not the main teststand process and should not bring down teststand.
    -Doug

  • How to delete or rename an object that has been created in IR.

    Dear friends
    I have transfered a software component from SLD.
    But if I want to rename this so that I can re-import it from SLD or delet this transfered SWC object, how can i do it.
    I see a 'delete' option under the menu item Object, but it is grayed out and cannot be used.
    Any suggestions or feedback will be greatly appreciated.
    Thanks

    Gregor,
    You can delete it by double clicking on the software component. And in the right frame choose Software Component Version - Delete.
    raj.

  • How to Get object that a JPanel belongs to.

    I created an object that has a JPanel. When that JPanel is clicked, how can I get the object to which its a GUI data member of?

    Hi,
    If you try JPanel.getParent() it will return the Container that it is in.
    If what you want is the creator you can derive from JPanel and add a constructor that has the creator as its only parm.
      JPanel panel = new JPanel(this);
    public class MyPanel extends JPanel {
      Object myCreator;
      public JPanel(Object creator) {
         super();
         myCreator = creator;
    }Now you can use myCreator to access that class that created it.
    Paul

  • Determine all objects that a group has been assigned to

    I am trying to determine all objects that a group has been assigned to. For example, I would like to know what communities and portletes a group has been assigned to.
    I can retrieve the information directly from the plumtree database, however, I have not been able to determine how to accomplish this via the api.
    I have tried the following
    IPTObjectManager ptObjMng = ptSession.GetCommunities();
    for(inti = 0; i<3;i++)
    filter[i] = newObject[1];
    filter[0][0] = PT_PROPIDS.PT_PROPID_USERGROUP_GROUPID;
    filter[1][0] = PT_FILTEROPS.PT_FILTEROP_EQ;
    filter[2][0] = 1634; //group id for my group
    IPTQueryResult ptResult = ptObjMng.Query(PT_PROPIDS.PT_PROPID_ALL,-1,PT_PROPIDS.PT_PROPID_NAME,0,-1,filter);
    I have verified that the group has been assigned to the community, however, this query returns no records.
    How can I retrieve all communities or group that a specific group has been assigned too?
    thanks in advance

    This sure would be a handy feature! iTunes has it so that you can easily tell which playlists a song is in. It would be convenient for iPhoto as well.

  • How can I edit the database in Lookout OPC Modbus driver OPC sever with the address that has a write attribute?

    When I use Lookout Modbus driver OPC to communicate with my instrumnets, I edited the database number such as 41202 that has a Write attribute in my instrumnet manual, the OPC explorer got bad data, and the OPC server gave the illegal address alarm, when I input the address such as 41203 that has R/W attribute, it worked very well. Is there a way to fix this problem. When I used other OPC server, there was no this kind of problem. Thanks!

    Thanks for your suggestion. I checked the Modbus manual of my instrument, the register is 16 bit. I tried to edit the data according to the Modbus data member in lookout modbus drivere server for several different member, but the OPC still gave me the illegal address. I think the problem may be produced by their attribute, for the address 1201 and 1202, they have the write attribute, for other addresses, they have W/R attribute, and they can be read or write through Lookout OPC server perfectly. when I used the demo OPC server from other company, it can work well, but it is not convinient for me to use Labview when I use that software. I prefer NI Lookout OPc server. I am using the Lookout 4.5. I am wondering whether the Lookout has some shortcoming when I
    use the Modbus driver. Please give me any suggestion, is there any newest version of Lookout OPC sever? Thanks!

  • Returning an object that contains a collection WL 9.2

    Hello,
    I have a class like this:
    public class data {
    private Collection<MyObject> coll; //MyObject is another class
    If I return this object from a web service call, i.e.
    @WebService
    public class HelloWorld {
         @WebMethod
    public data hello() {
    I get an error saying java class MyObject is not known, which makes sense, because I only declared "HelloWorld" to jwsc task.
    How can I make this class known, by annotation etc.?
    Someone suggested to use "IncludeSchema" in the jwsc task, but apparently that has been deprecated.
    Thanks!
    Edited by ghosh007 at 02/21/2008 12:59 PM
    Edited by ghosh007 at 02/21/2008 1:23 PM

    Hi,
    As you have this "Artiicle" class, extend it to be serializable and then define an Array of type Artiicle. So the return type would be an Array of a complex type i.e. Articles. In WSDL there will be type that defines an Array and this type can be used as a return message for your methode.
    Try this, I think it will help you.
    Regards,

  • Is there a way using lab view objects to let an object that is contained within another object get access to its owner?

    I've been playing with lvoop for 4 or 5 months now, and in general I like it very much, but I've repeatedly wanted to build classes that know something about who owns them and I can't figure out how to make this happen.
    The simple example I've been thinking about is imagine having a person class which contains a car class. Now say that I get an instance of a car class and I want to ask it who its owner is. In C++, I'd do this by giving the car class a pointer to the person class it belongs to. (Of course you have to worry about car objects that don't belong to anyone in which case the pointer has to point to NULL.)
    I've tried copying this idea by giving the car class a data value reference to a person class, but when I dereference the reference using an in place loop and call a method on it I get data from the moment the reference was made and not the current data of the person class.
    I realize this is sorta breaking data flow so maybe it's not possible on purpose?

    Scot18 wrote:
    I've tried copying this idea by giving the car class a data value reference to a person class, but when I dereference the reference using an in place loop and call a method on it I get data from the moment the reference was made and not the current data of the person class.
    Yes, LVOOP uses value based references, and when you split the wire to write the owner you created a data copy. The function you're after requires you do use a DVR for all class functions in which case you'll get reference based OOP, which is more familiar coming from text based OOP.
    It just so happens that G# uses that approach, take a look at it.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • Error : Period dimension 'Period' is missing a Base Time Period member 'Jun' that has been deleted since the last deployment. Base Time Period members cannot be deleted once the dimension is deployed

    HI,
    I am using V11.1.2.2 Hyperion Planning. I am currently getting an error:
    Error : Period dimension 'Period' is missing a Base Time Period member 'Jun' that has been deleted since the last deployment. Base Time Period members cannot be deleted once the dimension is deployed
    This is what i got when i tried to add alternate hierarchy to my shared dimension. I tried to delete it and it messed up.
    NOw it wont deploy my application.
    Can any one suggest.
    Thanks in advance
    Cheers,
    XXX

    EPMA!!!!! EPMA!!!!
    I'm playing around with it to write a blog post and it is crazy. Only possible workaround (till now i'm not able to figure out a solution to it) is to copy the application and deploy it as a new one. Take copy of all objects (forms, tasklist etc). Delete the corrupted application and rename the new one to old.
    Regards
    Celvin
    http://www.orahyplabs.com

  • Objects in an Array

    I'm having trouble getting my objects into an array. The program compilies just fine, but when you run it, it just outputs all null values.
    //import necessary classes
    import java.util.Scanner;
    import java.io.File;
    import java.io.IOException;
    import java.io.BufferedWriter;
    import java.io.FileWriter;
    import javax.swing.JOptionPane;
    public class DanMPA6
      public DanMPA6() throws IOException
      // get the name of the input file from the username
      String inFile = JOptionPane.showInputDialog( "Enter the name of the file:" ) ; 
      File inputFile = new File(inFile);
      Scanner scan = new Scanner(inputFile);
      scan.useDelimiter("[|\n\r]+");
    // Passenger myPassObj;
      Passenger[] ayPass = new Passenger [1500];
      int count = 0;
      //start the loop
      while (scan.hasNext())
                  // read all of the information from the data file in order
                   int fakeID = Integer.parseInt(scan.next());
                 String fakeClass = scan.next();
                   int fakeSurvive = Integer.parseInt(scan.next());
                 String fakeName = scan.next();
               double fakeAge = Double.parseDouble(scan.next()); 
               String fakeFrom = scan.next();
                   String fakeTo = scan.next();
                   String fakeRoom = scan.next();
                 String fakeTicket = scan.next();
                 String fakeLifeboat = scan.next();     
                 String fakeSex = scan.next();
                 Passenger myPassObj = new Passenger (fakeID, fakeClass, fakeSurvive, fakeName, fakeAge, fakeFrom, fakeTo, fakeRoom, fakeTicket, fakeLifeboat, fakeSex);
                   ayPass[count] = myPassObj;
                   count++;
           /*  String outFile = JOptionPane.showInputDialog (null, "Give the name of the output file:");
               FileWriter fw = new FileWriter (outFile, false);
               BufferedWriter bw = new BufferedWriter(fw);
               bw.write(ayPass[count] + "\n"); */
    public static void main (String [] args) throws IOException
         new DanMPA6();                      
    class Passenger
    // data members
           int passID;
           String passClass;
           int passSurvive;
           String passName;
           double passAge;
           String passFrom;
           String passTo;
           String passRoom;
           String passTicket;
           String passLifeboat;     
           String passSex;
           public Passenger (int fakeID, String fakeClass, int fakeSurvive, String fakeName, double fakeAge, String fakeFrom, String fakeTo, String fakeRoom,  String fakeTicket,  String fakeLifeboat, String fakeSex)
           passID = fakeID;
           passClass = fakeClass;
           passSurvive = fakeSurvive;
           passName = fakeName;
           passAge = fakeAge;
           passFrom = fakeFrom;
           passTo = fakeTo;
           passRoom = fakeRoom;
           passTicket = fakeTicket;
           passLifeboat = fakeLifeboat;     
           passSex = fakeSex;
         

    Thank you very much! That worked. So now I have all my objects in the array, but it seems that I'm running into a different problem when I attempt to output the results into a different .txt file. It creates the file, but with nothing in it! I even tried just a basic line of text and that didn't work either.
    This is the code that I was attempting to do that with:
    FileWriter fw = new FileWriter (outFile, false);
    BufferedWriter bw = new BufferedWriter(fw);
    bw.write(ayPass[count] + "\n");

  • How to retrict the number of object that a class can have...

    hi
    i m just writing a banking program and each customer can only have
    2 accounts,,,so i need to restrict the number of account object that a customer
    can have,,
    so i need to count object? or something like that so that when a customer
    try to create more account, i need to stop them. but
    i don't know how to do that....
    customer can only have two accounts, and,,,,how do i know
    if customer already have two accounts...........................

    i m just writing a banking program and each customer
    can only havePlease make the extra effort to write out words such as "am". The extra keystrokes won't cost much in the way of time, and the enhanced clarity will be appreciated by those communicating on a forum with international readership.
    >
    so i need to count object? Yes. The customer can possess a reference to each account. If the customer has two accounts, the customer can register no more.
    i don't know how to do that....
    The Java� Tutorial - A practical guide for programmers
    customer can only have two accounts, and,,,,how do i
    knowBy counting the number of accounts a customer has!
    P.S. What's with the repeated punctuation?

  • Anyone know of an ALV report in SAP that has Hotspot logic?

    Howdy,
    Does Anyone know of an ALV report in SAP that has Hotspot logic?
    I just need to implement this logic into my report and I thought I'd copy what was there.
    Also, anyone know of a report where buttons are available in the cells of an ALV grid?
    Thanksing you kindly.

    Hi Steve,
    it'a a report with alv grid, where i use hot spot event,
    i hope it helps you.
    bye
    *& Report  ZMONITOR_IP                                                 *
    REPORT  zmonitor_ip                             .
    TABLES: mapl, plko
    *****SELECTION-SCREEN.
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_matnr  FOR mapl-matnr,
                    s_plnty  FOR mapl-plnty,
                    s_zaehl  FOR plko-zaehl,
                    s_verwe  FOR plko-verwe,
                    s_plnnr  FOR plko-plnnr,
                    s_plnal  FOR plko-plnal,
                    s_plnty2 FOR plko-plnty.
    SELECTION-SCREEN: END OF BLOCK b1.
    **********TYPES:
    TYPES: BEGIN OF str_data,
             matnr    TYPE mapl-matnr,
             werks    TYPE plko-werks,
             plnal    TYPE plko-plnal,
             plnnr    TYPE plko-plnnr,
           END OF str_data.
    TYPES: BEGIN OF str_data2,
            prueflos TYPE qals-prueflos,
            art      TYPE qals-art,
            herkunft TYPE qals-herkunft,
            enstehdat TYPE qals-enstehdat,
            END OF str_data2.
    ****Global data.
    DATA: tb_plko TYPE TABLE OF plko,
          wa_plko TYPE plko,
          tb_mapl TYPE TABLE OF mapl,
          wa_mapl TYPE TABLE OF mapl,
          tb_data TYPE TABLE OF str_data,
          wa_data TYPE str_data,
          pos1 TYPE i,
          pos2 TYPE i,
          pos3 TYPE i,
          pos4 TYPE i,
          pos5 TYPE i,
          okcode_100 TYPE sy-ucomm,
          tb_data2 TYPE TABLE OF str_data2.
    ***********************VARIABILI E STRUTTURE PER ALV********************
    *       CLASS lcl_event_handler DEFINITION
    CLASS lcl_event_handler DEFINITION .
      PUBLIC SECTION .
        METHODS:
    *To add new functional buttons to the ALV toolbar
    *Hotspot click control
    handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
                         IMPORTING e_row_id e_column_id es_row_no,
    *Double-click control
    handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
                        IMPORTING e_row e_column es_row_no.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    *Handle Hotspot Click METHOD handle_hotspot_click .
        PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
      ENDMETHOD .                    "lcl_event_handler
    *Handle Double Click
      METHOD handle_double_click .
        PERFORM handle_double_click USING e_row e_column es_row_no .
      ENDMETHOD .                    "handle_double_click
    ENDCLASS.                    "lcl_event_handler IMPLEMENTATION
    *--- ALV Grid instance reference
    DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid.
    DATA gr_alvgrid2 TYPE REF TO cl_gui_alv_grid.
    *--- Name of the custom control added on the screen
    DATA gc_custom_control_name TYPE scrfname VALUE 'CC_ALV'.
    DATA gc_custom_control_name2 TYPE scrfname VALUE 'CC_ALV2'.
    *--- Customer contanier instance reference
    DATA gr_ccontainer TYPE REF TO cl_gui_custom_container.
    DATA gr_ccontainer2 TYPE REF TO cl_gui_custom_container.
    *--- Field catalog table
    DATA gt_fieldcat TYPE lvc_t_fcat.
    DATA gt_fieldcat2 TYPE lvc_t_fcat.
    *--- Layout structure
    DATA gs_layout TYPE lvc_s_layo.
    DATA gs_layout2 TYPE lvc_s_layo.
    DATA ls_variant       TYPE disvariant.
    DATA gr_event_handler TYPE REF TO lcl_event_handler .
    ****INITIALIZZATION
    INITIALIZATION.
      pos1 = 4.
      pos2 = pos1 + 20.
      pos3 = pos2 + 10.
      pos4 = pos3 + 10.
      pos5 = pos4 + 10.
    *****TOP OF PAGE
    TOP-OF-PAGE.
      WRITE AT /pos1 'Material'.
      WRITE AT pos2  'Plan'.
      WRITE AT pos3 'Group'.
      WRITE AT pos4 'Group Count'.
      SKIP 1.
    *****AT USER COMMAND.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'BACK'.
          SET SCREEN 0.
          LEAVE SCREEN.
      ENDCASE.
    AT LINE-SELECTION.
      PERFORM select_line.
    *****START-OF-SELECTION.
    START-OF-SELECTION.
      PERFORM select_data.
      PERFORM output.
    END-OF-SELECTION.
    ****END-OF-SELCTION.
    *&      Form  select_data
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_data .
      SELECT   b~werks b~plnal b~plnnr a~matnr
               FROM plko AS b
               JOIN mapl AS a
               ON ( a~plnty = b~plnty AND
                   a~plnnr = b~plnnr AND
                   a~plnal = b~plnal )
               INTO CORRESPONDING FIELDS OF TABLE tb_data
               WHERE
                 a~matnr IN s_matnr  AND
                 a~plnty IN s_plnty  AND
                 b~zaehl IN s_zaehl  AND
                 b~verwe IN s_verwe  AND
                 b~plnnr IN s_plnnr  AND
                 b~plnal IN s_plnal  AND
                 b~plnty IN s_plnty2 .
    ENDFORM.                    " select_data
    *&      Form  OUTPUT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM output .
      CALL SCREEN '0100'.
    ENDFORM.                    " OUTPUT
    *&      Form  SELECT_LINE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_line .
      DATA line TYPE i.
      CLEAR wa_data.
      GET CURSOR LINE line.
      READ LINE line FIELD VALUE wa_data-matnr  INTO wa_data-matnr.
      READ LINE line FIELD VALUE wa_data-werks  INTO wa_data-werks.
      READ LINE line FIELD VALUE wa_data-plnnr  INTO wa_data-plnnr.
      READ LINE line FIELD VALUE wa_data-plnal  INTO wa_data-plnal.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      SET PARAMETER ID 'MAT' FIELD wa_data-matnr.
      SET PARAMETER ID 'WRK' FIELD wa_data-werks.
      SET PARAMETER ID 'QHK' FIELD '89'.
      SET PARAMETER ID 'PLN' FIELD wa_data-plnnr.
      SET PARAMETER ID 'PAL' FIELD wa_data-plnal.
      CALL TRANSACTION 'QA01' AND SKIP FIRST SCREEN.
      SET PARAMETER ID 'PLN' FIELD ' '.
      SET PARAMETER ID 'PAL' FIELD ' '.
    ENDFORM.                    " SELECT_LINE
    *&      Form  prepare_field_catalog
    *       text
    *      -->PT_FIELDCATtext
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat .
      DATA ls_fcat TYPE lvc_s_fcat .
      ls_fcat-fieldname = 'MATNR' .
    *  ls_fcat-inttype = 'C' .
      ls_fcat-outputlen = '18' .
      ls_fcat-hotspot = 'X'.
      ls_fcat-coltext = 'Material' .
      ls_fcat-seltext = 'Material' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'WERKS' .
    *  ls_fcat-outputlen = '30' .
      ls_fcat-coltext = 'Plant' .
      ls_fcat-seltext = 'Plant' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'PLNNR' .
    *  ls_fcat-outputlen = '6' .
      ls_fcat-coltext = 'Orig. IP' .
      ls_fcat-seltext = 'Orig. IP' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'PLNAL' .
    *  ls_fcat-outputlen = '6' .
      ls_fcat-coltext = 'Orig. IP Conuter' .
      ls_fcat-seltext = 'Orig. IP Conuter' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
    ENDFORM .                    "prepare_field_catalog
    *&      Form  prepare_layout
    *       text
    *      -->PS_LAYOUT  text
    FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
      ps_layout-zebra = 'X' .
      ps_layout-grid_title = '' .
      ps_layout-smalltitle = 'X' .
      ps_layout-sel_mode = 'B'.
    ENDFORM. " prepare_layout
    *&      Module  DISPLAY  OUTPUT
    *       text
    MODULE display OUTPUT.
    ***ALV.
      IF gr_alvgrid IS INITIAL AND
         gr_alvgrid2 IS INITIAL.
    *----Creating custom container instance
        CREATE OBJECT gr_ccontainer
           EXPORTING
           container_name = gc_custom_control_name
           EXCEPTIONS
           cntl_error = 1
           cntl_system_error = 2
           create_error = 3
           lifetime_error = 4
           lifetime_dynpro_dynpro_link = 5
           OTHERS = 6 .
        CREATE OBJECT gr_ccontainer2
            EXPORTING
            container_name = gc_custom_control_name2
            EXCEPTIONS
            cntl_error = 1
            cntl_system_error = 2
            create_error = 3
            lifetime_error = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS = 6 .
    *----creating alv grid instance
        CREATE OBJECT gr_alvgrid
        EXPORTING
        i_parent = gr_ccontainer
        EXCEPTIONS
        error_cntl_create = 1
        error_cntl_init = 2
        error_cntl_link = 3
        error_dp_create = 4
        OTHERS = 5 .
        CREATE OBJECT gr_event_handler .
        SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid .
        SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid .
    *----Preparing field catalog.
        PERFORM prepare_field_catalog CHANGING gt_fieldcat .
    *----Preparing layout structure
        PERFORM prepare_layout CHANGING gs_layout .
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
        CALL METHOD gr_alvgrid->set_table_for_first_display
        EXPORTING
    * I_BUFFER_ACTIVE =
    * I_CONSISTENCY_CHECK =
    * I_STRUCTURE_NAME =
    is_variant = ls_variant
    i_save = 'A'
    * I_DEFAULT = 'X'
        is_layout = gs_layout
    * IS_PRINT =
    * IT_SPECIAL_GROUPS =
    * IT_TOOLBAR_EXCLUDING =
    * IT_HYPERLINK =
        CHANGING
        it_outtab = tb_data
        it_fieldcatalog = gt_fieldcat
    * IT_SORT =
    * IT_FILTER =
        EXCEPTIONS
        invalid_parameter_combination = 1
        program_error = 2
        too_many_lines = 3
        OTHERS = 4 .
      ELSE .
        CALL METHOD gr_alvgrid->refresh_table_display
    * EXPORTING
    * IS_STABLE =
    * I_SOFT_REFRESH =
        EXCEPTIONS
        finished = 1
        OTHERS = 2 .
      ENDIF .
    ENDMODULE.                 " DISPLAY  OUTPUT
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'MONITOR'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE okcode_100.
        WHEN 'BACK'.
          SET SCREEN 0.
          LEAVE SCREEN.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  handle_hotspot_click
    *       text
    *      -->I_ROW_ID   text
    *      -->I_COLUMN_IDtext
    *      -->IS_ROW_NO  text
    FORM handle_hotspot_click USING i_row_id TYPE lvc_s_row
                                    i_column_id TYPE lvc_s_col
                                    is_row_no TYPE lvc_s_roid.
      READ TABLE tb_data INDEX is_row_no-row_id INTO wa_data.
      SELECT * FROM qals INTO CORRESPONDING FIELDS OF TABLE tb_data2
                WHERE selmatnr = wa_data-matnr AND
                      werk     = wa_data-werks .
      IF gr_alvgrid2 IS INITIAL.
        CREATE OBJECT gr_alvgrid2
      EXPORTING
      i_parent = gr_ccontainer2
      EXCEPTIONS
      error_cntl_create = 1
      error_cntl_init = 2
      error_cntl_link = 3
      error_dp_create = 4
      OTHERS = 5 .
    *----preparing field catalog.
        PERFORM prepare_field_catalog2 CHANGING gt_fieldcat2 .
    *----Preparing layout structure
        PERFORM prepare_layout CHANGING gs_layout2 .
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
        CALL METHOD gr_alvgrid2->set_table_for_first_display
        EXPORTING
    * I_BUFFER_ACTIVE =
    * I_CONSISTENCY_CHECK =
    * I_STRUCTURE_NAME =
    is_variant = ls_variant
    i_save = 'A'
    * I_DEFAULT = 'X'
        is_layout = gs_layout2
    * IS_PRINT =
    * IT_SPECIAL_GROUPS =
    * IT_TOOLBAR_EXCLUDING =
    * IT_HYPERLINK =
        CHANGING
        it_outtab = tb_data2
        it_fieldcatalog = gt_fieldcat2
    * IT_SORT =
    * IT_FILTER =
        EXCEPTIONS
        invalid_parameter_combination = 1
        program_error = 2
        too_many_lines = 3
        OTHERS = 4 .
      ELSE.
        CALL METHOD gr_alvgrid2->refresh_table_display
    * EXPORTING
    * IS_STABLE =
    * I_SOFT_REFRESH =
      EXCEPTIONS
      finished = 1
      OTHERS = 2 .
      ENDIF.
    *  call screen 100.
    ENDFORM .                    "handle_hotspot_click
    *&      Form  prepare_field_catalog2
    *       text
    *      <--P_GT_FIELDCAT2  text
    FORM prepare_field_catalog2 CHANGING pt_fieldcat TYPE lvc_t_fcat .
      DATA ls_fcat TYPE lvc_s_fcat .
      ls_fcat-fieldname = 'PRUEFLOS' .
      ls_fcat-outputlen = '23' .
      ls_fcat-coltext = 'Inspection Lot Number' .
      ls_fcat-seltext = 'Inspection Lot Number' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'ART' .
      ls_fcat-coltext = 'Inspection Type' .
      ls_fcat-seltext = 'Inspection Type' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'HERKUNFT' .
      ls_fcat-coltext = 'Inspection Lot Origin' .
      ls_fcat-seltext = 'Inspection Lot Origin' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
      ls_fcat-fieldname = 'ENSTEHDAT' .
      ls_fcat-coltext = 'Date of Lot Creation' .
      ls_fcat-seltext = 'Date of Lot Creation' .
      APPEND ls_fcat TO pt_fieldcat .
      CLEAR ls_fcat .
    ENDFORM.                    " prepare_field_catalog2
    *&      Form  handle_double_click
    *       text
    *      -->I_ROW      text
    *      -->I_COLUMN   text
    *      -->IS_ROW_NO  text
    FORM handle_double_click USING i_row TYPE lvc_s_row
                                   i_column TYPE lvc_s_col
                                   is_row_no TYPE lvc_s_roid.
      CLEAR wa_data.
      READ TABLE tb_data INDEX i_row-index INTO wa_data.
      SET PARAMETER ID 'MAT' FIELD wa_data-matnr.
      SET PARAMETER ID 'WRK' FIELD wa_data-werks.
      SET PARAMETER ID 'QHK' FIELD '89'.
      SET PARAMETER ID 'PLN' FIELD wa_data-plnnr.
      SET PARAMETER ID 'PAL' FIELD wa_data-plnal.
      CALL TRANSACTION 'QA01' AND SKIP FIRST SCREEN.
      SET PARAMETER ID 'PLN' FIELD ' '.
      SET PARAMETER ID 'PAL' FIELD ' '.
    ENDFORM .                    "handle_double_click

Maybe you are looking for

  • JMS receiver error

    Hello, I have maintained a JMS receiver adapter to an existing MQ system (IBM WebSphere 6.0) After deploying the modules to PI (7.11) the adapter goes green but allways says "Sucessfully disconnected from destination". When sending a message through

  • ALV GRID with own EXCEL-Template

    Hallo, I have Problem with using ALV-Grid with a own created template. At First I copy the SAP_OM.XLS template to CUS_OM.XLS. Then I update it by deleting all sheets, but not RAWDATA. When I use this template in ALV-GRID, it would be the right one, b

  • How to get back a lost note

    i was on my iphone 6 plus in the notes application i was looking at a note which i was going to paste,it pasted al the note,i wanted to copy and paste a part of it,it was all highlighted in blue so to remove this i tapped on cut which had taken it aw

  • Graph Legend

    It must be me, it must be because this is fundemental in an graphing application. Across the top row of data I have what I would expect to appear as the legend. In this case 2006, 2007 and 2008 Down the first column the months, jan feb etc And in the

  • Downloading online, instead of disc bought edition?

    I bought an education edition of Adobe Creative Suit and acrobat X1 Pro, but my CD ROM drive is not working.  Is there anyway I can download the programs and enter my seial numbers online?