Select statement operators in ecc 6.
Hi Experts,
I have a small doubt about the '>=' ( greater than or equal to ) operator usage in select statement. Is this operator by any chance perform not as desired in ECC 6.0. Is it a good option to use 'GE' instead of '>='. ?
It may sound a bit awkward, but still I would like to know. I am facing a situation, which could be related to this. An early response would be highly appreciated.
I would request,you NOT TO REPLY with links/explanations which says how to use select statement. Only answer if you have the answers related to this query.
Regards,
Sandipan
>
Jaideep Sharma wrote:
> Hi,
> The only difference is GE will take a little more time than >= as system need to convert the keyword into actual operator when fetching data from Database.
>
> KR Jaideep,
????? Every Open SQL statements is translated to the SQL slang the underlying database is talking regardless if you type GE or >=
If the result differs using >= or GE i would open a call at SAP instead of asking in SDN.
Similar Messages
-
Select statement for JDBC receiver synch scenario for capturing random value from ECC portal
Dear Experts,
I am working on ECC <----> SAP-PO 7.31 <----> JDBC synchronous scenario. I am clear about the config part except the Select statement. I will be
capturing 2 random values from the portal i.e. VendId and VendName in ECC to get the vendor details like Vendor Country, Vendor Status, Vendor Contact , Vendor Address etc from JDBC vendor table/view VENDETAIL.
What would be the select statement to capture the random values for ECC portal? My select statement would look some thing like this..
Select f1,f2,f3,f4 from table VENDETAIL where key1 = "VendId" and "VendName"
Please suggest if the above select statement works for the above scenario...
Regards
RebeccaHi Rebecca,
Your statement should work fine.
Please see the statement we use below.
SELECT eT_cashier, eT_proc_yn, eT_proc_date FROM eTest WHERE eb_proc_yn = 'N'
Just remember to update the change indicator so that you dont duplicate your records.
UPDATE eTest SET eb_proc_yn = 'Y' WHERE eb_proc_yn = 'N'.
Regards,
Jannus Botha -
HOW CAN I USE MULTIPLE INNERJOINS IN A SINGLE SELECT STATEMENT?
HI,
I AM SHABEER AHMED,
I AM GETTING AN ERROR WHILE I ATTEMPT TO EXECUTE A SELECT STATEMENT WITH MULTIPLE INNER JOINS . BECOZ I WANT TO FETCH ITEM DATA, PARTNER DATA BASED ON HEADER DATA .
THEN OF COURSE I HAVE FETCH DATA FROM VBAK VBAP VBKD SO LZ SEND ME THE SOLUTION.
BYEHi,
1.Just see this:
SELECT * INTO CORRESPONDING FIELD OF TABLE itab
FROM t1 INNER JOIN t2 ON t1f4 EQ t2f4
INNER JOIN t3 ON t2f5 EQ t3f5 AND
t2f6 EQ t3f6 AND
t2f7 EQ t3f7.
2.But better to use for all entries.It increases the performance.
FOR ALL ENTRIES
Tabular Conditions
The WHERE clause of the SELECT statement has a special variant that allows you to derive conditions from the lines and columns of an internal table:
SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond> ...
<cond> may be formulated as described above. If you specify a field of the internal table <itab> as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read.
The internal table <itab> must have a structured line type, and each field that occurs in the condition <cond> must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.
You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.
Example for ALL ENTRIES
DATA: TAB_SPFLI TYPE TABLE OF SPFLI,
TAB_SFLIGHT TYPE SORTED TABLE OF SFLIGHT
WITH UNIQUE KEY TABLE LINE,
WA LIKE LINE OF TAB_SFLIGHT.
SELECT CARRID CONNID
INTO CORRESPONDING FIELDS OF TABLE TAB_SPFLI
FROM SPFLI
WHERE CITYFROM = 'NEW YORK'.
SELECT CARRID CONNID FLDATE
INTO CORRESPONDING FIELDS OF TABLE TAB_SFLIGHT
FROM SFLIGHT
FOR ALL ENTRIES IN TAB_SPFLI
WHERE CARRID = TAB_SPFLI-CARRID AND
CONNID = TAB_SPFLI-CONNID.
LOOP AT TAB_SFLIGHT INTO WA.
AT NEW CONNID.
WRITE: / WA-CARRID, WA-CONNID.
ENDAT.
WRITE: / WA-FLDATE.
ENDLOOP.
INNER JOINS
In a relational database, you normally need to read data simultaneously from more than one database table into an application program. You can read from more than one table in a single SELECT statement, such that the data in the tables all has to meet the same conditions, using the following join expression:
SELECT...
FROM <tab> INNER JOIN <dbtab> AS <alias> ON <cond> <options>
where <dbtab> is a single database table and <tab> is either a table or another join expression. The database tables can be specified statically or dynamically as described above. You may also use aliases. You can enclose each join expression in parentheses. The INNER addition is optional.
A join expression links each line of <tab> with the lines in <dbtab> that meet the condition <cond>. This means that there is always one or more lines from the right-hand table that is linked to each line from the left-hand table by the join. If <dbtab> does not contain any lines that meet the condition <cond>, the line from <tab> is not included in the selection.
The syntax of the <cond> condition is like that of the WHERE clause, although individual comparisons can only be linked using AND. Furthermore, each comparison must contain a column from the right-hand table <dbtab>. It does not matter on which side of the comparison it occurs. For the column names in the comparison, you can use the same names that occur in the SELECT clause, to differentiate columns from different database tables that have the same names.
The comparisons in the condition <cond> can appear in the WHERE clause instead of the ON clause, since both clauses are applied equally to the temporary table containing all of the lines resulting from the join. However, each join must contain at least one comparison in the condition <cond>.
Example for INNER JOINS
REPORT demo_select_inner_join.
DATA: BEGIN OF wa,
carrid TYPE spfli-carrid,
connid TYPE spfli-connid,
fldate TYPE sflight-fldate,
bookid TYPE sbook-bookid,
END OF wa,
itab LIKE SORTED TABLE OF wa
WITH UNIQUE KEY carrid connid fldate bookid.
SELECT pcarrid pconnid ffldate bbookid
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( ( spfli AS p
INNER JOIN sflight AS f ON pcarrid = fcarrid AND
pconnid = fconnid )
INNER JOIN sbook AS b ON bcarrid = fcarrid AND
bconnid = fconnid AND
bfldate = ffldate )
WHERE p~cityfrom = 'FRANKFURT' AND
p~cityto = 'NEW YORK' AND
fseatsmax > fseatsocc.
LOOP AT itab INTO wa.
AT NEW fldate.
WRITE: / wa-carrid, wa-connid, wa-fldate.
ENDAT.
WRITE / wa-bookid.
ENDLOOP.
Regards,
Shiva Kumar(Reward if helpful). -
Hi,
Am getting dump with the below select statement in ECC 6.0,
where as the same select works fine in 4.7C.
SELECT distinct aebeln abukrs absart alifnr azterm aekorg aekgrp awaers awkurs akdatb akdate aunsez bebelp btxz01 bwerks blgort bbednr bmatkl bidnlf bmeins bbprme bnetpr bpeinh bknttp badrn2 csakto canln1 caufnr cgsber cps_psp_pnr detenr dlpein deindt dwemng dslfdt dmenge
INTO CORRESPONDING FIELDS OF TABLE it_output FROM
( ( ( ekko AS a INNER JOIN ekpo AS b ON aebeln = bebeln )
INNER JOIN ekkn AS c ON bebeln = cebeln and bebelp = cebelp )
INNER JOIN eket AS d ON cebeln = debeln and cebelp = debelp )
WHERE aebeln IN s_ebeln AND alifnr IN s_lifnr AND a~bukrs IN s_bukrs.
Whether I've to add anything addition for select distinct statement in ecc 6.0 or is it obsolette?
can oneone help in this regards?
Thanks,
Ponraj.s.Hi,
This is only dev.server and it consists only few records.
TYPES: BEGIN OF ty_output,
*********Header data*****************************
rectype_line1(1) TYPE c,
rectype_line2(1) TYPE c,
rectype_line3(1) TYPE c,
rectype_line4(1) TYPE c,
ebeln TYPE ebeln,
bukrs TYPE bukrs, "Company Code
bsart TYPE bsart, "Documnet Type
lifnr TYPE lifnr,
zterm TYPE dzterm,
ekorg TYPE ekorg, "Purchase Org
ekgrp TYPE ekgrp, "Purchase grp
waers TYPE waers, "Currency
wkurs TYPE wkurs, "Exchange rate
wkurs1(9) TYPE c,
kdatb TYPE kdatb,
kdate TYPE kdate, "Validity end date
unsez TYPE unsez, "Our Reference
********Line item data***************************
ebelp TYPE ebelp, "po item
txz01 TYPE txz01, "Item Text
werks TYPE werks, "Plant
lgort TYPE lgort_d, "Storage Location
bednr TYPE bednr, "Tracking No
matkl TYPE matkl, "Material group
idnlf TYPE idnlf, "Vendor Material No
meins TYPE meins, "Order unit
bprme TYPE bprme, "Order price unit
netpr TYPE netpr, "Net price
netpr1(11) TYPE c,
peinh TYPE peinh, "Price unit
peinh1(5) TYPE c,
knttp TYPE knttp, "Acc Assgnment
adrn2 TYPE adrn2,
**************G/L Account data***********************
menge2(13) TYPE c, "PO Quantity
sakto TYPE sakto, "GL Acc No
anln1 TYPE anln1, "Main Asset number
aufnr TYPE aufnr, "Order Number
gsber TYPE gsber, "Business Area
ps_psp_pnr(8) TYPE c,
**********Item schedule data*******************************
etenr TYPE etenr,
lpein TYPE lpein, "Delivery date category
eindt TYPE eindt, "Delivery date
menge TYPE menge, "Schedule Quantity
menge1(13) TYPE c,
wemng TYPE wemng,
wemng1(13) TYPE c,
slfdt TYPE slfdt, "Start of Delivery date
END OF ty_output.
DATA : it_output TYPE STANDARD TABLE OF ty_output.
This is my table declaration,pls help me in resolving this issue. -
Execute an string as select statement
Hi,
I have a problem:
I'm working with an older oracle verion (7.x??). I want to create a dynamic select statement. I create a string, e.g. v_sql_string, and want the database to execute it. What possibilities do I have to do this?
Thanks in advance
MathiasYes,
I went through the documentation, but it's only working with cursors.
For better comprehension:
This is the string:
'select count(*) from invoice where sup_no ' || op_sup_no || ' v_sup_no and trpt_code ' || op_trpt_code || ' v_trpt_code and ship_no ' || op_ship_no || ' v_ship_no'
I want to set the operators (op_xxx) dynamiclly. Isn't there something like RUN or EXECUTE, where I only have to pass a string, and the statement is executed ...
But I don't know how ...
Mathias -
Build SVG graphic for Select statement
I asked an earlier question and need to refine it or even ask it differently.. So here goes..
I have a report, that is built using a select statement.. In this report I need to have an item that is a barcode printed.
I have a function that is from a member here, that will produce a svg bar code, in an HTML region, using an application process.. I wish to modify this and make it return an SVG string to be used in the select statement..
Is this possible?
Thank you,
Tony Miller
UTMB/EHNThe answer is in the last frame of you cartoon. Read it again.
If you are letting users type if values that will be used unfiltered, you have a lot bigger problems on your hands than SQL insertion.
Why are you letting operators type in their name? Never let operators type in their own name. In fact don't let users type at all except as a last resort.
Likewise, lot number or id or whatever should not be typed. Selected, yes. Scanned, yes. But not typed.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
If statement in select statement alias
I have the following select statement. It has the alias Survivors, Deaths and "All Cases". Is it posible to use :P_LANGUAGE variable to say that -- IF :P_LANGUAGE = FRENCH THEN alias are Survivants for survivors, Décès for Deaths, Tous_les_cas for All Cases. Please advise
SELECT ALL T_NTR_MULTIBAR.CAT, T_NTR_MULTIBAR.NUM_CASES_LEFTBAR AS Survivors,
T_NTR_MULTIBAR.NUM_CASES_MIDDLEBAR AS Deaths, T_NTR_MULTIBAR.NUM_CASES_RIGHTBAR AS "All Cases"
FROM T_NTR_MULTIBAR
WHERE INSTANCE_NUM = :P_INSTANCENUM
order by ORDERSYou may not be able to add this condition inside the SQL Statement. But you can add this condition outside the statement, if you're using PL/SQL...
IF :p_language = french THEN
SELECT ALL t_ntr_multibar.cat,
t_ntr_multibar.num_cases_leftbar AS survivors,
t_ntr_multibar.num_cases_middlebar AS deaths,
t_ntr_multibar.num_cases_rightbar AS "All Cases"
ELSE
END IF; -
How to get all values from an interval using select statement
Hi,
Is it possible to write a select statement that returns all values from an interval? Interval boundaries are variable.
something like this:
select (for x in 1,1024 loop x end loop) from dual
(this, of course, doesn't work)
The result in this example should be 1024 rows of numbers from 1 to 1024. These numbers are parameters, so it is not possible to create a table with predefined values.
Thanks in advance for your help,
Mia.For your simple case, with a lower boundary of 1, you can use:
SELECT rownum
FROM all_objects
WHERE rownum <= 1024For a set of number between say 50 - 100, you can use something like:
SELECT rownum + (50 - 1)
FROM all_objects
WHERE rownum <= (100 - 50 + 1)Note, that all_objects was used only because it generally has a lot of rows. Any table with at least the number of rows in your range will work.
TTFN
John -
How to find the number of fetched lines from select statement
Hi Experts,
Can you tell me how to find the number of fetched lines from select statements..
and one more thing is can you tell me how to check the written select statement or written statement is correct or not????
Thanks in advance
santoshHi,
Look for the system field SY_TABIX. That will contain the number of records which have been put into an internal table through a select statement.
For ex:
data: itab type mara occurs 0 with header line.
Select * from mara into table itab.
Write: Sy-tabix.
This will give you the number of entries that has been selected.
I am not sure what you mean by the second question. If you can let me know what you need then we might have a solution.
Hope this helps,
Sudhi
Message was edited by:
Sudhindra Chandrashekar -
Use of LIKE in where clause of select statement for multiple records
Hi Experts,
I have a account number field which is uploaded from a file. Now this account numbers uploaded does not match fully with sap table account numbers but it contains all of the numbers provided in the file mostly in the upright positions.
For example in file we have account number as 2ARS1 while in sap table the value is 002ARS1.
And i want to fetch data from sap table based on account number uploaded. So, i am trying to use LIKE with for all entries but its not working as mentioned below but LIKE is not working with FOR ALL ENTRIES.
data : begin of t_dda occurs 0,
dda(19) type c,
end of t_dda.
data : begin of t_bukrs occurs 0,
bukrs type t012k-bukrs,
end of t_bukrs.
data : dda type t012k-bankn,
w_dda type t012k-bankn.
CONCATENATE '%'
'2ARS1'
INTO W_DDA.
MOVE W_DDA TO T_DDA-DDA.
APPEND T_DDA.
CLEAR T_DDA.
free t_bukrs.
SELECT BUKRS
FROM T012K
into TABLE t_bukrs
for all entries in t_dda
WHERE BANKN like t_dda-dda.
Can anybody suggest what should i use to get the data for multiple account numbers using one select statement only instead on using SELECT UP TO 1 ROWS in LOOP....ENDLOOP ?
Thanks in advance,
AkashHi,
yes, For All entries won't work for LIKE with '% '.
I think the other alternative is go for Native SQL by writing sub-query
sample code is here:
data: begin of i_mara occurs 0,
matnr like mara-matnr,
matkl like mara-matkl,
end of i_mara.
exec sql.
select matnr, matkl from mara where matnr in (select matnr from marc) and matnr like '%ma' into :i_mara
endexec.
loop at i_mara.
write:/ i_mara-matnr, i_mara-matkl.
endloop.
hope u got it.
regards
Mahesh
Edited by: Mahesh Reddy on Jan 21, 2009 2:32 PM -
What is the use of additon in up to 1 rows in SELECT statement
Hi All,
What is the use of up to 1 rows in select statement.
for example
SELECT kostl
FROM pa0001
INTO y_lv_kostl UP TO 1 ROWS
WHERE pernr EQ pernr
AND endda GE sy-datum.
ENDSELECT.
I'm unable to get in wat situations we hav to add up to 1 rows
please help me out...
Thanks,
santosh.Hi,
Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for.
The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS.
The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.
Regards,
Bhaskar -
Secondary Index Select Statement Problem
Hi friends.
I have a issue with a select statement using secondary index,
SELECT SINGLE * FROM VEKP WHERE VEGR4 EQ STAGE_DOCK
AND VEGR5 NE SPACE
AND WERKS EQ PLANT
%_HINTS ORACLE
'INDEX("&TABLE&" "VEKP~Z3" "VEKP^Z3" "VEKP_____Z3")'.
given above statement is taking long time for processing.
when i check for the same secondary index in vekp table i couldn't see any DB index name with vekp~z3 or vekp^z3 or vekp____z3.
And the sy-subrc value after select statement is 4. (even though values avaliable in VEKP with given where condition values)
My question is why my select statement is taking long time and sy-subrc is 4?
what happens if a secnodary index given in select statement, which is not avaliable in that DB Table?Hi,
> ONe more question: is it possible to give more than one index name in select statement.
yes you can:
read the documentation:
http://download.oracle.com/docs/cd/A97630_01/server.920/a96533/hintsref.htm#5156
index_hint:
This hint can optionally specify one or more indexes:
- If this hint specifies a single available index, then the optimizer performs
a scan on this index. The optimizer does not consider a full table scan or
a scan on another index on the table.
- If this hint specifies a list of available indexes, then the optimizer
considers the cost of a scan on each index in the list and then performs
the index scan with the lowest cost. The optimizer can also choose to
scan multiple indexes from this list and merge the results, if such an
access path has the lowest cost. The optimizer does not consider a full
table scan or a scan on an index not listed in the hint.
- If this hint specifies no indexes, then the optimizer considers the
cost of a scan on each available index on the table and then performs
the index scan with the lowest cost. The optimizer can also choose to
scan multiple indexes and merge the results, if such an access path
has the lowest cost. The optimizer does not consider a full table scan.
Kind regards,
Hermann -
BI Publisher : SELECT statement in RTF template
Hi Guys
I have written a BI Publisher Report using XML file created from Oracle Reports(in Oracle Apps).
Repors runs from Oracle Apps perfectly ok. Now I need to fetch some data from couple of tables and display on the Report.
I am wondering whether I can directly code SELECT statement in RTF file rather than messing with Oracle Report(.rdf) file.
Please advise.
Thanks and Regards
VijayHey Vijay,
You cannot query in RTF using select :)..
You have to mess/play with RDF to do it ;)
Oh wait, did i say , we cannot in RTF, we can , but that is difficult approach to go with., keep this as an end of the world option. -
Can we use is null in our select statement in ABAP program
hi,
I want to use 'is nul' or 'not null' in select statement of my ABAP program for any field. I have written below query but I am getting sy-subrc = 4 and getting no data. Can anyone resolve this.Hi,
I think you've posted your question on the wrong forum. This is the SAP Business One development forum which is not part of ERP and doesn't include any ABAP or Netweaver programming.
For a list of forums please see here:
http://forums.sdn.sap.com/index.jspa
Kind Regards,
Owen -
Performance issue - Select statement
Hi I am having the 10 lack records in the KONP table . If i am trying to see all the records in SE11 , it is giving the short dump TSV_TNEW_PAGE_ALLOC_FAILED . I know this is because of less memory in the Server . Is there any other way to get the data ? How to optimise the below SELECT statement if i have large data in the table .
i_condn_data - is having 8 lack records .
SELECT knumh kznep valtg valdt zterm
FROM konp
INTO TABLE i_condn_data_b
FOR ALL ENTRIES IN i_condn_data
WHERE knumh = i_condn_data-knumh
AND kschl = p_kschl.
Please suggest .Hi,
try to use "UP TO n ROWS" to control the quantity of selected data in each Loop step.
Something like this:
sort itab by itab-knumh.
flag = 'X'.
while flag = 'X'.
SELECT knumh kznep valtg valdt zterm
FROM konp
INTO TABLE i_condn_data_b UP TO one_million ROWS
WHERE knumh > new_value_for_selection
AND kschl = p_kschl.
describe table i_condn_data_b lines i.
read table i_condn_data_b index i.
new_value_for_selection = i_condn_data_b-knumh.
*....your logic for table i_condn_data_b
if one_million > i.
clear flag.
endif.
endwhile.
Regards
Maybe you are looking for
-
Export of instance takes long time
Hi, we're exporting an instance of a 10g database and it takes incredible long time. The dba told me, he sees wait/io on db file sequential read. I've tried to break the issue down on the OS side (Solaris 10 U09 Sparc,Generic_147440-09 ). The process
-
Hi all, Can anybody give the documents related to E1/E2 Process and High Sea sale Process.
-
VBScript support in Mac OS 10.6
My level of computer ability is a 4.98/5 FYI. I'm currently taking a required 'scripting w/ database & lab' course in college. Instead of using a universal language and database like C++/PHP/Java w/ MySQL, they are using VBScript. (the point is to un
-
BAPI to bring TAX INFO, ORDER HISTORY and PAYMENT DETAILS of a PO ??
Hi All, Is there any BAPI that brings TAX INFO ORDER HISTORY and PAYMENT DETAILS of a PO ? Please let me know. Thnx. Regards, Nandha
-
Upon downloading Adobe flash player for farmville when I click on the icon to open Firefox I get this message when I click OK it disappears and opens Firefox How can I delete this so it don't appear