Limit size (in byte) of SELECT-OPTIONS in WHERE clauses
hi,
as far as I know there is a limit size (in byte) for SELECT-OPTIONS used in WHERE clauses. Is it true? What is the limit? If the SELECT-OPTIONS is based on lifnr (character type, 10 long) is the following calculation valid?
sign - 1 byte
option - 2 bytes
low - 10 bytes
high - 10 bytes
23 bytes all together for one line, is this valid?
thanks
ec
Hi,
Check this link..
https://forums.sdn.sap.com/click.jspa?searchID=6896082&messageID=2891787
Regards,
Omkar.
Similar Messages
-
SELECT-OPTIONS in WHERE condition
Hi All,
SELECT-OPTIONS : S_TCODE FOR TSTCT-TCODE.
START-OF-SELECTION.
SELECT * FROM TSTCT INTO TABLE IT_TSTCT
WHERE TCODE = S_TCODE.
The same code results in SYNTAX ERROR in 4.7c.
In ECC 6.0, no such error resulted, but SUBRC is 4.
Why is it like this in ECC 6.0?
Regards,
R.Nagarajan.hi,
You are right in ECC 6 this will not give any error as long as you are referencing to the work area of the Select-option, but will start giving error as soon as you refer to the table using the [] command beside the select-option the it will give you a syntax error in ECC 6.0 also.
The reason might be the unicode enabling started in ECC 6.0
Hope That Helps
Anirban M. -
Select-options with where condition
Hello ABAPers,
I want to create a select-options like s_operid for vbpa-kunnr but with a condition specified is VBPA-KUNNR where VBPA-PARVW = 'WE'.
Thanks in advance. Pls reply asap. Points will definitely be rewarded.
Rituhi,
use this
PARAMETERS : TAB_ID TYPE ZALOAD_PROD_COMB-TAB_ID OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR TAB_ID.
DATA : BEGIN OF INT_TAB_ID OCCURS 0,
TAB_ID TYPE ZALOAD_PROD_COMB-TAB_ID,
END OF INT_TAB_ID.
DATA : LOC_MAX TYPE ZALOAD_PROD_COMB-TAB_ID.
CLEAR INT_TAB_ID.
REFRESH INT_TAB_ID.
SELECT MAX( TAB_ID) INTO (LOC_MAX) FROM ZALOAD_PROD_COMB.
COUNT = LOC_MAX + 1.
DO 10 TIMES.
MOVE COUNT TO INT_TAB_ID-TAB_ID.
APPEND INT_TAB_ID.
COUNT = COUNT + 1.
ENDDO.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'TAB_ID' u201C Internal table field name
DYNPPROG = 'PROG_NAME u201C Program name
DYNPNR = SY-DYNNR
DYNPROFIELD = 'TAB_ID' u201C Field where u need F4 help
VALUE_ORG = 'S'
WINDOW_TITLE = u2018Any descriptionu2019
TABLES
VALUE_TAB = INT_TAB_ID. u201C Internal table name
Mark the post answered once ur problem is solved .... -
[PERSISTENCE CLASS] SELECT OPTION in WHERE statement
Hi Gurus,
I would like to know how could I code the WHERE statement with a SELECT OPTION, in Persistence Class ?
Currenlty, I would like to code this kind of request :
DELETE FROM ziTab
WHERE zdate IN so_date.
Do you know, how could I code it ?
Many thx for helps.
Best regards.
Rachid.Sorry Glen,
Unfortunately, I am trying to find the correct syntax to use a SELECT OPTION in a Query Request of Persistence Class:
Something like that:
SELECT-OPTIONS so_date FOR sy-datum .
DATA lo_query_manager TYPE REF TO if_os_query_manager .
DATA lo_query TYPE REF TO if_os_query .
DATA lo_agent TYPE REF TO zca_persistence_zint_rsbankinv.
DATA lo_base TYPE REF TO zcb_persistence_zint_rsbankinv.
DATA lo_rsbankinv TYPE REF TO zcl_persistence_zint_rsbankinv.
DATA lo_table TYPE osreftab .
DATA ls_table TYPE REF TO zcl_persistence_zint_rsbankinv.
DATA ls_tmp TYPE REF TO object .
DATA lv_string TYPE string .
DATA lo_exception TYPE REF TO cx_root .
TRY .
lo_agent = zca_persistence_zint_rsbankinv=>agent.
* Create Query
lo_query_manager = cl_os_system=>get_query_manager( ).
lo_query = lo_query_manager->create_query( i_filter = 'ZEXDAT IN PAR1' ).
lo_table =
lo_agent->if_os_ca_persistency~get_persistent_by_query(
i_query = lo_query
i_par1 = so_date
LOOP AT lo_table INTO ls_tmp.
ls_table ?= ls_tmp .
lv_string = ls_table->zget_all_fields( ).
WRITE lv_string.
ENDLOOP.
CATCH cx_root INTO lo_exception.
lv_string = lo_exception->get_text( ).
WRITE lv_string.
ENDTRY.
But I have an error message :
Syntax error when parsing a query : Excepected symbol 'IN' (row: O, column: 7)
Any idea ? -
Values from a Multi-Select in the where clause of a Select statement
I have a web page that solicits query parameters from the user.
The selections that the user makes will populate the WHERE clause of a Select statement.
One of the controls on the page is a multi-select control.
When this page posts, I would like to execute a Select statement wherein the selected values from this control appear in the .. Column IN ( <list here> ) portion of the WHERE clause.
This is an extremely common scenario, but I cannot seem to locate a how-to or message thread that addresses this specific case.
I have an idea that it may involve dynamic SQL or Execute Immediate, but cannot seem to pin down the answer.
Any help would be greatly appreciated!anonymous - As illustrated here: Re: Search on a typed in list of values
Scott -
Issue in select query with where clause
Hi guys,
I'm facing an issue while using select query with the where clause. When I'm selecting all the data from the table it returns the correct result. But when I'm using the where clause to get the specific rows from the table it returns no rows. But the data I'm trying to fetch using the where condition exists in the table.
Here is my query which causing the issue,
select * from mytable where myfield = 'myvalue'
But if I use the following query it returns the result correctly.
select * from mytable
Also the myfield value 'myvalue' exists in the table.
I have tried by running this query in both SQL Developer and SQL Plus. I have tried this query in mssql as well. It works perfectly and returns correct result sets for both the queries I have mentioned above. I'm unable to predict the issue as I'm new to ORACLE. Please help.
Thanks,
Ram.Hi Ram,
I experienced an issue similar to this with a varchar2 field. Some of our records had a hidden newline character at the end of them, which was making queries like the one below fail:
select * from employees
where email = '[email protected]'The best way I found to detect this was to use
select 'XX'||email||'XX' from employeesTo make sure that there were no newlines. But that is just a guess. If you could provide some example table data and the outputs of your selects, it would be helpful.
Jeff -
Update table based on a select with a where clause
I am trying to update a table only for records where i have a status of changed.
Using the following code the update changes all the records putting in blank data if it is outwith the where clause.
ideas?
-- Update changed records
UPDATE IP_SURVEY_ACTIVITY_REG_NO old
SET (
old.SLPN,
old.SURVEY_DATE,
old.SEQUENTIAL_REF_NUMBER,
old.TOTAL_NUM_OF_SAMPLES,
old.TOTAL_NUM_OF_ASSOC_SAMPLES,
old.AIR_TESTS,
old.REMARKS,
old.SURVEY_DETAILS,
old.FURTHER_SURVEY_DETAILS,
old.GENERAL_COMMENTS) =
(SELECT
new.SLPN,
new.SURVEY_DATE,
new.SEQUENTIAL_REF_NUMBER,
new.TOTAL_NUM_OF_SAMPLES,
new.TOTAL_NUM_OF_ASSOC_SAMPLES,
new.AIR_TESTS,
new.REMARKS,
new.SURVEY_DETAILS,
new.FURTHER_SURVEY_DETAILS,
new.GENERAL_COMMENTS
FROM IP_SURVEY_ACTIVITY_REG_NO_INT new
WHERE new.load_id = v_load_id
AND new.status = 'CHANGED'
AND new.sarn = old.sarn);
cheers bjornThe EXISTS claue just needs to be added to your original query as a predicate on the ip_survey_activity_reg_no table. somethign like:
UPDATE ip_survey_activity_reg_no old
SET (old.slpn, old.survey_date, old.sequential_ref_number,
old.total_num_of_samples, old.total_num_of_assoc_samples,
old.air_tests, old.remarks, old.survey_details,
old.further_survey_details, old.general_comments) =
(SELECT new.slpn, new.survey_date,
new.sequential_ref_number,
new.total_num_of_samples,
new.total_num_of_assoc_samples, new.air_tests,
new.remarks, new.survey_details,
new.further_survey_details,new.general_comments
FROM ip_survey_activity_reg_no_int new
WHERE new.load_id = v_load_id and
new.status = 'CHANGED' and
new.sarn = old.sarn)
WHERE EXISTS (SELECT 1 FROM ip_survey_activity_reg_no_int new
WHERE new.load_id = v_load_id and
new.status = 'CHANGED' and
new.sarn = old.sarn)An updateable join view is similar, except you just join the two tables. Assuming that sarn is the primary key of ip_survey_activity_reg_no_int, or is at least declared as unique in that table, then the update of the join would look something like:
UPDATE (SELECT old.slpn oslpn, old.survey_date osurvey_date,
old.sequential_ref_number osequential_ref_number,
old.total_num_of_samples ototal_num_of_samples,
old.total_num_of_assoc_samples ototal_num_of_assoc_samples,
old.air_tests oair_tests, old.remarks oremarks,
old.survey_details osurvey_details,
old.further_survey_details ofurther_survey_details,
old.general_comments ogeneral_comments,
new.slpn nslpn, new.survey_date nsurvey_date,
new.sequential_ref_number nsequential_ref_number,
new.total_num_of_samples ntotal_num_of_samples,
new.total_num_of_assoc_samples ntotal_num_of_assoc_samples,
new.air_tests nair_tests, new.remarks nremarks,
new.survey_details nsurvey_details,
new.further_survey_details nfurther_survey_details,
new.general_comments ngeneral_comments
FROM ip_survey_activity_reg_no old, ip_survey_activity_reg_no_int new
WHERE new.sarn = old.sarn and
new.status = 'CHANGED' and
new.load_id = v_load_id)
SET oslpn = nslpn,
osurvey_date = nsurvey_date,
osequential_ref_number = nsequential_ref_number,
ototal_num_of_samples = ntotal_num_of_samples,
ototal_num_of_assoc_samples = ntotal_num_of_assoc_samples,
oair_tests = nair_tests,
oremarks = nremarks,
osurvey_details = nsurvey_details,
ofurther_survey_details = nfurther_survey_details,
ogeneral_comments = ngeneral_commentsHTH
John
Message was edited by:
John Spencer
Honest, Eric wasn't there when I posted :-) -
SELECT QUERY CHECK & WHERE CLAUSE DIFFERENCE.URGENT PLEASE.
My question is ,
IF SBOOK_WA-CARRID = 'LH' CONDITION IS AGAIN PRESENT IN THE DATABASE TABLE ,,,,WILL THE CHECK CONDITION SEARCH IT AGAIN EVEN AFTER FINDING IT IN THE FIRST OF THE TABLE???OR SIMPLY TERMINATE IN THE FIRST TIME THE CONDITION SATISFIES??IF DOES TERMINATE THEN ERRONEOUS RESULT IS BOUND TO COME SINCE ONE MORE RECORS IS UNSELECTED.
SIMILARLY DOES THE WHERE CLAUSE CONTINUE SEARCHING EVEN AFTER HAVING FOUND THE CONDITION ALREADY ONCE IN THE TABLE??
PLEASE HELP ME IN THIS ASPECT.PLEASE CHECK THE TWO DIFFERENT CODES & ANSWER ACCORDINGLY..
SELECT * FROM SBOOK INTO SBOOK_WA.
CHECK: SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
ENDSELECT.
SELECT * FROM SBOOK INTO SBOOK_WA
WHERE CARRID = 'LH' AND
CONNID = '0400'.
ENDSELECT.Hi,
The Check condition will be true, so it will not going to display the records, it will fill the internal table.
In the Where condition it will fill the Internal table as well as it will display also.
Hope now your query is solved
Regards,
Dhruv Shah -
Select sdo_nn with where-clause on large table
Hi spatial-experts,
I've following problem. I use a table with more than 2.500.000 dataset. Every dataset represents one point (SDO_GEOMETRY, SDO_POINT_TYPE) and have further (text) information. (PI (point of interest) table from TeleAtlas mn_pi)
Following Select works fine:
SELECT /*+ ORDERED NO_INDEX(pi IX_PI_FEATTYP) */
sdo_nn_distance(1) distance,
id, feattyp, arnamelc, name, stname, stnamelc, hsnum, postcode
FROM multinet.mn_pi pi
WHERE
pi.feattyp IN ( 9373,9374)
AND
SDO_NN(
pi.geom,
SDO_GEOMETRY( 2001, 8307, SDO_POINT_TYPE(613.86865234375/60, 3002.94677734375/60, NULL), NULL, NULL),
'sdo_batch_size=0', 1) = 'TRUE'
AND rownum = 1
ORDER BY distance
(P.S. IX_PI_FEATTYP is an index on column feattyp, here not used. When I'm using it the select do not work (it last very long...))
When I now modify the where clause to an pi which feat type that does not exists (no entry in table) the select lasts very long (I canceled the select after 5 minutes).
for example: pi.feattyp = 9756
Otherwise I add a further where clause like
AND arnamelc = 'ITA'
the select also works very long. The point are now in italy. refrence point is in germany and is more than 500km away.
Are there some solutions to solve this problems
(should I use for every feat type a own table)?
Why is the select so slow?
Thanks for all helpfully answers,
MatthiasHi Matthias,
When you use nearest neighbor, Oracle will use the spatial index to find the nearest neighbor that meets the query criteria. It probes into the index, calculates distances, and returns data in distance order.
Using SDO_BATCH_SIZE, it keeps going back to the database, returning more and more records in distance order until the other predicates are satisfied (in your case, pi.feattyp IN ( 9373,9374).
When you specified pi.feattyp = 9756 (which doesn't exist), you told Oracle to keep going and calculating distances for each of the more than 2.500.000 records in the the data set (you killed it after 5 minutes).
I don't know why adding: AND arnamelc = 'ITA' caused Oracle to take extra time. Sometimes I will do a: set autotrace trace exp
then compare plans for something that runs quickly vs. something that runs slowly. If you want to post the plans for the fast and slow versions it might be interesting to look at.
My guess is you may want to look at a solution that incorporates various possibilities. For instance, if there are only a few of some feattyp values, you may want to select those using the non-spatial index then use sdo_geom.sdo_distance to find the closest point rather than risk having to look through a few million values for a match.
I'm sure other people have thoughts as well...
Kind regards,
Dan -
Hi All,
I have select-option on selection screen.
Entered 7000 values to select-option.
When executed it dumps, but small input values report is executed.
Is their any limitation for input values in select-option.
Moderator message: FAQ, please search for previous discussions of this topic.
Edited by: Thomas Zloch on Sep 14, 2011 3:02 PMHi,
problem is not with select option, it can contain milions of entries.
You are propably using select option in where condition of your select statement. You should keep limit about 1000-2000 entries, it depends on db system and memory.
Regards
Matus -
Using Select option in Native SQL
Hi,
Can any one tell me, how to use select option value in native SQL.
ie.,
I want to use select option in where condition. Need to select all the records from table(non-SAP) where date in given range.
Please suggest.
Thanks,
AmalHi
No!
U need to find a way to convert a range of select-option to a range for Native SQL, probably it should be better doesn't use a select-option for the date but two parameters: one for date from and one for date to.
Max -
Hello All,
I'm creating an application with MVC model.Now I want a selection-screen page with select-options .
but where to create these select-option fields and how to link them within my view ?
Regards,
Deepu.KHi Deepu,
I think, the best demo example for this/MVC is,Web log-BSP / HowTo: Exploring BSP Development with MVC-Craig Cmehil , Where you can get a lot of help.
Pls check this at ;
/people/sap.user72/blog/2005/03/29/bsp-howto-exploring-bsp-development-with-mvc
Assign the points if info is useful**
Also check these web logs.
/people/ulli.hoffmann2/blog/2004/10/20/personalize-my-bsp-form-items
/people/pankaj.kumar32/blog/2003/12/19/all-those-lids
http://www.sapdevelopment.co.uk/webapps/bsp/mvchome.htm - this is one of the best demo for sample apps.
/people/sap.user72/blog/2005/05/05/bsphowto-filter-using-dropdown-in-tableview
/people/thomas.jung3/blog/2004/09/15/bsp-150-a-developer146s-journal-part-xi--table-view-iterators
/people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator
Regards
CSM Reddy
Message was edited by: REDDY CSM -
Dynamis where Condition using select-options
Hi All,
I am trying to form a dynamic where clause using values entered on a selection screen. I want that if a new entry is added in the selection screen the where clause can also be modified dynamically without any change in coding. The only change required should be addition of select-option statement in the selection screen declaration.
Thanks in advance.
Anjurefer below example
L_COND_SYNTAX = 'd2ext_status = l_status and d2ext_date ne c_intdate and '
& 'd2~ext_uploaded = space'.
SELECT D1TKNUM D1SHTYP D1TPLST D1ERNAM D1ERDAT D1BFART
D1VSART D1ROUTE D1SIGNI D1EXTI1 D1~TPBEZ
D1DATBG D1UATBG D1TDLNR D2VBELN D2~POSNR
D2EXT_FAILED D2EXT_COUNT D2EXT_DATE D2EXT_TIME
D2EXT_REP_DATE D2EXT_REP_TIME
D2EXT_RES_DATE D2EXT_RES_TIME D2~EXT_ERR_TYPE
INTO TABLE PA_GT_SHIP_HEADER
FROM VTTK AS D1 INNER JOIN RIOZTM_DELSTAT AS D2
ON D1TKNUM = D2TKNUM
WHERE
D1~TKNUM IN S_TKNUM AND
D1~SHTYP IN S_SHTYP AND
AND
<b>(L_COND_SYNTAX).</b>
Plz note the backet in L_COND_SYNTAX.
Reward points if helpful -
SELECT statement in FROM clause - syntax help
Hi,
I want to have a SELECT statement in the FROM clause. I get syntax error when doing this and since I am new to ABAP I need som help.
I want to do the following, (and if anyone has any SELECT statement from their own system which you know there is no syntax error in please post it here so I can analyze the syntax):
*I leave the INTO itab clause out, since I only want to demonstrate the functionality
I am trying to get.
<b>SELECT</b> tableOne~someField
<b>FROM</b> tab <b>AS</b> tableOne (<b>SELECT</b> someField
<b>FROM</b> tab
<b>WHERE</b> someFiled > 1) <b>AS</b> tableTwo
<b>WHERE</b> tableOnesomeField > tableTwosomeField
like I said, the problem is that the select statement in the parenthesis in the from clause seems to be incorrect because I get "wrong expression" when trying to compile. Is this because I cannot have a select statement in the from clause or is it because of a minor syntax error, such as I forgot a dot, or some other sign?
thanks and regards
Baransorry i am not enough familiar with sub queries but some error i can see which i will state here.
1> you have to use sub queries i.e. select in ( ) after where clause because here you are fulfilling a where clause by another select statement.
like this
SELECT * FROM SFLIGHT
INTO WA
WHERE SEATSOCC = ( SELECT MAX( SEATSOCC ) FROM SFLIGHT ).
2> you cannot specify field name without into clause either you have to use
select * or select f1 into tab-f1 like this...
but if you are using select * without into you have to define
tables : dbtab.
selec * from dbtab. like that.
regards
shiba dutta -
Tuning Select Statement . field sequence and where clause
Hi All
Are there any general guidelines how to write select < field sequence >where clause < field sequence ? Is that shuld be in order of the field sequence in tables?
And how to use this when we have a view or a inner - join . Is that separate from normal select statement that is using FOR ALL ENTRIES.
Please let me know any general guidelines available on this,
AmolHello Amol,
I have another hint:
The statement FOR ALL ENTRIES will package the select statements for every five entries in the internal table. So in comparison to the following code sequence...
LOOP AT itab.
SELECT * FROM table WHERE key = itab-key.
ENDLOOP
the number of select statements is reduced to 20% with
SELECT * FROM table INTO TABLE ...
FOR ALL ENTRIES IN itab
WHERE key = itab-key
If I'm expecting a <i>huge</i> amount of data a go a step further and create my own packages by building a range table with around 100-500 entries and execute a select there...
LOOP AT itab.
IF counter < 500.
APPEND itab-key TO range-tab. " just code example
ENDIF.
IF count >= 500.
SELECT * FROM table APPENDING TABLE ...
WHERE key IN range_tab
ENDIF.
" adjust and calculate counter
ENDLOOP.
* Don't forget last select statement after loop
Best wishes,
Florin
Maybe you are looking for
-
Hi all, System is giving dump while saving the changes in the project. Short text The current application triggered a termination with a short dump. What happened? The current application program detected a situation which really shoul
-
How to determine the screen structure of the detail area of a screen...
Hi all, How to determine the screen structure of the detail area of a screen?
-
UTF-8 stored in VARCHAR2 on a non-Unicode DB
Hi there, we have a company that implements storing Unicode data in Oracle in the following way: A plain VARCHAR2 on a non-Unicode DB (charset is actually WE8MSWIN1252) receives UTF-8 coded data. As client and server have the same setting for NLS_LAN
-
Issue on binding e4x to dataprovider
I have a items.xml like this: <items> <item>..</item> <item>..</item> <item>..</item> </items> In mxml, the codes are: <fx:XML id="dataSet" source="items.xml" format="e4x"/> <mx:DataGrid dataProvider="{dataSet.item}"> The datagrid is e
-
How to maintain Hierarchy?
Dear all, We create a hierarchy on CM Account(InfoObject),Every month there ara some new records should be upload to it. The problem is that after upload new records the hierarchy wouldn't maintain,so the report result is wrong. I want to kown how to