Display data in JTable

I am trying to display data from database into the JTable swing component. I can see the table and the heading coming from the vector. I cannot see why the data from the databse table is not loaded on to the Jtable. I just get a table with 6 rows blank.
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import java.util.*;
public class dataTable extends JApplet
String dbdriver="jdbc:oracle:thin:@ds1.ctateu.edu:1521:wpac";
String dbuser="system";
String dbpass="pass";
Container c;
JScrollPane jsp;
JTable table;
int v,h;
Connection connection;
Statement stmt;
ResultSet rs;
String param_start,param_end, param_disp_start, param_disp_end,param_shortdesc, param_longdesc;
public void init()
c= getContentPane();
c.setLayout (new BorderLayout());
v=ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
Vector heading = new Vector();
heading.addElement("Event Start Date");
heading.addElement("Event End Date");
heading.addElement("Display Start Date");
heading.addElement("Display End Date");
heading.addElement("Short Description");
heading.addElement("Long Description");
Vector data = new Vector();
try
Class.forName("oracle.jdbc.driver.OracleDriver");
connection=DriverManager.getConnection(dbdriver,dbuser,dbpass);
stmt=connection.createStatement();
rs= stmt.executeQuery("select * from univevents");
while(rs.next())
param_start = rs.getString("start_date");
param_end = rs.getString("end_date");
param_disp_start = rs.getString("display_start");
param_disp_end =rs.getString("display_end");
param_shortdesc = rs.getString("short_desc");
param_longdesc = rs.getString("long_desc");
catch (Exception e)
//JOptionPane.showMessageDialogue("Exception: "+e.getMessage());
data.addElement(param_start);
data.addElement(param_end);
data.addElement(param_disp_start);
data.addElement(param_disp_end);
data.addElement(param_shortdesc);
data.addElement(param_longdesc);
table = new JTable(data, heading);
jsp = new JScrollPane(table,v,h);
//Add scrollpane to container
c.add("Center",jsp);
}//init
}//JApplet

Your data vector should be a Vector of Vectors.
I think you need to change your loop to look something like this:
while(rs.next())
    Vector row = new Vector();
    row.addElement( rs.getString("start_date") );
    row.addElement( rs.getString("end_date") );
    row.addElement( rs.getString("display_start") );
    row.addElement( rs.getString("display_end") );
    row.addElement( rs.getString("short_desc") );
    row.addElement( rs.getString("long_desc") );
    data.addElement( row );
} Then remove your data.addElement() statements found outside the loop.

Similar Messages

  • Using JTables to display data from a text file

    How do I display data from a .txt file into a column inside a JTable?

    dont quite get the "vectors" part..
    by the way, my program is as follows
    * Damn Java ..
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    public class ScoreBoard extends JPanel {
    private boolean DEBUG = false;
    public ScoreBoard() {
    super(new GridLayout(1,0));
    String[] columnNames = {"Player's Name",
    "Time Completed",
    "$ Amount Earned $"};
    /* Object[][] data = {
    {"1",
    new Integer(5), new Integer(500)},
    {"2",
    new Integer(5), new Integer(3200)},
    {"3",
    new Integer(5), new Integer(1000)},
    {"4",
    new Integer(5), new Integer(100)},
    {"5",
    new Integer(5), new Integer(200)},
    final JTable table = new JTable(data, columnNames);
    table.setPreferredScrollableViewportSize(new Dimension(600, 90));
    if (DEBUG) {
    table.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    printDebugData(table);
    //Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);
    //Add the scroll pane to this panel.
    add(scrollPane);
    private void printDebugData(JTable table) {
    int numRows = table.getRowCount();
    int numCols = table.getColumnCount();
    javax.swing.table.TableModel model = table.getModel();
    System.out.println("Value of data: ");
    for (int i=0; i < numRows; i++) {
    System.out.print(" row " + i + ":");
    for (int j=0; j < numCols; j++) {
    System.out.print(" " + model.getValueAt(i, j));
    System.out.println();
    System.out.println("--------------------------");
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("ScoreBoard");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    ScoreBoard newContentPane = new ScoreBoard();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    and i want to display the player name from a textfile.txt to the player column instead of hardcoding it like above. Thanks!

  • Query by example - how can I display VCRow in JTable?

    I would like to provide the user with a searchable table.
    Actually I would like to use two tables: one, displaying one row where the user can specify the search criteria. And the second table should display the data found.
    I could store the entered criteria locally in a hashmap in TableModel, for example, then create a WHERE clause. This solution is quite messy, since the user can add, remove and rearrange the columns of both tables.
    Or I could use -I hope- the query-by-example feature, like this:
    am = app.getApplicationModule();
    ViewObject vo = am.createViewObject( "MyVO", "mypackage1.PatView" );
    ViewCriteria vc = vo.createViewCriteria();
    ViewCriteriaRow vcr = vc.createViewCriteriaRow();
    Now I can set attributes and use vo.applyViewCriteria() to find my data.
    But how can I bring the first JTable to display this single ViewCriteriaRow, so that the user can do the editing?
    The JUNavigationBar does it, if I am not mistaken. It switches the PanelBinding to find mode, and then a JTable displays a ViewCriteriaRow (?) instead of the ViewObject's data. But I don't want to use the bar. How do I create this behaviour manually?
    The javadoc of JUPanelBinding says:
    "Sets this panel and all its associated iterators into find mode."
    So I guess that setting iterators into find mode is what I need. But I cannot figure out how to do that. Who can?

    You cannot set the iterators in a panelBinding to separate find/data modes individually.
    However you can create two JUPanelBinding objects one for the findMode form and one that displays Data.
    here's what I did to modify a generated SingleForm, to display two panels of the same type one in find mode and other in data mode.
    I changed the jbInit method of the "LayoutPanel" class to be like:
    //declare this as a member of the class.
    JButton findBtn;
    public void jbInit() throws Exception
    // Panel layout
    masterViewPanel = new PanelDeptView(panelBinding);
    //create another instance of PanelBinding for a second (findform) DeptView panel.
    JUPanelBinding binding = new JUPanelBinding("Project3.Mypackage1Module", this);
    binding.setApplication(panelBinding.getApplication());
    masterViewPanel1 = new PanelDeptView(binding); //create second instance
    findBtn = masterViewPanel1.navBar.getButton(JUNavigationBar.BUTTON_FIND);
    findBtn.doClick(); //set the second instance in find mode.
    //add a listener on the second instance's execute button so that it resets the form into find mode
    //this forces the second instance to be in find mode when execute button is pressed.
    masterViewPanel1.navBar.getButton(JUNavigationBar.BUTTON_EXECUTE).addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ev)
    SwingUtilities.invokeLater(new Runnable() {
    public void run()
    findBtn.doClick();
    this.setLayout(panelLayout);
    add(masterViewPanel, BorderLayout.WEST);
    //add the second instance.
    add(masterViewPanel1, BorderLayout.EAST);
    I also had to call findBtn.doClick() again in the "constructor" that takes (JUApplication, boolean) after the panelBinding is executed,
    to force the initial startup of this panel in findmode

  • Database data into JTables

    Hi All,
    Does anybody know how i would go about displaying data from a database in a JTable?
    Thanks

    http://search.java.sun.com/search/java/index.jsp?and=database+jtable&phr=&qt=&not=&field=title&since=&nh=10&col=javaforums&rf=0&Search.x=22&Search.y=13

  • URGENT !!! HOW CAN CHANGE DATA IN JTABLE!!!

    My Program ....
    pLinhas.dataModel.addTableModelListener(new TableModelListener() {
    public void tableChanged(TableModelEvent e) {
    int row = e.getFirstRow();
    int column = e.getColumn();
    Object data = pLinhas.dataModel.getValueAt(row,column);
    Object valor = pLinhas.dataModel.getValueAt(row,6);
    System.out.println("Quantidade -" + data.toString());
    System.out.println("Valor a Cobrar -" + valor.toString());
    setValueAt(data,row,6);
    public void setValueAt(Object value, int row, int col) {
    System.out.println("Mudou ou nao");
    pLinhas.dataModel.fireTableCellUpdated(row, col);
    this dont work. When the method setValue() run, the java break.
    the message are :
    # An EXCEPTION_STACK_OVERFLOW exception has been detected in native code outside the VM.
    # Program counter=0x77e94aa0
    how can i change my data for a new data in jtable.
    tx for help.

    I had a problem similar to this. I was writing my own table model which would work sometimes and at other times fail similar to what you describe. I ended up printing out the source code to the DefaultTableModel and taking a look at it and then deciding to subclass that class and add my additional functionality as opposed to writing a completely new model and trying to duplicate the DefaultTableModel. My needs were relatively simple and the subclassing fixed the problem. I can change data with no problem in the displayed table. If you're not already subclassing and trying to write your own table model you may want to give this a try. I'd struggled with the problem for several days thinking I'd fixed it and having it come up again. I invested 2 hours doing the subclassing and the problem has never appeared since then. I know I just missed doing something in the table model I was trying to write but my schedule was tight and the subclassing offered a quick fix. Hope this helps!

  • Couldn't show sql data in jtable, please help

    Dear All,
    I'm trying to display the data from database in a jtable by following the jtable demo example in Java Tutorials Sample Code; but, I couldn't output the data to the jtable. The following code is what I've done so far. Can anybody please point out a direction for showing the data in jtable? Thanks a lot in advance.
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    public class Patient {
    static String szJdbcURL = "jdbc:oracle:thin:@129.78.110.188:1521:MyDB";                
    static String szUser = "...";                
    static String szPasswd = "...";                
    static String szModelName = "...";
    static Oracle oracle = new Oracle(szJdbcURL, szUser, szPasswd);
    public void findMedication() throws SQLException{
      Statement stmt1 = null;
      try {
             stmt1=oracle.getConnection().createStatement();             
              String res1=null;
              String res2=null;                
         String sqlQuery="Select * From PatientTable ";
            ResultSet rs= stmt1.executeQuery(sqlQuery);
       if (!rs.isBeforeFirst())
             {System.out.println("OOPS! data not found.");
              System.out.println(); }
       else {
        while (rs.next()) {
       ArrayList<Medication> medList = new ArrayList<Medication>();
       res1=rs.getString("patientName");
       res2=rs.getString("medication");
       Medication med=new Medication (res1, res2);
       medList.add(med);
       System.out.println();
       finally {stmt1.close();}
    import java.util.ArrayList;
    public class Medication {
        String ptName;
        String ptMedication;
    public Medication(String ptName, String ptMedication){
      this.ptName=ptName;
      this.ptMedication=ptMedication;
    public String getPtName() {
      return ptName;
    public void setPtName(String ptName) {
      this.ptName = ptName;
    public String getPtMedication() {
      return ptMedication;
    public void setPtMedication(String ptMedication) {
      this.ptMedication = ptMedication;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.AbstractTableModel;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.util.ArrayList;
    public class TableDemo extends JPanel {
      private boolean DEBUG = false;
    public TableDemo () {
      super(new GridLayout(1,0));
      ArrayList<Medication> medList = new ArrayList<Medication>();
      //how to add the data to the ArrayList here?
            JTable table = new JTable(new MyTableModel(medList));
            table.setPreferredScrollableViewportSize(new Dimension(500, 70));
            table.setFillsViewportHeight(true);
            //Create the scroll pane and add the table to it.
            JScrollPane scrollPane = new JScrollPane(table);
            //Add the scroll pane to this panel.
            add(scrollPane);
      class MyTableModel extends AbstractTableModel {
         private String[] columnNames = new String []{"Patient Name", "Medication"};
         ArrayList<Medication> medList = null;
        public MyTableModel (ArrayList<Medication> medList){
         this.medList=medList;
           public int getColumnCount() {  
         return columnNames.length;
       public int getRowCount() {
        return medList.size();
       public String getColumnName(int columnIndex) {
            return columnNames[columnIndex];
    public Object getValueAt(int rowIndex, int columnIndex) {
      Medication object = medList.get(rowIndex);
            switch (columnIndex) {
            case 0:
                 return object.getPtName();
            case 1:
                 return object.getPtMedication();   
            default:
                 return "unknown";
    @SuppressWarnings("unchecked")
    public Class getColumnClass(int c) {
            return getValueAt(0, c).getClass();
         private static void createAndShowGUI() {
             JFrame frame = new JFrame("TableDemo");
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             //Create and set up the content pane.
             TableDemo newContentPane = new TableDemo();
             newContentPane.setOpaque(true); //content panes must be opaque
             frame.setContentPane(newContentPane);
             //Display the window.
             frame.pack();
             frame.setVisible(true);
         public static void main(String[] args) {
             javax.swing.SwingUtilities.invokeLater(new Runnable() {
                 public void run() {
                     createAndShowGUI();

    This line will create an ArrayList which will be used to store the output data of the sql query with the type is Medication class
    NO! Read what TPD ask again carefully -
    Please explain (as explicit as you can) what these two lines do.
    Did you notice that TWO in there?
    Did you notice that your reply said 'This line' when it should have said 'These TWO lines .'?
    You are creating a new ArrayList EVERY TIME thru the loop; you are NOT creating ONE ArrayList and adding things to it.
    The problem is how to show the ArrayList in the jtable defined in another class.
    And the answer is: use one of the THOUSANDS of examples on the internet.
    See the trail 'How to Use Tables' in The Java Tutorials
    http://docs.oracle.com/javase/tutorial/uiswing/components/table.html
    Read the trail - try the example. You learn by doing and using code that already works.

  • Multiprovider display data issue

    Hello,
    I'm using BI7.0 and created Multiprovider using Custom DSO and Infocube1.
    the problem is, when i use display data through multiprovider, I'm not able to see data from DSO .
    I have considered all common fields from DSO and Cube and assigned in multiprovider.
    basically I'm selecting all IO and Keyfigures from Infocube1 and few IO from DSO
    some reason I am not able to see data from DSO when i view data through multi provider.
    Please help me to view data from both cube and dso through multi provider.
    Thanks
    Ganga

    Hi Ganga,
    Please check whether there is any restrictions for the field 0PROVIDER. There may be restriction to get the data only from cube.
    If there is no any restrictions then here may be your problem.
    You need to maintain atleast one key figure in both targets.
    Since there is no any key fig coming from DSO
    please create a dummy key fig and try to check once again.
    please go through the link.
    Re: MULTIPROVIDER NOT GETTING DATA
    hope this helps u.
    Thanks,
    Sai Chand

  • Need Suggestion in displaying data in ALV.

    Hi All Experts,
    I have a scepic scenario for which I need your inputs. I am preparing a report which will display data foe entries made in time sheet. The entries in time sheet can be made for anything like a change request on an incident etc. It will have various output fields
    And also dates for which entries are made. So it can have date from 1 to 31. This all is
    to be displayed in ALV. Now the report can be displayed in two Summarised ways.
    One summary can be for a user and another for the  object type(incident, change request).
    Now if the user wants to see this report for a period more than a month  then I have to summarise it against a month too. So am not sure how to handle this. Which type of ALV function module to be used to display this?
    Regards,
    Saket

    hello,
    I would suggest to go for GRID display - for that you can use either function module or class.
    Tips:
    If it also need to be summarised by month then add an extra field in fieldcatalog as monthid / monthname.
    also it's better to have an extra field for object tyoe (Incident/ change)...
    Thanks.

  • Displaying data in a tree from database table

    Hi,
    I want to display data from a database table (mara-matnr) in a tree structure. I went through the coding of SBSPEXT_HTMLB. There static data was taken in to wa_tab. But there I want to bring data from a database table into wa_tab. For this I created an internal table without headerline by taking a work area, now how can I move data from this work area to wa_tab record by record.
    I hope some one might have worked on this. Plz help me....
    Thanks in advance,
    Ravindra.

    Hi,
    take a look at this <a href="/people/tomas.altman/blog/2004/12/13/sdn-blog-how-to-do-internal-tables-in-bsp which explains how internal tables work in ABAP OO.
    Furthermore I think you want to do this:
    insert <yourWorkarea> into table wa_tab.
    A complete mara example would be:
    data tab_mara type table of mara.
    data wa_mara type mara.
    select * from mara into table tab_mara.
    *or you can use:
    select * from mara into wa_mara.
       insert wa_mara into table tab_mara.
    endselect.
    regards
    Thomas

  • Can't display data that exist in cupe

    Hi All,
    I get a problem which is thar even i entered data in the cube i cant display with charecteristics. When i go to bw and display data if i say select charecteristics i can see any data but if i dont select charecteristics i can display data. Also when i enter data and sen data it say succesful but i loose data on view. Have anyone get any problem like that thanks for your interest.
    Kasim

    Hi,
    The code you sent appears to be the Audio Talkthrough example with several modifications. Here's the first thing I noticed that appears to be incorrect: You're using the BF AD1871 Wait on Data Ready Flag VI to fill the sub-buffer, then you go into a loop and get the contents of that buffer 256 times. You should be filling the buffer each time before you get the buffer instead of only filling it once. You also aren't resetting the data ready flag by using the BF AD1871 Clear Data Ready Flag VI.
    Message Edited by Michael P on 07-28-2006 09:55 AM
    Michael P
    National Instruments

  • Not able to display data in different columns using Unicode encoding

    Hi,
    Iam using Unicode encoding in my Java appln to support Japanese characters while downloading CSV report. But using the Unicode encoding displays all data in the first column of Excel sheet.
    Please let me know how to display data in different columns using Unicode encoding in Excel sheet.

    Hi Venkat,
    After extracting data into DSO check the request whether active or not.
    Check data in DSO in contents.
    If is there any restrictions on info providers in Queries.
    Let us know status clearly.......
    Reg
    Pra

  • Not able to display data in separate columns using Unicode encoding

    Hi,
    Iam using Unicode encoding in my Java appln to support Japanese characters while downloading CSV report. But using the Unicode encoding displays all data in the first column of Excel sheet.
    Please let me know how to display data in different columns using Unicode encoding in Excel sheet.
    This is an urgent need. Please help me out.

    Hi,
    I have no problem with item :P15_EV_LCL this is having a value my probem here is i am using java script to display the value in different color based on the condtion case
    eg:
    select
    case
    TRUNC((
    ( (NVL(Z."AEWP",0) - NVL(Z."BEWP_Final",0) ) / DECODE(Z."BEWP_Final",0,NULL,Z."BEWP_Final") ) * 100
    ),2)
    = :P15_EV_LCL
    then
    span style="background-color:lightgreen"
    || TRUNC((
    ( (NVL(Z."AEWP",0) - NVL(Z."BEWP_Final",0) ) / DECODE(Z."BEWP_Final",0,NULL,Z."BEWP_Final") ) * 100
    ),2) || '%' || /span
    else
    span style="background-color:yellow"
    || TRUNC(
    ( (NVL(Z."AEWP",0) - NVL(Z."BEWP_Final",0) ) / DECODE(Z."BEWP_Final",0,NULL,Z."BEWP_Final") ) * 100
    ),2) || '%' || /span
    end "Effort"
    from actuals Z
    If i dont use this <Span style="Background-color:color"> i am able to generate data in excel sheet if i use this color coding i am not able to get data in spread sheet.
    Please suggest
    Thanks
    Sudhir
    Edited by: Sudhir_N on Mar 23, 2009 10:00 PM

  • Displaying data in one row for  for 2 tables without relaiton

    I Have 2 tables without any relation and there is a common field and i want to display data like below
    table refdet
    1)
    refdt----------refbr----refamt----refcat
    10-aug-09---10-----34234-----101a
    10-aug-009--11----23245-----102a
    1-AUG-09----10----455.98----104A
    19-aug-09-12-----10000-------103B
    2) brdet
    trdt---------brn-----brtot-----------brcat
    11-aug09--10-----454000-------A
    09-aug-09-12-----550000-------B
    30-sep-09--10-----430000------A
    09-aug-09-11-----550000-------B
    i want to display data for each branch refdet.refbr = brdet.brn
    refdet
    Br10
    refdt----------refbr----refamt----refcat-----trdt---------brn-----brtot-----------brcat
    10-aug-09---10-----34234-----101a-------11-aug09--10-----454000-------A
    1-AUG-09----10----455.98----104A------30-sep-09--10-----430000------A
    Br 11
    10-aug-009--11----23245-----102a -------09-aug-09-11-----550000-------B
    Br12
    19-aug-09-12-----10000-------103B------09-aug-09----12-----550000-------B
    i tried the following query but its not working
    select distinct null as refdt,null as refbr,null as refamt,null as refcat,b.trdt,b.brn,b.brtot,b.brcat
    from brdet a,refdet b
    where a.refbr (+) = b.brn
    union all
    select distinct a.refdt,a.refbr,a.refamt,a.refcat,null as trdt,null as brn,null as brtot,null as brcat
    from brdet a,refdet b
    where a.refbr = b.brn (+)
    its not giving the records on each row for both side its creating separte rows for each records in both table.
    rgds
    jytohi
    -

    Hi jytohi,
    Please lean back for a moment and study your question. Ask yourself, is this a reasonable way to ask a question?
    Jopefully you'll reach the answer, "No it isn't, I need to.."
    1. Turn these
    1)
    refdt----------refbr----refamt----refcat
    2) brdet
    trdt---------brn-----brtot-----------brcatinto CREATE TABLE statements.
    2. Turn these
    10-aug-09---10-----34234-----101a
    10-aug-009--11----23245-----102a
    1-AUG-09----10----455.98----104A
    19-aug-09-12-----10000-------103B
    11-aug09--10-----454000-------A
    09-aug-09-12-----550000-------B
    30-sep-09--10-----430000------A
    09-aug-09-11-----550000-------Binto INSERT INTO statements
    3. Turn this
    refdet
    Br10
    refdt----------refbr----refamt----refcat-----trdt---------brn-----brtot-----------brcat
    10-aug-09---10-----34234-----101a-------11-aug09--10-----454000-------A
    1-AUG-09----10----455.98----104A------30-sep-09--10-----430000------A
    Br 11
    10-aug-009--11----23245-----102a -------09-aug-09-11-----550000-------B
    Br12
    19-aug-09-12-----10000-------103B------09-aug-09----12-----550000-------Binto properly formatted expected output, along with a reasonable explanation of why
    4. Turn this
    select distinct null as refdt,null as refbr,null as refamt,null as refcat,b.trdt,b.brn,b.brtot,b.brcat
    from brdet a,refdet b
    where a.refbr (+) = b.brn
    union all
    select distinct a.refdt,a.refbr,a.refamt,a.refcat,null as trdt,null as brn,null as brtot,null as brcat
    from brdet a,refdet b
    where a.refbr = b.brn (+)into a properly formatted query
    And last, put everything in into curly brackets {noformat}{noformat} to preserve formatting and blank space.
    Best regards
    Peter                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Display data in r/3 set up tables

    how to display data in r/3 set up tables

    Hi,
    You have different TCodes in R/3 to fill up the setup tables for different areas. Like for Inventory for intializing the opening balance we use MCNB and for Movements we use 0LI1BW and for Revaluations you need to use OLIZBW. You have to follow a set of instructions while filling up the setup tables like there should be no postings going on while you are filling up the setup tables etc...
    Once you fillup the setup tables, then if you go to RSA3 and enter the data source name, you will be able to see the data for it. Unless you sill the setup tables, your data source wont give you any data. You can search for How to... documents which will be useful to you in understanding the concept.
    Hope it helps...

  • Unable to display data no entry in the table without using Model clause

    Hi,
    I've an urgent requirement described below :
    The previously posted Question has been answerted using Model Clause:
    Is there any way out to solve it without using Model clause:
    I've a table named as "sale" consisting of three columns : empno, sale_amt and sale_date.
    (Please ref. The table script with data as given below)
    Now if I execute the query :
    "select trunc(sale_date) sale_date, sum(sale_amt) total_sale from sale group by trunc(sale_date) order by 1"
    then it displays the data for the dates of which there is an entry in that table. But it does not display data for the
    date of which there is no entry in that table.
    If you run the Table script with data in your schema, then u'll see that there is no entry for 28th. Nov. 2009 in
    sale table. Now the above query displays data for rest of the dates as its are in sale table except for 28th. Nov. 2009.
    But I need its presence in the query output with a value of "sale_date" as "28th. Nov. 2009" and that of "total_sale" as
    "0".
    Is there any means to get the result as I require?
    Please help ASAP.
    Thanks in advance.
    Create table script with data:
    CREATE TABLE SALE
    EMPNO NUMBER,
    SALE_AMT NUMBER,
    SALE_DATE DATE
    SET DEFINE OFF;
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('12/01/2009 10:20:10', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/30/2009 10:21:04', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/29/2009 10:21:05', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/26/2009 10:21:06', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/25/2009 10:21:07', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 5000, TO_DATE('11/27/2009 10:23:06', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 4000, TO_DATE('11/29/2009 10:23:08', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 3000, TO_DATE('11/24/2009 10:23:09', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 2000, TO_DATE('11/30/2009 10:23:10', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 7000, TO_DATE('11/24/2009 10:24:19', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 5000, TO_DATE('11/25/2009 10:24:20', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 3000, TO_DATE('11/27/2009 10:24:21', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 2000, TO_DATE('11/29/2009 10:24:22', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 1000, TO_DATE('11/30/2009 10:24:22', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;
    Any help will be needful for me
    Regards,

    select sale_date,sum(sale_amt) total_sale
    from
    select empno,0 sale_amt,(sale_date + ao.rn) sale_date
    from
    select empno,sale_amt,sale_date ,(t.nxt_dt - t.sale_date) diff
    from
    select empno
    ,sale_amt,trunc(sale_date) sale_date
    ,trunc(nvl(lead(sale_date) over (partition by 1 order by sale_date),sale_date)) nxt_dt
    from sale
    ) t
    where (t.nxt_dt - t.sale_date) >1
    ) rec,(select rownum rn from user_objects where rownum<=200) ao
    where ao.rn <=(rec.diff-1)
    union all
    select empno,sale_amt,trunc(sale_date) sale_date
    from sale
    group by sale_date
    order by 1;
    ~~~~Guess this will serve the purpose...
    Cheers Arpan

Maybe you are looking for