How to fill a table?
hello all!
i need to display a result set in a html table. I'm kinda confused with how the table will be filled up, since the table will grow depending on the number of records that the DB table has.
here is what i have:
<table border="1">
<th>Row</th><th>Name</th><th>User/Dept</th><th>Use</th><th>Last Update</th><th>Updated By</th><th> </th>
<%
try{Connecting con = new Connecting();
ResultSet rs;
ResultSet rs;
String s[]= new String[10];
int x=0;
%>
<%
con.connect();
rs = con.viewUsers();
x= rs.getRow(); %>
<%while(rs.next()){%>
<%s[x]=rs.getString(1)
%>
<tr>
<td></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%><td></td> <td>
</tr>
</table>
Hey!
Thanks for the hint, i'm getting the table filled, but now my issue is that its not showing the right data.
first the query i'm using:
public ResultSet viewUsers(){
try{
ps = conMsg.prepareStatement("SELECT name + ' '+ lastName as 'Name', userDeptName as 'User/Dept.' , userDeptCategory as 'Use', lastChangedDate + ' ' + lastChangedTime as 'Last Update', lastChangedBy as 'Updated By:' from SystemUser");
rs = ps.executeQuery();
}catch(Exception e){
e.getMessage();
e.printStackTrace();
return rs;
}here is my code inside the jsp page:
<table border="1">
<th>Row</th><th>Name</th><th>User/Dept</th><th>Use</th><th>Last Update</th><th>Updated By</th><th></th>
<%
try{Connecting con = new Connecting();
ResultSet rs;
String s[]= new String[10];
int x=0;
%>
<%
con.connect();
rs = con.viewUsers();
x= rs.getRow(); %>
<tr>
<%while(rs.next()){%>
<%s[x]=rs.getString(1); %>
<td></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%><td></td><a href="#">View</a> <a href="#">Modify</a> <a href="#">Delete</a><td>
</tr>
<%
}catch(Exception e){} %>
</table>
Hey!
Thanks for the hint, i'm getting the table filled, but now my issue is that its not showing the right data.
first the query i'm using:
public ResultSet viewUsers(){
try{
ps = conMsg.prepareStatement("SELECT name + ' '+ lastName as 'Name', userDeptName as 'User/Dept.' , userDeptCategory as 'Use', lastChangedDate + ' ' + lastChangedTime as 'Last Update', lastChangedBy as 'Updated By:' from SystemUser");
rs = ps.executeQuery();
}catch(Exception e){
e.getMessage();
e.printStackTrace();
return rs;
}here is my code inside the jsp page:
<table border="1">
<th>Row</th><th>Name</th><th>User/Dept</th><th>Use</th><th>Last Update</th><th>Updated By</th><th></th>
<%
try{Connecting con = new Connecting();
ResultSet rs;
String s[]= new String[10];
int x=0;
%>
<%
con.connect();
rs = con.viewUsers();
x= rs.getRow(); %>
<tr>
<%while(rs.next()){%>
<%s[x]=rs.getString(1); %>
<td></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%></td> <td><%=s[x]%><td></td><a href="#">View</a> <a href="#">Modify</a> <a href="#">Delete</a><td>
</tr>
<%
}catch(Exception e){} %>
</table>
Similar Messages
-
How to fill internal table with selection screen field.
Hi all,
i am new to sap . pls tell me how to fill internal table with selection screen field.Hi,
Please see the example below:-
I have used both select-options and parameter on the selection-screen.
Understand the same.
* type declaration
TYPES: BEGIN OF t_matnr,
matnr TYPE matnr,
END OF t_matnr,
BEGIN OF t_vbeln,
vbeln TYPE vbeln,
END OF t_vbeln.
* internal table declaration
DATA : it_mara TYPE STANDARD TABLE OF t_matnr,
it_vbeln TYPE STANDARD TABLE OF t_vbeln.
* workarea declaration
DATA : wa_mara TYPE t_matnr,
wa_vbeln TYPE t_vbeln.
* selection-screen field
SELECTION-SCREEN: BEGIN OF BLOCK b1.
PARAMETERS : p_matnr TYPE matnr.
SELECT-OPTIONS : s_vbeln FOR wa_vbeln-vbeln.
SELECTION-SCREEN: END OF BLOCK b1.
START-OF-SELECTION.
* I am adding parameter value to my internal table
wa_mara-matnr = p_matnr.
APPEND wa_mara TO it_mara.
* I am adding select-options value to an internal table
LOOP AT s_vbeln.
wa_vbeln-vbeln = s_vbeln-low.
APPEND wa_vbeln TO it_vbeln.
ENDLOOP.
Regards,
Ankur Parab -
How to fill internal table dynamically
Hi All,
how to fill internal table dynamically.
for example:
begin of itab occurs 0,
empid like pa0000-pernr,
empname like pa0001-ename,
grade(5),
end of itab.
now i want to append dynamically field itab-grade along with rest fields.
is this possible?? if yes kindly let me know how to do that.
Regards,
Kiran IHi kiran,
To fill and create and internal table dynamically you can use this code.
TYPE-POOLS: slis.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
is_fcat LIKE LINE OF it_fcat.
DATA: it_fieldcat TYPE lvc_t_fcat,
is_fieldcat LIKE LINE OF it_fieldcat.
DATA: new_table TYPE REF TO data.
DATA: new_line TYPE REF TO data.
FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
is_fieldcat-fieldname = 'FIELD1'.
is_fieldcat-ref_field = 'MATNR'.
is_fieldcat-ref_table = 'MARA'.
APPEND is_fieldcat TO it_fieldcat.
is_fieldcat-fieldname = 'FIELD2'.
is_fieldcat-ref_field = 'SPRPS'.
is_fieldcat-ref_table = 'PA0001'.
APPEND is_fieldcat TO it_fieldcat.
is_fieldcat-fieldname = 'FIELD3'.
is_fieldcat-ref_field = 'BEGDA'.
is_fieldcat-ref_table = 'PA0002'.
APPEND is_fieldcat TO it_fieldcat.
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = new_table.
Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <l_table>.
CREATE DATA new_line LIKE LINE OF <l_table>.
ASSIGN new_line->* TO <l_line>.
Test it...
DO 40 times.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = '12345'.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = 'X'.
ASSIGN COMPONENT 'FIELD3' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = '20030101'.
INSERT <l_line> INTO TABLE <l_table>.
ENDDO.
LOOP AT <l_table> ASSIGNING <l_line>.
ASSIGN COMPONENT 'field1' OF STRUCTURE <l_line> TO <l_field>.
WRITE / <l_line>.
ENDLOOP.
regards,
Aashish Garg -
How to fill internal table with no data in debugging mode
Hi all,
I modified one existing program.Now I want to test it.I am not given test data.So in the middle of my debugging, I found that one internal table with no data.My problem is how to fill that internal table with few records in that debugging mode just as we change contents in debugging mode.If I want to proceed further means that internal table must have some records.
Please I dont know how to create test data so I am trying to create values temporarily in debugging mode only.
Thanks,
BalajiHi,
In the debugging do the following..
Click the Table button..
Double click on the internal table name..
Then in the bottom of the screen you will get the buttons like CHANGE, INSERT, APPEND, DELETE..
Use the APPEND button to insert records to the internal table..
Thanks,
Naren -
Hi
I want to fill a table model (that I've defined as DefaultTableModel) with data I'm retireving from a DB.
Then, I've made a "populate" method that try to do the job as follows:
try {
Statement statement = dbcon.createStatement();
String query = "SELECT * FROM datos ORDER BY nombre";
ResultSet rs = statement.executeQuery(query);
Vector ucliente = new Vector();
while (rs.next()) {
ucliente.add(rs.getString("codigo"));
ucliente.add(rs.getString("nombre"));
ucliente.add(rs.getString("email"));
ucliente.add(rs.getString("fax"));
ucliente.add("");
clientsModel.addRow(ucliente);
ucliente.clear();
} catch (SQLException ex) {
System.err.print("SQLException: ");
System.err.println(ex.getMessage());
}But when I run my program I receive a java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Vector.java:427)
What's wrong ? How could I fill the model ?
Thanks in advance
xlwhile (rs.next()) {
Vector ucliente = new Vector();
ucliente.add(rs.getString("codigo"));
ucliente.add(rs.getString("nombre"));
ucliente.add(rs.getString("email"));
ucliente.add(rs.getString("fax"));
ucliente.add("");
clientsModel.addRow(ucliente); -
How to fill datasource/table from archive?
Dear Colleagues!
How can I fill a datasource with archived data?
I have created the Infostructure and the generic datasource (SD_VBRK_ARKIV). The datasource is available in BW after replication. But when I try to load it with an infopackage it finds 0 records. Am I missing a step? Is there something I need to do on the R/3 side to fill the table?
Hope you can help,
Regards SiljeHi Shabar,
I have only tested it in Test, since I do not have any rights in Prod yet (waiting..). And it extracts data in test. But I don't know if there has been done any special operation on the R/3 test side before the extractor was able to collect data. It might be that the extractor is imported into production (since I get it when replicating in BI prod) but there is some operation that need to be done to collect data. Becaus as of now I am receiving 0 records in prod.
Silje -
How to Fill Setup tables for MAP (IS- Retail)
Hello,
I am working on MAP scenario, I found the following data sources as a part of it. Can anybody please tell me how to fill the setup tables for these and what are the base tables for it??
2LIS_40_REVAL
2LIS_40_S202
2LIS_40_S207
2LIS_40_S208
Your reply is highly appreciated.
Regards,
NareshHi Naresh,
We cannot fill setup tables for each data source.
ORISBW -- This is the t-code to fill the setup tables for all the data sources which are related to application component 40.
If you want setup tables names of your data sources please check below.
2LIS_40_REVAL --- MC40RP0REVSETUP.
Comes to your second post.
2LIS_40_S202
2LIS_40_S207
2LIS_40_S208 these are LIS data sources, whic are replaced with LO data sources in SAP BI 7.0
If you are using LO data sources then no need to use LIS data sources.
Regards,
Venkatesh -
How to fill reconciliation tables (RCA, RCB, RCD, RCE etc.)
Hello!
I have a problem with empty tables in oracle database. These tables connected with reconciliation events (RCA, RCB, RCE etc) in OIM. They are empty, absolutely. Please, give me advise, how to make OIM fill these tables?I am not sure its easy to get all your information, but a good indication as a start is the USR_CREATEBY fiield in the USR table. If the USR_KEY referred to is of the OIMINTERNAL user then I would assume the user was created by reconciliation. For any other user the user was created by an admin. That does not unfortunately tell you from which system it was reconciled. If you need more information you may need to delve into the UPA (user profile audit tables). Again I do not think this directly tells you what system a user was created from. but if you find the creation event (SRC us the UserManager, Method: CREATE) the DELTA_SIGNATURE may confirm the reason as reconciliation, and by using timestamps you may find a way to cross-reference to the reconciliation event. I am afraid you may have to look into your data a bit more to see precisely what information this gives you.
Edited by: duncandb on Nov 1, 2012 2:05 AM -
How to fill a table UI element
hello,
how can I fill a table header?
any suggest?__day_ __hour_ month_ year_
Mo 2 July 2210
so i could fill the table with -
> Mo 2 July 2210
BUT not the header -
> day hour month year !!
Edited by: Scafandri on May 13, 2011 1:40 PM
Edited by: Scafandri on May 13, 2011 1:41 PM -
How to fill setup table for Application 18 Customer services
Hi,
How can I fill setup table for application 18.
Regards,
STHi,
To fill LIS, first set your LIS to update. use the central Tcode OMO1(for SD), OMO2(for MM) or OMO3(for other logistics) or you can set it in MC24 also(activate button).
SBIW -> settings for application specific datasources -> Logistics -> managing transfer information structures ->.... -> statistical setup Sales. (Application component 17 >transaction OLIIBW,Application component 18> OLISBW )-->select the relevent one whether sales/billings/deliveries etc in the pop-up. enter your LIS, give a name to job and execute.
Also pls chk this;
Re: query on setup table filling
Regards
CSM Reddy -
How to fill the table manually
Hi guys,
may I fill z table manually and how?
thanks
NihadHi,
Please create a Table maintainance generator for the Table created, and then either use SM30 or SE16 or SE16N to fill the entries to that table.
Please dont use SE11 to create entries to the database table created, because, If you are creating entries using SE11, then these entries will not be available in Quality system when you have transported your table from Development system to quality system.
But those entries created using SM30 or SE16 or SE16N, will ask for a TR name and you can save the entries under that TR.
Best Regards,
Suresh -
How to fill setup table based on date???
Hi Experts,
I need to do repair full request for 2lis_11_vaitm datasource, I want to load from 1st Apr 2008 to 31st March 2009, but in OLI7BW t-code i am unable to find date field in selection screen.
1) How can I fill setup table based on date?
2) In RSA7 containing records even though is it possible to fill setup table ?
Helpful answer will be appreciated with points,
Thanks in advance,
Venakt.Venkata,
1) How can I fill setup table based on date?
--> If date not possible then try to setup with available options/characteristics.
--> While pulling into BW, extract data selectively. Give date selection at infopcakge.
2) In RSA7 containing records even though is it possible to fill setup table ?
--> Yes, you can do it.
Srini -
How to fill a table using netBeans?
Hi. I use netBeans with Derby. I can create tables in my database (Create Table in Runtime), but I can't find any option which would allow me to fill my table with particular data. Could You give me some advice how to do this? I know that I can write a simple app which would add data to DB using text fields, but maybe there is some simpler tool?
Greetingswhile (rs.next()) {
Vector ucliente = new Vector();
ucliente.add(rs.getString("codigo"));
ucliente.add(rs.getString("nombre"));
ucliente.add(rs.getString("email"));
ucliente.add(rs.getString("fax"));
ucliente.add("");
clientsModel.addRow(ucliente); -
How to fill Lookup table run time with desired values in project server 2010.
HI,
is this possible to fill LookUp Table with some Desired Values at Runtime ??
Or How to bind a LookUp table with DataBase Table??Dear Rohan,
You need to do this via PSI script for lookup table.
Follow this blog Chris Boyd:
http://blogs.msdn.com/b/project_programmability/archive/2006/11/08/adding-a-project-to-a-category.aspx
Regards,
Avinash kumar | Blog:http://avigr8.wordpress.com | If you found this post helpful, please “Vote as Helpful”. If it answered your question, please “Mark as Answer”. -
How to fill Bapireturn table ?
Hello All,
I've created a BAPI .
In this BAPI as I shud not use exceptions I need to fill the BAPI Return Table.
Can anyone tell me how to fill this BAPI Return Table ?
I saw a FM BALW_BAPIRETURN_GET2 .
How to use this FM ?
Any help is appreciated .
Regards,
Deepu.KThere are function modules to convert an error message into structure BAPIRET.
CALL FUNCTION 'BALW_BAPIRETURN_GET1'
EXPORTING
type = 'E'
cl = 'F2'
number = '156'
par1 = sy-msgv1
par2 = sy-msgv2
par3 = sy-msgv3
par4 = sy-msgv4
IMPORTING
bapireturn = return
EXCEPTIONS
OTHERS = 1.
An other function module BALW_RETURN_TO_RET2 convert BAPIRETURN structure to BAPIRET2 structure.
Regards
Maybe you are looking for
-
Warning: iOS 8 Resized My Images When Exporting Via Image Capture
I have an iPad Air and I take lots of pictures. I installed iOS 8 last night. I don't like the lack of a Photo Stream and a Camera Roll, but I am willing to try new things, so I decided to clear out all the images from my iPad and start from scratch.
-
2 Classic Reports with edit fields on the same page
Hi All, need your help. I am trying to have 2 classic reports on one page with edit fields like date, list values, text I have noticed that the element indexes are the same f01_0001 have both first elements from both reports. This is making my code g
-
Finding recursively the iViews assigned to a Role - Portal Component
Hi, I am trying to make a Portal Component where in I need to know what iViews are assigned to any particular role in a recursive manner. Currently by using the following code I can search the iViews recursively in the portal_content folder structure
-
I uploaded videos to the premiere, and when I go to edit them they are zoomed in majorly close. What do I do?
-
I downloaded and copied the mozutils.dll and mozjs.dll in the system32 folder and the first error message stopped. But the second error message persists. The second error message says that no entry point found...... could not be located in the dynami