VBUND information in table COSS

Hi Everyone,
is there any possibility of bringing the Partner information (VBUND) in the table COSS?
thanks

This is a Total table, it would be total per cost object....You might need to pull it from COEP do what is required to meet yr requirements.

Similar Messages

  • SAP Query - Additional field that collects information from table RESB

    Hello gurus. I have a question.
    I want to create a SAP Query that shows me the stock level of a list of materials, and also show me the total quantity of order reservations in an additional field.
    I created an InfoSet with table MARD, which is the one that holds the Stock information in a plant. Then I created an additional field which would read information from table RESB, the table that holds order reservations per material.
    So I wrote this piece of code:
    SELECT * FROM RESB
    WHERE MATNR EQ MARD-MATNR and
           WERKS EQ MARD-WERKS.
    ENDSELECT.
    if ( sy-dbcnt NE '0').
          MOVE RESB-BDMNG to ZQTY.
    ELSE.
          MOVE '' to ZQTY.
    ENDIF.
    This works fine. However, this is currently just catching the first record in table RESB that matches my condition.
    What I would like is to collect every instance of RESB-BDMNG and add them to field "ZQTY", have it loop in RESB until it finishes finding every record that match the MATNR and WERKS. With this I could get the total number of order reservations that this material has in that table.
    Could someone share some coding that would help me achieve this?

    Yes! That did it. That's what I needed to do. Thank you so much.
    While I'm at it, let me ask you a related question.
    When I execute the query, in the first records of the query where there's no value from RESB to transfer, the value of field ZQTY appears empty. Once it finds the first record in RESB and it populates ZQTY with a value, then the rest of the records with no hit get the proper value of 0.
    Do you know why the first records in the query appear empty and not with a 0? Is there anything I should add to the coding to fix this?

  • Performance problem with table COSS...

    Hi
    Anyone encountered performance problem with these table : COSS, COSB, COEP
    Best Regards

    >
    gsana sana wrote:
    > Hi Guru's
    >
    > this is the select Query which is taking much time in Production. so please help me to improve the preformance with BSEG.
    >
    > this is my select query:
    >
    > select  bukrs
    >               belnr
    >               gjahr
    >               bschl
    >               koart
    >               umskz
    >               shkzg
    >               dmbtr
    >               ktosl
    >               zuonr
    >               sgtxt
    >               kunnr
    >         from  bseg
    >         into  table gt_bseg1
    >          for  all entries in gt_bkpf
    >        where  bukrs eq p_bukrs
    >          and  belnr eq gt_bkpf-belnr
    >          and  gjahr eq p_gjahr
    >          and  buzei in gr_buzei
    >          and  bschl eq  '40'
    >          and  ktosl  ne  'BSP'.
    >
    > UR's
    > GSANA
    Hi,
    This is what I know and please if any expert think its incorrect, please do correct me.
    BSEG is a cluster table with BUKRS, BELNR, GJAHR and BUZEI as the key whereas other key will be stored in database as raw data thus SAP apps will need to convert that raw data first if we are using other keys in where condition. Hence, I suggest to use up to buzei in the where condition and filter other condition in internal table level like using Delete statement. Hope its help.
    Regards,
    Abraham

  • Regarding tables coss and cosp

    Hi Experts,
    In table AUFK there is object number field against order and against that object number there are lot of entries in tables coss and cosp.
    I need to know from which transaction these entries get updated and also can we come to know from these entries in tables coss & cosp, whether the order is newly entered or changed or any other operation happen on that order??
    Thnx..

    I can explain the costing frame work behind the Production order /Internal order.
    For all the items and Item types (material, service, Employee, Variable items ) based on Production order/Internal order Objnr( Object number) Cost estimate number will be generated (KALNR) .
    B       Base Planning Object
    E       Internal Activity   
    F       External Activity   
    L       Subcontracting      
    M       Material            
    N       Service             
    P       Process (Manual)    
    T       Text Item           
    V       Variable Item
    then all the items will be posted against the OBJNR and KALNR.
    Create the costing component for each item type using the function module
    KKDI_OBJECTS_CREATE_FROM_RES
    CL_COST_ESTIMATE is the class behind all the costings.  for behind each item type different class will be there for costing.  using cost estimate object all the Items will be inserted ( INSERT_COMPONENT method is responsible) .
    after that  calculation will happen using the calculate method of cl_cost_estimate ,then save_temporarily
    finally cl_cost_estimate=>commit_all
    Once it is commited then CKIS , COSP, COSS data will be updated from the items..
    i hope it is very vague for you.

  • Creating entry in table COSS

    Hi All,
    I want to create an entry in table COSS..
    if any transaction please tell me....
    or any other ways....
    Please help me...
    Thnx
    Rohit

    Hi All,,
    What i found is that for creating records in COSS we can use KP06 transaction...but with cost Element with Secondary cost element categories ....ie 21,31 42, 43,etc
    then only it will creates entry in COSS....
    Till now this is my finding.....
    if u have another way plz let me know....
    Thnx
    Rohit

  • How to put bin information to table T_QMAT thru user exit for stock remove?

    Hi,
    I have already use stock removal strategy 'F' and checked the flag 'User exit active', but the value in table T_QMAT filled by the standard system not include all vendors. So I need to use stock removal strategy " " and set up the table T_QMAT by the user exit.
    Do you know what is the user exit and the ABAP coding to put bin information to table T_QMAT for stock removal?
    Best Regards,
    Chris.

    Hi Chris,
    You can use the exit: EXIT_SAPLL03A_005 to populate t_qmat table based on your requirements. As you have already mentioned, it is important to check the flag: User exit active in SPRO, but bear in mind the stock removal strategy has to be BLANK. If you use F, then standard SAP auto-populates the T_QMAT table.
    Regards,
    Narendra.

  • I want complete information about table maintanence genarator?

    i want complete information about table maintanence genarator?

    hi there,,,,,,,
    The purpose of table maintainence generator is to enable the table maintenance through SM30, and to implement and validation etc on table field inputs.
    SE11->Utillities->table maintainence generator
    You need to enter the values of following fields:
    1. Table name
    2. Authorization group , and authorization object (select the suitable one )
    3. Function group and package
    4. Maintainence type : single or double screen maintainence view depending on the option selected.
    5. Maintain screen number : you may specify a value or let the system generate one for you.
    The validation code for the table entry is written in the flow logic of this screen. Even some of the fields may be made display only , by adding suitable code in the logic or directly disabling the input in table control in the layout.
    Table maintanance is for creating,adding datas to an existing table.
    it is for adding muiltiple records at a time in the table
    A table can be manipulated by a program or manually.
    When creating table, you will find a check box 'Table maintenance allowed'. If we
    check that option, we can manually enter entries using SE16 or table
    maintenance generator screen.
    SE16 is for data browser.
    Go to SE11, give the table name and click on change. Then Go to utilities--> Table
    maintenance generator.
    In the table maintenance generator screen, we should give Authorization Group,
    Function Group name (Function Group name can be same as table name),
    Maintenance type can be one step or two step, usually we will create with one
    step. we should give maintenance screen number. After clicking on create button,
    a table maintenance generator will be created.
    To check it go to SM30 . In SM30, we find display, Maintain options.
    We can view the table contents by choosing Display and we can create table
    entries by choosing Maintain.
    In the production system, end-users will not be having access to transaction
    codes like SE11 and SE16. Developers will not be having access to many
    transaction codes including the above two.
    To view the contents of the database table, we will use SE16n in Production
    system. Please find out the difference between SE16 and SE16n.
    All these authorizations will be maintained by BASIS team, by creating access
    profiles.
    So in order to edit or create the contents of a database table, we should go for
    table maintenance generator. In real time, authorizations will be maintained in
    production system. (even in development and Test systems to some extent).
    There is an audit like Sarbanes-Oxley Act for American clients, where every thing
    will be audited by government agency. To know more about SOX, use the links on
    the right hand side of this page.
    The second reason is, we can edit or create multiple entries at a time, using table
    maintenance generator.
    Apart from that we have options like 'Enter conditions' in table maintenance
    screen SM30. Please try to find out the use of those, by creating an example.
    Table Maintenance generator: Difference between one step and two steps.
    While creating table maintenance generator, we find below options:
    When we choose one step, we have to give the screen number in Overview Screen field.
    When we choose two step, we have to give both overview screen number and single screen number.
    You can give any number for screen. Don’t give 1000 screen number. As this
    number is reserved for selection screen.
    When we choose two step, two screens will be created for table maintenance. For
    single step only one screen will be created.
    When we choose two step, table maintenance will work as follows
    Go to SM30, give the table name for which you have created table maintenance-
    Overview screen will be displayed. To create entries, when you click on ‘new
    entries’. Another screen will be displayed, where you give input and save. You can
    enter one record at a time.
    Go to SM30; give table name for which you have created table maintenance-
    Overview screen will be displayed; To create entries click on ‘new entries’, you can
    enter the records on the same screen. You can enter multiple records at a time.
    We use single step generally, as it is user friendly.
    To completely understand the difference and above points please do exercise by
    creating table maintenance generator in both ways (using single step and two
    step).
    Link: http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
    Link: http://help.sap.com/saphelp_46c/helpdata/en/a7/5133ac407a11d1893b0000e8323c4f/frameset.htm
    Link: /message/2831202#2831202 [original link is broken]
    One step, two step in Table Maintenance Generator
    Single step: Only overview screen is created i.e. the Table Maintenance Program will have only one screen where you can add, delete or edit records.
    Two step: Two screens namely the overview screen and Single screen are created. The user can see the key fields in the first screen and can further go on to edit further details.
    pls reward if useful
    regards,
    rekha

  • Reg:where can i see doocuments attachments information in Tables urgent

    HI All GM,
    I want to see documents attachmens information in tables. in which tables documents attachments information will store. how can i see .
    regards
    JK Rao

    Hi....
    Can you be clear with your querry.Its not clear and hence many of us are unable to answer.
    Regards
    Aravind

  • Table coss

    Hi All ,
    Im using the badi DPR_FIN_GECCO_CALC for rate calculation on period wise role distribution.
    I want to know how will the table COSS be updated in this. The std prog is also dointg the same but im not able to find the exact structure.
    help needed.

    This is a Total table, it would be total per cost object....You might need to pull it from COEP do what is required to meet yr requirements.

  • Create entry in Internal Posting table COSS

    Hi All,
    I want to create an entry in table COSS..
    Please help me...
    Thnx
    Rohit

    You can enter data Programatically but it is not a correct approach.
    Create a Table maintenance Generator to for table COSS to make an Entry.
    follow below steps
    1) go to se11 check table maintanance check box under
    attributes tab
    2) utilities-table maintanance Generator->
    create function group and assign it under
    function group input box.
    also assign authorization group default &NC& .
    3)
    select standard recording routine radio in table
    table mainitainence generator to move table
    contents to quality and production by assigning
    it to request.
    4) select maintaience type as single step.
    5) maintainence screen as system generated numbers
    this dialog box appears when you click on create
    button
    6) save and activate table
    OR.
    Check Tcode for the COSS table and Use BDC.
    Regards,
    Gurpreet

  • Information about table spaces.

    Hi!
    I have a requirement to   create a Bex by which I can display the  list of table spaces available and status of  those  table spaces like memory free, Used. Though we can get this information from  DB02  I need to generate a  report and  broadcast that to users.
    Can anyone help me in telling me the table name  where you can get the list of table spaces  and infomation or any function module which lists the  table spaces name and  status of them. 
    Regards
    Venkat

    Hello,
    Could you please share more information about this? We need to do the same thing. How did you create your generic datasource? what table/Function module did you used?
    Thank you
    Ramona

  • Required information of tables related to PC and IP

    We requires some tables info in order to get a better understanding on how information regarding process chains and infopackages is stored in BW.
    Only relevant tables that can be used for example for <b>weekly quality checks</b> and that can be especially useful after transports.
    So that we can do quality checks in a very fast way without having to go into each infopackage or processchain
    Please do reply .

    hi,
    process chain tables
    RSPC_BUFFER                    Shared Buffer for Processes (Esp. Customer
    RSPC_MONITOR                   Monitor individual process chains         
    RSPCABAPASYNC                  Logging for ABAP Processes(Synchronously a
    RSPCCATEGORY                   Process Type Categories                   
    RSPCCATEGORYT                  Texts for Category                        
    RSPCCHAIN                      Process chain                             
    RSPCCHAINATTR                  Attributes for a Process Chain            
    RSPCCHAINEVENTS                Multiple Events with Process Chains       
    RSPCCHAINT                     Texts for Chain                           
    RSPCCOMMANDLOG                 System Command Execution Logs (Process Cha
    RSPCENQUEUE                    Dummy Table for Runtime Locks of a Process
    RSPCEXOR                       Excluding Or: Log Table                   
    RSPCINFO                       Special Values for Communication between P
    RSPCINFOT                      Special Values for Communication between P
    RSPCINSTANCE                   Generic Instance Storage                  
    RSPCINSTANCET                  Texts for Generic Instance-Storage        
    RSPCLOGCHAIN                   Cross-Table Log ID / Chain ID             
    RSPCLOGCROSS                   Cross-Table Log ID Old / Log ID New       
    RSPCLOGS                       Application Logs for the Process Chains (G
    RSPCPROCESSLOG                 Logs for the Chain Runs                   
    RSPCRUNVARIABLES               Variables for Process Chains for Runtime  
    RSPCTRIGGER                    Variants for the Trigger Processes        
    RSPCTRIGGERT                   Texts for the Trigger Variants            
    RSPCTYPESDEP                   Dependencies for Processes                
    RSPCTYPESPROC                  Attributes of BW processes (RSSM)         
    RSPCVARIANT                    Generic Variant-Storage                   
    RSPCVARIANTATTR                Attributes of a Process Variant 
    RSPCVARIANTT                   Texts for Generic Variant Storage

  • Updation agent information in table

    Hi ,
    I have created one custom module pool program which is used for request for resource.
    Now in that i create new entries with request no , date (i.e sydatum) , person responsible (for creating request)
    all this values are stored in the custom table .
    when i hit the save the workflow should trigger.
    I have used table maintainence generator and created the event and used swe_create_event to trigger the workflow.
    now the workflow select the agent from the Ztable where the agant are maintained .
    i want to know how should i update the information as to which agent has approved the workitem in the custom and at which date.
    i believe i am correct in stating my query .
    Thanks in advance
    chitis

    The simple way is to make use of program exit tab of the step which is sent ot approver for approval.The progrma exit events react based on various eventytpes, like workitem before creation, after execution, completed, state chnaged etc...
    My suggesstion is to create a program exit class and include the class in the program exit tab of the step and update you z table in the one of the methods of the program exits tab.
    for more information, on how to create and use it please go through the [wiki|https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/programExitsIn+Workflow]

  • Storing shape information in table

    Hi All,
    I have a Program which displays shape (rectangle,oval,etc) in the panel which is enclosed in a frame.. shape can be dragged and dropped anywhere on panel... also one can delete shape... Now I Want To Store All The Exiting Shapes (as they are added on panel ) in some structure say a table, and alongwith it, i also want to store additional information about shape, say its location currently on panel, its present color, etc so that i can use this information later in the program... how do i do implement this ?? Plz Help Me.. It would be great if you include the changes in the source code itself...
    thanks
    Here is the source code :
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.ArrayList;
    public class ShapeDrawFrame extends javax.swing.JFrame {
        JCheckBoxMenuItem addLargeShapes;    
       JCheckBoxMenuItem addBorderedShapes; 
       JRadioButtonMenuItem red, green, blue,      
                            cyan, magenta, yellow, 
                            black, gray, white;  
       JPopupMenu popup;
        public ShapeDrawFrame() {
            super("Shape Draw");
            //initComponents();        
          ShapeCanvas canvas = new ShapeCanvas();
          setContentPane(canvas);
          /* Create the menu bar and the menus */
          JMenuBar menubar = new JMenuBar();
          setJMenuBar(menubar);
          JMenu addShapeMenu = new JMenu("Add");
          addShapeMenu.setMnemonic('A');
          menubar.add(addShapeMenu);
          JMenu shapeColorMenu = new JMenu("Color");
          shapeColorMenu.setMnemonic('C');
          menubar.add(shapeColorMenu);
          JMenu optionsMenu = new JMenu("Options");
          optionsMenu.setMnemonic('O');
          menubar.add(optionsMenu);
          /* Create menu items for adding shapes to the canvas,
             and add them to the "Add" menu.  The canvas serves
             as ActionListener for these menu items. */     
          JMenuItem rect = new JMenuItem("Rectangle");
          rect.setAccelerator( KeyStroke.getKeyStroke("ctrl R") );
          addShapeMenu.add(rect);
          rect.addActionListener(canvas);
          JMenuItem oval = new JMenuItem("Oval");
          oval.setAccelerator( KeyStroke.getKeyStroke("ctrl O") );
          addShapeMenu.add(oval);
          oval.addActionListener(canvas);
          JMenuItem roundrect = new JMenuItem("Round Rect");
          roundrect.setAccelerator( KeyStroke.getKeyStroke("ctrl D") );
          addShapeMenu.add(roundrect);
          roundrect.addActionListener(canvas);
          /* Create the JRadioButtonMenuItems that control the color
             of a newly added shape, and add them to the "Color"
             menu.  There is no ActionListener for these menu items.
             The canvas checks for the currently selected color when
             it adds a shape to the canvas.  A ButtonGroup is used
             to make sure that only one color is selected. */
          ButtonGroup colorGroup = new ButtonGroup();
          red = new JRadioButtonMenuItem("Red");
          shapeColorMenu.add(red);
          colorGroup.add(red);
          red.setSelected(true);
          green = new JRadioButtonMenuItem("Green");
          shapeColorMenu.add(green);
          colorGroup.add(green);
          blue = new JRadioButtonMenuItem("Blue");
          shapeColorMenu.add(blue);
          colorGroup.add(blue);
          cyan = new JRadioButtonMenuItem("Cyan");
          shapeColorMenu.add(cyan);
          colorGroup.add(cyan);
          magenta = new JRadioButtonMenuItem("Magenta");
          shapeColorMenu.add(magenta);
          colorGroup.add(magenta);
          yellow = new JRadioButtonMenuItem("Yellow");
          shapeColorMenu.add(yellow);
          colorGroup.add(yellow);
          black = new JRadioButtonMenuItem("Black");
          shapeColorMenu.add(black);
          colorGroup.add(black);
          gray = new JRadioButtonMenuItem("Gray");
          shapeColorMenu.add(gray);
          colorGroup.add(gray);
          white = new JRadioButtonMenuItem("White");
          shapeColorMenu.add(white);
          colorGroup.add(white);
          /* Create the "Clear" menu item, and add it to the
             "Options" menu.  The canvas will listen for events
             from this menu item. */
          JMenuItem clear = new JMenuItem("Clear");
          clear.setAccelerator( KeyStroke.getKeyStroke("ctrl C") );
          clear.addActionListener(canvas);
          optionsMenu.add(clear);
          optionsMenu.addSeparator();  // Add a separating line to the menu.
          /* Create the JCheckBoxMenuItems and add them to the Options
             menu.  There is no ActionListener for these items because
             the canvas class will check their state when it adds a
             new shape. */
          addLargeShapes = new JCheckBoxMenuItem("Add Large Shapes");
          addLargeShapes.setSelected(true);
          optionsMenu.add(addLargeShapes);
          addBorderedShapes = new JCheckBoxMenuItem("Add Shapes with Border");
          addBorderedShapes.setSelected(true);
          optionsMenu.add(addBorderedShapes);
          optionsMenu.addSeparator();
          /* Create a menu for background colors, and add it to the
             "Options" menu.  It will show up as a hierarchical sub-menu. */
          JMenu background = new JMenu("Background Color");
          optionsMenu.add(background);
          background.add("Red").addActionListener(canvas);
          background.add("Green").addActionListener(canvas);
          background.add("Blue").addActionListener(canvas);
          background.add("Cyan").addActionListener(canvas);
          background.add("Magenta").addActionListener(canvas);
          background.add("Yellow").addActionListener(canvas);
          background.add("Black").addActionListener(canvas);
          background.add("Gray").addActionListener(canvas);
          background.add("White").addActionListener(canvas);
          /* Create the pop-up menu and add commands for editing a
             shape.  This menu is not used until the user performs
             the pop-up trigger mouse gesture on a shape. */
          popup = new JPopupMenu();
          popup.add("Delete Shape").addActionListener(canvas);
          popup.add("Bring to Front").addActionListener(canvas);
          popup.addSeparator();
          popup.add("Make Large").addActionListener(canvas);
          popup.add("Make Small").addActionListener(canvas);
          popup.addSeparator();
          popup.add("Add Black Border").addActionListener(canvas);
          popup.add("Remove Black Border").addActionListener(canvas);
          popup.addSeparator();
          popup.add("Set Color to Red").addActionListener(canvas);
          popup.add("Set Color to Green").addActionListener(canvas);
          popup.add("Set Color to Blue").addActionListener(canvas);
          popup.add("Set Color to Cyan").addActionListener(canvas);
          popup.add("Set Color to Magenta").addActionListener(canvas);
          popup.add("Set Color to Yellow").addActionListener(canvas);
          popup.add("Set Color to Black").addActionListener(canvas);
          popup.add("Set Color to Gray").addActionListener(canvas);
          popup.add("Set Color to White").addActionListener(canvas);
          /* Set the "DefaultCloseOperation" for the frame.  This determines
             what happens when the user clicks the close box of the frame.
             It is set here so that System.exit() will be called to end
             the program when the user closes the window. */
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          /* Set the size and location of the frame, and make it visible. */
          setLocation(20,50);
          setSize(550,420);
          show();       
       class ShapeCanvas extends JPanel
                         implements ActionListener, MouseListener, MouseMotionListener {
             // This class represents a "canvas" that can display colored shapes and
             // let the user drag them around.  It uses an off-screen images to
             // make the dragging look as smooth as possible.
          ArrayList shapes = new ArrayList();
               // holds a list of the shapes that are displayed on the canvas
          ShapeCanvas() {
               // Constructor: set background color to white
               // set up listeners to respond to mouse actions
             setBackground(Color.white);
             addMouseListener(this);
             addMouseMotionListener(this);
          public void paintComponent(Graphics g) {
               // In the paint method, all the shapes in ArrayList are
               // copied onto the canvas.
             super.paintComponent(g);  // First, fill with background color.
             int top = shapes.size();
             for (int i = 0; i < top; i++) {
                Shape s = (Shape)shapes.get(i);
                s.draw(g);
          public void actionPerformed(ActionEvent evt) {
                 // Called to respond to action events from the
                 // menus or pop-up menu.
             String command = evt.getActionCommand();
             if (command.equals("Clear")) {
                shapes.clear(); // Remove all items from the ArrayList
                repaint();
             else if (command.equals("Rectangle"))
                addShape(new RectShape());
             else if (command.equals("Oval"))
                addShape(new OvalShape());
             else if (command.equals("Round Rect"))
                addShape(new RoundRectShape());
             else if (command.equals("Red"))
                setBackground(Color.red);
             else if (command.equals("Green"))
                setBackground(Color.green);
             else if (command.equals("Blue"))
                setBackground(Color.blue);
             else if (command.equals("Cyan"))
                setBackground(Color.cyan);
             else if (command.equals("Magenta"))
                setBackground(Color.magenta);
             else if (command.equals("Yellow"))
                setBackground(Color.yellow);
             else if (command.equals("Black"))
                setBackground(Color.black);
             else if (command.equals("Gray"))
                setBackground(Color.gray);
             else if (command.equals("White"))
                setBackground(Color.white);
             else if (clickedShape != null) {
                    // Process a command from the pop-up menu.
                if (command.equals("Delete Shape"))
                   shapes.remove(clickedShape);
                else if (command.equals("Bring to Front")) {
                   shapes.remove(clickedShape);
                   shapes.add(clickedShape); 
                else if (command.equals("Make Large"))
                   clickedShape.setSize(100,60);
                else if (command.equals("Make Small"))
                   clickedShape.setSize(50,30);
                else if (command.equals("Add Black Border"))
                   clickedShape.setDrawOutline(true);
                else if (command.equals("Remove Black Border"))
                   clickedShape.setDrawOutline(false);
                else if (command.equals("Set Color to Red"))
                   clickedShape.setColor(Color.red);
                else if (command.equals("Set Color to Green"))
                   clickedShape.setColor(Color.green);
                else if (command.equals("Set Color to Blue"))
                   clickedShape.setColor(Color.blue);
                else if (command.equals("Set Color to Cyan"))
                   clickedShape.setColor(Color.cyan);
                else if (command.equals("Set Color to Magenta"))
                   clickedShape.setColor(Color.magenta);
                else if (command.equals("Set Color to Yellow"))
                   clickedShape.setColor(Color.yellow);
                else if (command.equals("Set Color to Black"))
                   clickedShape.setColor(Color.black);
                else if (command.equals("Set Color to Gray"))
                   clickedShape.setColor(Color.gray);
                else if (command.equals("Set Color to White"))
                   clickedShape.setColor(Color.white);
                repaint();
          } // end actionPerformed()
          void addShape(Shape shape) {
                 // Add the shape to the canvas, and set its size, color
                 // and whether or not it should have a black border.  These
                 // properties are determined by looking at the states of
                 // various menu items.  The shape is added at the top-left
                 // corner of the canvas.
             if (red.isSelected())
                shape.setColor(Color.red);
             else if (blue.isSelected())
                shape.setColor(Color.blue);
             else if (green.isSelected())
                shape.setColor(Color.green);
             else if (cyan.isSelected())
                shape.setColor(Color.cyan);
             else if (magenta.isSelected())
                shape.setColor(Color.magenta);
             else if (yellow.isSelected())
                shape.setColor(Color.yellow);
             else if (black.isSelected())
                shape.setColor(Color.black);
             else if (white.isSelected())
                shape.setColor(Color.white);
             else
                shape.setColor(Color.gray);
             shape.setDrawOutline( addBorderedShapes.isSelected() );
             if (addLargeShapes.isSelected())
                shape.reshape(3,3,100,60);
             else
                shape.reshape(3,3,50,30);
             shapes.add(shape);
             repaint();
          } // end addShape()
          // -------------------- This rest of this class implements dragging ----------------------
          Shape clickedShape = null;  // This is the shape that the user clicks on.
                                      // It becomes the draggedShape is the user is
                                      // dragging, unless the user is invoking a
                                      // pop-up menu.  This variable is used in
                                      // actionPerformed() when a command from the
                                      // pop-up menu is processed.
          Shape draggedShape = null;  // This is null unless a shape is being dragged.
                                      // A non-null value is used as a signal that dragging
                                      // is in progress, as well as indicating which shape
                                      // is being dragged.
          int prevDragX;  // During dragging, these record the x and y coordinates of the
          int prevDragY;  //    previous position of the mouse.
          public void mousePressed(MouseEvent evt) {
                // User has pressed the mouse.  Find the shape that the user has clicked on, if
                // any.  If there is no shape at the position when the mouse was clicked, then
                // ignore this event.  If there is then one of three things will happen:
                // If the event is a pop-up trigger, then the pop-up menu is displayed, and
                // the user can select from the pop-up menu to edit the shape.  If the user was
                // holding down the shift key, then bring the clicked shape to the front, in
                // front of all the other shapes.  Otherwise, start dragging the shape.
             if (draggedShape != null) {
                  // A drag operation is already in progress, so ignore this click.
                  // This might happen if the user clicks a second mouse button before
                  // releasing the first one(?).
                return;
             int x = evt.getX();  // x-coordinate of point where mouse was clicked
             int y = evt.getY();  // y-coordinate of point
             clickedShape = null;  // This will be set to the clicked shape, if any.
             for ( int i = shapes.size() - 1; i >= 0; i-- ) { 
                    // Check shapes from front to back.
                Shape s = (Shape)shapes.get(i);
                if (s.containsPoint(x,y)) {
                   clickedShape = s;
                   break;
             if (clickedShape == null) {
                   // The user did not click on a shape.
                return;
             else if (evt.isPopupTrigger()) {
                  // The user wants to see the pop-up menu
                popup.show(this,x-10,y-2);
             else if (evt.isShiftDown()) {
                  // Bring the clicked shape to the front
                shapes.remove(clickedShape);
                shapes.add(clickedShape);
                repaint();
             else {
                  // Start dragging the shape.
                draggedShape = clickedShape;
                prevDragX = x;
                prevDragY = y;
          public void mouseDragged(MouseEvent evt) {
                 // User has moved the mouse.  Move the dragged shape by the same amount.
             if (draggedShape == null) {
                    // User did not click a shape.  There is nothing to do.
                return;
             int x = evt.getX();
             int y = evt.getY();
             draggedShape.moveBy(x - prevDragX, y - prevDragY);
             prevDragX = x;
             prevDragY = y;
             repaint();      // redraw canvas to show shape in new position
          public void mouseReleased(MouseEvent evt) {
                 // User has released the mouse.  Move the dragged shape, and set
                 // draggedShape to null to indicate that dragging is over.
                 // If the shape lies completely outside the canvas, remove it
                 // from the list of shapes (since there is no way to ever move
                 // it back on screen).  However, if the event is a popup trigger
                 // event, then show the popup menu instead.
             if (draggedShape == null) {
                   // User did not click on a shape. There is nothing to do.
                return;
             int x = evt.getX();
             int y = evt.getY();
             if (evt.isPopupTrigger()) {
                   // Check whether the user is trying to pop up a menu.
                   // (This should be checked in both the mousePressed() and
                   // mouseReleased() methods.)
                popup.show(this,x-10,y-2);
             else {
                draggedShape.moveBy(x - prevDragX, y - prevDragY);
                if ( draggedShape.left >= getSize().width || draggedShape.top >= getSize().height ||
                        draggedShape.left + draggedShape.width < 0 ||
                        draggedShape.top + draggedShape.height < 0 ) {  // shape is off-screen
                   shapes.remove(draggedShape);  // remove shape from list of shapes
                repaint();
             draggedShape = null;  // Dragging is finished.
          public void mouseEntered(MouseEvent evt) { }   // Other methods required for MouseListener and
          public void mouseExited(MouseEvent evt) { }    //              MouseMotionListener interfaces.
          public void mouseMoved(MouseEvent evt) { }
          public void mouseClicked(MouseEvent evt) { }
       }  // end class ShapeCanvas
       // ------- Nested class definitions for the abstract Shape class and three -----
       // -------------------- concrete subclasses of Shape. --------------------------
       static abstract class Shape {
             // A class representing shapes that can be displayed on a ShapeCanvas.
             // The subclasses of this class represent particular types of shapes.
             // When a shape is first constructed, it has height and width zero
             // and a default color of white.
          int left, top;      // Position of top left corner of rectangle that bounds this shape.
          int width, height;  // Size of the bounding rectangle.
          Color color = Color.white;  // Color of this shape.
          boolean drawOutline;  // If true, a black border is drawn on the shape
          void reshape(int left, int top, int width, int height) {
                // Set the position and size of this shape.
             this.left = left;
             this.top = top;
             this.width = width;
             this.height = height;
          void setSize(int width, int height) {
                // Set the size of this shape
             this.width = width;
             this.height = height;
          void moveBy(int dx, int dy) {
                 // Move the shape by dx pixels horizontally and dy pixels vertically
                 // (by changing the position of the top-left corner of the shape).
             left += dx;
             top += dy;
          void setColor(Color color) {
                 // Set the color of this shape
             this.color = color;
          void setDrawOutline(boolean draw) {
                 // If true, a black outline is drawn around this shape.
             drawOutline = draw;
          boolean containsPoint(int x, int y) {
                // Check whether the shape contains the point (x,y).
                // By default, this just checks whether (x,y) is inside the
                // rectangle that bounds the shape.  This method should be
                // overridden by a subclass if the default behavior is not
                // appropriate for the subclass.
             if (x >= left && x < left+width && y >= top && y < top+height)
                return true;
             else
                return false;
          abstract void draw(Graphics g); 
                // Draw the shape in the graphics context g.
                // This must be overridden in any concrete subclass.
       }  // end of class Shape
       static class RectShape extends Shape {
             // This class represents rectangle shapes.
          void draw(Graphics g) {
             g.setColor(color);
             g.fillRect(left,top,width,height);
             if (drawOutline) {
                g.setColor(Color.black);
                g.drawRect(left,top,width,height);
       static class OvalShape extends Shape {
              // This class represents oval shapes.
          void draw(Graphics g) {
             g.setColor(color);
             g.fillOval(left,top,width,height);
             if (drawOutline) {
                g.setColor(Color.black);
                g.drawOval(left,top,width,height);
          boolean containsPoint(int x, int y) {
                // Check whether (x,y) is inside this oval, using the
                // mathematical equation of an ellipse.
             double rx = width/2.0;   // horizontal radius of ellipse
             double ry = height/2.0;  // vertical radius of ellipse
             double cx = left + rx;   // x-coord of center of ellipse
             double cy = top + ry;    // y-coord of center of ellipse
             if ( (ry*(x-cx))*(ry*(x-cx)) + (rx*(y-cy))*(rx*(y-cy)) <= rx*rx*ry*ry )
                return true;
             else
               return false;
       static class RoundRectShape extends Shape {
              // This class represents rectangle shapes with rounded corners.
              // (Note that it uses the inherited version of the
              // containsPoint(x,y) method, even though that is not perfectly
              // accurate when (x,y) is near one of the corners.)
          void draw(Graphics g) {
             g.setColor(color);
             g.fillRoundRect(left,top,width,height,width/3,height/3);
             if (drawOutline) {
                g.setColor(Color.black);
                g.drawRoundRect(left,top,width,height,width/3,height/3);
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
        private void initComponents() {
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 400, Short.MAX_VALUE)
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 300, Short.MAX_VALUE)
            pack();
        }// </editor-fold>                       
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new ShapeDrawFrame().setVisible(true);
        // Variables declaration - do not modify                    
        // End of variables declaration                  
    }

    Kartik_Nibjiya wrote:
    I Want To Keep Track Of Each Shape Throughout as long as i dont exit my program and Each Of Its Individual Properties... How Do I DO That ??Well, in your programm you have the structure "shapes" where you keep track of each shape object containing each of its induvidual properties. So I don't understand what else you might want.

  • Information about Table Type

    Hi Guys,
    What does Table Type mean?
    What are uses of Table Type?
    Regards,
    Chandru

    Hi
    Analogous to the predefined ABAP types such as C or I , one may define user-defined types in the dictionary.
    The following user-defined types are allowed
    Data elements: Describe an elementary type by defining   the data type, length and possibly decimal places.
    Structures: Consist of components that can have any       type.
    Table types: Describe the structure of an internal table.
    Elaboration on the type categories.
    There are three different type categories in the ABAP Dictionary:
    Data elements (elementary types) Elementary types have no structure. They describe the data type attributes (such as given Dictionary data type, number of places) and information that is relevant for the screen (such as title) of unstructured data objects (variables/fields).
    Structures (structured types) Structured types describe the structure and functions of any structured data objects, that is of data structures with components of any type. A component can be a field with an elementary type or can itself be a structure. A table can also be used as a component in a structure. A database table always has a structure and is therefore implicitly a structured type. However, the fields of a database table can only have an elementary type.
    Table types Table types describe the structure and functions of internal tables in the ABAP program. Their rows can have any row type. Table types with elementary row type therefore can be defined just the same as multi-dimensional table types (table types with a table type as row type) or table types using structures with table-like components.
    Any complex user-defined type may be built using the
    previously mentioned basic types.

Maybe you are looking for

  • How do I transfer music from my iPhone5 to Windows 7 or 8?

    Hi! Okay, so I've done it before and just can't remember how to make the file button come down so I can transfer my purchased music to my pc. I know that that little icon isn't the button I need, but thats about it. My computers already authorized an

  • Com.sap.aii.adapter.jdbc.svc and com.sap.aii.adapter.jms.svc don't start

    Hello, In order to configure JMS Receiver Adapter to access Websphere Application Server 7.0, I have recently deployed file com.sap.aii.adapter.lib.sca with the following libraries: com.sap.aii.adapter.lib_api.jar com.ibm.ws.ejb.thinclient_7.0.0.jar

  • Brought film is out of sink between action and voice

    I purchased a film but on playback it is out of sink the action is not matching the sound I am using windows 8 can some one help others wise i will not purchase anything from itunes again

  • Auto renewable subscription verify receipt, unexpected value in expires_date field

    During renewable IAP subscription receipt verification I need to get the end date of the latest reciept. Apple has documented the receipt field "expires_date" field as giving the number of milliseconds since 1 jan 1970 but it actually contains the fo

  • Help with backing up January update

    I have to send my computer back to Gatweway for the 3rd time. Let's just say I'm about ready to take a bat to this thing! Anyway, they will be deleting everything on my computer and I've already backed up all my music/photos and videos on my portable