Is it worth using select query on infotype tables
Hi Experts,
I might be posting in the wrong column, but i just need to know is it worth using a select query on Infotype tables (PAxxxx)?? or should we prefer using the function modules for data fetching?
If select is not suggested, what is the reason for that?
Rgds
Prateek
Hi ,
Its not said that u cant write select on PAXXXX tables . Yes of couse LDB are there to fetch the data but it depends on
the requirement when to write a select and when to consider using in LDB .
Generally when you are looking at say 8 to 10 tables of infotypes with free selection , then LDB is suggested to fetch the data .
if you are looking to fetch the data for say some tables for a restricted selection (where clause) then select is used .
If i want to write a program using select only then fetching data from infotypes tables for large no of records will lead to
more time consumption which becomes easier in LDB as they are fetched in hierarchy level based on keys .
Normally it will be a combination of LDB and select querys in the development scenario
Br,
Vijay.
Similar Messages
-
To display 01 to 10 using select query
Hi all,
using select query...
In where clause...,
If u give 1 to 9 it should display 01 to 09 and
If u give 10 it should display as 10.
I want it in a single query .
Thanks & Regards,
Hariharan ST.Just need to build a where condition to the query posted by ascheffer -
Something Like this -
1 Select rn
2 From ( Select To_Char(ROWNUM, '09') rn
3 From Dual
4 Connect By rownum < 11
5 )
6 Where ( ( Trim(rn) < 10
7 And '&Param' = '1 to 9'
8 )
9 Or ( Trim(rn) = LPAD('&Param', 2, 0)
10 )
11* )
SQL> /
Enter value for param: 10
old 7: And '&Param' = '1 to 9'
new 7: And '10' = '1 to 9'
Enter value for param: 10
old 9: Or ( Trim(rn) = LPAD('&Param', 2, 0)
new 9: Or ( Trim(rn) = LPAD('10', 2, 0)
RN
10
SQL> /
Enter value for param: 7
old 7: And '&Param' = '1 to 9'
new 7: And '7' = '1 to 9'
Enter value for param: 7
old 9: Or ( Trim(rn) = LPAD('&Param', 2, 0)
new 9: Or ( Trim(rn) = LPAD('7', 2, 0)
RN
07
SQL> /
Enter value for param: 4
old 7: And '&Param' = '1 to 9'
new 7: And '4' = '1 to 9'
Enter value for param: 4
old 9: Or ( Trim(rn) = LPAD('&Param', 2, 0)
new 9: Or ( Trim(rn) = LPAD('4', 2, 0)
RN
04
SQL> /
Enter value for param: 1 to 9
old 7: And '&Param' = '1 to 9'
new 7: And '1 to 9' = '1 to 9'
Enter value for param: 1 to 9
old 9: Or ( Trim(rn) = LPAD('&Param', 2, 0)
new 9: Or ( Trim(rn) = LPAD('1 to 9', 2, 0)
RN
01
02
03
04
05
06
07
08
09
9 rows selected.Shailender Mehta -
Select query on a table with 13 million of rows
Hi guys,
I have been trying to perform a select query on a table which has 13 millions of entries however it took around 58 min to complete.
The table has 8 columns with 4 Primary keys looks like below:
(PK) SegmentID > INT
(PK) IPAddress > VARCHAR (45)
MAC Address > VARCHAR (45)
(PK) Application Name > VARCHAR (45)
Total Bytes > INT
Dates > VARCHAR (45)
Times > VARCHAR (45)
(PK) DateTime > DATETIME
The sql query format is :
select ipaddress, macaddress, sum(totalbytes), applicationname , dates,
times from appstat where segmentid = 1 and datetime between '2011-01-03
15:00:00.0' and '2011-01-04 15:00:00.0' group by ipaddress,
applicationname order by applicationname, sum(totalbytes) desc
Is there a way I can improve this query to be faster (through my.conf or any other method)?
Any feedback is welcomed.
Thank you.
MusTolls wrote:
What db is this?
You never said.
Anyway, it looks like it's using the Primary Key to find the correct rows.
Is that the correct number of rows returned?
5 million?
Sorted?I am using MySQL. By the way, the query time has been much more faster (22 sec) after I changed the configuration file (based on my-huge.cnf).
The number of rows returned is 7999 Rows
This is some portion of the my.cnf
# The MySQL server
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 800M
max_allowed_packet = 1M
table_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
log = /var/log/mysql.log
log-slow-queries = /var/log/mysqld.slow.log
long_query_time=10
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 6
Is there anything else I need to tune so it can be faster ?
Thanks a bunch.
Edited by: user578505 on Jan 17, 2011 6:47 PM -
CV04N takes long time to process select query on DRAT table
Hello Team,
While using CV04N to display DIR's, it takes long time to process select query on DRAT table. This query includes all the key fields. Any idea as to how to analyse this?
Thanks and best regards,
Bobby
Moderator message: please read the sticky threads of this forum, there is a lot of information on what you can do.
Edited by: Thomas Zloch on Feb 24, 2012Be aware that XP takes approx 1gb of your RAM leaving you with 1gb for whatever else is running. MS Outlook is also a memory hog.
To check Virtual Memory Settings:
Control Panel -> System
System Properties -> Advanced Tab -> Performance Settings
Performance Options -> Adavanced Tab - Virtual Memory section
Virtual Memory -
what are
* Initial Size
* Maximum Size
In a presentation at one of the Hyperion conferences years ago, Mark Ostroff suggested that the initial be set to the same as Max. (Max is typically 2x physical RAM)
These changes may provide some improvement. -
Hello All,
I am writing select query on TCURR table , but unable to get the values from table though i cansee the entries in table for the same condition as i provided int he program .
Is there an peculiar reason for the sme .
MY query is as follows.
SELECT * FROM tcurr INTO TABLE g_t_tcurr
WHERE kurst = 'M' AND fcurr = g_f_waers
AND tcurr = 'AUD'
AND gdatu LE l_f_datum (MKPF-BUDAT).
Any help is appreciated .
ThanksHi,
Please check the datatype and try again...
data:
DATC(8) TYPE C,
GDATU_OLD(8) TYPE C.
*exc_type = 'M'.
SELECT * FROM tcurf into table g_t_tcurr
CLIENT SPECIFIED
WHERE kurst = exc_type
AND fcurr = for_curr
AND tcurr = loc_curr
AND gdatu GE datc
AND mandt = mandt
ORDER BY PRIMARY KEY.
FM: CONVERT_TO_LOCAL_CURRENCY_N can be used to convert the amt from local currency to Foreign currency.
Regds
Parvathi -
How to insert the select query result into table?
How to insert the select query result into table?
SELECT top 20 creation_time
,last_execution_time
,total_physical_reads
,total_logical_reads
,total_logical_writes
, execution_count
, total_worker_time
, total_elapsed_time
, total_elapsed_time / execution_count avg_elapsed_time
,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
((CASE statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE qs.statement_end_offset END
- qs.statement_start_offset)/2) + 1) AS statement_text
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
ORDER BY total_elapsed_time / execution_count DESC;
Thanks,
Tirumala1. SELECT INTO
Below method will create table when data is inserted from one table to another table. Its useful when you need exactly same datatype as source table.
Use AdventureWorks2008R2;
Go
---Insert data using SELECT INTO
SELECT AddressLine1, City
INTO BothellAddresses
FROM Person.Address
where City = 'Bothell';
GO
---VERIFY DATA
Select AddressLine1, City
FROM BothellAddresses
---DROP TABLE
DROP TABLE BothellAddresses
GO
2. INSERT INTO SELECT
Below method will need table to be created prior to inserting data. Its really useful when table is already created and you want insert data from
another table.
Use AdventureWorks2008R2;
Go
---Create Table
CREATE TABLE BothellAddresses (AddressLine1 NVARCHAR(60), City NVARCHAR(30))
---Insert into above table using SELECT
INSERT INTO BothellAddresses(AddressLine1, City)
SELECT AddressLine1, City
FROM Person.Address
where City = 'Bothell';
---VERIFY DATA
Select AddressLine1, City
FROM BothellAddresses
---DROP TABLE
DROP TABLE BothellAddresses
GO
Regards,
Vishal Patel
Blog: http://vspatel.co.uk
Site: http://lehrity.com -
Creating SELECT query between 3 tables
Hi there,
Im trying to create a SELECT query between 3 tables and it is driving me round the bend.
I have 3 tables connected together which are:
MODUL
modulid
modulname
modulevel
STUDENT
studentid
surname
inits
s e x
phone
email
logon
STUDREGOCCUR
modulid
acyear
semester
occletter
studentid
result
I want to select the fields surname, inits, studentid from the STUDENT table, modulname from the MODUL table and result from my STUDREGOCCUR table that is NOT NULL.
I have tried SELECT STUDENT.STUDENTID, STUDENT.INITS, STUDENT.SURNAME, MODUL.MODULNAME, STUDREGOCCUR.RESULT WHERE STUDREGOCCUR.RESULT IS NOT NULL;
I have also tried many other ways and done research hwich hasnt really helped me unfortunately.
Im quite new to SELECT queries and im not sure where im going wrong, i would greatly appreciate if someone could help me solve my problem.
Thanks for the help :)
Edited by: user633643 on 06-Dec-2008 08:09If you want data from multiple tables you would need to perform a join. The general form would be:
select t1.cola, t2.col2, t3.col.x
from table_a a, table_b b, table_c c
where a.key = b.key
and b.key = c.key
or perhaps c relates back directly to a so it is a.key = c.key where key can be any column whose value is equilivent in what it represents to the value it is being compared to, that is, student_number = student_number or the columns regardless of name are both building numbers, room numbers, etc ....
This is not your exact solution but it should help.
HTH -- Mark D Powell -- -
How will use Select-Options in Read table Concept.
Hi All,
How will use Select-Options in Read table. For example,
Select-Options : test for bseg-prctr.
Select * from bseg into table ITAB.
Read table ITAB with key prctr in test.
Last line is showing error. If any way to read ITAB as conditions given per select options.
Thankx Advance,,,HI,
you cannot use " IN " with read statement , read statement is used as:
READ TABLE it_collect ASSIGNING <fs_collect>
WITH KEY rbpl = <fs_wkdet>-arbpl
ufnr = <fs_wkdet>-aufnr.
anyways you can use loop at statement before read to use " into " statement as:
LOOP AT it_master INTO l_master
WHERE werks = l_werks
hope it will help you
regards
rahul
Edited by: RAHUL SHARMA on Dec 30, 2008 9:14 AM -
Order mismatch in selected data using Select query
Hello Experts,
We are upgrading from 4.6C to ECC6. I came across a select query on a custom table, which gives different order of data from 4.6C to ECC6. Data (no. of records) is same in both the servers but order is different. Table doesn't have indexes in either 4.6C or ECC6. What would be the cause for order change?
Further, in 4,6C, ECC6 and data bases order of the data is totally different. Select query have some conditions in where clause with select options, but in both the cases (4.6C and ECC6) I am not passing any data from the selection screen so am getting entire data from the data base.
Thanks in advance
PhalaniFrom the SAP service market place I found that
1. Unless we use SORT or ORDER BY clause the order of the data is not in our control.
2. In 4.6C, two same select queries never give the result in the same order, if the primary key contains character fields.
Thanks for your help.
Phalani -
How to Get the Job, Cost center, Position description using select query
Hi all,
How to get the Job, Cost center, Position description through select query without using the Function module?
thanks,
Prasaduse adhoq query and take the report chose both text and value
-
Oracle Forms List Items :not populating list Dynamically using select Query
Hi ,
I need to create a list item. And the values to be populated in the list are from Database but I'm unable to populate from database.
Please help me out how to populate the values from database.
In Property Pallete we have Elements in List under Functional section , In this we have to manually enter the List values but we can't use any Query to Dynamically populate.
Thanks,
Kiran SangaWhen you need to fill a list with the result of a query, you'll have to do it at runtime.
Andreas has a good blogpost about this. -
How to use one query against multiple table and recieve one report?
I have duplicate tables, (except for their names of course) with commodities prices. They have the same column headings, but the data is different of course. I have a query that gives me a certain piece of information I am looking for but now I need to run this query against every table. I will do this every day as well, to see if the buying criteria is met. There are alot of tables though (256). Is there a way to say run query in all tables and return the results in one place? Thanks for your help.
hey
a. the all 256 tables whuld be one big partitoned table
b. you can use all_tables in order to write a select that will write the report for you:
SQL> set head off
SQL> select 'select * from (' from dual
2 union all
3 select 'select count(*) from ' || table_name || ' union all ' from a
4 where table_name like 'DB%' AND ROWNUM <= 3
5 union all
6 select ')' from dual;
select * from (
select count(*) from DBMS_LOCK_ALLOCATED union all
select count(*) from DBMS_ALERT_INFO union all
select count(*) from DBMS_UPG_LOG$ union all
remove the last 'union all', and tun the generated quary -
SQL> set head on
SQL> select * from (
2 select count(*) from DBMS_LOCK_ALLOCATED union all
3 select count(*) from DBMS_ALERT_INFO union all
4 select count(*) from DBMS_UPG_LOG$
5 );
COUNT(*)
0
0
0
Amiel -
Performance issue when using select count on large tables
Hello Experts,
I have a requirement where i need to get count of data from a database table.Later on i need to display the count in ALV format.
As per my requirement, I have to use this select count inside a nested loops.
Below is the count snippet:
LOOP at systems assigning <fs_sc_systems>.
LOOP at date assigning <fs_sc_date>.
SELECT COUNT( DISTINCT crmd_orderadm_i~header )
FROM crmd_orderadm_i
INNER JOIN bbp_pdigp
ON crmd_orderadm_iclient EQ bbp_pdigpclient "MANDT is referred as client
AND crmd_orderadm_iguid EQ bbp_pdigpguid
INTO w_sc_count
WHERE crmd_orderadm_i~created_at BETWEEN <fs_sc_date>-start_timestamp
AND <fs_sc_date>-end_timestamp
AND bbp_pdigp~zz_scsys EQ <fs_sc_systems>-sys_name.
endloop.
endloop.
In the above code snippet,
<fs_sc_systems>-sys_name is having the system name,
<fs_sc_date>-start_timestamp is having the start date of month
and <fs_sc_date>-end_timestamp is the end date of month.
Also the data in tables crmd_orderadm_i and bbp_pdigp is very large and it increases every day.
Now,the above select query is taking a lot of time to give the count due to which i am facing performance issues.
Can any one pls help me out to optimize this code.
Thanks,
SumanHi Choudhary Suman ,
Try this:
SELECT crmd_orderadm_i~header
INTO it_header " interna table
FROM crmd_orderadm_i
INNER JOIN bbp_pdigp
ON crmd_orderadm_iclient EQ bbp_pdigpclient
AND crmd_orderadm_iguid EQ bbp_pdigpguid
FOR ALL ENTRIES IN date
WHERE crmd_orderadm_i~created_at BETWEEN date-start_timestamp
AND date-end_timestamp
AND bbp_pdigp~zz_scsys EQ date-sys_name.
SORT it_header BY header.
DELETE ADJACENT DUPLICATES FROM it_header
COMPARING header.
describe table it_header lines v_lines.
Hope this information is help to you.
Regards,
José -
Dynamic Select Query including Dynamic Tables with For all Entries
Hello everyone,
I need to create a select query which involves using of Dynamic Tables.
Suppose I have a dynamic table <d1> which consist of let say 10 records.
Now i need to make a select query putting data into another dynamic table <d2>
CONCATENATE keyfield '=' '<d1>' INTO g_condition SEPARATED BY space.
CONCATENATE g_condition '-' keyfield INTO g_condition.
SELECT * FROM (wa_all_tables-name) INTO CORRESPONDING FIELDS OF TABLE <d1>
FOR ALL ENTRIES IN <d1>
WHERE (g_condition).
But it is giving dump.
Please help me on this....Short text
A condition specified at runtime has an unexpected format.
What happened?
Error in the ABAP Application Program
The current ABAP program "ZNG_CUSTOMWRITE" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
not caught in
procedure "WRITE_ARCHIVE_PROD" "(FORM)", nor was it propagated by a RAISING
clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The current ABAP program has tried to execute an Open SQL statement
which contains a WHERE, ON or HAVING condition with a dynamic part.
The part of the WHERE, ON or HAVING condition specified at runtime in
a field or an internal table, contains the invalid value "ZCOURIER-ZCOURIERID".
CONCATENATE keyfield '=' g_header INTO g_condition SEPARATED BY space.
CONCATENATE g_condition '-' keyfield INTO g_condition.
SELECT * FROM (wa_all_tables-name) INTO CORRESPONDING FIELDS OF TABLE <dyn_table1>
FOR ALL ENTRIES IN <dyn_table>
WHERE (g_condition). -
OPtimizing Performance for Select query on NAST table
Hi All,
We are fetching a single record from NAST table. The table has around 10 Million Entries.
The Select Query takes around 5-6 minutes to return.
We are not using the Primary key completely. We are using only one field of the primary key.
The field is also a part of the Index but we are not using all the fields in the index as well.
We need to bring down the time. What can be the solution? I cant see any changes to the code, since its a single query and we cant use the Entire Primary key.
Would creating an Index on the fields that we are concerned with help in this regard.
Open to all solutions.
Thanks in Advance,
ImranHi,
Please check this thread
http://sap.ittoolbox.com/documents/popular-q-and-a/specifying-the-index-to-be-used-2462
For creating another secondary index in NAST whether basis will approve for this?
aRs
Maybe you are looking for
-
How to include a delete functionality to web reports of BW
Hello Experts, How can we delete the views which are saved by endusers in a web report. I hope there should be a possibility of adding a "button" to the report which gives the user the functionality of deleting a view. Please let me know <removed by
-
Acrobat 11 doesn't recognise the installation
I've just installed Acrobat 11 Pro on a new computer. I have a pre-existing installation on the old machine. Adobe recognises that the licence is valid but says it can't find a qualifying product. The drop down on the product choice does not have Ado
-
Check User inputs ( sap.m.input / sap.m.inputType )
Hi there, I'm trying to check user inputs using sap.m.inputs. I want my inputs' state to be changed when their value breaks a constraint. For example : <input type="Number" .../> => Value is "Azerty" => Error, control's valueStat = Error, the inputs
-
How do I re-download a digitally purchased copy of Lightroom3?
I need to re-download a digitally purchased copy lightroom 3. Can anyone please help?
-
No costing at header material of a production order
Dear Friends, We maintained a finished material as valuated . I don't want to cost the header material of the production orderand want to cost only the components and activities. But i don't want to create the header material as non valuated . Please