Select statement issue--urgent
Hi All,
i need information regarding below select statement.
SELECT ebelp
ebeln
vgabe
SUM( menge ) AS menge
shkzg
FROM ekbe
INTO TABLE t_ekbe
WHERE ebeln EQ t_documents-ebeln
AND ebelp EQ t_documents-ebelp
AND ( vgabe EQ c_1
OR vgabe EQ c_2 )
GROUP by ebelp ebeln vgabe shkzg.
I am working 4.5b version now.All the data declartion is correct.This select statement goes to Dump .when ever data is selected before the select statment.
let me any other choices to do same.its urgent.
Thanks,
Arnald
Hi...Arnald..
Try this way... Runtime error may be bcoz of the Order of fields....
types : begin of st_ekbe,
EBELN TYPE EKBE-EBELN,
EBELPTYPE EKBE-EBELP,
VGABE TYPE EKBE-VGABE,
SHKZG TYPE EKBE-SHKZG,
MENGE TYPE EKBE-MENGE,
end of st_ekbe.
DATA: T_EKBE TYPE TABLE OF ST_EKBE.
SELECT
ebeln
ebelp
vgabe
shkzg
SUM( menge )
FROM ekbe
INTO TABLE t_ekbe
WHERE ebeln EQ t_documents-ebeln
AND ebelp EQ t_documents-ebelp
AND ( vgabe EQ c_1
OR vgabe EQ c_2 )
GROUP by ebeln ebelp vgabe shkzg.
<b>Reward if Helpful</b>
Similar Messages
-
Select statement issue- urgent pls help
Hi
The following select statement is always failed, even LIKP table has data. pls help me
LOOP AT LT_VBRP.
IF LV_KEEP_VGBEL <> LT_VBRP-VGBEL.
LV_KEEP_VGBEL = LT_VBRP-VGBEL.
CLEAR LIKP.
SELECT single VBELN TRAID TRATY VERUR BOLNR LFDAT
FROM LIKP INTO
(LIKP-VBELN,LIKP-TRAID,LIKP-TRATY,LIKP-VERUR,LIKP-BOLNR,LIKP-LFDAT)
WHERE BOLNR = LT_VBRP-VGBEL.
IF SY-SUBRC = 0.
LV_ASN_FOUND = 'X'.
ELSE.
CLEAR LV_ASN_FOUND.
ENDIF.
ENDIF.
MOVE-CORRESPONDING LT_VBRP TO LT_LIPOV.
IF LV_ASN_FOUND = 'X'.
LT_LIPOV-VBELN = LIKP-VBELN. "ASN #
LT_LIPOV-LFDAT = LIKP-LFDAT.
lt_lipov-verur = likp-verur.
LT_LIPOV-BOLNR = LIKP-BOLNR. "DDL#
LT_LIPOV-KOMAU = LIKP-VBELN.
get the ASN line number details.
SELECT VBELN POSNR MATNR ERDAT LFIMG ERNAM WERKS VGBEL VGPOS FROM LIPS INTO
TABLE LT_LIPOV
WHERE VBELN = LIKP-VBELN.
ELSE.
CLEAR LT_REP-VBELN.
CLEAR LT_REP-LFDAT.
CLEAR LT_REP-VERUR.
CLEAR LT_REP-BOLNR.
LT_REP-KOMAU = LT_VBRP-VBELN. "Inv no
LV_MESSAGE = TEXT-504.
PERFORM CREATE_REPORT_RECORD_LIN01.
LT_REP-LINE_COLOUR = 'C610'. " red Intensified
ENDIF.
APPEND LT_REP.
APPEND LT_LIPOV.
CLEAR LT_LIPOV.
CLEAR LT_REP.
ENDLOOP.Hi Kumar....
if statement should not be like ..
if lv_keep_vgbel lt_vbrp-vgbel.
Should be like this if lv_keep_vgbel = lt_vbrp-vgbel.
and try to use work area and table to select and loop the data...
Have YOu checked whether da data in it_vbrp...
there few error in way You are writing...
And one more thing in the table LIKP the field BOLNR is 35 Char and VGBEL of VBRP is 10 char ...and your are equalling that to extract the data which will not happen even..
So before select statement change VBRP-VGBEL as 35 char varible by using like this
data : v_vgbel type likp-bolnr.
loop at lt_vbrp.
if lv_keep_vgbel lt_vbrp-vgbel. " Why did you right the statement like this
if lv_keep_vgbel = lt_vbrp-vgbel.
clear likp.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = lt_vbrp-vgbel
importing
output = v_vgbel.
select single vbeln traid traty verur bolnr lfdat
from likp into
(likp-vbeln,likp-traid,likp-traty,likp-verur,likp-bolnr,likp-lfdat)
where bolnr = v-vgbel.
regards,
sg
Edited by: Suneel Kumar Gopisetty on May 26, 2008 4:41 AM -
Stop auditing select statements issued against SYS objects
Hi,
My current client has a requirement to track destructive updates (i.e. insert, update, delete) issued by users who can connect directly to the database. At the moment though, SELECT statements issued against SYS-owned objects are also being captured to the Oracle audit trail. For the time being at least these need to be disabled.
I've issued NOAUDIT SELECT TABLE/SEQUENCE and NOAUDIT SELECT ANY TABLE/SEQUENCE commands, as has a user with the SYSDBA privilege, and they're still being logged. Is there any way to switch these off? I don't know if it's significant (I'm not a DBA by trade) but the audit_sys_operations parameter is set to True.
My client is currently running Oracle Database 10.2.0.5.0 standard edition.
If anyone has any suggestions I'd be grateful.
Thanks in advance,
SteveHi,
Thanks for the input so far ...
@Eduardo and KarK ...
show parameter audit
audit_file_dest string D:\ORACLE\PRODUCT\10.2.0\ADMIN\USSUPM2\ADUMP
audit_sys_operations boolean TRUE
audit_trail string DB, EXTENDED
If we set audit_sys_operations to FALSE, won't that stop auditing of all actions carried out by, for example, someone who connects as SYSDBA? That is something that's still needed to be captured. Unfortunately they go to the WIndows Event Log but at least they're captured somewhere.
@Hemant
This auditing was in place before my client took me on, so I can't say what was used to initiate it unfortunately. What I can say though is that they absolutely don't want to turn off auditing by SYS- type users, just SELECT against SYS-owned objects.
Thinking simplistically, could I just write a script which trawls dba_objects for sys-owned tables, views and sequences and explicitly issues a noaudit select against what's found, and get one of the sysdba-type people we have access to to run it?
Thanks in advance (again)
Steve -
Selected state issue with Menu Module V2
OK so I am getting an issue with Menu Module V2. I have used this before with success but this time I have hit a wall. I possed this question to BC live chat and they bugged out real quick.
The site in construction is http://www.urbanista.com.au
What is happening is that in the top right tools nav with the headings Home, Services, People, Contact Us using Menu Module V2. The Heading Services has a drop down and this is where the issue resides. Roll over any of these nav devices and you will see they will highlight orange. Home is already auto activating its Selcted state. Click on Contact Us and it will do the same. Roll over and click on Services and it appears to have worked. While in Services roll over the drop down again and you will see all links have activated the Selected state. This is the issue. If you view the code of the Services UL you will see only the Services state has been alocated the Slected state. See below:
<li id="Services" class="selected">
<a href="/services.htm">Services</a>
<ul>
<li id="tools-panningdev">
<li id="tools-housing">
<li id="tools-urban-renewal">
<li id="tools-project-management">
<li id="tools-feasibility-tools">
<li id="tools-governance-systems">
<li id="tools-communications">
<li id="tools-projects">
</ul>
</li>
The CSS that runs the nav is as follows:
ul.dropdown {
font-weight: normal;
font-family: Arial, Helvetica, sans-serif;
font-style: normal;
text-decoration: none;
ul.dropdown li {
background-color: transparent;
color: #999;
padding-top: 5px;
padding-right: 10px;
padding-bottom: 5px;
padding-left: 10px;
font-size: 12px;
ul.dropdown li.hover,
ul.dropdown li:hover {
background-color: transparent;
color: #FFF;
ul.dropdown a:link,
ul.dropdown a:visited {
color: #FFF;
text-decoration: none;
ul.dropdown a:hover { color: #ff871f; }
ul.dropdown a:active {
color: #b33b00;
/* -- level mark -- */
ul.dropdown ul {
width: 150px;
margin-top: 1px;
background-image: url(/images/nav-transparency.png);
background-repeat: repeat;
color: #FFF;
ul.dropdown ul li {
font-weight: normal;
ul.dropdown li.selected a {
color: #ff871f;
The last entry 'ul.dropdown li.selected a {color: #ff871f;}' is required in order to allocate a Slected State. Without it not Selected state is active and the links al remian white.
I have tried all manner of combinations and additonal tags with no success. Any suggestions greatly appreciated. I have not modified the default Javascript provided by BC in the system apart from allocating the required ulTagClass as specified. The Javascript in the supplied 'container.html' is as follows:
<script type="text/javascript" >
// ids need to be unique per page, use different ones if you are including multiple menus in the same page
// id of the nav tag, used above
var divTagId = "myMenu1";
// desired id for 1st <ul> tag
var ulTagId = "myMenu1List";
// desired class for 1st <ul> tag
var ulTagClass = "dropdown dropdown-vertical";
if ((null !== ulTagId) && ("" !== ulTagId)) {
document.getElementById(divTagId).getElementsByTagName("ul")[0].setAttribute("id",ulTagId );
if ((null !== ulTagClass) && ("" !== ulTagClass)) {
document.getElementById(divTagId).getElementsByTagName("ul")[0].className = ulTagClass;
// this will set the selected state
if ((null !== ulTagId) && ("" !== ulTagId)) {
catSetSelectedCSSItem(ulTagId);
</script>
Lastly this is one of the recomended navs by BC at the following address: http://lwis.net/free-css-drop-down-menu/
I have used these before with success but for the life of me this has stumped me big time.Hi Matthew,
Having a super quick look at the code I'd say it's because of:
ul.dropdown li.selected a {
color: #ff871f;
This affects all the child elements.
To override this down the line you could do something like:
ul.dropdown li.selected ul li a {
color: #fff;
This would override the parent link color when selected.
You could probably then also add:
ul.dropdown li.selected ul li.selected a {
color: #ff871f;
For the dropdown selected states.
That's a quick look though so don't quote me too much -
HI All,
I have 10 records in a internal table. I have 20 records in a database table. i want those records from the database table which does not exists in internal table.Which is the better select statement for this situation with performance.
Regards,
Hazamsimplest way is just fetch all the records instead of checking each and every record of internal table with database table records.
select f1 f2 f3
from mara
<b> into table itab</b>
where <condition>.
this will just replace all the existing records of ITAB with the new values.
here alternatively you can use <b>RANGES</b>. but if your primaarey key of that database table is only 1 field,then you can use RANGES. but if your WHERE condition fields also more,then this way of doing with RANGES is time consuming.
For example, if you are fetching data from MARA table,
RANGES R_MATNR FOR MARA-MATNR.
R_MATNR-SIGN = 'E'.
R_MATNR-OPTION = 'EQ'.
LOOP AT ITAB1.
R_MATNR-LOW = ITAB1-MATNR.
APPEND R_MATNR.
ENDLOOP.
Now R_MATNR will have all material nos fromn the first internal table.
then send this to select
SELECT * FROM MARA
<b> APPENDING TABLE ITAB1</b>
WHERE MATNR NOT IN R_MATNR.
Regards,
Srikanth
Message was edited by: Srikanth Kidambi
Message was edited by: Srikanth Kidambi -
Select statement- very urgent pls help
hi
i want to extract following fields into one internal table.
anyone pls help me to do this?
mara-mandt, mara-matnr, mara-meins, mara-laeda, mara-aenam, marc-werks, makt-maktx, sy-datum, sy-uzeit, sy-uname
Thanks
KumarHi Kumar K,
TABLES: MARA, MARC, MAKT.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
PARAMETERS : P_WERKS LIKE MARC-WERKS OBLIGATORY.
DATA : BEGIN OF WA_FINAL,
MANDT LIKE MARA-MANDT,
MATNR LIKE MARA-MATNR,
MEINS LIKE MARA-MEINS,
LAEDA LIKE MARA-LAEDA,
AENAM LIKE MARA-AENAM,
WERKS LIKE MARC-WERKS,
MAKTX LIKE MAKT-MAKTX,
DATE TYPE SY-DATUM,
TIME TYPE SY-UZEIT,
UNAME TYPE SY-UNAME,
END OF WA_FINAL,
BEGIN OF WA_MARA,
MANDT LIKE MARA-MANDT,
MATNR LIKE MARA-MATNR,
MEINS LIKE MARA-MEINS,
LAEDA LIKE MARA-LAEDA,
AENAM LIKE MARA-AENAM,
END OF WA_MARA,
BEGIN OF WA_MAKT,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
END OF WA_MAKT,
BEGIN OF WA_MARC,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
END OF WA_MARC.
DATA : IT_MARA LIKE STANDARD TABLE OF WA_MARA WITH HEADER LINE,
IT_FINAL LIKE STANDARD TABLE OF WA_FINAL WITH HEADER LINE,
IT_MAKT LIKE STANDARD TABLE OF WA_MAKT WITH HEADER LINE,
IT_MARC LIKE STANDARD TABLE OF WA_MARC WITH HEADER LINE.
SELECT MANDT
MATNR
MEINS
LAEDA
AENAM
FROM MARA
INTO TABLE IT_MARA
WHERE MATNR IN S_MATNR.
IF IT_MARA[] IS NOT INITIAL.
SELECT MATNR
WERKS
FROM MARC
INTO TABLE IT_MARC
FOR ALL ENTRIES IN IT_MARA
WHERE MATNR = IT_MARA-MATNR
AND WERKS = P_WERKS.
ENDIF.
IF IT_MARA[] IS NOT INITIAL.
SELECT MATNR
MAKTX
FROM MAKT
INTO TABLE IT_MAKT
FOR ALL ENTRIES IN IT_MARA
WHERE MATNR = IT_MARA-MATNR.
ENDIF.
LOOP AT IT_MARA.
IT_FINAL-MANDT = IT_MARA-MANDT.
IT_FINAL-MATNR = IT_MARA-MATNR.
IT_FINAL-MEINS = IT_MARA-MEINS.
IT_FINAL-LAEDA = IT_MARA-LAEDA.
IT_FINAL-AENAM = IT_MARA-AENAM.
READ TABLE IT_MARC WITH KEY MATNR = IT_MARA-MATNR.
IF SY-SUBRC = 0.
IT_FINAL-WERKS = IT_MARC-WERKS.
ENDIF.
READ TABLE IT_MAKT WITH KEY MATNR = IT_MARA-MATNR.
IF SY-SUBRC = 0.
IT_FINAL-MAKTX = IT_MAKT-MAKTX.
ENDIF.
IT_FINAL-DATE = SY-DATUM.
IT_FINAL-TIME = SY-UZEIT.
IT_FINAL-UNAME = SY-UNAME.
APPEND IT_FINAL.
CLEAR : IT_FINAL, IT_MARA , IT_MAKT, IT_MARC.
ENDLOOP.
now IT_FINAL table contains the final data which you want...
Hope it will solve your problem
Reward points if useful...
Thanks & Regards
ilesh 24x7 -
Is there any way to Mask the Name when a select statement is issued?
Dear all,
Is there any way to mask the name .. i mean if User issue a select statement in a customer table the real name should come like ' ABCXXXDEFXXCFXX'... Which is not the actual name?
e.g if Name: CHIEV SONG MEE
If user issue a statment select * from customers;
The Result Should come something Like this:
Name
CHXXV SXNG MXX
Thank Youuser3029023 wrote:
but it seems there is no option in oracle it self which can be used as there they are saying to get a data masking software which we can't due to some internal issues....I would not say that. How one implements masking depends entirely on the requirements that need to be met.
For example, schema A owns all the tables. Schema B can be created as a "trusted" schema - in other words, schema A trusts schema B and allows it full access (with grants) to its tables. Schema B implements data masking as views. For each table in A, a view exists in B that implements the required masking. B can now grant select access on these views to user C. User C will see the same data object names in B as it would have if it used A - only, by using the B data objects it uses masked data objects and not the original source data objects.
Another example - schema Dev is to have all the data objects of schema Prod, but masked where needed. One can use CTAS (Create Table As Select) to create the required tables in Dev with masked values where relevant. This Dev schema can be "refreshed" on weekends by dropping all tables and getting a new fresh copy of production data and masking it - ready for the next week's development cycle.
If the application use is for example APEX, then instead of coding SQL directly as reporting regions to display, a function is used instead. APEX supports reporting regions where it calls a function and this function provides the APEX run-time with the SQL to execute and contents to render. It is easy to use this approach to implement logic in functions that masked column data depending on who the APEX user is, the security/role attributes of the user, and so on.
No there is not a single "+mask this column!+" feature in Oracle.. but that does not mean that such a feature is not supported and cannot be implemented. Oracle has a very comprehensive and rich set of tools - more so than most (if not all) other RDBMS products.
It is up to the architect/designer/developer to use this toolkit in creating a system that meets the specific requirements at hand. -
Performance Issue in Select Statement (For All Entries)
Hello,
I have a report where i have two select statement
First Select Statement:
Select A B C P Q R
from T1 into Table it_t1
where ....
Internal Table it_t1 is populated with 359801 entries through this select statement.
Second Select Statement:
Select A B C X Y Z
from T2 in it_t2 For All Entries in it_t1
where A eq it_t1-A
and B eq it_t1-B
and C eq it_t1-C
Now Table T2 contains more than 10 lac records and at the end of select statement it_t2 is populated with 844003 but it takes a lot of time (15 -20 min) to execute second select statement.
Can this code be optimized?
Also i have created respective indexes on table T1 and T2 for the fields in Where Condition.
Regards,If you have completed all the steps mentioned by others, in the above thread, and still you are facing issues then,.....
Use a Select within Select.
First Select Statement:
Select A B C P Q R package size 5000
from T1 into Table it_t1
where ....
Second Select Statement:
Select A B C X Y Z
from T2 in it_t2 For All Entries in it_t1
where A eq it_t1-A
and B eq it_t1-B
and C eq it_t1-C
do processing........
endselect
This way, while using for all entries on T2, your it_t1, will have limited number of entries and thus the 2nd select will be faster.
Thanks,
Juwin -
Issue with Select options in select statement - ABAP Question
Hi
I am facing an issue with select options. Select statement is returning sy-subrc as 4.
I wrote the program as below:
SELECT-OPTIONS:
s_kunnr FOR bsad-kunnr,
s_lifnr FOR bsak-lifnr,
s_gjahr FOR bsad-gjahr,
s_bukrs FOR bsad-bukrs,
s_saknr FOR bsad-saknr,
s_budat FOR bsak-budat.
In start of selection I have written the select statement as
SELECT * FROM bsak INTO TABLE lt_bsak
WHERE bukrs IN s_bukrs AND lifnr = s_lifnr AND gjahr IN s_gjahr AND budat IN s_budat AND saknr IN s_saknr.
In selection screen I have not entered any values and executed the program. I am not getting any result. When I debug that, sy-subrc is 4 at above select statement. But table has records.
If am removing the "lifnr = s_lifnr " condition in select then select is returning values.
I am not getting where I made the mistake. Please suggest.
Thank you
HanuHi,
The problem here with where condition select option lifnr = s_lifnr.
Use below select query.
SELECT * FROM bsak INTO TABLE lt_bsak
WHERE bukrs IN s_bukrs
AND lifnr IN s_lifnr
AND gjahr IN s_gjahr
AND budat IN s_budat
AND saknr IN s_saknr.
s_lifnr is a select option and you are passing it as parameter lifnr = s_lifnr.
if you want to pass this s_lifnr as single vale then pass in below mentioned way.
lifnr = s_lifnr-low
BR,
Vijay -
Urgent, SELECT statement results in error
hi all, this is very urgent, could you guys have a look at my SELECT statement?
SELECT vk~kunnr "customer no
vk~vbeln "sales order no
vk~audat "date
vk~vbtyp "SD DOCUMENT CATEGORY
vk~knumv "lwk
vp~kwmeng "qty
vp~matnr "material no
vp~posnr "LINE ITEM
vd~bstkd "PURCHASE ORDER NO
* kv~kwert "lwk
FROM vbak AS vk
INNER JOIN vbap AS vp
ON vk~vbeln = vp~vbeln
INNER JOIN vbkd AS vd
ON vk~vbeln = vd~vbeln
* INNER JOIN konv AS kv
* ON kv~knumv = vk~knumv
INTO CORRESPONDING FIELDS OF TABLE it_so
WHERE vk~vkorg IN s_vkorg
AND vk~audat IN s_date
AND vk~kunnr IN s_kunnr
AND vp~matnr IN s_matnr
AND vd~bstkd IN s_bstkd
AND vk~vbeln IN s_vbeln
* AND kv~kschl = 'ZP00'
AND vk~vbtyp = 'C'.
The commented lines are the new additions that i want to add to the SELECT statement. But when i un-comment them, i get an error while activating my program. Error is as follows:
For pooled tables, cluster tables, and project views, JOIN is not allowed: "KONV".
Is there a way i can go around it?Hi,
look at this SAP note : 550043
Symptom
KEPM: dump 'MESSAGE_TYPE_X' during automatic planning method execution.
Other terms
KEPM MESSAGE_TYPE_X transform characteristic value
Reason and Prerequisites
This note is related only to cases, if dump 'MESSAGE_TYPE_X' is raising
during execution of planning method, for which is possible to define
transformation of characteristics values i.e. Copy, Forecast, Top-Down
distribution, Ratios and Customer Enhancement.
Dump is raising in case, if there was defined transformation of char.
values in parameter set definition for some characteristic. Later on,
this characteristic was removed from planning level definition but
characteristic wasn't removed from relevant customizing of transform
characteristic values before.
Solution
Please apply attached program correction.
Regards,
GSR. -
Urgent: regarding sub select statement
I making a report in which i have to display the STOCK and i want to do the sum in a select statement of the value coming from the field AFRU-GMNGA so that i can do calculation of the value of 1st field to be subtracted from the last value of the same field .
can anybody provide me example of it as i am currently using dis select statement:-
SELECT AMATNR ALGORT BGMNGA BVORNR C~MEINS FROM AFPO AS A
INNER JOIN AFRU AS B ON AAUFNR = BAUFNR
INNER JOIN MARA AS C ON AMATNR = CMATNR
INTO TABLE ITAB
WHERE MTART IN MAT_TYPE AND A~MATNR IN P_MATNR .
plzz help me out as it is really urgent to me.Hi,
Go thr the below select query.
select tvkwzwerks a350kschl a350vkorg konpkbetr
from tvkwz inner join a350 on tvkwzvkorg = a350vkorg inner join konp
on a350knumh = konpknumh into table itab where tvkwz~werks = '1003'
and a350~kschl = 'ZCPA'.
Regards,
vijay -
What happen while issuing select statement
hi,
Can any one please explain what happen while we are issuing select statement in instance ?
please give me info.
thanks,
Sanjeev.Please read Overview of SQL Processing in http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/sqllangu.htm#CHDFCAGA
-
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 -
IF-ELSE issue in Select Statement
Hello,
I have following query in SQL Server which I am trying to convert to Oracle 11g.
IF '[Param.1]' = 'S' OR '[Param.1]' = 'T' THEN
select * from ULQUEUE
END IF
But when I write the same query in Oracle, it gives error stating Invalid SQL Statement. So how do I incorporate IF-ELSE in Select Statement in Oracle?
Edited by: 967327 on Oct 31, 2012 2:01 PMHi,
First of all, remove asterisk sign from the end of line
select * from ULQUEUE;* Second: where you try to put this code? This is not SQL, but PL\SQL so you have to have some variable where you want to put query result like this:
declare
x ULQUEUE%Rowtype;
begin
select *
into x
from ULQUEUE
end; This of course works when your query returns only one row. Otherwise process data in the loop or put result into array. -
Performance Issue in select statements
In the following statements, it is taking too much time for execution,Is there any best way to change these selection statements...int_report_data is my final internal table....
select fsplant fvplant frplant fl1_sto pl1_delivery pl1_gr pl2_sto pl2_delivery perr_msg into (dochdr-swerks,dochdr-vwerks,dochdr-rwerks,dochdr-l1sto,docitem-l1xblnr, docitem-l1gr,docitem-l2sto, docitem-l2xblnr,docitem-err_msg) from zdochdr as f inner join zdocitem as p on fl1_sto = pl1_sto where fsplant in s_werks and
fvplant in v_werks and frplant in r_werks and pl1_delivery in l1_xblnr and pl1_gr in l1_gr and p~l2_delivery in l2_xblnr.
move : dochdr-swerks to int_report_data-i_swerks,
dochdr-vwerks to int_report_data-i_vwerks,
dochdr-rwerks to int_report_data-i_rwerks,
dochdr-l1sto to int_report_data-i_l1sto,
docitem-l1xblnr to int_report_data-i_l1xblnr,
docitem-l1gr to int_report_data-i_l1gr,
docitem-l2sto to int_report_data-i_l2sto,
docitem-l2xblnr to int_report_data-i_l2xblnr,
docitem-err_msg to int_report_data-i_errmsg.
append int_report_data.
endselect.
Goods receipt
loop at int_report_data.
select single ebeln from ekbe into l2gr where ebeln = int_report_data-i_l2sto and bwart = '101' and bewtp = 'E' and vgabe = '1'.
if sy-subrc eq 0.
move l2gr to int_report_data-i_l2gr.
modify int_report_data.
endif.
endloop.
first Billing document (I have to check fkart = ZRTY for second billing *document..how can i write the statement)
select vbeln from vbfa into (tabvbfa-vbeln) where vbelv = int_report_data-i_l2xblnr or vbelv = int_report_data-i_l1xblnr.
select single vbeln from vbrk into tabvbrk-vbeln where vbeln = tabvbfa-vbeln and fkart = 'IV'.
if sy-subrc eq 0.
move tabvbrk-vbeln to int_report_data-i_l2vbeln.
modify int_report_data.
endif.
endselect.
Thanks in advance,
YadHi!
Which of your selects is slow? Make a SQL-trace, check which select(s) is(are) slow.
For EKBE and VBFA you are selecting first key field - in general that is fast. If your z-tables are the problem, maybe an index might help.
Instead of looping and making a lot of select singles, one select 'for all entries' can help, too.
Please analyze further and give feedback.
Regards,
Christian
Maybe you are looking for
-
Faxing of SAPScript throwing exception
Dear All, I am facing problem while sending Sales Order output through FAX. It is throwing exception in OPEN_FORM function module as FAX_NOT_VALID. I debugged and found that actually system is failing FM SX_NUMBER_TO_DEVTYPE which in turn showing tha
-
Hi We need to take the print out of 531 mvt What are the standerd Setting needs to maintain for the same, Regards Niti Narayan
-
Help regarding a new enhancement
Hi, We got a new requirement stating that we need to have a link in user interface .So that when the manager clicks on that links we should display the users details like firstname,lastname,email for whom he is the manager in a table format. Can some
-
CS6 Master Collection installer constant fail
I purchased CS6 Master Collection and, to save download time, the reseller (iSoftware) burnt it to disk for me. All four folders are now in a single folder on my desktop. I've tried "setup.exe" multiple times (in part 1) and the installer always fail
-
Disabled Add Button on Visual Adminitrator
Hello there, I'm following this steps to add J2EE_admin user into the administartor users 1. Start the Visual Administrator. 2. Go to Server -> Services -> Security Provider 3. Choose the ?Security Roles? tab. 4. Choose component ?SAP-J2EEEngine?. 5.