Select with OR condoition
Hi All,
i need to select the bkpf table with OR condition.
example
Select * from bkpf where
and ledger group is either 0L or initial.
kindly help me with the same.
i have tried with creating a range table and populating the values 0L and initial to the same.
but i believe it is not fetching the correct records. As the same is only considering the records with 0L only.
note i have reached the forum but not able to find any helpful answer.
link related to this will be also be of great help.
many thanks,
Anuj.
Moderator Message: SCN is not a place where you can get your consulting work done for free. Put some effort into trying to solve the issue rather than shooting questions one after the other. If you feel you are not up to the task, take a classroom training in ABAP.
Edited by: kishan P on Nov 24, 2010 10:05 AM
Here's what does work for me -
SELECT *
FROM products
WHERE ProdCatID IN (9,12,13)
But isn't that the same as OR?
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"Murray *ACE*" <[email protected]> wrote
in message
news:fj73rk$3hh$[email protected]..
> Standby - brain fart in progress.... 8)
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
>
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
>
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
> ==================
>
>
> "Joris van Lier" <[email protected]> wrote in
message
> news:fj73g0$382$[email protected]..
>> "Murray *ACE*"
<[email protected]> wrote in message
>> news:fj73bt$348$[email protected]..
>>> How do I do a SELECT WHERE foo = 'a' OR foo =
'b', when what I want is
>>> both conditions, not the first one to test TRUE?
In other words, I want
>>> my recordset to contain both 'a' and 'b'.
>>
>> Use AND instead of OR
>> WHERE foo = 'a' AND foo = 'b'
>>
>> Joris
>> --
>> happy Sinterklaas
http://en.wikipedia.org/wiki/Sinterklaas
>>
>>
>
Similar Messages
-
Database selection with invalid cursor !
hi experts,
When execute SAP BW processchar, it occur some system error: (sm21)
Database selection with invalid cursor
The database interface was called by a cursor (in a FETCH or CLOSE
cursor operation) that is not flagged as opened. This can occur if a
COMMIT or ROLLBACK was executed within a SELECT loop (which closes all
opened cursors), followed by another attempt to access the cursor (for
example, the next time the loop is executed).
this error occur when apply bw support package 19.
sap notes 1118584 Solution is: Import Support Package 17 . but my support package is 19.
how can i solve this error?
thanks,
xwu.I am only assuming things, but it might be worth to look closely if you were experiencing an ORA- error during the execution. This could have caused a rollback and thus closed the cursor. Please check the job log, the workprocess trace (dev_wX file) and the system log SM21 and ST22 as well.
Besides that check the oracle alertlog and the usertrace destination.
Best regards, Michael -
Database selection with invalid cursor with MaxDB database
Hi Experts,
I encountered the this error:
"Database selection with invalid cursor
The database interface was called by a cursor (in a FETCH or CLOSE
cursor operation) that is not flagged as opened. This can occur if a
COMMIT or ROLLBACK was executed within a SELECT loop (which closes all
opened cursors), followed by another attempt to access the cursor (for
example, the next time the loop is executed)."
We are using bw support package 19 early this month. Previously is working fine but this problem occured from the last 2 days.
We are using MaxDB database.
Really appreciate any speedy responds.Hi,
We finally resolved the issue.
The solution:
We check the RFC connection test in SM59. There are connection error.
There is an error that related J2EE_ADMIN user.
SO we reset the J2EE_ADMIN id in SU01.
The problem goes away.
Many thanks -
Load data error: Database selection with invalid cursor (sm21)
hi experts,
when I execute processchar, it occur some system error:
"Database selection with invalid cursor ",
"Documentation for system log message BY 7 :
The database interface was called by a cursor (in a FETCH or CLOSE
cursor operation) that is not flagged as opened. This can occur if a
COMMIT or ROLLBACK was executed within a SELECT loop (which closes all
opened cursors), followed by another attempt to access the cursor (for
example, the next time the loop is executed). "
the error msg occur when apply bw support package19.
data from DSO to CUBE, Transferred Recodes is not zero, but Added Recodes is zero.
Request status always yellow, process is running.
current sys info: BI7 and BW19, BASIS17,PI_BASIS17, the database is oracle10g R2.
thanks for your help.I have solved this issue, The Oracle checkpoint not complete.
thanks,
xwu. -
Processchar occur error: Database selection with invalid cursor (sm21)
hi,
when I execute processchar, it occur some system error:
"Database selection with invalid cursor ",
"Documentation for system log message BY 7 :
The database interface was called by a cursor (in a FETCH or CLOSE
cursor operation) that is not flagged as opened. This can occur if a
COMMIT or ROLLBACK was executed within a SELECT loop (which closes all
opened cursors), followed by another attempt to access the cursor (for
example, the next time the loop is executed). "
the error msg occur when apply bw support package19.
data from DSO to CUBE, Transferred Recodes is not zero, but Added Recodes is zero.
Request status always yellow, process is running.
current sys info: BI7 and BW19, BASIS17,PI_BASIS17, the database is oracle10g R2.
thanks for your help.I have solved this issue , The Oracle checkpoint is not complete.
thanks,
xwu. -
Database selection with Invalid Cursor error in RSDRI_INFOPROV_READ
Hi Everyone.
I am using RSDRI_INFOPROV_READ Function module for reading data from a multiprovider.
Logic of the code is as following
while <more data>
CALL RSDRI_INFOPROV_READ reading data in E_T_DATA
Append lines of E_T_DATA to EO_T_DATA.
If total lines of data in EO_T_DATA > 200000
<save EO_T_DATA in a file using GUI_DOWNLOAD>
<clear EO_T_DATA>
EndIF
EndWhile.
As soon as number of record exceed 200000 first file is saved, but after that next data call results in error.
Error says "Database selection with invalid cursor".
I suspect that this because of call to FM GUI_DOWNLOAD. While calling this FM after RSDRI_INFOPROV_READ causes system to commit and again the cursor is tried to open in next call casuing it to fail.
But it is imperative for me to save data in file at regular intervals as data volume is huge.
Any pointers in this direction will be helpful.Hi Everyone.
I am using RSDRI_INFOPROV_READ Function module for reading data from a multiprovider.
Logic of the code is as following
while <more data>
CALL RSDRI_INFOPROV_READ reading data in E_T_DATA
Append lines of E_T_DATA to EO_T_DATA.
If total lines of data in EO_T_DATA > 200000
<save EO_T_DATA in a file using GUI_DOWNLOAD>
<clear EO_T_DATA>
EndIF
EndWhile.
As soon as number of record exceed 200000 first file is saved, but after that next data call results in error.
Error says "Database selection with invalid cursor".
I suspect that this because of call to FM GUI_DOWNLOAD. While calling this FM after RSDRI_INFOPROV_READ causes system to commit and again the cursor is tried to open in next call casuing it to fail.
But it is imperative for me to save data in file at regular intervals as data volume is huge.
Any pointers in this direction will be helpful. -
Hi
I want to create a app redirecting to my mebsite.This app permit to select a "area" selected on a UICollectionViewController, and an "event" selected with a UITableViewController.
I need to integer both informations on the FinalViewController (called in my app AnnoncesViewController) =>
The fisrst array is selected on CollectionViewController:@"http://carnet-du-jour.com/index.php/component/ohanah/?option=com_ohanah&view=e vents&Itemid=0&ohanah_venue_id=21"
The second array is selected onUITableViewController:@"&ohanah_category_id=1&textToSearch="
The final array must be:http://carnet-du-jour.com/index.php/component/ohanah/?option=com_ohanah&view=eve nts&Itemid=0&ohanah_venue_id=21&ohanah_category_id=1&textToSearch=
How can I integer these 2 NSArray to obtain this result to link to a UIWebView as FinalViewController?
Thank you for your help!!
My App is on Drobox:https://www.dropbox.com/s/43l1p2hj5bqamvn/Carnet%20du%20Jour.zip
Gracefully
RémySpehlerHi
I want to create a app redirecting to my mebsite.This app permit to select a "area" selected on a UICollectionViewController, and an "event" selected with a UITableViewController.
I need to integer both informations on the FinalViewController (called in my app AnnoncesViewController) =>
The fisrst array is selected on CollectionViewController:@"http://carnet-du-jour.com/index.php/component/ohanah/?option=com_ohanah&view=e vents&Itemid=0&ohanah_venue_id=21"
The second array is selected onUITableViewController:@"&ohanah_category_id=1&textToSearch="
The final array must be:http://carnet-du-jour.com/index.php/component/ohanah/?option=com_ohanah&view=eve nts&Itemid=0&ohanah_venue_id=21&ohanah_category_id=1&textToSearch=
How can I integer these 2 NSArray to obtain this result to link to a UIWebView as FinalViewController?
Thank you for your help!!
My App is on Drobox:https://www.dropbox.com/s/43l1p2hj5bqamvn/Carnet%20du%20Jour.zip
Gracefully
RémySpehler -
Delete statement that uses a sub-select with the statement in the cursor
Hi all,
How to write write a delete statement that uses a sub-select with the statement in the cursor?
CURSOR excluded_dates IS
SELECT TO_TIMESTAMP(report_parameter_value, in_date_format_mask)
INTO my_current_date_time
FROM report_parameters
WHERE report_parameters.report_parameter_id = in_report_parameter_id
AND report_parameters.report_parameter_group = 'DATE_TIME'
AND report_parameters.report_parameter_name = 'EXCLUDED_DATE';
OPEN excluded_dates;
LOOP
FETCH excluded_dates INTO my_excluded_date;
EXIT WHEN excluded_dates%NOTFOUND;
DELETE FROM edr_rpt_tmp_inclusion_table
WHERE TO_CHAR(date_time, 'mm/dd/yyyy') = TO_CHAR(my_excluded_date, 'mm/dd/yyyy');
END LOOP;
CLOSE excluded_dates;ThanksHi,
In such case I think is better to create a view an perform the delete using it. Example (using HR schema):
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL> create or replace view v_employees as select * from employees where first_name like 'J%';
View created
SQL> select * from v_employees;
EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
110 John Chen JCHEN 515.124.4269 28/09/1997 FI_ACCOUNT 8200,00 108 100
112 Jose Manuel Urman JMURMAN 515.124.4469 07/03/1998 FI_ACCOUNT 7800,00 108 100
125 Julia Nayer JNAYER 650.124.1214 16/07/1997 ST_CLERK 3200,00 120 50
127 James Landry JLANDRY 650.124.1334 14/01/1999 ST_CLERK 2400,00 120 50
131 James Marlow JAMRLOW 650.124.7234 16/02/1997 ST_CLERK 2500,00 121 50
133 Jason Mallin JMALLIN 650.127.1934 14/06/1996 ST_CLERK 3300,00 122 50
139 John Seo JSEO 650.121.2019 12/02/1998 ST_CLERK 2700,00 123 50
140 Joshua Patel JPATEL 650.121.1834 06/04/1998 ST_CLERK 2500,00 123 50
145 John Russell JRUSSEL 011.44.1344.429268 01/10/1996 SA_MAN 14000,00 0,40 100 80
156 Janette King JKING 011.44.1345.429268 30/01/1996 SA_REP 10000,00 0,35 146 80
176 Jonathon Taylor JTAYLOR 011.44.1644.429265 24/03/1998 SA_REP 8600,00 0,20 149 80
177 Jack Livingston JLIVINGS 011.44.1644.429264 23/04/1998 SA_REP 8400,00 0,20 149 80
181 Jean Fleaur JFLEAUR 650.507.9877 23/02/1998 SH_CLERK 3100,00 120 50
186 Julia Dellinger JDELLING 650.509.3876 24/06/1998 SH_CLERK 3400,00 121 50
189 Jennifer Dilly JDILLY 650.505.2876 13/08/1997 SH_CLERK 3600,00 122 50
200 Jennifer Whalen JWHALEN 515.123.4444 17/09/1987 AD_ASST 4400,00 101 10
16 rows selected
SQL> delete from v_employees where hire_date >= to_date('01/06/1998', 'dd/mm/yyyy');
2 rows deleted
SQL> regards, -
No selection with SIGN = 'I'; OPTION 'GE' allowed
Hello All,
I have added an ABAP routine in one of the InfoPackage to filter a field CREATDATE(char,8).
Whenever I am executing the InfoPackage I am getting the following error:-
For sel. field 'CREATDATE', no selection with SIGN = 'I'; OPTION 'GE' allowed
Message no. RSM1607
Through debugging I have noticed that after the EndForm of the InfoPackage filter the Program control goes to a System Program "RSS2_INTERPRET_SELOPTS_DS". All the Selection Options (EQ, BT, GE, GT, NE, LT, etc ) are defined in this program and the program control ignores the 'GE' option code specified in the program "RSS2_INTERPRET_SELOPTS_DS".
if not l_s_so-ge is initial.
clear l_s_selopts.
l_s_selopts-sign = 'I'.
l_s_selopts-option = 'GE'.
l_s_selopts-single = 'X'.
append l_s_selopts to e_t_selopts.
endif.
Can anyone help how to resolve this.
Thank You
Edited by: RACHANA_CG on Sep 27, 2010 2:28 PMHi,
I guess in Infopackage filter routine, you can only declare multiple single values or a range i.e technically I EQ & I BT.
Excluding or greater/less functions are disregarded. You can create a dynamic infopackage filter to have all the dates say for the next two years from the start date & run it.
--Akashdeep -
Select with no conditions taking long time, too many blocks, pctused?
select * from at_journal;is taking 15 seconds, which is absurd. I have similar situations with other log tables in this system.
(selecting with rownum < 5 and with first_rows hint still takes 15 seconds)
Suspicious parameters:
PCT_FREE 1
PCT_USED 99
(Some other log tables have PCT_FREE 5, PCTUSED 90)
The tables have frequent inserts, once every day all records older than 90 days get deleted.
After computing statistics:
Blocks: 42,304 (seems absurdly high)
Size: 663 Mb
NUM_ROWS: 505,966
After copying data without compression to new table:
Blocks: 3,785
Size: 60 Mb
NUM_ROWS: 505,966
The select on the new table is instantaneous.
On a side note, in general is compression for a table with frequent deletes OK? It seems OK to me.
Storage parameters of table creation script:
PCTUSED 99
PCTFREE 1
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
NOMONITORING;I imagine that most blocks for the table are empty. In my mind pctused of 99 means most of the block space should be full. I have read several explanations of PCTUSED/pctfree including oracle documentation and it seems pctused of 99 means the block should be 99% full.
Much thanks,
googoo wrote:
I imagine that most blocks for the table are empty. In my mind pctused of 99 means most of the block space should be full. I have read several explanations of PCTUSED/pctfree including oracle documentation and it seems pctused of 99 means the block should be 99% full.Hello, you don't give your database version, but if you were using Automatic Segment Space Management you would not need to worry about the PCTUSED setting, and it could be that you already are:
1 select tablespace_name, segment_space_management
2 from dba_TABLESPACES
TABLESPACE_NAME SEGMEN
SYSTEM MANUAL
SYSAUX AUTO
UNDOTBS1 MANUAL
TEMP MANUAL
USERS AUTO
EXAMPLE AUTOAnd if you are already using ASSM, then the PCTUSED is not an issue (PCTFREE still applies, but it's not an issue in your case).
goo wrote:
On a side note, in general is compression for a table with frequent deletes OK? It seems OK to me.Frequent DELETEs could be an issue because they will not reset the High Watermark, though there will not be a performance penalty because of the compression for DELETEs (the record only needs to be located for a DELETE, not decompressed). Your PCTUSED, however, is high enough so that any newly deleted record slots should be quickly reused, but... it depends on how those new records are being INSERTed. If, as Daniel says, the HWM is being effectively bypassed (Direct Path INSERTs, etc.), then the table will grow in size every day, but the volume of records effectively stays just about the same.
Have a look at how the new records are being added to that table, if it's a:
INSERT /*+ APPEND */ INTO tableA
SELECT...Then the HWM is being advanced, and the newly vacated slots from the DELETEd records are not being reused. So the table will continually grow, for roughly the same amount of data, and there'll be a proportionately longer data retrieval time. -
How to avoid select with in a loop.
Hi friends,
can any tell how to avoid the select with in a loop for the following code, since it badly effecting my performance. if possible with code
SELECT matnr werks
FROM marc
INTO TABLE it_marc
FOR ALL ENTRIES IN it_ausp_1
WHERE matnr = it_ausp_1-objek AND
werks = p_werks
AND mmsta LE 60.
SORT it_marc BY matnr.
CLEAR wa_ausp_1.
CLEAR wa_tabix.
LOOP AT it_ausp_1 INTO wa_ausp_1.
wa_tabix = sy-tabix.
READ TABLE it_marc INTO wa_marc WITH
KEY matnr = wa_ausp_1-objek
BINARY SEARCH.
IF sy-subrc EQ 0.
ELSE.
DELETE it_ausp_1 INDEX wa_tabix.
ENDIF.
ENDLOOP. " LOOP AT it_ausp_1 INTO wa_ausp_1.
APPEND LINES OF it_ausp_1 TO it_tal.
IF it_tal[] IS NOT INITIAL.
LOOP AT t_plan_order INTO fs_plan_order.
SELECT r~rsnum
r~rspos
r~matnr
r~nomng
r~meins
r~plnum
r~bdter
r~ewahr
r~alprf
r~posnr
r~baugr
m~dispo
INTO TABLE t_resb
FROM resb AS r
INNER JOIN marc AS m
ON rbaugr = mmatnr
AND rwerks = mwerks
FOR ALL ENTRIES IN it_tal
WHERE r~rsnum = fs_plan_order-rsnum
AND r~matnr = it_tal-objek
AND r~xloek = ' '
AND r~werks = p_werks.
APPEND LINES OF t_resb TO t_tacl.
ENDLOOP.SELECT r~rsnum r~rspos r~matnr r~nomng r~meins r~plnum r~bdter r~ewahr r~alprf r~posnr r~baugr m~dispo
INTO TABLE t_resb
FROM resb AS r
INNER JOIN marc AS m
ON r~baugr = m~matnr
AND r~werks = m~werks
FOR ALL ENTRIES IN it_tal
WHERE r~rsnum = fs_plan_order-rsnum
AND r~matnr = it_tal-objek
AND r~xloek = ' '
AND r~werks = p_werks.
The logic of this select is completely weird. Whcih order of the db-tables should be used, which indexes?
On RESB matnr, werks and xloek are in one index, but rsnum not.
Are the conditions in fs_plan_order and it_tal connected or independent?
It is probably much faster, to leave the fs_plan_order condition away and check it on the result.
SELECT r~rsnum r~rspos r~matnr r~nomng r~meins r~plnum r~bdter r~ewahr r~alprf r~posnr r~baugr m~dispo
INTO TABLE t_resb
FROM resb AS r
INNER JOIN marc AS m
ON m~matnr = r~baugr
AND m~werks = r~werks
FOR ALL ENTRIES IN it_tal
WHERE AND r~matnr = it_tal-objek
AND r~xloek = ' '
AND r~werks = p_werks.
sort fs_plan_order by rsnum.
loop at it_tal in wa.
read table fs_plan_order
with key rsnum = wa-rsnum
binary search.
if sy-subrc eq 0.
append ...
endif.
endloop.
Siegfried -
How to create VO with multiple dynamic where clauses on select with UNION?
I am trying to implement the View Object for the UNION query that looks like this:
select a,b,c...
from t1,t2,...
where dynamic_where_clause1
union all
select a,b,c,...
from t11,t12, ...
where dynamic_where_clause2
There are up to 60 input parameters that are used to generate dynamic where clauses. They are actually created by calling PL SQL function.
So far, I was not able to assign both where clauses to the view object. Is there a workable solution for this problem, besides resorting to programmatic View Object?
I understand that recommended way with UNIONs is to wrap both queries into a parent select:
select * from (
select a,b,c...
from t1,t2,...
where ... -- table relationship joints
union all
select a,b,c,...
from t11,t12, ...
where ... -- table relationship joints
) QRSLT
where dynamic_where_clause
Unfortunately this approach doesn't work here, since individual selects are producing unmanageable amount of data and resulting query takes forever to complete.I afraid I would not have any real benefits from using VO if I replace the entire query with every request. Actually, the performance may suffer.
I solved the problem by creating a POJO Data Control and invoking the custom select query from java. Not sure if it is the best approach to the problem, but implementation time is limited and it works.
Actually, this is not the first time I see the need to implement VO with complicated SQL like select with unions and dynamic pieces. It would be nice to find a solution and not resort to workarounds.
Edited by: viksicom on Aug 2, 2012 8:48 AM -
I need a report in SAP which allows multiple Profit centers selection with
Hi,
Cany anybody help me with below issue -
I need a report in SAP which allowing multiple Profit centers selection with :
- Profit Center #
- Profit center Name
- Profit center long text
- Profit Center group
- the related PC node showing the BU and the product category group.
Let me know is there any report which can provide us with all this details.
With regards.Hi,
I recommend the PCA standard drill-down or interactive reports accessible via the follwoing menu path:
Accounting --> Enterprise Controlling --> PCA --> Infosystem --> Reports for PCA
There are several reports which allow entering profitcenter groups or profitcenters.
Long Text is not possible. Makes also no sense to report on Long Text.
Best regards,
Andreas -
Product selection with outcome B
Hi all,
I would like to know which item category and schedule line category to be used if I am using outcome B in material determination functionality.
Can anyone help me with this configuration.
Regards,
BeenaHi,
For product selection with outcome B, The higher level item category is TAX(Non stock item) with schedule line category CX(No inventory mgmt.).
Item category of product selection is TAPS (Std.Item PS) it comes with Schedule line category of PN( Selection without MRP) and PP (Selection with MRP).
These are all standards. If you would like to configure new item & schedule line category that is also possible for particular order type.
Hope, it is useful to you.
Regards,
S.Balaji -
FS00 Matchcode selection with " * "
Hello Guys,
I'm working on ECC6 and I am facing the following issue: I launch the FS00 transaction, I want to display all the GL account starting with 4 so I type 4* in the matchcode, I press enter.... nothing happens ! It would normally display the list of the selected account.
Did anyone already face this issue of the the selection with the " * " character ?
Thanks in advance.Dear Moulin,
It should display all the records starting with 4... if you give 4*. <b>The popup will ask you for the confirmation. You would need to press enter.</b>
It could be that there are no GL Accounts starting with 4 in the chart of account. Anyways, try searching with 4.
However, you can test the searchhelp in SE11 as well.
Regards,
Naveen.
Maybe you are looking for
-
End of chapter pages disappear, one page is repeated sometimes 10 times
I have an ipad 2. I downloaded WIld, from Oprah's book club. When I get 5-10 pages from the end of a chapter, the page I am on starts repeating. I turn the page and it's the same, except the page numbers continue to ascend, until the end of the chapt
-
Dear Friends, One of my client procures stock material from his depot plants today due to somebad quality the material had been rejected and now they wants the material to be returned to vendor from depot plant. My question is how
-
I'm setting up up my gmail in mail and I don't know what it means by Incoming and Outgoing mail server. what do I put there? Thanks a lot meyer0095
-
FF 10: cannot load local html files by dragging to FF; links in email don't open
Just upgraded to FF 10. I cannot open a local html file by dragging it to to FF, or by clicking the file name. Clicking the file name brings up an error message: There was a problem sending the command to the program. Dragging just shows a circle wit
-
PS won't recognize "default" printer
This is an annoyance rather than an emergency-I'm on a Mac, I have three printers, and I want to use one in particular for a PS printing task. I fill up the printer with the right paper, then call up the flle and hit "print", forgetting to notice tha