Data structure similar to database table
i have the need for a data structure that will essentially be the same as a database table. this "table" can be queried against and sorted.
currently, i am using an interface to abstract this "table" datastructure, and implementing the interface via jdbc calls.
may someone point me in the right direction?
in .NET, they have the DataTable and DataSet data structures, which do exactly as i require. These are objects essentially correspond to a database table and database, respectively. They are used as in-memory database.
i have already tried using HSQL, but was wondering if there was a "better" way (i.e. more light-weight, intuitive, easier to use).
thanks.
Use an array and put your records in it.
Efficient querying (simple queries) requires you to build indices for each element you wish to query on. The type of index depends on the kind on search you want to perform. Exact matches can use Hashes. Sorting, prefix or postfix matching can be performed using various tree indices.
Complex queries (i.e. those that query on multiple parameters generally require query optimisers to figure out how to use the indies you have in the most efficient manner possible (well as close as the optimizer can get to it).
cheers
matfud
Similar Messages
-
Risks of changing the field length of data structure of a Cluster Table
Hello,
We are on ECC 604 and had implemented HR & Travel Management. Reporting on these applications is done in BI. We use ESS and & Mobile Travel for time, travel expenses, etc and use PCLn clusters.
There is business need to change the length of a field from 20 to 40 for the data structure PTK** of cluster table PCL1.
We are exploring various options to avoid core modifications.
We are also assessing the risks associated with changing the field length.
I am asking you for your opinion about the risks associated with changing the field length of a data structure of cluster table.
Thanks & Regards,
Manoj K PingaliRecently, we came across the same situation where we had to change the length of a field. Let me explain you what precautions we had taken during that time.
1. Apply the where use list of that table/ Field and check whether it has been used in some program and FM or not. If yes then check one more thing that check the TYPE of another variables on which system has populating data (move, write or in FM parameters). if you will not consider this then you can land you in big trouble. (Conversion dump)
2. Ask the basis to take a dump of the production, quality and data for the safer side if something does not go right.
Now, you can do the changes in your development system and then adjust the database and see the impact of it.
Hopefully, you will not come across any difficult situation in this changes.
Thanks.
Anurag -
A data structure to represent a table in ram ?
So I've implemented a shoppingCart using a table in the database and it's fine.
BUT, I'm thinking the table approach isn't that efficient - for example clicking Add to Cart does two things:
1) insert the row into the shoppingCart table
2) display the whole shopping cart for that session
I'm thinking, wouldn't it be nice if I could just store the shoppingCart in a data structure ? I'm sure Coldfusion supports such a strucuture with addRow , removeRow commands - I just can't think of it.
Do you think this is an efficient approach ?a data structure to represent a table in ram ?
Yes. In fact, you could literally use a structure to represent the shopping-cart in memory. It would begin like this:
<cfset session.shoppingCart = structnew()>
I'm sure Coldfusion supports such a strucuture with addRow , removeRow commands - I just can't think of it.
You would then be thinking of structInsert() and structDelete.
Do you think this is an efficient approach ?
Yes. However, I have a different suggestion. What you're doing is a learning exercise. That can only be a good thing.
If you're serious about setting up shop, which I assume you are, then you should invest in shopping-cart software. They cost little, relative to the benefit you could derive from them. Mary Jo's CFWebstore seems good value for money. -
Import data in excel to database table
How to insert data from excel to database table ? any suggestion ?
Hi,
1. Save your file as csv (say having empno, ename, sal and deptno columns).
2. Create a HTML page with file browse item.
3. Create a button.
3. Create the following process to be executed on pressing button on your region.
BEGIN
DECLARE
v_blob_data BLOB;
v_blob_len NUMBER;
v_position NUMBER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len number := 1;
v_line VARCHAR2 (32767) := NULL;
v_data_array wwv_flow_global.vc_arr2;
v_rows number;
v_sr_no number := 1;
v_rows_loaded NUMBER;
BEGIN
-- Read data from wwv_flow_files</span>
select blob_content into v_blob_data
from wwv_flow_files
where last_updated = (select max(last_updated) from wwv_flow_files where UPDATED_BY = :APP_USER)
and id = (select max(id) from wwv_flow_files where updated_by = :APP_USER);
v_blob_len := dbms_lob.getlength(v_blob_data);
v_position := 1;
-- Read and convert binary to char</span>
WHILE ( v_position <= v_blob_len ) LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
v_line := v_line || v_char;
v_position := v_position + c_chunk_len;
-- When a whole line is retrieved </span>
IF v_char = CHR(10) THEN
-- Convert comma to : to use wwv_flow_utilities </span>
v_line := REPLACE (v_line, ',', ':');
-- Convert each column separated by : into array of data </span>
v_data_array := wwv_flow_utilities.string_to_table (v_line);
--DELETE OLD DATA
-- Insert data into target table </span>
IF v_sr_no >1 THEN
EXECUTE IMMEDIATE 'INSERT INTO EMP(EMPNO, ENAME, SAL, DEPTNO)
VALUES (:1, :2, :3, :4)'
USING
-- v_sr_no,
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4);
END IF;
-- Clear out
v_line := NULL;
v_sr_no := v_sr_no + 1;
END IF;
END LOOP;
END;
COMMIT;
END;
Hope this helps.
Regards,
Zahid -
How can I Insert data into my msaccess Database table
Hello all,
I am new to Java programming and I have problem that how can i insert name into my database table.
The code which i have written is following:
String filename = "d:/test.mdb";
String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
database+= filename.trim() + ";DriverID=22;READONLY=true}";
Connection con = DriverManager.getConnection(database,"","");
String s = String.valueOf(text.getText());
int k =10;
Statement st = con.createStatement();
st.execute("create table Test123(name text)");
st.execute("INSERT INTO Test123 values" +s);
on the INSERT program throws exception???
can any one help me how to insert data into tabel.
Thankshe INSERT program throws exception???
can any one help me how to insert data into tabel.I have never used the jdbc driver to access, but what do you think that the flag READONLY=true means? An insert is not a read.
Kaj -
Oracle DB: How to read data from a corrupted database table.
Hi All,
Wanted to know if there is a way I could read data from a corrupted Oracle database table?
Are there any tools that I can use? Or does Oracle provides any mechanism to do that?
Any pointers in this regard would be helpful.
Thanks in Advance.user10600611 wrote:
Table shows inconsistent data.You are going to have to be more specific. Inconsistent in what sense? A correct data model should not allow for inconsistencies to crop up.
However, you may be able to use one of the many FLASHBACK features of Oracle to look at the table at a prior point in time before the corruption.
HTH! -
Copying data from KeyFigures to database table in APO
Hi Experts,
Is there any way to copy the key figure values to APO database table?
Can we use any macro function to satisfy this requirement?
Is there any function module/BAPI which might be helpful to copy the KF data to DB table within APO?
Thanks for looking into it..
Rgds/
JayIn the standard macro environment, there is a simple database table where you can store and retrieve data from, table /SAPAPO/ADV_SERI, with four keys and almost as many numbers as you want (combining some predefined column space and an iteration field). It only works for numbers.
You can use TS_SET to save data and TS_GET to store, please check the macro online help for the complete syntax.
Hope this helps,
Pablo -
How to make data entries in a database table field as a hyperlink?
Hello all,
I am designing an application in BSP. The requirement is to make some of the entries in the database
tables as hyperlink values.
I have a database table which has a field "country feature". The scenario is that the user can enter any value in this field through view. The value can be a hyperlink or a free text, depending on the user requirement.
Is there any way by which the user can enter hyperlink values in the particular field in a database table?
Thanks in advance for your help.
Gurmahima.Hey Gurmahima ,
This is sample code for Selecting and deselecting all the checkboxes .
All you have to do is Set a pf-status and follow the code logic .
Here w_check is the check box field , w_line is the line your raeding and w_lines is the total number of lines(entries ) you have in table .
set pf-status 'SELECT' .
case sy-ucomm .
when 'SELECTALL' .
set pf-status 'SELECT' excluding 'SELECTALL' immediately.
w_line = w_line + 3 .
do w_lines times .
read line w_line field value w_check .
if w_check = space .
w_check = 'X' .
modify line w_line field value w_check.
add 1 to w_line .
endif . " IF W_CHECK = ' '
enddo . " DO W_LINES TIMES
clear w_line .
when 'DESELECT' .
set pf-status 'SELECT' excluding 'DESELECT' immediately.
w_line = w_line + 3 .
do w_lines times .
read line w_line field value w_check .
if w_check = 'X' .
w_check = space .
modify line w_line field value w_check .
add 1 to w_line .
endif . " IF W_CHECK = 'X' .
enddo . " DO W_LINES TIMES
clear w_line .
Hope you get it!
Much Regards ,
Amuktha .
Edited by: Amuktha Naraparaju on Feb 5, 2009 6:22 AM -
Joining Querry to check data in two different database tables
Hi,
I have table employee in sqlserver and oracle database.I have to perform joining based on emp id.I know how to perform join if tables are present in one
database.But for different database tables any one can explainDBLINK AND Understanding Oracle Heterogeneous Services
1) http://docs.oracle.com/cd/B28359_01/gateways.111/b31042/newoverview.htm
2) http://docs.oracle.com/cd/B28359_01/gateways.111/b31042/configodbc.htm
Ramin Hashimzade -
How to insert data from screen to database Table..??
This is regarding screen painter area..
I have created a Z-table.
Also created a screen where i am having input box.
After entering text in the input box, i will click "SAVE" push button.
When i click "SAVE" push button, the Text entered in the screen input box should be saved in that z-table.
How to do it...??
Can anybody explain me with ABAP code...???
Thanks
PavanHi,
You can try follwong logic.
tables : ztable.
data wa_ztable like line of ztable.
Case sy-ucomm.
when 'SAVE'.
clear wa_ztable.
wa_ztable-field1 = screenfield1.
wa_ztable-field2 = screenfield2.
wa_ztable-field3 = screenfield3.
modify ztable from wa_ztable.
endcase.
If it is simple database insertion,
you can always use Table Maintainance provided by SAP.
So that the code will be automatically generated and you dont have to worry.
Regards,
Shashank -
Hierarchical data structures (in a single table)
Hi,
If I have a hierarchy of objects stored in a table -
ORG_UNIT
ID
PARENT_ID
NAME
And the JDO mapping for an OrgUnit contains a parent OrgUnit and a
Collection of children.
Is there an efficient way of pulling them out of the database.
It is currently loading each individual parent's kids.
This is going to be pretty slow if there are say 500 OrgUnits in the
database.
If it would be better to pull them all out and build the hierarchy up in
code (as it was being done in straight JDBC). How can I efficiently obtain
the parent or children without doing exactly the same?
Thanks,
SimonSimon,
There will be no db access for every child - you will read all child records
for a particular parent at once when you try to access its child collection.
Granted that for terminal leaves you will get an db access to load an empty
collection so effectively you will get a db access per node. If your goal is
always to load and traverse entire tree it will be expensive. But the
beauty of hierarchical structures is that while they could be huge millions
of nodes you do not need to load it all to navigate - just the path you
need. This is where lazy loading excels so overall on large trees you will
be much better of not loading whole thing at once. However if you still want
to do it nothing prevents you from not having persistent collection of child
records in OrgUnit class at all but only a reference to a parent, load
entire table using query and then build tree in memory yourself as you
iterate over the query resultset. You can probably even do it in a single
iteration over the resultset. I would never do it myself though . In my
opinion it defeats ease of use and cleanness of your object model.
Alex
"Simon Horne" <[email protected]> wrote in message
news:ag1p9p$9si$[email protected]..
Hi,
If I have a hierarchy of objects stored in a table -
ORG_UNIT
ID
PARENT_ID
NAME
And the JDO mapping for an OrgUnit contains a parent OrgUnit and a
Collection of children.
Is there an efficient way of pulling them out of the database.
It is currently loading each individual parent's kids.
This is going to be pretty slow if there are say 500 OrgUnits in the
database.
If it would be better to pull them all out and build the hierarchy up in
code (as it was being done in straight JDBC). How can I efficiently obtain
the parent or children without doing exactly the same?
Thanks,
Simon -
Hoa to delete data from the SE11 database table
Hi Friends,
Need some urgent help.
While uploading data to infotype 6 (addresses) in subtype 4(emergency address), I have uploaded the data twice and it has created a duplicate record now in table PA0006.
I have done this in the quality server. Will this effect the user acceptance testing(UAT) in anyway and how can I delete this data from table PA0006
Pls help me urgently.
Bye
NaveenHi Naveen ,
1 .Check what is the time constraint for address infotype .
2.If it is 2 , it would have delimited the record , if it is 3 it would have created another record , if it is one there will be no problem as it would have deleted the recored provided u have given the dates into consideration .
3.It will not be a problem for UAT . If it is not required do a scat for deletion of records .
Regards
Gajalakshmi -
Writing out data from a database table
Hi guys,
I am kinda new to ABAP Programming. I need to know how i can write the data stored in my database table which has the following structure:
data: begin of tablename occurs 100,
endof tablename.
I don't know how to loop into it and get the data out from it into a flat file on the application and the presentation server. right now, no data is getting written into the file because I am not looping through the table where the data is is present.
I need help asap.
Thanks,
MinalHi,
Plz go through this link it will help u a lot
http://www.sapdevelopment.co.uk/file/file_updown.htm
also see this link
http://www.sapdevelopment.co.uk/bdc/bdc_dbupdate.htm
Thanks & Regards,
Judith.
Message was edited by: Judith Jessie Selvi -
No data in Portal Database tables for Activity Report
Hi experts,
I've developed an Activity Report application in SAP Portal 7.0, which went live but the report shows no data.
We are pulling data from 2 portal database tables: WCR_WEBCONTENTSTAT and WCR_USERPAGEUSAGE
In non production environment there is data in the report but there is no data in the production environment.
The Activity Report service is already activated/started and set to true.
What could have caused this? And what should we check now?
What other configurations/setup should be done?
Regards,
GregHi Greg,
Those are the aggregated tables. If they are not filled with data although the Portal Activity Report is activated, you should check whether the aggregation finished successfully.
In the older SPs there were some problems that were fixed in later SPs of 7.0.
In order to have the latest version of Portal Activity report, you can check SAP note 1084379 - Portal Activity Report - Latest Version (SDA file).
You can compare the SP via the MANIFAST file, as it contains the version and SP number.
In order to troubleshoot problems in Activity Report, you can follow SAP note: 1690023 - Portal Activity Report - Component-specific Note
Some basic checks that you can do:
Run query on the raw data tables to check since when there is data in those tables:
select min(timestamphour) from SAP<SystemID>DB.WCR_WEBCNODESTAT;
If there is too much data from long time ago, then you should delete the old data, and leave only the new data (there is anyways retention time for the data to be kept).
If there is no data, then it means that the Portal Activity Report does not collect data, and not really activated (usually this is not the case).
The aggregation runs every top of the hour, so you can check in the default traces for an error during that time.
In most of the cases something went wrong while aggregating the data.
As a result the aggregation is not finished, so the transaction is not being committed, and the aggregated tables stay empty.
If there is a DuplicateKeyException in the trace, you can follow SAP note 1054145 - Duplicate Key Exception.
If you have any more questions, please don't hesitate to ask.
I hope this information helps,
Thanks & regards,
Michal Zilcha-Lang -
How to extract data from text file to database table
Hi ,
I am trying to upload data in text file to database table using GUI_UPLOAD function .what would be the program for that.
thanks in advance.Hi,
I don't think you have a standard sap program to upload data from file to database table...
Instead you can create a custom program like this..
DATA: T_FILEDATA(1000) OCCURS 0 WITH HEADER LINE.
DATA: T_ZTABLE LIKE ZTABLE OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\TEST.TXT'
tables
data_tab = T_FILEDATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT T_FILEDATA.
T_ZTABLE = T_FILEDATA.
APPEND T_ZTABLE.
ENDLOOP.
MODIFY ZTABLE FROM TABLE T_ZTABLE.
COMMIT WORK..
Thanks,
Naren
Maybe you are looking for
-
How can i get apple to understand this is an authorize cord? It's the cord that came with the phone.
-
Problem switcing Mac Mini HDMI via an Onkyo 606 Receiver
I'm having problems when attempting to switch my Mac Mini HDMI via my Onkyo Receiver. Connecting via a DVI to HDMI converter. Works fine when connected directly to the TV. When connected via the Onkyo, I get the Apple logo at the begining of the boot
-
Creating dim, cube based on SOLVED LEVEL-BASED Dims
Hi All, I have generated parent child script using cwm2_olap_pc_transform.create_script. After running this generated script, it has created 3 table/view. My Base Parent Child table is like this:- drop table PARENT_CHILD; create table PARENT_CHILD (P
-
How to control margin size between components in Java Studio Creator 2?
Hi, a website layout with hard-coded coordinates (x,y) for component positions cannot adapt to the size of the user's browser window. Therefore, I use a kind of flow layout instead, consisting of components that are grouped in nested GridPanels (with
-
Now that the project is done, what is the best way to clean up? Can I just delete the folder where I put everything? What if anything should stay (other than the projects final export to QT)? I just don't want FCE to crash looking for files that are